r616 - in trunk/simexplorer-is-entities/src: java/fr/cemagref/simexplorer/is/attachment java/fr/cemagref/simexplorer/is/entities java/fr/cemagref/simexplorer/is/entities/data java/fr/cemagref/simexplorer/is/entities/metadata java/fr/cemagref/simexplorer/is/factories test/fr/cemagref/simexplorer/is/entities/metadata
Author: glandais Date: 2008-02-04 13:53:37 +0000 (Mon, 04 Feb 2008) New Revision: 616 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/ContentType.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/ContentTypeFactory.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/RawType.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/BaseEntity.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Code.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Component.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Constant.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ConstantValue.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/DataEntity.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationApplication.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationData.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Library.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/LoggableElement.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Repository.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Structure.java 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/Version.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/BaseEntityFactory.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/CodeFactory.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ComponentFactory.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ConstantFactory.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ConstantValueFactory.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ExplorationApplicationFactory.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ExplorationDataFactory.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/LibraryFactory.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/LoggableElementFactory.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/MetaDataFactory.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/RepositoryFactory.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ResultFactory.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/StructureFactory.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/XMLStreamEncoder.java trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/XmlConstants.java trunk/simexplorer-is-entities/src/test/fr/cemagref/simexplorer/is/entities/metadata/VersionTest.java Log: Javadoc 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-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/Attachment.java 2008-02-04 13:53:37 UTC (rev 616) @@ -21,44 +21,104 @@ import org.apache.commons.lang.StringUtils; +/** + * Represents data attached to metadata. + * + * @author glandais + */ public class Attachment implements Serializable { + /** Serial version ID. */ private static final long serialVersionUID = 5467615366054227592L; + /** Filename. */ private String fileName; + + /** Content type. */ private ContentType contentType; + + /** Data hash. */ private int dataHash; + /** + * Gets the file name. + * + * @return the file name + */ public String getFileName() { return fileName; } + /** + * Sets the file name. + * + * @param fileName + * the new file name + */ public void setFileName(String fileName) { this.fileName = fileName; } + /** + * Gets the content type. + * + * @return the content type + */ public ContentType getContentType() { return contentType; } + /** + * Sets the content type. + * + * @param contentType + * the new content type + */ public void setContentType(ContentType contentType) { this.contentType = contentType; } + /** + * Gets the data hash. + * + * @return the data hash + */ public int getDataHash() { return dataHash; } + /** + * Sets the data hash. + * + * @param dataHash + * the new data hash + */ public void setDataHash(int dataHash) { this.dataHash = dataHash; } + /** + * Gets the unique id. + * + * @return the unique id + */ public String getUniqueId() { String hexDataHash = StringUtils.leftPad(Integer.toHexString(dataHash), 8, '0'); return hexDataHash + fileName; } + /** + * Int from hex string. + * + * @param nm + * the nm + * + * @return the int + * + * @throws NumberFormatException + * the number format exception + */ public static int intFromHexString(String nm) throws NumberFormatException { int radix = 16; int index = 0; @@ -88,11 +148,27 @@ return result; } + /** + * Gets the hash from unique id. + * + * @param uniqueId + * the unique id + * + * @return the hash from unique id + */ public static int getHashFromUniqueId(String uniqueId) { String hexHash = uniqueId.substring(0, 8); return intFromHexString("0X" + hexHash); } + /** + * Gets the file name from unique id. + * + * @param uniqueId + * the unique id + * + * @return the file name from unique id + */ public static String getFileNameFromUniqueId(String uniqueId) { return uniqueId.substring(9); } Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/ContentType.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/ContentType.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/ContentType.java 2008-02-04 13:53:37 UTC (rev 616) @@ -21,29 +21,35 @@ import java.io.Reader; /** - * Content handler + * Content handler. * * @author landais - * */ public abstract class ContentType { /** - * Index content + * Index content. * * @param is * Input stream + * * @return Indexable text + * * @throws Exception + * the exception */ public abstract Reader renderToText(InputStream is) throws Exception; /** + * Gets the mime type. + * * @return the mimeType */ public abstract String getMimeType(); /** + * Gets the description. + * * @return the description */ public abstract String getDescription(); Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/ContentTypeFactory.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/ContentTypeFactory.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/ContentTypeFactory.java 2008-02-04 13:53:37 UTC (rev 616) @@ -21,25 +21,25 @@ import java.util.Map; /** - * Cache content types + * Cache content types. * * @author landais - * */ public class ContentTypeFactory { - /** - * Content type cache - */ + /** Content type cache. */ private static Map<String, ContentType> contentTypes = null; /** - * Retrieve a content type instance + * Retrieve a content type instance. * * @param contentTypeClassSimpleName * Class required + * * @return Instance + * * @throws Exception + * the exception */ public static ContentType getContentTypeInstance( String contentTypeClassSimpleName) throws Exception { Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/RawType.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/RawType.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/attachment/RawType.java 2008-02-04 13:53:37 UTC (rev 616) @@ -17,32 +17,43 @@ * ##% */ package fr.cemagref.simexplorer.is.attachment; +import static org.codelutin.i18n.I18n._; + import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.Serializable; /** - * Raw content type + * Raw content type. * * @author landais - * */ public class RawType extends ContentType implements Serializable { + /** The Constant serialVersionUID. */ private static final long serialVersionUID = -8010160085848440286L; + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.attachment.ContentType#renderToText(java.io.InputStream) + */ @Override public Reader renderToText(InputStream is) { // No parsing return new InputStreamReader(is); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.attachment.ContentType#getDescription() + */ @Override public String getDescription() { - return "rawtype"; + return _("simexplorer.contenttype.rawtype"); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.attachment.ContentType#getMimeType() + */ @Override public String getMimeType() { return "text/text"; Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/BaseEntity.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/BaseEntity.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/BaseEntity.java 2008-02-04 13:53:37 UTC (rev 616) @@ -19,6 +19,11 @@ import java.io.Serializable; +/** + * The Class BaseEntity. + */ public abstract class BaseEntity implements Serializable { + // empty class + } Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Code.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Code.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Code.java 2008-02-04 13:53:37 UTC (rev 616) @@ -19,29 +19,61 @@ import java.io.Serializable; +/** + * The Class Code. + */ public class Code extends DataEntity implements Serializable { + /** The Constant serialVersionUID. */ private static final long serialVersionUID = 1232989963544650014L; - + + /** The language. */ private String language; + + /** The code. */ private String code; + /** + * Gets the language. + * + * @return the language + */ public String getLanguage() { return language; } + /** + * Sets the language. + * + * @param language + * the new language + */ public void setLanguage(String language) { this.language = language; } + /** + * Gets the code. + * + * @return the code + */ public String getCode() { return code; } + /** + * Sets the code. + * + * @param code + * the new code + */ public void setCode(String code) { this.code = code; } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ @Override public String toString() { return getCode() + " : " + getLanguage(); Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Component.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Component.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Component.java 2008-02-04 13:53:37 UTC (rev 616) @@ -22,47 +22,105 @@ import java.util.List; import java.util.Set; +/** + * The Class Component. + */ public class Component extends LoggableElement implements Serializable { + /** The Constant serialVersionUID. */ private static final long serialVersionUID = -1759921918565071510L; - + + /** The constants. */ Set<Constant> constants; + + /** The structures. */ Set<Structure> structures; + + /** The codes. */ Set<Code> codes; + + /** The libraries. */ Set<Library> libraries; + /** + * Gets the constants. + * + * @return the constants + */ public Set<Constant> getConstants() { return constants; } + /** + * Sets the constants. + * + * @param constants + * the new constants + */ public void setConstants(Set<Constant> constants) { this.constants = constants; } + /** + * Gets the structures. + * + * @return the structures + */ public Set<Structure> getStructures() { return structures; } + /** + * Sets the structures. + * + * @param structures + * the new structures + */ public void setStructures(Set<Structure> structures) { this.structures = structures; } + /** + * Gets the codes. + * + * @return the codes + */ public Set<Code> getCodes() { return codes; } + /** + * Sets the codes. + * + * @param codes + * the new codes + */ public void setCodes(Set<Code> codes) { this.codes = codes; } + /** + * Gets the libraries. + * + * @return the libraries + */ public Set<Library> getLibraries() { return libraries; } + /** + * Sets the libraries. + * + * @param libraries + * the new libraries + */ public void setLibraries(Set<Library> libraries) { this.libraries = libraries; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.entities.data.LoggableElement#getDirectChildren() + */ @Override public List<LoggableElement> getDirectChildren() { List<LoggableElement> directChildren = new ArrayList<LoggableElement>(); Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Constant.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Constant.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Constant.java 2008-02-04 13:53:37 UTC (rev 616) @@ -19,31 +19,63 @@ import java.io.Serializable; +/** + * The Class Constant. + */ public class Constant extends DataEntity implements Serializable { + /** The Constant serialVersionUID. */ private static final long serialVersionUID = 5473300963328292128L; - + + /** The name. */ private String name; + + /** The type. */ private Class<?> type; + /** + * Gets the name. + * + * @return the name + */ public String getName() { return name; } + /** + * Sets the name. + * + * @param name + * the new name + */ public void setName(String name) { this.name = name; } + /** + * Gets the type. + * + * @return the type + */ public Class<?> getType() { return type; } + /** + * Sets the type. + * + * @param type + * the new type + */ public void setType(Class<?> type) { this.type = type; } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ @Override public String toString() { - return getName()+ " : " +getType().getSimpleName(); + return getName() + " : " + getType().getSimpleName(); } } Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ConstantValue.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ConstantValue.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ConstantValue.java 2008-02-04 13:53:37 UTC (rev 616) @@ -19,25 +19,54 @@ import java.io.Serializable; +/** + * The Class ConstantValue. + */ public class ConstantValue extends DataEntity implements Serializable { + /** The Constant serialVersionUID. */ private static final long serialVersionUID = -5434140706898012637L; - + + /** The value. */ private String value; + + /** The constant. */ private Constant constant; + /** + * Gets the value. + * + * @return the value + */ public String getValue() { return value; } + /** + * Sets the value. + * + * @param value + * the new value + */ public void setValue(String value) { this.value = value; } + /** + * Gets the constant. + * + * @return the constant + */ public Constant getConstant() { return constant; } + /** + * Sets the constant. + * + * @param constant + * the new constant + */ public void setConstant(Constant constant) { this.constant = constant; } Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/DataEntity.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/DataEntity.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/DataEntity.java 2008-02-04 13:53:37 UTC (rev 616) @@ -19,19 +19,28 @@ import fr.cemagref.simexplorer.is.entities.BaseEntity; +/** + * The Class DataEntity. + */ public abstract class DataEntity extends BaseEntity { + /** The parent data. */ private DataEntity parentData; + + /** The Constant serialVersionUID. */ private static final long serialVersionUID = -2570073990226703994L; + /** + * Gets the parent loggable element. + * + * @return the parent loggable element + */ public LoggableElement getParentLoggableElement() { LoggableElement parentLoggableElement = null; if (getParentData() instanceof LoggableElement) { parentLoggableElement = (LoggableElement) getParentData(); } else { - if (getParentData() == null) { - parentLoggableElement = null; - } else { + if (getParentData() != null) { parentLoggableElement = getParentData() .getParentLoggableElement(); } @@ -40,6 +49,8 @@ } /** + * Gets the parent data. + * * @return the parentData */ public DataEntity getParentData() { @@ -47,6 +58,8 @@ } /** + * Sets the parent data. + * * @param parentData * the parentData to set */ Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationApplication.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationApplication.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationApplication.java 2008-02-04 13:53:37 UTC (rev 616) @@ -22,34 +22,67 @@ import java.util.List; import java.util.Set; -public class ExplorationApplication extends LoggableElement implements Serializable { +/** + * The Class ExplorationApplication. + */ +public class ExplorationApplication extends LoggableElement implements + Serializable { + /** The Constant serialVersionUID. */ private static final long serialVersionUID = 122049347724394193L; - + + /** The explorations. */ private Set<ExplorationData> explorations; + + /** The components. */ private Set<Component> components; + /** + * Gets the explorations. + * + * @return the explorations + */ public Set<ExplorationData> getExplorations() { return explorations; } + /** + * Sets the explorations. + * + * @param explorations + * the new explorations + */ public void setExplorations(Set<ExplorationData> explorations) { this.explorations = explorations; } + /** + * Gets the components. + * + * @return the components + */ public Set<Component> getComponents() { return components; } + /** + * Sets the components. + * + * @param components + * the new components + */ public void setComponents(Set<Component> components) { this.components = components; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.entities.data.LoggableElement#getDirectChildren() + */ @Override public List<LoggableElement> getDirectChildren() { List<LoggableElement> directChildren = new ArrayList<LoggableElement>(); directChildren.addAll(explorations); - directChildren.addAll(components); + directChildren.addAll(components); return directChildren; } Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationData.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationData.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationData.java 2008-02-04 13:53:37 UTC (rev 616) @@ -21,13 +21,28 @@ import java.util.List; import java.util.Set; +/** + * The Class ExplorationData. + */ public class ExplorationData extends LoggableElement implements Serializable { + /** The Constant serialVersionUID. */ private static final long serialVersionUID = -6439801837608358754L; - + + /** The values map. */ private Set<ConstantValue> valuesMap; + + /** The result. */ private Result result; + /** + * Find constant value. + * + * @param c + * the constant to find + * + * @return the constant value + */ private ConstantValue findConstantValue(Constant c) { for (ConstantValue constantValue : valuesMap) { if (c.equals(constantValue.getConstant())) { @@ -37,6 +52,14 @@ return null; } + /** + * Sets the constant value. + * + * @param c + * the constant to set + * @param value + * the value + */ public void setConstantValue(Constant c, String value) { ConstantValue constantValue = findConstantValue(c); if (constantValue == null) { @@ -47,31 +70,63 @@ constantValue.setValue(value); } + /** + * Gets the constant value. + * + * @param c + * the c + * + * @return the constant value + */ public Object getConstantValue(Constant c) { ConstantValue constantValue = findConstantValue(c); if (constantValue == null) { return null; - } else { - return constantValue.getValue(); } + return constantValue.getValue(); } + /** + * Gets the result. + * + * @return the result + */ public Result getResult() { return result; } + /** + * Sets the result. + * + * @param result + * the new result + */ public void setResult(Result result) { this.result = result; } + /** + * Gets the values map. + * + * @return the values map + */ public Set<ConstantValue> getValuesMap() { return valuesMap; } + /** + * Sets the values map. + * + * @param valuesMap + * the new values map + */ public void setValuesMap(Set<ConstantValue> valuesMap) { this.valuesMap = valuesMap; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.entities.data.LoggableElement#getDirectChildren() + */ @Override public List<LoggableElement> getDirectChildren() { return null; Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Library.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Library.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Library.java 2008-02-04 13:53:37 UTC (rev 616) @@ -20,10 +20,17 @@ import java.io.Serializable; import java.util.List; +/** + * The Class Library. + */ public class Library extends LoggableElement implements Serializable { + /** The Constant serialVersionUID. */ private static final long serialVersionUID = -5635619075345573945L; + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.entities.data.LoggableElement#getDirectChildren() + */ @Override public List<LoggableElement> getDirectChildren() { return null; Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/LoggableElement.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/LoggableElement.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/LoggableElement.java 2008-02-04 13:53:37 UTC (rev 616) @@ -22,12 +22,20 @@ import fr.cemagref.simexplorer.is.entities.metadata.MetaData; +/** + * The Class LoggableElement. + */ public abstract class LoggableElement extends DataEntity { + /** The meta data. */ private MetaData metaData; + + /** The Constant serialVersionUID. */ private static final long serialVersionUID = 2000267650904269217L; /** + * Gets the meta data. + * * @return the metaData */ public MetaData getMetaData() { @@ -35,13 +43,17 @@ } /** - * @param metaData - * the metaData to set + * Sets the meta data. + * + * @param metaData the metaData to set */ public void setMetaData(MetaData metaData) { this.metaData = metaData; } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ @Override public String toString() { if (metaData == null) { @@ -50,8 +62,18 @@ return metaData.getName() + " [" + metaData.getVersion() + ']'; } + /** + * Gets the direct children. + * + * @return the direct children + */ public abstract List<LoggableElement> getDirectChildren(); + /** + * Gets the children. + * + * @return the children + */ public List<LoggableElement> getChildren() { List<LoggableElement> directChildren = getDirectChildren(); Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Repository.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Repository.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Repository.java 2008-02-04 13:53:37 UTC (rev 616) @@ -19,8 +19,12 @@ import java.io.Serializable; +/** + * The Class Repository. + */ public class Repository extends DataEntity implements Serializable { + /** The Constant serialVersionUID. */ private static final long serialVersionUID = 1232065724338066924L; } Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java 2008-02-04 13:53:37 UTC (rev 616) @@ -19,8 +19,12 @@ import java.io.Serializable; +/** + * The Class Result. + */ public class Result extends DataEntity implements Serializable { + /** The Constant serialVersionUID. */ private static final long serialVersionUID = 2111484866027162494L; } Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Structure.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Structure.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/data/Structure.java 2008-02-04 13:53:37 UTC (rev 616) @@ -17,7 +17,11 @@ * ##% */ package fr.cemagref.simexplorer.is.entities.data; +/** + * The Class Structure. + */ public abstract class Structure extends DataEntity { + /** The Constant serialVersionUID. */ private static final long serialVersionUID = 2594331198459134006L; } 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-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java 2008-02-04 13:53:37 UTC (rev 616) @@ -26,27 +26,59 @@ import fr.cemagref.simexplorer.is.attachment.Attachment; import fr.cemagref.simexplorer.is.entities.BaseEntity; +/** + * The Class MetaData. + */ public class MetaData extends BaseEntity implements Serializable { + /** The Constant serialVersionUID. */ private static final long serialVersionUID = -7916932464982315229L; + /** The uuid. */ private String uuid; + + /** The name. */ private String name; + + /** The type. */ private String type; + + /** The description. */ private String description; + + /** The version. */ private Version version; + + /** The creation date. */ private Date creationDate; + + /** The hash. */ private String hash; + + /** The descriptors. */ private Map<String, String> descriptors; + + /** The attachments. */ private List<Attachment> attachments; + + /** The parent data uuid. */ private String parentDataUuid; - //TODO Why String representation, instead of Version ? + // TODO Why String representation, instead of Version ? + /** The parent data version. */ private String parentDataVersion; + + /** The parent version uuid. */ private String parentVersionUuid; + + /** The parent version version. */ private String parentVersionVersion; + + /** The latest. */ private boolean latest; /** + * Gets the uuid. + * * @return the uuid */ public String getUuid() { @@ -54,6 +86,8 @@ } /** + * Sets the uuid. + * * @param uuid * the uuid to set */ @@ -62,6 +96,8 @@ } /** + * Gets the name. + * * @return the name */ public String getName() { @@ -69,6 +105,8 @@ } /** + * Sets the name. + * * @param name * the name to set */ @@ -77,6 +115,8 @@ } /** + * Gets the type. + * * @return the type */ public String getType() { @@ -84,6 +124,8 @@ } /** + * Sets the type. + * * @param type * the type to set */ @@ -92,6 +134,8 @@ } /** + * Gets the description. + * * @return the description */ public String getDescription() { @@ -99,6 +143,8 @@ } /** + * Sets the description. + * * @param description * the description to set */ @@ -107,6 +153,8 @@ } /** + * Gets the version. + * * @return the version */ public Version getVersion() { @@ -114,6 +162,8 @@ } /** + * Sets the version. + * * @param version * the version to set */ @@ -122,6 +172,8 @@ } /** + * Gets the creation date. + * * @return the creationDate */ public Date getCreationDate() { @@ -129,6 +181,8 @@ } /** + * Sets the creation date. + * * @param creationDate * the creationDate to set */ @@ -137,6 +191,8 @@ } /** + * Gets the hash. + * * @return the hash */ public String getHash() { @@ -144,6 +200,8 @@ } /** + * Sets the hash. + * * @param hash * the hash to set */ @@ -152,6 +210,8 @@ } /** + * Gets the descriptors. + * * @return the descriptors */ public Map<String, String> getDescriptors() { @@ -159,6 +219,8 @@ } /** + * Sets the descriptors. + * * @param descriptors * the descriptors to set */ @@ -167,6 +229,8 @@ } /** + * Gets the attachments. + * * @return the attachments */ public List<Attachment> getAttachments() { @@ -177,6 +241,8 @@ } /** + * Sets the attachments. + * * @param attachments * the attachments to set */ @@ -185,6 +251,8 @@ } /** + * Gets the parent data uuid. + * * @return the parentDataUuid */ public String getParentDataUuid() { @@ -192,6 +260,8 @@ } /** + * Sets the parent data uuid. + * * @param parentDataUuid * the parentDataUuid to set */ @@ -200,6 +270,8 @@ } /** + * Gets the parent data version. + * * @return the parentDataVersion */ public String getParentDataVersion() { @@ -207,6 +279,8 @@ } /** + * Sets the parent data version. + * * @param parentDataVersion * the parentDataVersion to set */ @@ -215,6 +289,8 @@ } /** + * Gets the parent version uuid. + * * @return the parentVersionUuid */ public String getParentVersionUuid() { @@ -222,6 +298,8 @@ } /** + * Sets the parent version uuid. + * * @param parentVersionUuid * the parentVersionUuid to set */ @@ -230,6 +308,8 @@ } /** + * Gets the parent version version. + * * @return the parentVersionVersion */ public String getParentVersionVersion() { @@ -237,6 +317,8 @@ } /** + * Sets the parent version version. + * * @param parentVersionVersion * the parentVersionVersion to set */ @@ -244,10 +326,21 @@ this.parentVersionVersion = parentVersionVersion; } + /** + * Checks if is latest. + * + * @return true, if is latest + */ public boolean isLatest() { return latest; } + /** + * Sets the latest. + * + * @param latest + * the new latest + */ public void setLatest(boolean latest) { this.latest = latest; } Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/Version.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/Version.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/entities/metadata/Version.java 2008-02-04 13:53:37 UTC (rev 616) @@ -23,23 +23,27 @@ import java.util.StringTokenizer; /** - * Pointed version class - * + * Pointed version class. + * * @author glandais */ public class Version implements Comparable<Version>, Serializable, Cloneable { - /** Inner storage */ + /** Inner storage. */ protected List<Integer> pointedVersion; + /** The Constant EMPTY_VERSION. */ private static final String EMPTY_VERSION = ""; + /** The Constant serialVersionUID. */ private static final long serialVersionUID = 8931989369617566434L; /** - * Static public factory of Version from his string representation - * - * @param version the string representation of the version + * Static public factory of Version from his string representation. + * + * @param version + * the string representation of the version + * * @return a new instance of version */ public static Version valueOf(String version) { @@ -47,9 +51,10 @@ } /** - * Default constructor - * - * @param version String version + * Default constructor. + * + * @param version + * String version */ public Version(String version) { // Initialize list @@ -58,32 +63,35 @@ // tokenize on dot StringTokenizer st = new StringTokenizer(version, "."); while (st.hasMoreTokens()) { - addSubVersion(Integer.valueOf(st.nextToken())); + addSubVersion(Integer.valueOf(st.nextToken()).intValue()); } } } /** - * Retrieve sub version - * - * @param position Sub version wanted + * Retrieve sub version. + * + * @param position + * Sub version wanted + * * @return the sub version number */ public Integer getVersion(int position) { if (position < pointedVersion.size()) { return pointedVersion.get(position); - } else { - return null; } + return null; } /** - * Set a sub version - * - * @param position Sub version to modify - * @param subVersion New value + * Set a sub version. + * + * @param position + * Sub version to modify + * @param subVersion + * New value */ - public void setVersion(int position, int subVersion) { + public void setVersion(int position, Integer subVersion) { while (getVersion(position) == null) { addSubVersion(0); } @@ -91,20 +99,22 @@ } /** - * Add a new sub version - * - * @param subVersion Sub version value + * Add a new sub version. + * + * @param subVersion + * Sub version value */ - public void addSubVersion(int subVersion) { + public void addSubVersion(Integer subVersion) { pointedVersion.add(subVersion); } /** - * Clone current instance and Increment a sub version. - * <p/> - * Note : <b>The current instance is NOT modified</b> - * - * @param position Sub version position + * Clone current instance and Increment a sub version. <p/> Note : <b>The + * current instance is NOT modified</b> + * + * @param position + * Sub version position + * * @return the new instance of version object updated */ public Version incVersion(int position) { @@ -118,14 +128,17 @@ } /** - * Length of version - * + * Length of version. + * * @return Number of subversions */ public int getLength() { return pointedVersion.size(); } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ @Override public String toString() { if (getLength() == 0) { @@ -169,26 +182,44 @@ return result; } + /* (non-Javadoc) + * @see java.lang.Object#clone() + */ @Override public Version clone() throws CloneNotSupportedException { Version version = (Version) super.clone(); // must defined a new instance of list(otherwise it will use the same // instance than the original Version instance, and we don not want this - version.pointedVersion=new ArrayList<Integer>(pointedVersion); + version.pointedVersion = new ArrayList<Integer>(pointedVersion); return version; } + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ @Override public boolean equals(Object o) { - return this == o || (o instanceof Version && - pointedVersion.equals(((Version) o).pointedVersion)); + return this == o + || (o instanceof Version && pointedVersion + .equals(((Version) o).pointedVersion)); } + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ @Override public int hashCode() { return pointedVersion.hashCode(); } + /** + * Safe clone. + * + * @return the version + * + * @throws RuntimeException + * the runtime exception + */ public Version safeClone() throws RuntimeException { try { return clone(); Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/BaseEntityFactory.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/BaseEntityFactory.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/BaseEntityFactory.java 2008-02-04 13:53:37 UTC (rev 616) @@ -38,11 +38,17 @@ import fr.cemagref.simexplorer.is.entities.BaseEntity; import fr.cemagref.simexplorer.is.entities.data.DataEntity; +/** + * A factory for creating BaseEntity objects. + * @param <E> Entity type + */ public abstract class BaseEntityFactory<E extends BaseEntity> implements XmlConstants { + /** The document builder. */ private static DocumentBuilder documentBuilder = null; + /** The factories. */ private static Map<String, BaseEntityFactory<? extends DataEntity>> factories = new HashMap<String, BaseEntityFactory<? extends DataEntity>>(); /* @@ -50,12 +56,16 @@ */ /** - * Retrieve instance of the factory + * Retrieve instance of the factory. + * @param <E> Entity type * * @param entityClass * Class wanted + * * @return Factory + * * @throws Exception + * the exception */ @SuppressWarnings("unchecked") public static <E extends DataEntity> BaseEntityFactory<E> getFactory( @@ -65,7 +75,7 @@ if (result == null) { String elementFactoryClassName = BaseEntityFactory.class .getPackage().getName() - + "." + entityClass.getSimpleName() + "Factory"; + + "." + entityClass.getSimpleName() + FACTORY_SUFFIX; Class<? extends BaseEntityFactory<E>> factoryClass = (Class<? extends BaseEntityFactory<E>>) Class .forName(elementFactoryClassName).asSubclass( @@ -78,11 +88,15 @@ } /** - * Retrieve a factory with class name + * Retrieve a factory with class name. * * @param entityClassName - * @return + * the entity class name + * + * @return the factory + * * @throws Exception + * the exception */ public static BaseEntityFactory<? extends DataEntity> getFactory( String entityClassName) throws Exception { @@ -92,10 +106,12 @@ } /** - * Retrieve an instance of document builder + * Retrieve an instance of document builder. * * @return XML document builder + * * @throws Exception + * the exception */ public static synchronized DocumentBuilder getXMLBuilder() throws Exception { if (documentBuilder == null) { @@ -112,18 +128,22 @@ */ /** - * Instanciate an element + * Instanciate an element. * * @return Element */ public abstract E createInstance(); /** - * Load an element from an XML node + * Load an element from an XML node. * * @param xmlElement - * @return + * the xml element + * + * @return the E + * * @throws Exception + * the exception */ public E loadElement(Element xmlElement) throws Exception { E element = createInstance(); @@ -131,11 +151,15 @@ } /** - * Load an element from a XML stream + * Load an element from a XML stream. * * @param stream - * @return + * the stream + * + * @return the E + * * @throws Exception + * the exception */ public E loadElement(InputStream stream) throws Exception { Document document = getXMLBuilder().parse(stream); @@ -145,7 +169,7 @@ } /** - * Save an element to a XML node + * Save an element to a XML node. * * @param document * XML document @@ -153,18 +177,25 @@ * XML node storing the element (not null) * @param element * Element to save + * * @throws Exception + * the exception */ public abstract void saveElement(Document document, Element xmlElement, E element) throws Exception; /** - * Save an element to a XML stream + * Save an element to a XML stream. * * @param rootNodeName + * the root node name * @param element - * @return + * the element + * + * @return the input stream + * * @throws Exception + * the exception */ public InputStream saveElement(String rootNodeName, E element) throws Exception { @@ -194,10 +225,9 @@ */ /** - * Load a collection inside a node + * Load a collection inside a node. + * @param <T> Entity type * - * @param <T> - * Type of element of the collection * @param tagSetName * Tag of the node of the collection * @param tagName @@ -208,8 +238,11 @@ * Node containing the collection * @param parentData * Element holding the collection - * @return + * + * @return the set< t> + * * @throws Exception + * the exception */ public <T extends DataEntity> Set<T> loadCollection(String tagSetName, String tagName, Class<T> clazz, Element xmlElement, @@ -236,16 +269,24 @@ } /** - * Save a collection of elements to XML node + * Save a collection of elements to XML node. + * @param <T> Entity type * - * @param <T> * @param entities + * the entities * @param tagSetName + * the tag set name * @param tagName + * the tag name * @param clazz + * the clazz * @param document + * the document * @param xmlElement + * the xml element + * * @throws Exception + * the exception */ public <T extends DataEntity> void saveCollection(Set<T> entities, String tagSetName, String tagName, Class<T> clazz, @@ -263,11 +304,15 @@ } /** - * Save an element as a XML stream + * Save an element as a XML stream. * * @param node - * @return + * the node + * + * @return the input stream + * * @throws Exception + * the exception */ public static InputStream serializeElement(Element node) throws Exception { org.w3c.dom.Document xmlDocument = getXMLBuilder().newDocument(); @@ -292,7 +337,7 @@ */ /** - * Set a property in XML + * Set a property in XML. * * @param document * XML document @@ -314,21 +359,21 @@ } /** - * Get a property in XML + * Get a property in XML. * * @param xmlElement * Source node * @param tagName * Tag name of property + * * @return Property value */ public String getXMLProperty(Element xmlElement, String tagName) { Element element = getXMLElementByTagName(xmlElement, tagName); if (element != null) { return element.getFirstChild().getNodeValue(); - } else { - return null; } + return null; } /* @@ -336,27 +381,32 @@ */ /** - * Retrieve XML element just under with specified tag name + * Retrieve XML element just under with specified tag name. * * @param xmlElement + * the xml element * @param tagName - * @return + * the tag name + * + * @return First child element with tagName */ public Element getXMLElementByTagName(Element xmlElement, String tagName) { Set<Element> elements = getXMLElementsByTagName(xmlElement, tagName); if (elements.size() > 0) { return elements.iterator().next(); - } else { - return null; } + return null; } /** - * Retrieve all XML elements just under with specified tag name + * Retrieve all XML elements just under with specified tag name. * * @param xmlElement + * the xml element * @param tagName - * @return + * the tag name + * + * @return Children with tagName */ public Set<Element> getXMLElementsByTagName(Element xmlElement, String tagName) { Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/CodeFactory.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/CodeFactory.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/CodeFactory.java 2008-02-04 13:53:37 UTC (rev 616) @@ -22,13 +22,23 @@ import fr.cemagref.simexplorer.is.entities.data.Code; +/** + * A factory for creating Code objects. + * @param <E> Code + */ public class CodeFactory<E extends Code> extends BaseEntityFactory<Code> { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#createInstance() + */ @Override public Code createInstance() { return new Code(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#loadElement(org.w3c.dom.Element) + */ @Override public Code loadElement(Element xmlElement) throws Exception { Code code = super.loadElement(xmlElement); @@ -37,6 +47,9 @@ return code; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.BaseEntity) + */ @Override public void saveElement(Document document, Element xmlElement, Code element) throws Exception { Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ComponentFactory.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ComponentFactory.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ComponentFactory.java 2008-02-04 13:53:37 UTC (rev 616) @@ -26,14 +26,24 @@ import fr.cemagref.simexplorer.is.entities.data.Library; import fr.cemagref.simexplorer.is.entities.data.Structure; +/** + * A factory for creating Component objects. + * @param <E> Component + */ public class ComponentFactory<E extends Component> extends LoggableElementFactory<Component> { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#createInstance() + */ @Override public Component createInstance() { return new Component(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.LoggableElementFactory#loadElement(org.w3c.dom.Element) + */ @Override public Component loadElement(Element xmlElement) throws Exception { Component component = super.loadElement(xmlElement); @@ -53,6 +63,9 @@ return component; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.LoggableElementFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.data.LoggableElement) + */ @Override public void saveElement(Document document, Element xmlElement, Component element) throws Exception { Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ConstantFactory.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ConstantFactory.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ConstantFactory.java 2008-02-04 13:53:37 UTC (rev 616) @@ -22,14 +22,24 @@ import fr.cemagref.simexplorer.is.entities.data.Constant; +/** + * A factory for creating Constant objects. + * @param <E> Constant + */ public class ConstantFactory<E extends Constant> extends BaseEntityFactory<Constant> { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#createInstance() + */ @Override public Constant createInstance() { return new Constant(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#loadElement(org.w3c.dom.Element) + */ @Override public Constant loadElement(Element xmlElement) throws Exception { Constant constant = super.loadElement(xmlElement); @@ -39,6 +49,9 @@ return constant; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.BaseEntity) + */ @Override public void saveElement(Document document, Element xmlElement, Constant element) throws Exception { Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ConstantValueFactory.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ConstantValueFactory.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ConstantValueFactory.java 2008-02-04 13:53:37 UTC (rev 616) @@ -23,14 +23,24 @@ import fr.cemagref.simexplorer.is.entities.data.Constant; import fr.cemagref.simexplorer.is.entities.data.ConstantValue; +/** + * A factory for creating ConstantValue objects. + * @param <E> ConstantValue + */ public class ConstantValueFactory<E extends ConstantValue> extends BaseEntityFactory<ConstantValue> { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#createInstance() + */ @Override public ConstantValue createInstance() { return new ConstantValue(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#loadElement(org.w3c.dom.Element) + */ @Override public ConstantValue loadElement(Element xmlElement) throws Exception { ConstantValue constantValue = super.loadElement(xmlElement); @@ -43,6 +53,9 @@ return constantValue; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.BaseEntity) + */ @Override public void saveElement(Document document, Element xmlElement, ConstantValue element) throws Exception { Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ExplorationApplicationFactory.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ExplorationApplicationFactory.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ExplorationApplicationFactory.java 2008-02-04 13:53:37 UTC (rev 616) @@ -24,35 +24,53 @@ import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication; import fr.cemagref.simexplorer.is.entities.data.ExplorationData; +/** + * A factory for creating ExplorationApplication objects. + */ public class ExplorationApplicationFactory extends LoggableElementFactory<ExplorationApplication> { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#createInstance() + */ @Override public ExplorationApplication createInstance() { return new ExplorationApplication(); } - + + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.LoggableElementFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.data.LoggableElement) + */ @Override public void saveElement(Document document, Element xmlElement, ExplorationApplication element) throws Exception { super.saveElement(document, xmlElement, element); - saveCollection(element.getExplorations(), KEY_EXPLORATIONAPPLICATION_DATA, KEY_EXPLORATIONAPPLICATION_DATA_NODE, - ExplorationData.class, document, xmlElement); - saveCollection(element.getComponents(), KEY_EXPLORATIONAPPLICATION_COMPONENTS, - KEY_EXPLORATIONAPPLICATION_COMPONENT_NODE, Component.class, document, xmlElement); + saveCollection(element.getExplorations(), + KEY_EXPLORATIONAPPLICATION_DATA, + KEY_EXPLORATIONAPPLICATION_DATA_NODE, ExplorationData.class, + document, xmlElement); + saveCollection(element.getComponents(), + KEY_EXPLORATIONAPPLICATION_COMPONENTS, + KEY_EXPLORATIONAPPLICATION_COMPONENT_NODE, Component.class, + document, xmlElement); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.LoggableElementFactory#loadElement(org.w3c.dom.Element) + */ @Override public ExplorationApplication loadElement(Element xmlElement) throws Exception { ExplorationApplication explorationApplication = super .loadElement(xmlElement); - explorationApplication.setExplorations(loadCollection(KEY_EXPLORATIONAPPLICATION_DATA, - KEY_EXPLORATIONAPPLICATION_DATA_NODE, ExplorationData.class, xmlElement, - explorationApplication)); - explorationApplication.setComponents(loadCollection(KEY_EXPLORATIONAPPLICATION_COMPONENTS, - KEY_EXPLORATIONAPPLICATION_COMPONENT_NODE, Component.class, xmlElement, - explorationApplication)); + explorationApplication.setExplorations(loadCollection( + KEY_EXPLORATIONAPPLICATION_DATA, + KEY_EXPLORATIONAPPLICATION_DATA_NODE, ExplorationData.class, + xmlElement, explorationApplication)); + explorationApplication.setComponents(loadCollection( + KEY_EXPLORATIONAPPLICATION_COMPONENTS, + KEY_EXPLORATIONAPPLICATION_COMPONENT_NODE, Component.class, + xmlElement, explorationApplication)); return explorationApplication; } Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ExplorationDataFactory.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ExplorationDataFactory.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ExplorationDataFactory.java 2008-02-04 13:53:37 UTC (rev 616) @@ -24,14 +24,23 @@ import fr.cemagref.simexplorer.is.entities.data.ExplorationData; import fr.cemagref.simexplorer.is.entities.data.Result; +/** + * A factory for creating ExplorationData objects. + */ public class ExplorationDataFactory extends LoggableElementFactory<ExplorationData> { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#createInstance() + */ @Override public ExplorationData createInstance() { return new ExplorationData(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.LoggableElementFactory#loadElement(org.w3c.dom.Element) + */ @Override public ExplorationData loadElement(Element xmlElement) throws Exception { ExplorationData explorationData = super.loadElement(xmlElement); @@ -45,6 +54,9 @@ return explorationData; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.LoggableElementFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.data.LoggableElement) + */ @Override public void saveElement(Document document, Element xmlElement, ExplorationData element) throws Exception { Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/LibraryFactory.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/LibraryFactory.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/LibraryFactory.java 2008-02-04 13:53:37 UTC (rev 616) @@ -19,8 +19,14 @@ import fr.cemagref.simexplorer.is.entities.data.Library; +/** + * A factory for creating Library objects. + */ public class LibraryFactory extends LoggableElementFactory<Library> { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#createInstance() + */ @Override public Library createInstance() { return new Library(); Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/LoggableElementFactory.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/LoggableElementFactory.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/LoggableElementFactory.java 2008-02-04 13:53:37 UTC (rev 616) @@ -22,14 +22,24 @@ import fr.cemagref.simexplorer.is.entities.data.LoggableElement; import fr.cemagref.simexplorer.is.entities.metadata.MetaData; +/** + * A factory for creating LoggableElement objects. + * + * @param <E> + * LoggableElement subtype + */ public abstract class LoggableElementFactory<E extends LoggableElement> extends BaseEntityFactory<E> { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#loadElement(org.w3c.dom.Element) + */ @Override public E loadElement(Element xmlElement) throws Exception { E element = super.loadElement(xmlElement); - MetaDataFactory elementFactory = MetaDataFactory.getFactory(MetaData.class); + MetaDataFactory elementFactory = MetaDataFactory + .getFactory(MetaData.class); // Load metadata informations Element mdeElement = getXMLElementByTagName(xmlElement, KEY_METADATA); @@ -39,10 +49,14 @@ return element; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.BaseEntity) + */ @Override public void saveElement(org.w3c.dom.Document document, Element xmlElement, E element) throws Exception { - MetaDataFactory elementFactory = MetaDataFactory.getFactory(MetaData.class); + MetaDataFactory elementFactory = MetaDataFactory + .getFactory(MetaData.class); // Save metadata informations Element mdeElement = document.createElement(KEY_METADATA); Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/MetaDataFactory.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/MetaDataFactory.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/MetaDataFactory.java 2008-02-04 13:53:37 UTC (rev 616) @@ -34,22 +34,41 @@ import fr.cemagref.simexplorer.is.attachment.ContentTypeFactory; import fr.cemagref.simexplorer.is.entities.metadata.MetaData; +/** + * A factory for creating MetaData objects. + * @param <E> MetaData + */ public class MetaDataFactory<E extends MetaData> extends BaseEntityFactory<MetaData> { + /** The Constant sdf. */ private static final SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss"); + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#createInstance() + */ @Override public MetaData createInstance() { return new MetaData(); } + /** + * Gets the factory. + * @param <E> Metadata + * + * @param entityClass + * the entity class + * + * @return the factory + * + * @throws Exception + * the exception + */ @SuppressWarnings( { "unchecked" }) public static <E extends MetaData> MetaDataFactory<E> getFactory( Class<E> entityClass) throws Exception { - return (MetaDataFactory) BaseEntityFactory - .getFactory(entityClass); + return (MetaDataFactory) BaseEntityFactory.getFactory(entityClass); } /* @@ -143,6 +162,9 @@ return entity; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.BaseEntity) + */ @Override public void saveElement(Document document, Element xmlElement, MetaData element) throws Exception { @@ -230,11 +252,15 @@ /** * As metadata is stored inside an entity, this method loads metadata with - * parsing stream and retrieve metadata node + * parsing stream and retrieve metadata node. * * @param xmlStream - * @return + * the xml stream + * + * @return the meta data + * * @throws Exception + * the exception */ public MetaData loadElementFromParentXML(InputStream xmlStream) throws Exception { Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/RepositoryFactory.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/RepositoryFactory.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/RepositoryFactory.java 2008-02-04 13:53:37 UTC (rev 616) @@ -22,23 +22,36 @@ import fr.cemagref.simexplorer.is.entities.data.Repository; +/** + * A factory for creating Repository objects. + * @param <E> Repository + */ public class RepositoryFactory<E extends Repository> extends BaseEntityFactory<Repository> { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#createInstance() + */ @Override public Repository createInstance() { return new Repository(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#loadElement(org.w3c.dom.Element) + */ @Override public Repository loadElement(Element xmlElement) throws Exception { return super.loadElement(xmlElement); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.BaseEntity) + */ @Override public void saveElement(Document document, Element xmlElement, Repository element) throws Exception { - + // nothing to do yet } } Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ResultFactory.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ResultFactory.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/ResultFactory.java 2008-02-04 13:53:37 UTC (rev 616) @@ -22,21 +22,36 @@ import fr.cemagref.simexplorer.is.entities.data.Result; +/** + * A factory for creating Result objects. + * @param <E> Result + */ public class ResultFactory<E extends Result> extends BaseEntityFactory<Result> { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#createInstance() + */ @Override public Result createInstance() { return new Result(); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#loadElement(org.w3c.dom.Element) + */ @Override public Result loadElement(Element xmlElement) throws Exception { return super.loadElement(xmlElement); } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.factories.BaseEntityFactory#saveElement(org.w3c.dom.Document, org.w3c.dom.Element, fr.cemagref.simexplorer.is.entities.BaseEntity) + */ @Override public void saveElement(Document document, Element xmlElement, Result element) throws Exception { + + // not used yet } Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/StructureFactory.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/StructureFactory.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/StructureFactory.java 2008-02-04 13:53:37 UTC (rev 616) @@ -19,7 +19,13 @@ import fr.cemagref.simexplorer.is.entities.data.Structure; +/** + * A factory for creating Structure objects. + * + * @param <E> + * Structure subtype + */ public abstract class StructureFactory<E extends Structure> extends BaseEntityFactory<Structure> { - + // nothing to do yet } Modified: trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/XMLStreamEncoder.java =================================================================== --- trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/XMLStreamEncoder.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/XMLStreamEncoder.java 2008-02-04 13:53:37 UTC (rev 616) @@ -27,14 +27,35 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; +/** + * The Class XMLStreamEncoder. + */ public class XMLStreamEncoder extends Thread { + /** The dom source. */ private DOMSource domSource; + + /** The os. */ + @SuppressWarnings("unused") private PipedOutputStream os; + /** The result. */ private StreamResult result; + + /** The transformer. */ private Transformer transformer; + /** + * Instantiates a new xML stream encoder. + * + * @param domSource + * the dom source + * @param os + * the os + * + * @throws TransformerConfigurationException + * the transformer configuration exception + */ public XMLStreamEncoder(DOMSource domSource, PipedOutputStream os) throws TransformerConfigurationException { super(); @@ -46,6 +67,10 @@ transformer = tf.newTransformer(); } + /* (non-Javadoc) + * @see java.lang.Thread#run() + */ + @Override public void run() { try { transformer.transform(domSource, result); 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-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/java/fr/cemagref/simexplorer/is/factories/XmlConstants.java 2008-02-04 13:53:37 UTC (rev 616) @@ -18,73 +18,157 @@ package fr.cemagref.simexplorer.is.factories; /** - * Store all XML constants + * Store all XML constants. * * @author glandais - * */ public interface XmlConstants { + /** The Constant FACTORY_SUFFIX. */ + public static final String FACTORY_SUFFIX = "language"; + + /** The Constant KEY_CODE_LANGUAGE. */ public static final String KEY_CODE_LANGUAGE = "language"; + + /** The Constant KEY_CODE_CODE. */ public static final String KEY_CODE_CODE = "code"; + /** The Constant KEY_COMPONENT_CONSTANTS. */ public static final String KEY_COMPONENT_CONSTANTS = "constants"; + + /** The Constant KEY_COMPONENT_CONSTANT_NODE. */ public static final String KEY_COMPONENT_CONSTANT_NODE = "constant"; + + /** The Constant KEY_COMPONENT_STRUCTURE. */ public static final String KEY_COMPONENT_STRUCTURE = "structures"; + + /** The Constant KEY_COMPONENT_STRUCTURE_NODE. */ public static final String KEY_COMPONENT_STRUCTURE_NODE = "structure"; + + /** The Constant KEY_COMPONENT_CODES. */ public static final String KEY_COMPONENT_CODES = "codes"; + + /** The Constant KEY_COMPONENT_CODE_NODE. */ public static final String KEY_COMPONENT_CODE_NODE = "code"; + + /** The Constant KEY_COMPONENT_LIBRARIES. */ public static final String KEY_COMPONENT_LIBRARIES = "libraries"; + + /** The Constant KEY_COMPONENT_LIBRARY_NODE. */ public static final String KEY_COMPONENT_LIBRARY_NODE = "library"; + /** The Constant KEY_CONSTANT_NAME. */ public static final String KEY_CONSTANT_NAME = "name"; + + /** The Constant KEY_CONSTANT_TYPE. */ public static final String KEY_CONSTANT_TYPE = "type"; + /** The Constant KEY_CONSTANTVALUE_CONSTANT. */ public static final String KEY_CONSTANTVALUE_CONSTANT = "constant"; + + /** The Constant KEY_CONSTANTVALUE_VALUE. */ public static final String KEY_CONSTANTVALUE_VALUE = "value"; + /** The Constant KEY_EXPLORATIONAPPLICATION_DATA. */ public static final String KEY_EXPLORATIONAPPLICATION_DATA = "data"; + + /** The Constant KEY_EXPLORATIONAPPLICATION_DATA_NODE. */ public static final String KEY_EXPLORATIONAPPLICATION_DATA_NODE = "explorationdata"; + + /** The Constant KEY_EXPLORATIONAPPLICATION_COMPONENTS. */ public static final String KEY_EXPLORATIONAPPLICATION_COMPONENTS = "components"; + + /** The Constant KEY_EXPLORATIONAPPLICATION_COMPONENT_NODE. */ public static final String KEY_EXPLORATIONAPPLICATION_COMPONENT_NODE = "component"; + /** The Constant KEY_EXPLORATIONDATA_RESULT. */ public static final String KEY_EXPLORATIONDATA_RESULT = "result"; + + /** The Constant KEY_EXPLORATIONDATA_VALUES. */ public static final String KEY_EXPLORATIONDATA_VALUES = "values"; + + /** The Constant KEY_EXPLORATIONDATA_VALUE. */ public static final String KEY_EXPLORATIONDATA_VALUE = "value"; + /** The Constant KEY_RESULT_FILE. */ public static final String KEY_RESULT_FILE = "file"; + /** The Constant KEY_METADATA. */ public static final String KEY_METADATA = "metadata"; + /** The Constant KEY_METADATA_UUID. */ public static final String KEY_METADATA_UUID = "uuid"; + + /** The Constant KEY_METADATA_VERSION. */ public static final String KEY_METADATA_VERSION = "version"; + + /** The Constant KEY_METADATA_LATESTVERSION. */ public static final String KEY_METADATA_LATESTVERSION = "latestversion"; + + /** The Constant KEY_METADATA_NAME. */ public static final String KEY_METADATA_NAME = "name"; + /** The Constant KEY_METADATA_TYPE. */ public static final String KEY_METADATA_TYPE = "type"; + + /** The Constant VALUE_METADATA_TYPE_EA. */ public static final String VALUE_METADATA_TYPE_EA = "ExplorationApplication"; + + /** The Constant VALUE_METADATA_TYPE_COMPONENT. */ public static final String VALUE_METADATA_TYPE_COMPONENT = "Component"; + /** The Constant KEY_METADATA_DESCRIPTION. */ public static final String KEY_METADATA_DESCRIPTION = "description"; + + /** The Constant KEY_METADATA_CREATIONDATE. */ public static final String KEY_METADATA_CREATIONDATE = "creationdate"; + + /** The Constant KEY_METADATA_HASH. */ public static final String KEY_METADATA_HASH = "hash"; + + /** The Constant KEY_METADATA_PARENTDATA_UUID. */ public static final String KEY_METADATA_PARENTDATA_UUID = "parentdatauuid"; + + /** The Constant KEY_METADATA_PARENTDATA_VERSION. */ public static final String KEY_METADATA_PARENTDATA_VERSION = "parentdataversion"; + + /** The Constant KEY_METADATA_PARENTVERSION_UUID. */ public static final String KEY_METADATA_PARENTVERSION_UUID = "parentversionuuid"; + + /** The Constant KEY_METADATA_PARENTVERSION_VERSION. */ public static final String KEY_METADATA_PARENTVERSION_VERSION = "parentversionversion"; + + /** The Constant KEY_METADATA_DESCRIPTORS. */ public static final String KEY_METADATA_DESCRIPTORS = "descriptors"; + + /** The Constant KEY_METADATA_DESCRIPTOR. */ public static final String KEY_METADATA_DESCRIPTOR = "descriptor"; + + /** The Constant KEY_METADATA_ATTACHMENTS. */ public static final String KEY_METADATA_ATTACHMENTS = "attachments"; + + /** The Constant KEY_METADATA_ATTACHMENT. */ public static final String KEY_METADATA_ATTACHMENT = "attachment"; + /** The Constant KEY_METADATA_DESCRIPTOR_NAME. */ public static final String KEY_METADATA_DESCRIPTOR_NAME = "name"; + + /** The Constant KEY_METADATA_DESCRIPTOR_VALUE. */ public static final String KEY_METADATA_DESCRIPTOR_VALUE = "value"; + /** The Constant KEY_METADATA_ATTACHMENT_NAME. */ public static final String KEY_METADATA_ATTACHMENT_NAME = "name"; + + /** The Constant KEY_METADATA_ATTACHMENT_TYPE. */ public static final String KEY_METADATA_ATTACHMENT_TYPE = "type"; + + /** The Constant KEY_METADATA_ATTACHMENT_HASH. */ public static final String KEY_METADATA_ATTACHMENT_HASH = "hash"; + /** The Constant FILE_XML. */ public static final String FILE_XML = "data.xml"; + + /** The Constant FILE_DATA_PREFIX. */ public static final String FILE_DATA_PREFIX = "attachment"; } Modified: trunk/simexplorer-is-entities/src/test/fr/cemagref/simexplorer/is/entities/metadata/VersionTest.java =================================================================== --- trunk/simexplorer-is-entities/src/test/fr/cemagref/simexplorer/is/entities/metadata/VersionTest.java 2008-02-04 11:42:56 UTC (rev 615) +++ trunk/simexplorer-is-entities/src/test/fr/cemagref/simexplorer/is/entities/metadata/VersionTest.java 2008-02-04 13:53:37 UTC (rev 616) @@ -21,22 +21,49 @@ /** * Version Tester. - * + * * @author chemit * @version 1.0 - * @since <pre>02/02/2008</pre> + * @since + * + * <pre> + * 02 / 02 / 2008 + * </pre> */ public class VersionTest extends TestCase { - Version v0, v1; + /** The v0. */ + Version v0; + + /** The v1. */ + Version v1; + + /** + * Instantiates a new version test. + * + * @param name + * the name + */ public VersionTest(String name) { super(name); } + /** + * Test set get version. + * + * @throws Exception + * the exception + */ public void testSetGetVersion() throws Exception { - //TODO: Test goes here... + // TODO: Test goes here... } + /** + * Test get length. + * + * @throws Exception + * the exception + */ public void testGetLength() throws Exception { v0 = Version.valueOf(""); @@ -52,6 +79,12 @@ assertEquals(3, v0.getLength()); } + /** + * Test equals. + * + * @throws Exception + * the exception + */ public void testEquals() throws Exception { v0 = Version.valueOf(""); @@ -71,6 +104,12 @@ assertEquals(v0, v1); } + /** + * Test inc sub version. + * + * @throws Exception + * the exception + */ public void testIncSubVersion() throws Exception { v0 = Version.valueOf("0.1"); @@ -87,32 +126,62 @@ assertEquals(Version.valueOf("0.1.1"), v1); } + /** + * Test order. + * + * @throws Exception + * the exception + */ public void testOrder() throws Exception { v0 = Version.valueOf("1"); v1 = Version.valueOf("1"); - assertEqualsVersion(v0,v1); + assertEqualsVersion(v0, v1); v1 = Version.valueOf("1.0"); - assertSmallerVersion(v0,v1); + assertSmallerVersion(v0, v1); v1 = Version.valueOf("2"); - assertSmallerVersion(v0,v1); + assertSmallerVersion(v0, v1); v1 = Version.valueOf("0"); - assertGreaterVersion(v0,v1); + assertGreaterVersion(v0, v1); v1 = Version.valueOf("0.1"); - assertGreaterVersion(v0,v1); + assertGreaterVersion(v0, v1); } - private void assertEqualsVersion(Version v0, Version v1) { - assertEquals(0, v0.compareTo(v1)); + /** + * Assert equals version. + * + * @param va + * the va + * @param vb + * the vb + */ + private void assertEqualsVersion(Version va, Version vb) { + assertEquals(0, va.compareTo(vb)); } - private void assertSmallerVersion(Version v0, Version v1) { - assertEquals(-1, v0.compareTo(v1)); + /** + * Assert smaller version. + * + * @param va + * the va + * @param vb + * the vb + */ + private void assertSmallerVersion(Version va, Version vb) { + assertEquals(-1, va.compareTo(vb)); } - private void assertGreaterVersion(Version v0, Version v1) { - assertEquals(1, v0.compareTo(v1)); + /** + * Assert greater version. + * + * @param va + * the va + * @param vb + * the vb + */ + private void assertGreaterVersion(Version va, Version vb) { + assertEquals(1, va.compareTo(vb)); } }
participants (1)
-
glandais@users.labs.libre-entreprise.org