Author: glandais Date: 2008-02-06 17:09:53 +0000 (Wed, 06 Feb 2008) New Revision: 692 Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/Attachment.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/XmlConstants.java Log: Attachment handling Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/Attachment.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/Attachment.java 2008-02-06 16:39:44 UTC (rev 691) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/Attachment.java 2008-02-06 17:09:53 UTC (rev 692) @@ -120,4 +120,57 @@ return hexHash; } + /* (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 + public String toString() { + StringBuffer sb = new StringBuffer(); + sb.append(getFileName()).append(" - "); + sb.append(getDataHash()); + if (getContentType() != null) { + sb.append(" - ").append(getContentType().getDescription()); + } + return sb.toString(); + } + } Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/XmlConstants.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/XmlConstants.java 2008-02-06 16:39:44 UTC (rev 691) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/XmlConstants.java 2008-02-06 17:09:53 UTC (rev 692) @@ -24,9 +24,6 @@ */ public interface XmlConstants { - /** The Constant KEY_XML. */ - public static final String KEY_XML = "_xml"; - /** The Constant DOT. */ public static final String DOT = ".";