From 11bb9a8c7bf5c5c9162d4cb49a9fce4882201de4 Mon Sep 17 00:00:00 2001 From: Bruno Sinou Date: Fri, 6 Aug 2010 20:48:03 +0000 Subject: [PATCH] add some private constructors with no arg, some getters & setters and some ids to enable hibernate persistance of TabularDiffTestResult git-svn-id: https://svn.argeo.org/slc/trunk@3760 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../java/org/argeo/slc/diff/DiffIssue.java | 23 ++++++++++- .../java/org/argeo/slc/diff/DiffIssueKey.java | 6 +++ .../org/argeo/slc/diff/DiffNotMatched.java | 39 ++++++++++++++++++- .../java/org/argeo/slc/diff/DiffPosition.java | 4 ++ .../org/argeo/slc/diff/TableDiffPosition.java | 20 ++++++++++ 5 files changed, 89 insertions(+), 3 deletions(-) diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/DiffIssue.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/DiffIssue.java index 0caef2f10..041ec6465 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/DiffIssue.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/DiffIssue.java @@ -19,7 +19,11 @@ package org.argeo.slc.diff; /** The root class for issues which happened during a diff. */ public abstract class DiffIssue implements Comparable { /** The position of this issue. */ - protected final DiffPosition position; + // Was final and is not anymore in order to persist in hibernate + protected DiffPosition position; + + // hibernate + private long id; /** Constructor */ public DiffIssue(DiffPosition position) { @@ -35,4 +39,21 @@ public abstract class DiffIssue implements Comparable { public DiffPosition getPosition() { return position; } + + // Hibernate + @SuppressWarnings("unused") + private void setId(long id) { + this.id = id; + } + + @SuppressWarnings("unused") + private long getId() { + return id; + } + + @SuppressWarnings("unused") + private void setPosition(DiffPosition position) { + this.position = position; + } + } diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/DiffIssueKey.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/DiffIssueKey.java index fb123bfa4..9e17c37df 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/DiffIssueKey.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/DiffIssueKey.java @@ -44,4 +44,10 @@ public abstract class DiffIssueKey extends DiffIssue { return ""; } } + + // Hibernate + @SuppressWarnings("unused") + private void setKey(DiffKey key) { + this.key = key; + } } diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/DiffNotMatched.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/DiffNotMatched.java index c08b818af..364b198e5 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/DiffNotMatched.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/DiffNotMatched.java @@ -16,10 +16,17 @@ package org.argeo.slc.diff; +import org.argeo.slc.SlcException; + /** Diff issue where reached and expected values are different. */ public class DiffNotMatched extends DiffIssueKey { - private final Object expected; - private final Object reached; + + // To enable hibernate persistance, these object cannot be final + // private final Object expected; + // private final Object reached; + + private Object expected; + private Object reached; public DiffNotMatched(DiffPosition position, Object expected, Object reached) { super(position); @@ -53,4 +60,32 @@ public class DiffNotMatched extends DiffIssueKey { return result; } + @SuppressWarnings("unused") + private String getExpectedStr() { + if (expected instanceof String) + return (String) expected; + else + throw new SlcException( + "Object 'expected' is of wrong type. Must be a String"); + } + + @SuppressWarnings("unused") + private String getReachedStr() { + if (reached instanceof String) + return (String) reached; + else + throw new SlcException( + "Object 'reached' is of wrong type. Must be a String"); + } + + @SuppressWarnings("unused") + private void setReachedStr(String reachedStr) { + this.reached = reachedStr; + } + + @SuppressWarnings("unused") + private void setExpectedStr(String expectedStr) { + this.expected = expectedStr; + } + } diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/DiffPosition.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/DiffPosition.java index ad6fd5fe6..e705176cb 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/DiffPosition.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/DiffPosition.java @@ -25,6 +25,10 @@ public abstract class DiffPosition implements Comparable { this.relatedFile = relatedFile; } + // For Hibernate + DiffPosition() { + } + public RelatedFile getRelatedFile() { return relatedFile; } diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/TableDiffPosition.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/TableDiffPosition.java index dda5fa1c2..45084f51c 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/TableDiffPosition.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/TableDiffPosition.java @@ -37,6 +37,10 @@ public class TableDiffPosition extends DiffPosition { this.columnName = columnName; } + @SuppressWarnings("unused") + private TableDiffPosition() { + } + public Integer getLine() { return line; } @@ -79,4 +83,20 @@ public class TableDiffPosition extends DiffPosition { return buf.toString(); } + // Hibernate + @SuppressWarnings("unused") + private void setLine(Integer line) { + this.line = line; + } + + @SuppressWarnings("unused") + private void setColumn(Integer column) { + this.column = column; + } + + @SuppressWarnings("unused") + private void setColumnName(String columnName) { + this.columnName = columnName; + } + } -- 2.39.2