Index: topia/src/java/org/codelutin/topia/TopiaContext.java diff -u topia/src/java/org/codelutin/topia/TopiaContext.java:1.56 topia/src/java/org/codelutin/topia/TopiaContext.java:1.57 --- topia/src/java/org/codelutin/topia/TopiaContext.java:1.56 Thu Dec 8 12:51:52 2005 +++ topia/src/java/org/codelutin/topia/TopiaContext.java Thu Dec 8 16:48:46 2005 @@ -23,15 +23,18 @@ * * @author Benjamin Poussin * Copyright Code Lutin -* @version $Revision: 1.56 $ +* @version $Revision: 1.57 $ * -* Mise a jour: $Date: 2005/12/08 12:51:52 $ +* Mise a jour: $Date: 2005/12/08 16:48:46 $ * par : $Author: thimel $ */ package org.codelutin.topia; +import java.io.BufferedWriter; import java.io.Reader; +import java.io.StringReader; +import java.io.StringWriter; import java.io.Writer; import java.lang.reflect.Method; import java.util.HashMap; @@ -612,7 +615,9 @@ /** * Vérifie l'existence des implantations de toutes les operations pour - * l'entite specifiee + * l'entite specifiee. Cette méthode n'a plus vraiment lieu d'être puisque + * les méthodes des interfaces sont maintenant intégrées aux interfaces + * Operation * @return true si chaque implantation a ete trouvee */ public boolean checkOperationExistenceClass(Class clazz) { @@ -628,26 +633,29 @@ operationsClass = (Class)Util.getClazz(interfacez.getName() + "Impl"); } } catch (TopiaException te) { - if (log.isTraceEnabled()) { + if (log.isInfoEnabled()) { log.info("Pas d'implantation d'operation trouvee pour l'entite \"" + clazz.getName() + "\""); } return false; } boolean allCorrect = true; - for (Method method : clazz.getMethods()) { - if (MethodInfoHelper.type(method) == MethodType.OPERATION) { + Method[] methodArray = clazz.getMethods(); + for (Class interfacezz : clazz.getInterfaces()) { + methodArray = (Method[])ArrayUtil.concat(methodArray, interfacezz.getMethods()); + } + for (Method method : methodArray) { + boolean isFromElement = TopiaElement.class.isAssignableFrom(method.getDeclaringClass()); + //Si c'est une entité, on vérifie que la méthode est un accès aux opérations + if ((isFromElement && MethodInfoHelper.type(method) == MethodType.OPERATION) || (!isFromElement)) { Class[] args = (Class[])ArrayUtil.concat(new Class[] {clazz}, method.getParameterTypes()); Method operationMethod = MethodUtils.getAccessibleMethod( operationsClass, method.getName(), args); if (operationMethod == null) { - if (log.isTraceEnabled()) { - String methodArgs = ""; - for (Class argType : args) { - methodArgs += argType.getName() + ", "; - } - log.info("La methode \"" + method.getName() + "(" + methodArgs.substring(0, methodArgs.length() - 2) + ")\" n'a pas ete trouve sur la classe \"" + operationsClass.getName() + "\""); + if (log.isInfoEnabled()) { + String methodArgs = org.codelutin.topia.generators.Util.getMethodParameterList(args, false); + log.info("La methode \"" + method.getName() + "(" + methodArgs + ")\" n'a pas ete trouve sur la classe \"" + operationsClass.getName() + "\""); } } allCorrect &= (operationMethod != null); @@ -697,4 +705,16 @@ */ public abstract void exportToXMLAll(Writer out) throws TopiaException; + /** + * Effectue une copie d'un Context à l'autre + * @param otherContext le context source + * @param handler le gestionnaire d'erreurs associé + */ + public void copyFromContext(TopiaContext otherContext, ErrorHandler handler) throws TopiaException { + StringWriter from = new StringWriter(); + otherContext.exportToXMLAll(from); + StringReader incomming = new StringReader(from.getBuffer().toString()); + importFromXML(incomming, handler); + } + } // TopiaContext