Author: glandais
Date: 2008-03-21 17:33:59 +0000 (Fri, 21 Mar 2008)
New Revision: 1445
Modified:
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/Composite.java
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/Entity.java
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/Leaf.java
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/attachment/Attachment.java
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/composite/SimpleComposite.java
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Code.java
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Component.java
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Constant.java
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ConstantValue.java
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Descriptor.java
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationApplication.java
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationData.java
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Library.java
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/LoggableElement.java
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Repository.java
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Structure.java
trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java
Log:
Using EqualsBuilder and HashCodeBuilder for hash codes and equals
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/Composite.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/Composite.java 2008-03-21 16:53:16 UTC (rev 1444)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/Composite.java 2008-03-21 17:33:59 UTC (rev 1445)
@@ -25,7 +25,7 @@
/**
* The Class Composite. This class aims to be a node with children
*/
-public abstract class Composite implements Entity {
+public abstract class Composite extends Entity {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1;
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/Entity.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/Entity.java 2008-03-21 16:53:16 UTC (rev 1444)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/Entity.java 2008-03-21 17:33:59 UTC (rev 1445)
@@ -20,18 +20,28 @@
import java.io.Serializable;
import java.util.List;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+
/**
* The minimal Entity contract. <p/> This is a <code>marker</code> interface, nothing special to describe for this
* contract. <p/> An Entity is serializable and visitable.
*/
-public interface Entity extends Serializable, EntityVisitable {
+public abstract class Entity implements Serializable, EntityVisitable {
/**
+ * Gets the exclude fields from equals and hash.
+ *
+ * @return the exclude fields
+ */
+ protected abstract String[] getExcludeFields();
+
+ /**
* Gets the children.
*
* @return the children
*/
- public List<Entity> getChildren();
+ public abstract List<Entity> getChildren();
/**
* Gets the row for UI.
@@ -40,4 +50,20 @@
*/
public abstract List<String> getRow();
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public final boolean equals(Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj, getExcludeFields());
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public final int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this, getExcludeFields());
+ }
+
}
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/Leaf.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/Leaf.java 2008-03-21 16:53:16 UTC (rev 1444)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/Leaf.java 2008-03-21 17:33:59 UTC (rev 1445)
@@ -23,11 +23,11 @@
/**
* The Class Leaf. This class represents a leaf of the tree
*/
-public abstract class Leaf implements Entity {
+public abstract class Leaf extends Entity {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1;
-
+
/* (non-Javadoc)
* @see fr.cemagref.simexplorer.is.entities.pattern.Entity#getChildren()
*/
@@ -44,6 +44,9 @@
visitor.visitLeaf(this);
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
@Override
public String toString() {
return EntityTypeEnum.getLibelle(this);
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/attachment/Attachment.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/attachment/Attachment.java 2008-03-21 16:53:16 UTC (rev 1444)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/attachment/Attachment.java 2008-03-21 17:33:59 UTC (rev 1445)
@@ -23,6 +23,7 @@
import java.util.List;
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.builder.HashCodeBuilder;
import org.codelutin.util.StringUtil;
import fr.cemagref.simexplorer.is.entities.Leaf;
@@ -49,6 +50,8 @@
/** The data size. */
private long dataSize;
+ private static final String[] excludeFields = { "excludeFields", "contentType", "dataSize" };
+
/**
* Gets the file name.
*
@@ -154,43 +157,6 @@
}
/* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((dataHash == null) ? 0 : dataHash.hashCode());
- result = prime * result + ((fileName == null) ? 0 : fileName.hashCode());
- return result;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- final Attachment other = (Attachment) obj;
- if (dataHash == null) {
- if (other.dataHash != null)
- return false;
- } else if (!dataHash.equals(other.dataHash))
- return false;
- if (fileName == null) {
- if (other.fileName != null)
- return false;
- } else if (!fileName.equals(other.fileName))
- return false;
- return true;
- }
-
- /* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
@@ -220,4 +186,12 @@
return row;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.entities.Entity#getExcludeFields()
+ */
+ @Override
+ protected String[] getExcludeFields() {
+ return excludeFields;
+ }
+
}
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/composite/SimpleComposite.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/composite/SimpleComposite.java 2008-03-21 16:53:16 UTC (rev 1444)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/composite/SimpleComposite.java 2008-03-21 17:33:59 UTC (rev 1445)
@@ -43,6 +43,8 @@
/** The children. */
private List<E> elements;
+ private static final String[] excludeFields = { "excludeFields", "metadataIS" };
+
/**
* Instantiates a new simple composite.
*/
@@ -83,36 +85,13 @@
}
/* (non-Javadoc)
- * @see java.lang.Object#hashCode()
+ * @see fr.cemagref.simexplorer.is.entities.Entity#getExcludeFields()
*/
@Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((elements == null) ? 0 : elements.hashCode());
- return result;
+ protected String[] getExcludeFields() {
+ return excludeFields;
}
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- final SimpleComposite<?> other = (SimpleComposite<?>) obj;
- if (elements == null) {
- if (other.elements != null)
- return false;
- } else if (!elements.equals(other.elements))
- return false;
- return true;
- }
-
+
/**
* Gets the children class.
*
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Code.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Code.java 2008-03-21 16:53:16 UTC (rev 1444)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Code.java 2008-03-21 17:33:59 UTC (rev 1445)
@@ -36,6 +36,8 @@
/** The code. */
private String code;
+ private static final String[] excludeFields = { "excludeFields" };
+
/**
* Gets the language.
*
@@ -89,36 +91,12 @@
return row;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.entities.Entity#getExcludeFields()
+ */
@Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((code == null) ? 0 : code.hashCode());
- result = prime * result + ((language == null) ? 0 : language.hashCode());
- return result;
+ protected String[] getExcludeFields() {
+ return excludeFields;
}
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- final Code other = (Code) obj;
- if (code == null) {
- if (other.code != null)
- return false;
- } else if (!code.equals(other.code))
- return false;
- if (language == null) {
- if (other.language != null)
- return false;
- } else if (!language.equals(other.language))
- return false;
- return true;
- }
-
}
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Component.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Component.java 2008-03-21 16:53:16 UTC (rev 1444)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Component.java 2008-03-21 17:33:59 UTC (rev 1445)
@@ -45,6 +45,8 @@
/** The libraries. */
Libraries libraries;
+ private static final String[] excludeFields = { "excludeFields", "metadataIS" };
+
/**
* Gets the constants.
*
@@ -130,47 +132,12 @@
return directChildren;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.entities.Entity#getExcludeFields()
+ */
@Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((codes == null) ? 0 : codes.hashCode());
- result = prime * result + ((constants == null) ? 0 : constants.hashCode());
- result = prime * result + ((libraries == null) ? 0 : libraries.hashCode());
- result = prime * result + ((structures == null) ? 0 : structures.hashCode());
- return result;
+ protected String[] getExcludeFields() {
+ return excludeFields;
}
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- final Component other = (Component) obj;
- if (codes == null) {
- if (other.codes != null)
- return false;
- } else if (!codes.equals(other.codes))
- return false;
- if (constants == null) {
- if (other.constants != null)
- return false;
- } else if (!constants.equals(other.constants))
- return false;
- if (libraries == null) {
- if (other.libraries != null)
- return false;
- } else if (!libraries.equals(other.libraries))
- return false;
- if (structures == null) {
- if (other.structures != null)
- return false;
- } else if (!structures.equals(other.structures))
- return false;
- return true;
- }
-
}
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Constant.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Constant.java 2008-03-21 16:53:16 UTC (rev 1444)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Constant.java 2008-03-21 17:33:59 UTC (rev 1445)
@@ -34,6 +34,8 @@
/** The type. */
private Class<?> type;
+ private static final String[] excludeFields = { "excludeFields" };
+
/**
* Gets the name.
*
@@ -87,35 +89,12 @@
return row;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.entities.Entity#getExcludeFields()
+ */
@Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((type == null) ? 0 : type.getCanonicalName().hashCode());
- return result;
+ protected String[] getExcludeFields() {
+ return excludeFields;
}
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- final Constant other = (Constant) obj;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (type == null) {
- if (other.type != null)
- return false;
- } else if (!type.getCanonicalName().equals(other.type.getCanonicalName()))
- return false;
- return true;
- }
-
}
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ConstantValue.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ConstantValue.java 2008-03-21 16:53:16 UTC (rev 1444)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ConstantValue.java 2008-03-21 17:33:59 UTC (rev 1445)
@@ -36,6 +36,8 @@
/** The constant. */
private Constant constant;
+ private static final String[] excludeFields = { "excludeFields" };
+
/**
* Gets the value.
*
@@ -93,35 +95,12 @@
return row;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.entities.Entity#getExcludeFields()
+ */
@Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((constant == null) ? 0 : constant.hashCode());
- result = prime * result + ((value == null) ? 0 : value.hashCode());
- return result;
+ protected String[] getExcludeFields() {
+ return excludeFields;
}
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- final ConstantValue other = (ConstantValue) obj;
- if (constant == null) {
- if (other.constant != null)
- return false;
- } else if (!constant.equals(other.constant))
- return false;
- if (value == null) {
- if (other.value != null)
- return false;
- } else if (!value.equals(other.value))
- return false;
- return true;
- }
-
}
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Descriptor.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Descriptor.java 2008-03-21 16:53:16 UTC (rev 1444)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Descriptor.java 2008-03-21 17:33:59 UTC (rev 1445)
@@ -36,6 +36,8 @@
/** The value. */
private String value;
+ private static final String[] excludeFields = { "excludeFields" };
+
/**
* Instantiates a new descriptor.
*
@@ -108,35 +110,12 @@
return this.getName().compareTo(o.getName());
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.entities.Entity#getExcludeFields()
+ */
@Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((value == null) ? 0 : value.hashCode());
- return result;
+ protected String[] getExcludeFields() {
+ return excludeFields;
}
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- final Descriptor other = (Descriptor) obj;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (value == null) {
- if (other.value != null)
- return false;
- } else if (!value.equals(other.value))
- return false;
- return true;
- }
-
}
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationApplication.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationApplication.java 2008-03-21 16:53:16 UTC (rev 1444)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationApplication.java 2008-03-21 17:33:59 UTC (rev 1445)
@@ -37,6 +37,8 @@
/** The components. */
private Components components;
+ private static final String[] excludeFields = { "excludeFields", "metadataIS" };
+
/**
* Gets the explorations.
*
@@ -84,35 +86,12 @@
return directChildren;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.entities.Entity#getExcludeFields()
+ */
@Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((components == null) ? 0 : components.hashCode());
- result = prime * result + ((explorations == null) ? 0 : explorations.hashCode());
- return result;
+ protected String[] getExcludeFields() {
+ return excludeFields;
}
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- final ExplorationApplication other = (ExplorationApplication) obj;
- if (components == null) {
- if (other.components != null)
- return false;
- } else if (!components.equals(other.components))
- return false;
- if (explorations == null) {
- if (other.explorations != null)
- return false;
- } else if (!explorations.equals(other.explorations))
- return false;
- return true;
- }
-
}
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationData.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationData.java 2008-03-21 16:53:16 UTC (rev 1444)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationData.java 2008-03-21 17:33:59 UTC (rev 1445)
@@ -40,6 +40,8 @@
/** The result. */
private Result result;
+ private static final String[] excludeFields = { "excludeFields", "metadataIS" };
+
/**
* Find constant value.
*
@@ -135,35 +137,12 @@
return children;
}
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.entities.Entity#getExcludeFields()
+ */
@Override
- public int hashCode() {
- final int prime = 31;
- int resultHash = super.hashCode();
- resultHash = prime * resultHash + ((constantValues == null) ? 0 : constantValues.hashCode());
- resultHash = prime * resultHash + ((this.result == null) ? 0 : this.result.hashCode());
- return resultHash;
+ protected String[] getExcludeFields() {
+ return excludeFields;
}
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- final ExplorationData other = (ExplorationData) obj;
- if (constantValues == null) {
- if (other.constantValues != null)
- return false;
- } else if (!constantValues.equals(other.constantValues))
- return false;
- if (result == null) {
- if (other.result != null)
- return false;
- } else if (!result.equals(other.result))
- return false;
- return true;
- }
-
}
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Library.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Library.java 2008-03-21 16:53:16 UTC (rev 1444)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Library.java 2008-03-21 17:33:59 UTC (rev 1445)
@@ -23,31 +23,14 @@
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1;
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- // add properties hashes
- // result = prime * result + property.hashCode();
- return result;
- }
+ private static final String[] excludeFields = { "excludeFields", "metadataIS" };
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.entities.Entity#getExcludeFields()
+ */
@Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- final Library other = (Library) obj;
- // add properties tests
- // if (property == null) {
- // if (other.property != null)
- // return false;
- // } else if (!property.equals(other.property))
- // return false;
- return true;
+ protected String[] getExcludeFields() {
+ return excludeFields;
}
}
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/LoggableElement.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/LoggableElement.java 2008-03-21 16:53:16 UTC (rev 1444)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/LoggableElement.java 2008-03-21 17:33:59 UTC (rev 1445)
@@ -231,51 +231,4 @@
this.metadataIS = metadataIS;
}
- @Override
- public int hashCode() {
- // metadata is and should not included!
-
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((attachments == null) ? 0 : attachments.hashCode());
- result = prime * result + ((description == null) ? 0 : description.hashCode());
- result = prime * result + ((descriptors == null) ? 0 : descriptors.hashCode());
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- // metadata is and should not included!
-
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- final LoggableElement other = (LoggableElement) obj;
- if (attachments == null) {
- if (other.attachments != null)
- return false;
- } else if (!attachments.equals(other.attachments))
- return false;
- if (description == null) {
- if (other.description != null)
- return false;
- } else if (!description.equals(other.description))
- return false;
- if (descriptors == null) {
- if (other.descriptors != null)
- return false;
- } else if (!descriptors.equals(other.descriptors))
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- return true;
- }
-
}
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Repository.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Repository.java 2008-03-21 16:53:16 UTC (rev 1444)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Repository.java 2008-03-21 17:33:59 UTC (rev 1445)
@@ -30,38 +30,22 @@
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1;
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- // add properties hashes
- // result = prime * result + property.hashCode();
- return result;
- }
+ private static final String[] excludeFields = { "excludeFields" };
@Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- final Repository other = (Repository) obj;
- // add properties tests
- // if (property == null) {
- // if (other.property != null)
- // return false;
- // } else if (!property.equals(other.property))
- // return false;
- return true;
- }
-
- @Override
public List<String> getRow() {
List<String> row = new ArrayList<String>();
row.add("");
row.add(toString());
return row;
}
+
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.entities.Entity#getExcludeFields()
+ */
+ @Override
+ protected String[] getExcludeFields() {
+ return excludeFields;
+ }
+
}
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java 2008-03-21 16:53:16 UTC (rev 1444)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java 2008-03-21 17:33:59 UTC (rev 1445)
@@ -28,37 +28,21 @@
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1;
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- // add properties hashes
- // result = prime * result + property.hashCode();
- return result;
- }
+ private static final String[] excludeFields = { "excludeFields" };
@Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- final Result other = (Result) obj;
- // add properties tests
- // if (property == null) {
- // if (other.property != null)
- // return false;
- // } else if (!property.equals(other.property))
- // return false;
- return true;
- }
-
- @Override
public List<String> getRow() {
List<String> row = new ArrayList<String>();
row.add(toString());
return row;
}
+
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.entities.Entity#getExcludeFields()
+ */
+ @Override
+ protected String[] getExcludeFields() {
+ return excludeFields;
+ }
+
}
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Structure.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Structure.java 2008-03-21 16:53:16 UTC (rev 1444)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Structure.java 2008-03-21 17:33:59 UTC (rev 1445)
@@ -30,37 +30,21 @@
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1;
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- // add properties hashes
- // result = prime * result + property.hashCode();
- return result;
- }
+ private static final String[] excludeFields = { "excludeFields" };
@Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- final Structure other = (Structure) obj;
- // add properties tests
- // if (property == null) {
- // if (other.property != null)
- // return false;
- // } else if (!property.equals(other.property))
- // return false;
- return true;
- }
-
- @Override
public List<String> getRow() {
List<String> row = new ArrayList<String>();
row.add(toString());
return row;
}
+
+ /* (non-Javadoc)
+ * @see fr.cemagref.simexplorer.is.entities.Entity#getExcludeFields()
+ */
+ @Override
+ protected String[] getExcludeFields() {
+ return excludeFields;
+ }
+
}
Modified: trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java 2008-03-21 16:53:16 UTC (rev 1444)
+++ trunk/simexplorer-is/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java 2008-03-21 17:33:59 UTC (rev 1445)
@@ -66,6 +66,8 @@
/** The class name of the element. */
private Class<?> elementClass;
+ private static final String[] excludeFields = { "excludeFields" };
+
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@@ -316,85 +318,11 @@
}
/* (non-Javadoc)
- * @see java.lang.Object#hashCode()
+ * @see fr.cemagref.simexplorer.is.entities.Entity#getExcludeFields()
*/
@Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((creationDate == null) ? 0 : creationDate.hashCode());
- result = prime * result + ((description == null) ? 0 : description.hashCode());
- result = prime * result + ((elementClass == null) ? 0 : elementClass.hashCode());
- result = prime * result + ((hash == null) ? 0 : hash.hashCode());
- result = prime * result + (latest ? 1231 : 1237);
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((parentUuid == null) ? 0 : parentUuid.hashCode());
- result = prime * result + ((parentVersion == null) ? 0 : parentVersion.hashCode());
- result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
- result = prime * result + ((version == null) ? 0 : version.hashCode());
- return result;
+ protected String[] getExcludeFields() {
+ return excludeFields;
}
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- final MetaData other = (MetaData) obj;
- if (creationDate == null) {
- if (other.creationDate != null)
- return false;
- } else if (!creationDate.equals(other.creationDate))
- return false;
- if (description == null) {
- if (other.description != null)
- return false;
- } else if (!description.equals(other.description))
- return false;
- if (elementClass == null) {
- if (other.elementClass != null)
- return false;
- } else if (!elementClass.equals(other.elementClass))
- return false;
- if (hash == null) {
- if (other.hash != null)
- return false;
- } else if (!hash.equals(other.hash))
- return false;
- if (latest != other.latest)
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (parentUuid == null) {
- if (other.parentUuid != null)
- return false;
- } else if (!parentUuid.equals(other.parentUuid))
- return false;
- if (parentVersion == null) {
- if (other.parentVersion != null)
- return false;
- } else if (!parentVersion.equals(other.parentVersion))
- return false;
- if (uuid == null) {
- if (other.uuid != null)
- return false;
- } else if (!uuid.equals(other.uuid))
- return false;
- if (version == null) {
- if (other.version != null)
- return false;
- } else if (!version.equals(other.version))
- return false;
- return true;
- }
-
}
\ No newline at end of file