r1021 - in trunk/simexplorer-is: simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/metadata simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages
Author: tchemit Date: 2008-02-16 15:10:16 +0000 (Sat, 16 Feb 2008) New Revision: 1021 Added: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/EntityVisitable.java trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/EntityVisitor.java trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/SimpleEntityVisitor.java Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/BaseEntity.java trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Code.java trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Component.java trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Constant.java trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ConstantValue.java trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/DataEntity.java trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationApplication.java trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationData.java trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Library.java trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Repository.java trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Structure.java trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ExplorationDataFactory.java trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDetail.java Log: passage de classe abstraite en interface (BaseEntity, ContentType. suppression des implements Serializable inutile sur des classes qui ?\195?\169tant d?\195?\169j?\195?\160 ce contrat. renommage de la propri?\195?\169t?\195?\169 valueMap en constantValues (dans ExplorationData) Introduction d'un visiteur de BaseEntity, marquage du contrat de BaseEntity par cette interface. implantation d'un premier visiteur qui definit la navigation dans les LoggableElement. Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/BaseEntity.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/BaseEntity.java 2008-02-16 15:05:24 UTC (rev 1020) +++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/BaseEntity.java 2008-02-16 15:10:16 UTC (rev 1021) @@ -20,13 +20,16 @@ import java.io.Serializable; /** - * The Class BaseEntity. - * TODO Be an interface + * 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. + * + * @author glandais + * @see Serializable + * @see EntityVisitable */ -public abstract class BaseEntity implements Serializable { - - // empty class - - /** The Constant serialVersionUID. */ - private static final long serialVersionUID = -1180452401816397351L; +public interface BaseEntity extends Serializable, EntityVisitable { } Added: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/EntityVisitable.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/EntityVisitable.java (rev 0) +++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/EntityVisitable.java 2008-02-16 15:10:16 UTC (rev 1021) @@ -0,0 +1,36 @@ +/* +* ##% Copyright (C) 2007, 2008 Code Lutin, Tony Chemit, Gabriel Landais +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* ##% */ +package fr.cemagref.simexplorer.is.entities; + +/** + * Le contrat a respecter par un entity pour être visiter par un + * {@link EntityVisitor} visiteur. + * + * @author chemit + * @see EntityVisitor + */ +public interface EntityVisitable { + /** + * Méthode à implanter dans chaque visitable pour indiquer ce que + * le visiteur doit visiter. + * + * @param visitor le visiteur + */ + void accept(EntityVisitor visitor); + +} Added: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/EntityVisitor.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/EntityVisitor.java (rev 0) +++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/EntityVisitor.java 2008-02-16 15:10:16 UTC (rev 1021) @@ -0,0 +1,210 @@ +/* +* ##% Copyright (C) 2007, 2008 Code Lutin, Tony Chemit, Gabriel Landais +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* ##% */ +package fr.cemagref.simexplorer.is.entities; + +import fr.cemagref.simexplorer.is.entities.attachment.Attachment; +import fr.cemagref.simexplorer.is.entities.data.Code; +import fr.cemagref.simexplorer.is.entities.data.Component; +import fr.cemagref.simexplorer.is.entities.data.Constant; +import fr.cemagref.simexplorer.is.entities.data.ConstantValue; +import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication; +import fr.cemagref.simexplorer.is.entities.data.ExplorationData; +import fr.cemagref.simexplorer.is.entities.data.Library; +import fr.cemagref.simexplorer.is.entities.data.Repository; +import fr.cemagref.simexplorer.is.entities.data.Result; +import fr.cemagref.simexplorer.is.entities.data.Structure; +import fr.cemagref.simexplorer.is.entities.metadata.MetaData; + +import java.util.Collection; + +/** + * Le contrat à respecter pour un visiteur à visiter des {@link EntityVisitable}.. + * + * @author chemit + * @see EntityVisitable + * @see SimpleEntityVisitor + */ +public interface EntityVisitor { + + /** + * La méthode de base pour visiter n'importe quel {@link EntityVisitable}. + * + * @param v le visité + */ + void visit(EntityVisitable v); + + /** + * Pour visiter une exploration d'application + * + * @param v le visité + * @see ExplorationApplication + */ + void visitExplorationApplication(ExplorationApplication v); + + /** + * Pour visiter un Component + * + * @param v le visité + * @see Component + */ + void visitComponent(Component v); + + /** + * Pour visiter une ExplorationApplication + * + * @param v le visité + * @see ExplorationApplication + */ + void visitExplorationData(ExplorationData v); + + /** + * Pour visiter un Library + * + * @param v le visité + * @see Library + */ + void visitLibrary(Library v); + + /** + * Pour visiter un Metadata + * + * @param v le visité + * @see MetaData + */ + void visitMetaData(MetaData v); + + /** + * Pour visiter un Result + * + * @param v le visité + * @see Result + */ + void visitResult(Result v); + + /** + * Pour visiter un Constant + * + * @param vs le visité + * @see Constant + */ + void visitConstant(Constant vs); + + /** + * Pour visiter un Code + * + * @param v le visité + * @see Code + */ + void visitCode(Code v); + + /** + * Pour visiter un Structure + * + * @param v le visité + * @see Structure + */ + void visitStructure(Structure v); + + /** + * Pour visiter un ConstantValue + * + * @param v le visité + * @see ConstantValue + */ + void visitConstantValue(ConstantValue v); + + /** + * Pour visiter un Attachment + * + * @param v le visité + * @see Attachment + */ + void visitAttachment(Attachment v); + + /** + * Pour visiter un Repository + * + * @param v le visité + * @see Repository + */ + void visitRepository(Repository v); + + /** + * Pour visiter une collection de Component + * + * @param vs les visités + * @see Component + */ + void visitComponents(Collection<Component> vs); + + /** + * Pour visiter une collection de ExplorationData + * + * @param vs les visités + * @see ExplorationData + */ + void visitExplorationDatas(Collection<ExplorationData> vs); + + /** + * Pour visiter une collection de Library + * + * @param vs les visités + * @see Library + */ + void visitLibraries(Collection<Library> vs); + + /** + * Pour visiter une collection de Constant + * + * @param vs les visités + * @see Constant + */ + void visitConstants(Collection<Constant> vs); + + /** + * Pour visiter une collection de Code + * + * @param vs les visités + * @see Code + */ + void visitCodes(Collection<Code> vs); + + /** + * Pour visiter une collection de Structure + * + * @param vs les visités + * @see Structure + */ + void visitStructures(Collection<Structure> vs); + + /** + * Pour visiter une collection de ConstantValue + * + * @param vs les visités + * @see ConstantValue + */ + void visitConstantValues(Collection<ConstantValue> vs); + + /** + * Pour visiter une collection de Attachment + * + * @param vs les visités + * @see Attachment + */ + void visitAttachments(Collection<Attachment> vs); +} Added: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/SimpleEntityVisitor.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/SimpleEntityVisitor.java (rev 0) +++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/SimpleEntityVisitor.java 2008-02-16 15:10:16 UTC (rev 1021) @@ -0,0 +1,167 @@ +/* +* ##% Copyright (C) 2007, 2008 Code Lutin, +* Tony Chemit, Gabriel Landais +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* ##% */ +package fr.cemagref.simexplorer.is.entities; + +import fr.cemagref.simexplorer.is.entities.attachment.Attachment; +import fr.cemagref.simexplorer.is.entities.data.Code; +import fr.cemagref.simexplorer.is.entities.data.Component; +import fr.cemagref.simexplorer.is.entities.data.Constant; +import fr.cemagref.simexplorer.is.entities.data.ConstantValue; +import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication; +import fr.cemagref.simexplorer.is.entities.data.ExplorationData; +import fr.cemagref.simexplorer.is.entities.data.Library; +import fr.cemagref.simexplorer.is.entities.data.Repository; +import fr.cemagref.simexplorer.is.entities.data.Result; +import fr.cemagref.simexplorer.is.entities.data.Structure; +import fr.cemagref.simexplorer.is.entities.metadata.MetaData; + +import java.util.Collection; + +/** + * Un simple visiteur de BaseEntity. + * + * @author chemit + * @see EntityVisitor + * @see EntityVisitable + * @see BaseEntity + */ +public class SimpleEntityVisitor implements EntityVisitor { + + /** + * La méthode générique pour visiter un {@link EntityVisitable}. + * + * @param v le visité + */ + public void visit(EntityVisitable v) { + if (v != null) { + // on lance la visite + v.accept(this); + } + } + + public void visitExplorationApplication(ExplorationApplication v) { + if (v != null) { + visitComponents(v.getComponents()); + visitExplorationDatas(v.getExplorations()); + visitMetaData(v.getMetaData()); + } + } + + public void visitComponent(Component v) { + if (v != null) { + visitConstants(v.getConstants()); + visitCodes(v.getCodes()); + visitLibraries(v.getLibraries()); + visitMetaData(v.getMetaData()); + } + } + + public void visitExplorationData(ExplorationData v) { + if (v != null) { + visitConstantValues(v.getConstantValues()); + visitResult(v.getResult()); + visitMetaData(v.getMetaData()); + } + } + + public void visitLibrary(Library v) { + if (v != null) { + visitMetaData(v.getMetaData()); + } + } + + public void visitMetaData(MetaData v) { + if (v != null) { + visitAttachments(v.getAttachments()); + } + } + + public void visitExplorationDatas(Collection<ExplorationData> vs) { + visitSet(vs); + } + + public void visitComponents(Collection<Component> v) { + visitSet(v); + } + + public void visitCodes(Collection<Code> v) { + visitSet(v); + } + + public void visitConstants(Collection<Constant> vs) { + visitSet(vs); + } + + public void visitConstantValues(Collection<ConstantValue> vs) { + visitSet(vs); + } + + public void visitLibraries(Collection<Library> vs) { + visitSet(vs); + } + + public void visitStructures(Collection<Structure> vs) { + visitSet(vs); + } + + public void visitAttachments(Collection<Attachment> vs) { + visitSet(vs); + } + + public void visitCode(Code v) { + // by default, do nothing + } + + public void visitConstant(Constant v) { + // by default, do nothing + } + + public void visitConstantValue(ConstantValue v) { + // by default, do nothing + } + + public void visitResult(Result v) { + // by default, do nothing + } + + public void visitRepository(Repository v) { + // by default, do nothing + } + + public void visitStructure(Structure v) { + // by default, do nothing + } + + public void visitAttachment(Attachment v) { + // by default, do nothing + } + + /** + * Visite une collection de visitables du même type. + * + * @param vs l'ensemble de visitables visités + */ + protected void visitSet(Collection<? extends EntityVisitable> vs) { + if (vs != null) { + for (EntityVisitable visitable : vs) { + visitable.accept(this); + } + } + } +} Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Code.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Code.java 2008-02-16 15:05:24 UTC (rev 1020) +++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Code.java 2008-02-16 15:10:16 UTC (rev 1021) @@ -17,6 +17,8 @@ * ##% */ package fr.cemagref.simexplorer.is.entities.data; +import fr.cemagref.simexplorer.is.entities.EntityVisitor; + import java.io.Serializable; /** @@ -78,4 +80,8 @@ public String toString() { return getCode() + " : " + getLanguage(); } + + public void accept(EntityVisitor visitor) { + visitor.visitCode(this); + } } Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Component.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Component.java 2008-02-16 15:05:24 UTC (rev 1020) +++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Component.java 2008-02-16 15:10:16 UTC (rev 1021) @@ -17,6 +17,8 @@ * ##% */ package fr.cemagref.simexplorer.is.entities.data; +import fr.cemagref.simexplorer.is.entities.EntityVisitor; + import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -128,4 +130,7 @@ return directChildren; } + public void accept(EntityVisitor visitor) { + visitor.visitComponent(this); + } } Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Constant.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Constant.java 2008-02-16 15:05:24 UTC (rev 1020) +++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Constant.java 2008-02-16 15:10:16 UTC (rev 1021) @@ -17,11 +17,11 @@ * ##% */ package fr.cemagref.simexplorer.is.entities.data; +import fr.cemagref.simexplorer.is.entities.EntityVisitor; + import java.io.Serializable; -/** - * The Class Constant. - */ +/** The Class Constant. */ public class Constant extends DataEntity implements Serializable { /** The Constant serialVersionUID. */ @@ -35,7 +35,7 @@ /** * Gets the name. - * + * * @return the name */ public String getName() { @@ -44,9 +44,8 @@ /** * Sets the name. - * - * @param name - * the new name + * + * @param name the new name */ public void setName(String name) { this.name = name; @@ -54,7 +53,7 @@ /** * Gets the type. - * + * * @return the type */ public Class<?> getType() { @@ -63,9 +62,8 @@ /** * Sets the type. - * - * @param type - * the new type + * + * @param type the new type */ public void setType(Class<?> type) { this.type = type; @@ -78,4 +76,8 @@ public String toString() { return getName() + " : " + getType().getSimpleName(); } + + public void accept(EntityVisitor visitor) { + visitor.visitConstant(this); + } } Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ConstantValue.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ConstantValue.java 2008-02-16 15:05:24 UTC (rev 1020) +++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ConstantValue.java 2008-02-16 15:10:16 UTC (rev 1021) @@ -17,6 +17,8 @@ * ##% */ package fr.cemagref.simexplorer.is.entities.data; +import fr.cemagref.simexplorer.is.entities.EntityVisitor; + import java.io.Serializable; /** @@ -71,4 +73,8 @@ this.constant = constant; } + public void accept(EntityVisitor visitor) { + visitor.visitConstantValue(this); + } + } Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/DataEntity.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/DataEntity.java 2008-02-16 15:05:24 UTC (rev 1020) +++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/DataEntity.java 2008-02-16 15:10:16 UTC (rev 1021) @@ -22,7 +22,7 @@ /** * The Class DataEntity. */ -public abstract class DataEntity extends BaseEntity { +public abstract class DataEntity implements BaseEntity { /** The parent data. */ private DataEntity parentData; Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationApplication.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationApplication.java 2008-02-16 15:05:24 UTC (rev 1020) +++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationApplication.java 2008-02-16 15:10:16 UTC (rev 1021) @@ -17,6 +17,8 @@ * ##% */ package fr.cemagref.simexplorer.is.entities.data; +import fr.cemagref.simexplorer.is.entities.EntityVisitor; + import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -86,4 +88,7 @@ return directChildren; } + public void accept(EntityVisitor visitor) { + visitor.visitExplorationApplication(this); + } } Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationData.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationData.java 2008-02-16 15:05:24 UTC (rev 1020) +++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/ExplorationData.java 2008-02-16 15:10:16 UTC (rev 1021) @@ -17,6 +17,8 @@ * ##% */ package fr.cemagref.simexplorer.is.entities.data; +import fr.cemagref.simexplorer.is.entities.EntityVisitor; + import java.io.Serializable; import java.util.List; import java.util.Set; @@ -29,8 +31,8 @@ /** The Constant serialVersionUID. */ private static final long serialVersionUID = -6439801837608358754L; - /** The values map. */ - private Set<ConstantValue> valuesMap; + /** The values map. TODO le champs doit s'appeller constantValues */ + private Set<ConstantValue> constantValues; /** The result. */ private Result result; @@ -44,7 +46,7 @@ * @return the constant value */ private ConstantValue findConstantValue(Constant c) { - for (ConstantValue constantValue : valuesMap) { + for (ConstantValue constantValue : constantValues) { if (c.equals(constantValue.getConstant())) { return constantValue; } @@ -65,7 +67,7 @@ if (constantValue == null) { constantValue = new ConstantValue(); constantValue.setConstant(c); - valuesMap.add(constantValue); + constantValues.add(constantValue); } constantValue.setValue(value); } @@ -110,18 +112,18 @@ * * @return the values map */ - public Set<ConstantValue> getValuesMap() { - return valuesMap; + public Set<ConstantValue> getConstantValues() { + return constantValues; } /** * Sets the values map. * - * @param valuesMap + * @param constantValues * the new values map */ - public void setValuesMap(Set<ConstantValue> valuesMap) { - this.valuesMap = valuesMap; + public void setConstantValues(Set<ConstantValue> constantValues) { + this.constantValues = constantValues; } /* (non-Javadoc) @@ -132,4 +134,7 @@ return null; } + public void accept(EntityVisitor visitor) { + visitor.visitExplorationData(this); + } } Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Library.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Library.java 2008-02-16 15:05:24 UTC (rev 1020) +++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Library.java 2008-02-16 15:10:16 UTC (rev 1021) @@ -17,13 +17,12 @@ * ##% */ package fr.cemagref.simexplorer.is.entities.data; -import java.io.Serializable; +import fr.cemagref.simexplorer.is.entities.EntityVisitor; + import java.util.List; -/** - * The Class Library. - */ -public class Library extends LoggableElement implements Serializable { +/** The Class Library. */ +public class Library extends LoggableElement { /** The Constant serialVersionUID. */ private static final long serialVersionUID = -5635619075345573945L; @@ -36,4 +35,7 @@ return null; } + public void accept(EntityVisitor visitor) { + visitor.visitLibrary(this); + } } Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Repository.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Repository.java 2008-02-16 15:05:24 UTC (rev 1020) +++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Repository.java 2008-02-16 15:10:16 UTC (rev 1021) @@ -17,14 +17,19 @@ * ##% */ package fr.cemagref.simexplorer.is.entities.data; +import fr.cemagref.simexplorer.is.entities.EntityVisitor; + import java.io.Serializable; /** * The Class Repository. */ -public class Repository extends DataEntity implements Serializable { +public class Repository extends DataEntity { /** The Constant serialVersionUID. */ private static final long serialVersionUID = 1232065724338066924L; + public void accept(EntityVisitor visitor) { + visitor.visitRepository(this); + } } Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java 2008-02-16 15:05:24 UTC (rev 1020) +++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Result.java 2008-02-16 15:10:16 UTC (rev 1021) @@ -17,10 +17,12 @@ * ##% */ package fr.cemagref.simexplorer.is.entities.data; +import fr.cemagref.simexplorer.is.entities.EntityVisitor; + import java.io.Serializable; /** The Class Result. */ -public class Result extends DataEntity implements Serializable { +public class Result extends DataEntity { /** The Constant serialVersionUID. */ private static final long serialVersionUID = 2111484866027162494L; @@ -29,4 +31,8 @@ public String toString() { return "Result " + Math.abs(hashCode()); } + + public void accept(EntityVisitor visitor) { + visitor.visitResult(this); + } } Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Structure.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Structure.java 2008-02-16 15:05:24 UTC (rev 1020) +++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/data/Structure.java 2008-02-16 15:10:16 UTC (rev 1021) @@ -17,11 +17,17 @@ * ##% */ package fr.cemagref.simexplorer.is.entities.data; +import fr.cemagref.simexplorer.is.entities.EntityVisitor; + /** * The Class Structure. */ -public abstract class Structure extends DataEntity { +public class Structure extends DataEntity { /** The Constant serialVersionUID. */ private static final long serialVersionUID = 2594331198459134006L; + + public void accept(EntityVisitor visitor) { + visitor.visitStructure(this); + } } Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java 2008-02-16 15:05:24 UTC (rev 1020) +++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/entities/metadata/MetaData.java 2008-02-16 15:10:16 UTC (rev 1021) @@ -17,20 +17,18 @@ * ##% */ package fr.cemagref.simexplorer.is.entities.metadata; -import java.io.Serializable; +import fr.cemagref.simexplorer.is.entities.attachment.Attachment; +import fr.cemagref.simexplorer.is.entities.BaseEntity; +import fr.cemagref.simexplorer.is.entities.EntityVisitor; + import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; -import fr.cemagref.simexplorer.is.attachment.Attachment; -import fr.cemagref.simexplorer.is.entities.BaseEntity; +/** The Class MetaData. */ +public class MetaData implements BaseEntity { -/** - * The Class MetaData. - */ -public class MetaData extends BaseEntity implements Serializable { - /** The Constant serialVersionUID. */ private static final long serialVersionUID = -7916932464982315229L; @@ -72,7 +70,7 @@ /** * Gets the uuid. - * + * * @return the uuid */ public String getUuid() { @@ -81,9 +79,8 @@ /** * Sets the uuid. - * - * @param uuid - * the uuid to set + * + * @param uuid the uuid to set */ public void setUuid(String uuid) { this.uuid = uuid; @@ -91,7 +88,7 @@ /** * Gets the name. - * + * * @return the name */ public String getName() { @@ -100,9 +97,8 @@ /** * Sets the name. - * - * @param name - * the name to set + * + * @param name the name to set */ public void setName(String name) { this.name = name; @@ -110,7 +106,7 @@ /** * Gets the type. - * + * * @return the type */ public String getType() { @@ -119,9 +115,8 @@ /** * Sets the type. - * - * @param type - * the type to set + * + * @param type the type to set */ public void setType(String type) { this.type = type; @@ -129,7 +124,7 @@ /** * Gets the description. - * + * * @return the description */ public String getDescription() { @@ -138,9 +133,8 @@ /** * Sets the description. - * - * @param description - * the description to set + * + * @param description the description to set */ public void setDescription(String description) { this.description = description; @@ -148,7 +142,7 @@ /** * Gets the version. - * + * * @return the version */ public Version getVersion() { @@ -157,9 +151,8 @@ /** * Sets the version. - * - * @param version - * the version to set + * + * @param version the version to set */ public void setVersion(String version) { this.version = Version.valueOf(version); @@ -167,7 +160,7 @@ /** * Gets the creation date. - * + * * @return the creationDate */ public Date getCreationDate() { @@ -176,9 +169,8 @@ /** * Sets the creation date. - * - * @param creationDate - * the creationDate to set + * + * @param creationDate the creationDate to set */ public void setCreationDate(Date creationDate) { this.creationDate = creationDate; @@ -186,7 +178,7 @@ /** * Gets the hash. - * + * * @return the hash */ public String getHash() { @@ -195,9 +187,8 @@ /** * Sets the hash. - * - * @param hash - * the hash to set + * + * @param hash the hash to set */ public void setHash(String hash) { this.hash = hash; @@ -205,7 +196,7 @@ /** * Gets the descriptors. - * + * * @return the descriptors */ public Map<String, String> getDescriptors() { @@ -214,9 +205,8 @@ /** * Sets the descriptors. - * - * @param descriptors - * the descriptors to set + * + * @param descriptors the descriptors to set */ public void setDescriptors(Map<String, String> descriptors) { this.descriptors = descriptors; @@ -224,7 +214,7 @@ /** * Gets the attachments. - * + * * @return the attachments */ public List<Attachment> getAttachments() { @@ -236,11 +226,12 @@ /** * Get attachment by his index + * * @param attachmentIndex index of attachment to find * @return the correct attachment */ public Attachment getAttachment(Integer attachmentIndex) { - if (attachmentIndex!=null && attachmentIndex>-1 && attachments != null && !attachments.isEmpty() && attachments.size()>attachmentIndex) { + if (attachmentIndex != null && attachmentIndex > -1 && attachments != null && !attachments.isEmpty() && attachments.size() > attachmentIndex) { return attachments.get(attachmentIndex); } return null; @@ -248,6 +239,7 @@ /** * Get attachment by his uniqueId + * * @param attachmentUniqueId unqiue id of attachment to find * @return the correct attachment */ @@ -264,9 +256,8 @@ /** * Sets the attachments. - * - * @param attachments - * the attachments to set + * + * @param attachments the attachments to set */ public void setAttachments(List<Attachment> attachments) { this.attachments = attachments; @@ -274,7 +265,7 @@ /** * Gets the parent version uuid. - * + * * @return the parentVersionUuid */ public String getParentVersionUuid() { @@ -283,9 +274,8 @@ /** * Sets the parent version uuid. - * - * @param parentVersionUuid - * the parentVersionUuid to set + * + * @param parentVersionUuid the parentVersionUuid to set */ public void setParentVersionUuid(String parentVersionUuid) { this.parentVersionUuid = parentVersionUuid; @@ -293,7 +283,7 @@ /** * Gets the parent version version. - * + * * @return the parentVersionVersion */ public String getParentVersionVersion() { @@ -302,9 +292,8 @@ /** * Sets the parent version version. - * - * @param parentVersionVersion - * the parentVersionVersion to set + * + * @param parentVersionVersion the parentVersionVersion to set */ public void setParentVersionVersion(String parentVersionVersion) { this.parentVersionVersion = parentVersionVersion; @@ -312,7 +301,7 @@ /** * Checks if is latest. - * + * * @return true, if is latest */ public boolean isLatest() { @@ -321,12 +310,14 @@ /** * Sets the latest. - * - * @param latest - * the new latest + * + * @param latest the new latest */ public void setLatest(boolean latest) { this.latest = latest; } + public void accept(EntityVisitor visitor) { + visitor.visitMetaData(this); + } } Modified: trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ExplorationDataFactory.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ExplorationDataFactory.java 2008-02-16 15:05:24 UTC (rev 1020) +++ trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/factories/ExplorationDataFactory.java 2008-02-16 15:10:16 UTC (rev 1021) @@ -49,7 +49,7 @@ .loadElement( getXMLElementByTagName(xmlElement, KEY_EXPLORATIONDATA_RESULT))); - explorationData.setValuesMap(loadCollection(KEY_EXPLORATIONDATA_VALUES, + explorationData.setConstantValues(loadCollection(KEY_EXPLORATIONDATA_VALUES, KEY_EXPLORATIONDATA_VALUE, ConstantValue.class, xmlElement, explorationData)); return explorationData; @@ -68,7 +68,7 @@ element.getResult()); xmlElement.appendChild(xmlResult); - saveCollection(element.getValuesMap(), KEY_EXPLORATIONDATA_VALUES, + saveCollection(element.getConstantValues(), KEY_EXPLORATIONDATA_VALUES, KEY_EXPLORATIONDATA_VALUE, ConstantValue.class, document, xmlElement); Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDetail.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDetail.java 2008-02-16 15:05:24 UTC (rev 1020) +++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDetail.java 2008-02-16 15:10:16 UTC (rev 1021) @@ -210,7 +210,7 @@ * @return the list< tree node> */ private List<TreeNode> generateValues(ExplorationData explorationData) { - Set<ConstantValue> values = explorationData.getValuesMap(); + Set<ConstantValue> values = explorationData.getConstantValues(); List<TreeNode> res = new ArrayList<TreeNode>(); for (ConstantValue value : values) { TreeNode node = new TreeNode();
participants (1)
-
tchemit@users.labs.libre-entreprise.org