Author: tchemit Date: 2008-02-08 09:41:59 +0000 (Fri, 08 Feb 2008) New Revision: 741 Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java Log: utilisation factory de version Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java 2008-02-08 09:41:41 UTC (rev 740) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java 2008-02-08 09:41:59 UTC (rev 741) @@ -168,7 +168,7 @@ * the version to set */ public void setVersion(String version) { - this.version = new Version(version); + this.version = Version.valueOf(version); } /** @@ -241,6 +241,34 @@ } /** + * Get attachment by his index + * @param attachmentIndex index of attachment to find + * @return the correct attachment + */ + public Attachment getAttachment(int attachmentIndex) { + if (attachmentIndex>-1 && attachments != null && !attachments.isEmpty() && attachments.size()>attachmentIndex) { + return attachments.get(attachmentIndex); + } + return null; + } + + /** + * Get attachment by his uniqueId + * @param attachmentUniqueId unqiue id of attachment to find + * @return the correct attachment + */ + public Attachment getAttachment(String attachmentUniqueId) { + if (attachmentUniqueId != null && attachments != null && !attachments.isEmpty()) { + for (Attachment attachment : attachments) { + if (attachmentUniqueId.equals(attachment.getUniqueId())) { + return attachment; + } + } + } + return null; + } + + /** * Sets the attachments. * * @param attachments
participants (1)
-
tchemit@users.labs.libre-entreprise.org