Index: topia-service/src/java/org/codelutin/topia/migration/common/ExceptionAttributeUndefined.java diff -u /dev/null topia-service/src/java/org/codelutin/topia/migration/common/ExceptionAttributeUndefined.java:1.1 --- /dev/null Mon Apr 2 14:24:42 2007 +++ topia-service/src/java/org/codelutin/topia/migration/common/ExceptionAttributeUndefined.java Mon Apr 2 14:24:37 2007 @@ -0,0 +1,72 @@ +/* *##% + * Copyright (C) 2007 Code Lutin + * + * 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 org.codelutin.topia.migration.common; + +/** + * ExceptionAttributeUndefined.java + * + * Lancee si le developpeur tente d'acceder a des attribut non existant. + * + * @author Chatellier Eric + * @author Chevallereau Benjamin + * @author Eon Sébastien + * @author Trève Vincent + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2007/04/02 14:24:37 $ + */ +public class ExceptionAttributeUndefined extends Exception { + + /** + * Version UID + */ + private static final long serialVersionUID = 1L; + + /** + * Constructeur par defaut + */ + public ExceptionAttributeUndefined() { + super(); + } + + /** + * Constructeur avec message + * @param message + */ + public ExceptionAttributeUndefined(String message) { + super(message); + } + + /** + * Constructeur avec exception + * @param cause + */ + public ExceptionAttributeUndefined(Throwable cause) { + super(cause); + } + + /** + * Constructeur avec message et exception + * @param message + * @param cause + */ + public ExceptionAttributeUndefined(String message, Throwable cause) { + super(message, cause); + } +} Index: topia-service/src/java/org/codelutin/topia/migration/common/ProxyClass.java diff -u /dev/null topia-service/src/java/org/codelutin/topia/migration/common/ProxyClass.java:1.1 --- /dev/null Mon Apr 2 14:24:42 2007 +++ topia-service/src/java/org/codelutin/topia/migration/common/ProxyClass.java Mon Apr 2 14:24:37 2007 @@ -0,0 +1,49 @@ +/* *##% + * Copyright (C) 2007 Code Lutin + * + * 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 org.codelutin.topia.migration.common; + +/** + * ProxyClass.java + * + * Represente un nom long de classe. + * + * @author Chatellier Eric + * @author Chevallereau Benjamin + * @author Eon Sébastien + * @author Trève Vincent + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2007/04/02 14:24:37 $ + */ +public interface ProxyClass { + + /** + * Nom long de la classe. + * + * Exemple "domaine.Produit" + * + * @return le nom canonique + */ + public String getCanonicalName(); + + /** + * Redefinition de la methode clone + */ + public ProxyClass clone(); +} Index: topia-service/src/java/org/codelutin/topia/migration/common/MapAdapter.java diff -u /dev/null topia-service/src/java/org/codelutin/topia/migration/common/MapAdapter.java:1.1 --- /dev/null Mon Apr 2 14:24:42 2007 +++ topia-service/src/java/org/codelutin/topia/migration/common/MapAdapter.java Mon Apr 2 14:24:37 2007 @@ -0,0 +1,115 @@ +/* *##% + * Copyright (C) 2007 Code Lutin + * + * 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 org.codelutin.topia.migration.common; + +import java.io.Serializable; +import java.util.Map; + +/** + * MapAdapter.java + * + * Interface developpeur, contenant juste les methode qui lui sont nécessaires. + * + * @author Chatellier Eric + * @author Chevallereau Benjamin + * @author Eon Sébastien + * @author Trève Vincent + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2007/04/02 14:24:37 $ + */ +public interface MapAdapter { + + /** + * Accesseur permettant de récupérer les valeurs de l'objet entrant. + * + * @param key + * Clé du champ + * @return Valeur du champ + */ + public Serializable getOldValue(String key) throws ExceptionAttributeUndefined; + + /** + * Accesseur permettant de récupérer les valeurs de l'objet sortant. + * + * @param key + * Clé du champ + * @return Valeur du champ + * @throws ExceptionAttributeUndefined + */ + public Serializable getValue(String key) throws ExceptionAttributeUndefined; + + /** + * Modificateur permettant de définir la valeur d'un attribut de l'objet + * sortant. + * + * @param nameAtt + * Nom de l'attribut + * @param valueAtt + * Valeur de l'attribut + * @throws ExceptionAttributeUndefined + */ + public void setValue(String nameAtt, Serializable valueAtt); + + /** + * Recopie un attribut + * @param nameAtt le nom de l'attribut + */ + public void copy(String nameAtt); + + /** + * Recopie tous les attributs. + */ + public void copyAll(); + + /** + * Suppression d'un attribut de la map de sortie. + * @param nameAtt Nom de l'attribut. + * @throws ExceptionAttributeUndefined + */ + public void delete(String nameAtt) throws ExceptionAttributeUndefined; + + /** + * Suppression de tous les attributs de la map de sortie. + */ + public void deleteAll(); + + /** + * Fonction qui permet de récupérer une Map afin de la sauvegarder + * directement en base. + * + * @return La map complète. + */ + public Map getOuterMap(); + + /** + * Fonction qui permet de récupérer une Map contenant toutes les + * informations de l'objet en entrée. + * + * @return La map complète. + */ + public Map getInnerMap(); + + /** + * Retourne l'identifiant de l'objet. + * @return l'identifiant. + */ + public Serializable getIdInner(); + +} Index: topia-service/src/java/org/codelutin/topia/migration/common/Version.java diff -u /dev/null topia-service/src/java/org/codelutin/topia/migration/common/Version.java:1.1 --- /dev/null Mon Apr 2 14:24:42 2007 +++ topia-service/src/java/org/codelutin/topia/migration/common/Version.java Mon Apr 2 14:24:37 2007 @@ -0,0 +1,135 @@ +/* *##% + * Copyright (C) 2007 Code Lutin + * + * 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 org.codelutin.topia.migration.common; + +import java.util.StringTokenizer; + +/** + * Version.java + * + * Les version, de la forme "x.x.x". + * Permet les comparaisons. + * + * @author Chatellier Eric + * @author Chevallereau Benjamin + * @author Eon Sébastien + * @author Trève Vincent + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2007/04/02 14:24:37 $ + */ +public class Version implements Comparable { + + /** + * La version + */ + private String value; + + /** + * Version V0 + */ + public static final Version VZERO = new Version("0"); + + /** + * Constructeur vide + */ + public Version() { + this.value = new String(); + } + + /** + * Constructeur avec version + * @param value + */ + public Version(String value){ + this.value = value; + } + + + + @Override + public boolean equals(Object obj) { + if (obj instanceof Version) + return this.compareTo((Version) obj) == 0; + return false; + } + + /** + * implementation de l'interface Comparable + */ + public int compareTo(Version other) { + StringTokenizer tokOther = new StringTokenizer(other.getVersion(),"."); + StringTokenizer tokThis = new StringTokenizer(this.getVersion(),"."); + + // resultat + boolean find = false; + + int result = 0; + while (!find) { + int otherPart = 0; + int thisPart = 0; + if(tokOther.hasMoreTokens()){ + otherPart =Integer.parseInt(tokOther.nextToken()); + } + if(tokThis.hasMoreTokens()){ + thisPart = Integer.parseInt(tokThis.nextToken()); + } + result = thisPart- otherPart; + + find =result!=0 || !(tokOther.hasMoreTokens() || tokThis.hasMoreElements()); + } + + return result; + } + + + public String toString(){ + return "V" + value; + } + + /** + * @return value of the version + */ + public String getVersion() { + return value; + } + + /** + * + * @param value the value to set + */ + public void setVersion(String value) { + this.value = value; + } + + /** + * Convertit les versions pour etre valides : + * - en java : "." interdit + * - en mysql, h2 ... : "." interdit + * @return la valeur ou les carateres interdits sont remplacer par '_' + */ + public String getValidName() { + String validName = value; + + // replace "." + validName = validName.replaceAll("\\.", "_"); + + return validName; + } +} Index: topia-service/src/java/org/codelutin/topia/migration/common/SimpleProxyClass.java diff -u /dev/null topia-service/src/java/org/codelutin/topia/migration/common/SimpleProxyClass.java:1.1 --- /dev/null Mon Apr 2 14:24:45 2007 +++ topia-service/src/java/org/codelutin/topia/migration/common/SimpleProxyClass.java Mon Apr 2 14:24:37 2007 @@ -0,0 +1,87 @@ +/* *##% + * Copyright (C) 2007 Code Lutin + * + * 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 org.codelutin.topia.migration.common; + +import java.util.StringTokenizer; + +/** + * SimpleProxyClass.java + * + * @author Chatellier Eric + * @author Chevallereau Benjamin + * @author Eon Sébastien + * @author Trève Vincent + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2007/04/02 14:24:37 $ + */ +public class SimpleProxyClass implements ProxyClass { + + /** + * le nom long (avec package) + */ + private String canonicalName; + + /** + * le nom cours + */ + private String name; + + /** + * Contructeur avec nom long + * @param canonicalName le nom avec package + */ + public SimpleProxyClass(String canonicalName) { + super(); + this.canonicalName = canonicalName; + StringTokenizer tokenizer = new StringTokenizer(canonicalName,"."); + this.name=null; + while(tokenizer.hasMoreTokens()){ + this.name = tokenizer.nextToken(); + } + } + + public String getCanonicalName() { + return canonicalName; + } + + public String getShortClassName() { + return this.name; + } + + public int hashCode(){ + return this.canonicalName.hashCode(); + } + + public ProxyClass clone(){ + return new SimpleProxyClass(this.canonicalName); + } + + public boolean equals(Object other) { + if (other instanceof ProxyClass) { + ProxyClass o = (ProxyClass) other; + return o.getCanonicalName().equals(this.canonicalName); + } + return false; + } + + public String toString(){ + return "["+this.canonicalName+"]"; + } +} Index: topia-service/src/java/org/codelutin/topia/migration/common/MapAdapterImpl.java diff -u /dev/null topia-service/src/java/org/codelutin/topia/migration/common/MapAdapterImpl.java:1.1 --- /dev/null Mon Apr 2 14:24:45 2007 +++ topia-service/src/java/org/codelutin/topia/migration/common/MapAdapterImpl.java Mon Apr 2 14:24:37 2007 @@ -0,0 +1,404 @@ +/* *##% + * Copyright (C) 2007 Code Lutin + * + * 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 org.codelutin.topia.migration.common; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * MapAdapterImpl.java + * + * Implementation des MapAdapter. + * + * @author Chatellier Eric + * @author Chevallereau Benjamin + * @author Eon Sébastien + * @author Trève Vincent + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2007/04/02 14:24:37 $ + */ +public class MapAdapterImpl implements MapAdapter, MapAdapterAdmin { + + /** + * Map contenant les informations de l'objet entrant. + */ + private Map InnerMap; + + /** + * Map contenant les informations de l'objet sortant. + */ + private Map OuterMap; + + /** + * Identifiant de l'objet entrant. + */ + private Serializable idInner; + + /** + * Nom de l'attribut de l'identifiant + */ + private String nameAttId; + + /** + * Nom de la classe de l'objet entrant. + */ + private ProxyClass InnerClass; + + /** + * Nom de la classe de l'objet sortant. + */ + private ProxyClass OuterClass; + + /** + * Version entrante + */ + private Version InnerVersion; + + /** + * Version sortante + */ + private Version OuterVersion; + + /** + * Logger (common-logging) + */ + // private static Log logger = + // LogFactory.getLog(ConfigurationAdapter.class); + /** + * Constructeur vide. + */ + public MapAdapterImpl() { + InnerMap = new HashMap(); + OuterMap = new HashMap(); + } + + /** + * Constructeur qui permet d'initialiser complètement l'objet. + */ + public MapAdapterImpl(Map _inner, + ProxyClass nameInnerClass, String _nameAttId, Serializable _idInner) { + InnerMap = new HashMap(_inner); + + Set removeKey = new TreeSet(); + + Set s = InnerMap.keySet(); + for (String key : s) { + Pattern pattern = Pattern.compile("\\$.*\\$"); + Matcher matcher = pattern.matcher(key); + if (matcher.find()) { + removeKey.add(key); + } + } + + for (String key : removeKey) { + InnerMap.remove(key); + } + + OuterMap = new HashMap(); + InnerClass = nameInnerClass; + idInner = _idInner; + nameAttId = _nameAttId; + + InnerMap.remove(nameAttId); + } + + /** + * Modificateur qui permet d'initialiser l'entrée de l'objet. + */ + public void setInner(ProxyClass nameClass, String _nameAttId, + Serializable _idInner, Map _inner) { + InnerMap = _inner; + InnerClass = nameClass; + idInner = _idInner; + nameAttId = _nameAttId; + InnerMap.remove(nameAttId); + } + + /** + * Modificateur qui permet d'initialiser l'entrée de l'objet en supposant + * que l'objet entrant est de la même classe que celui sortant. + */ + public void setInner(String _nameAttId, Serializable _idInner, + Map _inner) { + InnerMap = _inner; + idInner = _idInner; + nameAttId = _nameAttId; + InnerMap.remove(nameAttId); + } + + /** + * Accesseur permettant de récupérer les valeurs de l'objet entrant. + * + * @param key + * Clé du champ + * @return Valeur du champ + * @throws ExceptionAttributeUndefined + */ + public Serializable getOldValue(String key) + throws ExceptionAttributeUndefined { + if (InnerMap.containsKey(key)) { + return (Serializable) InnerMap.get(key); + } else { + throw new ExceptionAttributeUndefined(); + } + } + + /** + * Accesseur permettant de récupérer les valeurs de l'objet sortant. + * + * @param key + * Clé du champ + * @return Valeur du champ + * @throws ExceptionAttributeUndefined + */ + public Serializable getValue(String key) throws ExceptionAttributeUndefined { + try { + return (Serializable) OuterMap.get(key); + } catch (Exception e) { + throw new ExceptionAttributeUndefined(); + } + } + + /** + * Modificateur permettant de définir la valeur d'un attribut de l'objet + * sortant. + * + * @param nameAtt + * Nom de l'attribut + * @param valueAtt + * Valeur de l'attribut + * @throws ExceptionAttributeUndefined + */ + public void setValue(String nameAtt, Serializable valueAtt) { + if (OuterMap == null) { + OuterMap = new HashMap(); + } + OuterMap.put(nameAtt, valueAtt); + } + + /** + * Fonction qui permet de récupérer une Map afin de la sauvegarder + * directement en base. + * + * @return La map complète. + */ + public Map getOuterMap() { + Map m = new HashMap(OuterMap); + m.put(nameAttId, idInner); + if (OuterClass != null) { + m.put("$type$", OuterClass.getCanonicalName()); + } + return m; + } + + /** + * Fonction qui permet de récupérer une Map contenant toutes les + * informations de l'objet en entrée. + * + * @return La map complète. + */ + public Map getInnerMap() { + Map m = new HashMap(InnerMap); + m.put(nameAttId, idInner); + if (InnerClass != null) { + m.put("$type$", InnerClass.getCanonicalName()); + } + return m; + } + + /** + * Retourne le nom de la classe persistante d'entrée. + * + * @return le nom de la classe. + */ + public ProxyClass getInnerClass() { + return InnerClass; + } + + /** + * Retourne le nom de la classe persistante de sortie. + * + * @return le nom de la classe. + */ + public ProxyClass getOuterClass() { + return OuterClass; + } + + /** + * Retourne la version en entrée. + * + * @return la version en entrée. + */ + public Version getInnerVersion() { + return InnerVersion; + } + + /** + * Modificateur de la version entrante. + * + * @param innerVersion + * la version entrante. + */ + public void setInnerVersion(Version innerVersion) { + InnerVersion = innerVersion; + } + + /** + * Retourne la version en sortie. + * + * @return la version en sortie. + */ + public Version getOuterVersion() { + return OuterVersion; + } + + /** + * Modificateur de la version sortante. + * + * @param outerVersion + * la version sortante. + */ + public void setOuterVersion(Version outerVersion) { + OuterVersion = outerVersion; + } + + /** + * Méthode pour basculer la version sortante sur la version entrante. + */ + public void switchVersion() { + InnerVersion = OuterVersion; + InnerMap.clear(); + InnerMap.putAll(OuterMap); + InnerClass = OuterClass.clone(); + + OuterVersion = null; + OuterMap.clear(); + OuterClass = null; + } + + /** + * Calcul le code de hashage. + * + * @return le hash code. + */ + public int hashCode() { + return this.idInner.hashCode(); + } + + /** + * Comparaison de maps. + * + * @param obj + * un autre objet. + * @return l'égalité des deux objets. + */ + public boolean equals(Object obj) { + if (obj instanceof MapAdapter) { + MapAdapter other = (MapAdapter) obj; + return (this.idInner.equals(other)); + } + return false; + } + + /** + * Retourne l'identifiant de l'objet. + * + * @return l'identifiant. + */ + public Serializable getIdInner() { + return idInner; + } + + /** + * Recopie un attribut + * + * @param nameAtt + * le nom de l'attribut + */ + public void copy(String nameAtt) { + if (InnerMap.containsKey(nameAtt)) { + OuterMap.put(nameAtt, InnerMap.get(nameAtt)); + } else { + OuterMap.put(nameAtt, null); + } + } + + /** + * Recopie tous les attributs. + */ + public void copyAll() { + Set s = InnerMap.keySet(); + for (Iterator iter = s.iterator(); iter.hasNext();) { + String element = (String) iter.next(); + OuterMap.put(element, InnerMap.get(element)); + } + } + + /** + * Suppression d'un attribut de la map de sortie. + * + * @param nameAtt + * Nom de l'attribut. + * @throws ExceptionAttributeUndefined + */ + public void delete(String nameAtt) throws ExceptionAttributeUndefined { + if (OuterMap.containsKey(nameAtt)) { + OuterMap.remove(nameAtt); + } else { + throw new ExceptionAttributeUndefined(); + } + } + + /** + * Suppression de tous les attributs de la map de sortie. + */ + public void deleteAll() { + OuterMap.clear(); + } + + /** + * Modificateur de la classe sortante. + * + * @param outerClass + * La classe de sortie. + */ + public void setOuterClass(ProxyClass outerClass) { + OuterClass = outerClass; + } + + /** + * toString() + */ + public String toString() { + return "Inner => " + this.InnerClass + ":" + this.InnerMap.toString() + + "\n" + "Outer => " + this.OuterClass + ":" + + this.OuterMap.toString(); + } + + public void setOldValue(String nameAttribut, Serializable value) { + InnerMap.put(nameAttribut, value); + } +} Index: topia-service/src/java/org/codelutin/topia/migration/common/MapAdapterAdmin.java diff -u /dev/null topia-service/src/java/org/codelutin/topia/migration/common/MapAdapterAdmin.java:1.1 --- /dev/null Mon Apr 2 14:24:45 2007 +++ topia-service/src/java/org/codelutin/topia/migration/common/MapAdapterAdmin.java Mon Apr 2 14:24:37 2007 @@ -0,0 +1,113 @@ +/* *##% + * Copyright (C) 2007 Code Lutin + * + * 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 org.codelutin.topia.migration.common; + +import java.io.Serializable; +import java.util.Map; + +/** + * MapAdapterAdmin.java + * + * Interface interne, contenant plus de méthode que celle du developpeur. + * + * @author Chatellier Eric + * @author Chevallereau Benjamin + * @author Eon Sébastien + * @author Trève Vincent + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2007/04/02 14:24:37 $ + */ +public interface MapAdapterAdmin extends MapAdapter { + + /** + * Modificateur qui permet d'initialiser l'entrée de l'objet. + * + * @param nameClass Nom de la classe entrante + * @param _idInner la valeur de l'id + * @param _inner la map en entree + * @param nameAttId le nom de l'attribut etant l'identifiant + */ + public void setInner(ProxyClass nameClass, String nameAttId, Serializable _idInner, Map _inner); + + /** + * Modificateur qui permet d'initialiser l'entrée de l'objet en supposant + * que l'objet entrant est de la même classe que celui sortant. + * + * @param _idInner Identifiant de l'objet entrant + * @param _inner la map d'entree + * @param nameAttId le nom de l'attribut etant l'identifiant + */ + public void setInner(String nameAttId, Serializable _idInner, Map _inner); + + /** + * Retourne le nom de la classe persistante d'entrée. + * @return le nom de la classe. + */ + public ProxyClass getInnerClass(); + + /** + * Retourne le nom de la classe persistante de sortie. + * @return le nom de la classe. + */ + public ProxyClass getOuterClass(); + + /** + * Retourne la version en entrée. + * @return la version en entrée. + */ + public Version getInnerVersion(); + + /** + * Modificateur de la version entrante. + * @param innerVersion la version entrante. + */ + public void setInnerVersion(Version innerVersion); + + /** + * Retourne la version en sortie. + * @return la version en sortie. + */ + public Version getOuterVersion(); + + /** + * Modificateur de la version sortante. + * @param outerVersion la version sortante. + */ + public void setOuterVersion(Version outerVersion); + + /** + * Méthode pour basculer la version sortante sur la version entrante. + */ + public void switchVersion(); + + /** + * Modificateur de la classe sortante. + * @param outerClass La classe de sortie. + */ + public void setOuterClass(ProxyClass outerClass); + + /** + * Modificateur d'un parametre de la mode en entrée. + * + * @param nameAttribut + * @param value + */ + public void setOldValue(String nameAttribut, Serializable value); +} Index: topia-service/src/java/org/codelutin/topia/migration/common/SimpleProxyClassMapped.java diff -u /dev/null topia-service/src/java/org/codelutin/topia/migration/common/SimpleProxyClassMapped.java:1.1 --- /dev/null Mon Apr 2 14:24:45 2007 +++ topia-service/src/java/org/codelutin/topia/migration/common/SimpleProxyClassMapped.java Mon Apr 2 14:24:37 2007 @@ -0,0 +1,107 @@ +/* *##% + * Copyright (C) 2007 Code Lutin + * + * 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 org.codelutin.topia.migration.common; + +import java.io.Serializable; + +import org.codelutin.topia.migration.transformation.Migration; + +/** +* SimpleProxyClassMapped.java +* +* @author Chatellier Eric +* @author Chevallereau Benjamin +* @author Eon Sébastien +* @author Trève Vincent +* @version $Revision: 1.1 $ +* +* Last update : $Date: 2007/04/02 14:24:37 $ +*/ +public class SimpleProxyClassMapped implements ProxyClassMapped { + + private ProxyClass pc; + + private Serializable nameIdAttribute; + + private Migration m; + + /** + * @param pc + * @param nameIdAttribute + */ + public SimpleProxyClassMapped(ProxyClass pc, Serializable nameIdAttribute) { + super(); + this.pc = pc; + this.nameIdAttribute = nameIdAttribute; + } + + public SimpleProxyClassMapped(ProxyClass pc, Serializable nameIdAttribute, Migration migration) { + super(); + this.pc = pc; + this.nameIdAttribute = nameIdAttribute; + this.m = migration; + } + + + + public SimpleProxyClassMapped(ProxyClass class1) { + super(); + this.pc = class1; + } + + /* (non-Javadoc) + * @see org.codelutin.topia.migration.common.ProxyClassMapped#getIdAttribute() + */ + public Serializable getIdAttribute() { + return nameIdAttribute; + } + + /* (non-Javadoc) + * @see org.codelutin.topia.migration.common.ProxyClassMapped#getProxyClass() + */ + public ProxyClass getProxyClass() { + return pc; + } + + /** + * @param nameIdAttribute the nameIdAttribute to set + */ + public void setNameIdAttribute(Serializable nameIdAttribute) { + this.nameIdAttribute = nameIdAttribute; + } + + public int hashCode(){ + return this.pc.getCanonicalName().hashCode(); + } + + public boolean equals(Object other){ + if (other instanceof ProxyClassMapped) { + ProxyClassMapped o = (ProxyClassMapped) other; + return o.getProxyClass().equals(this.pc); + } + return false; + } + + public String toString() { + return pc+"["+nameIdAttribute+"]"; + } + + public Migration getMigrationClass() { + return m; + } +} Index: topia-service/src/java/org/codelutin/topia/migration/common/ProxyClassMapped.java diff -u /dev/null topia-service/src/java/org/codelutin/topia/migration/common/ProxyClassMapped.java:1.1 --- /dev/null Mon Apr 2 14:24:46 2007 +++ topia-service/src/java/org/codelutin/topia/migration/common/ProxyClassMapped.java Mon Apr 2 14:24:37 2007 @@ -0,0 +1,58 @@ +/* *##% + * Copyright (C) 2007 Code Lutin + * + * 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 org.codelutin.topia.migration.common; + +import java.io.Serializable; + +import org.codelutin.topia.migration.transformation.Migration; + +/** + * ProxyClassMapped.java + * + * Un proxy class, et le nom de son attribut identifiant + * + * @author Chatellier Eric + * @author Chevallereau Benjamin + * @author Eon Sébastien + * @author Trève Vincent + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2007/04/02 14:24:37 $ + */ +public interface ProxyClassMapped { + + /** + * La proxy class + * @return la proxy class + * @see ProxyClass + */ + public ProxyClass getProxyClass(); + + /** + * Le nom de l'attribut + * @return le nom de l'attribut identifiant + */ + public Serializable getIdAttribute(); + + /** + * La classe de migration + * @return la classe de migration + */ + public Migration getMigrationClass(); +}