- Timestamp:
- 10/07/12 13:48:17 (9 years ago)
- Location:
- mauRepo/xmi2sqlalchemy/trunk/src/main
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
mauRepo/xmi2sqlalchemy/trunk/src/main/java/ndg/services/newmoon/NmParser.java
r8393 r8455 34 34 35 35 import org.apache.commons.collections.CollectionUtils; 36 import org.apache.commons.collections.SetUtils;37 36 import org.apache.commons.io.IOUtils; 38 37 import org.apache.commons.lang.StringUtils; -
mauRepo/xmi2sqlalchemy/trunk/src/main/java/ndg/services/newmoon/NmParserHelper.java
r8393 r8455 36 36 import java.util.Arrays; 37 37 import java.util.HashSet; 38 import java.util.List;39 38 import java.util.Set; 39 import ndg.services.newmoon.xmiModel.UMLModel; 40 40 41 import ndg.services.newmoon.xmiModel.UMLAssociation;42 import ndg.services.newmoon.xmiModel.UMLGeneralization;43 import ndg.services.newmoon.xmiModel.UMLModel;44 import ndg.services.newmoon.xmiModel.UML_Element;45 import ndg.services.newmoon.xmiModel.UML_ID;46 41 47 42 import org.apache.commons.io.IOUtils; -
mauRepo/xmi2sqlalchemy/trunk/src/main/java/ndg/services/newmoon/UmlToRDBM.java
r8393 r8455 35 35 36 36 import java.io.File; 37 import java.io.FileNotFoundException;38 37 import java.io.IOException; 39 38 import java.io.InputStream; 40 import java.util.Collection;41 39 import java.util.HashMap; 42 40 import java.util.HashSet; … … 47 45 import java.util.concurrent.Future; 48 46 49 import ndg.services.newmoon.NewmoonManager.NM_PARAM;50 47 import ndg.services.newmoon.collect.AttributeModel; 51 48 import ndg.services.newmoon.collect.ClassModel; … … 56 53 import ndg.services.newmoon.velocity.python.GenerateFromClassModel; 57 54 import ndg.services.newmoon.velocity.python.GenerateTables; 58 import ndg.services.newmoon.xmiModel.UMLClass;59 55 import ndg.services.newmoon.xmiModel.UMLModel; 60 56 61 import org.apache.commons.collections.CollectionUtils;62 57 import org.apache.commons.collections.ListUtils; 63 import org.apache.commons.io.FileUtils;64 58 import org.apache.commons.io.IOUtils; 65 59 import org.apache.commons.lang.StringUtils; … … 171 165 } 172 166 167 @SuppressWarnings("unchecked") 173 168 private void substitutesSuperAttributes(List<ClassModel> cms) { 174 169 //creates a map between parents and childrens (classes and their subclasses) -
mauRepo/xmi2sqlalchemy/trunk/src/main/java/ndg/services/newmoon/velocity/python/GenerateTables.java
r8243 r8455 41 41 import java.util.Set; 42 42 43 import ndg.services.newmoon.MaxDepthException;44 import ndg.services.newmoon.NewmoonException;45 43 import ndg.services.newmoon.UMLElementsArchive; 46 44 import ndg.services.newmoon.collect.AttributeModel; … … 55 53 56 54 import org.apache.commons.collections.CollectionUtils; 57 import org.apache.commons.collections.SetUtils;58 55 import org.apache.commons.lang.text.StrBuilder; 59 56 import org.apache.velocity.context.Context; -
mauRepo/xmi2sqlalchemy/trunk/src/main/java/ndg/services/newmoon/velocity/python/NmVelocity.java
r8393 r8455 34 34 35 35 import org.apache.velocity.Template; 36 import org.apache.velocity.VelocityContext;37 36 import org.apache.velocity.app.VelocityEngine; 38 37 import org.apache.velocity.context.Context; -
mauRepo/xmi2sqlalchemy/trunk/src/main/java/ndg/services/newmoon/velocity/python/NmVelocityHelper.java
r8393 r8455 47 47 48 48 import org.apache.commons.collections.CollectionUtils; 49 import org.apache.commons.collections.ListUtils;50 import org.apache.commons.collections.SetUtils;51 49 import org.apache.commons.lang.StringUtils; 52 50 … … 165 163 return ret; 166 164 } 167 168 // /**169 // * Returns an array containg on the first element the name of the module from170 // * where import and on the second the name of which class import. This methods171 // * takes care to substitute when necesary the172 // * @param className a class name173 // * @return a two elements array, <code>null</code> if {@link #isExternallyMapped(String)} returns <code>false</code>174 // * */175 // @Deprecated176 // public static String[] getMappedImportImport(String className) {177 // String[] ret = null;178 // if (isExternallyMapped(className)) {179 // ret = new String[2];180 // String clazz = getXMIToSQL().getProperty(className);181 // ret[0] = StringUtils.substringBeforeLast(clazz, ".");182 // ret[1] = StringUtils.substringAfterLast(clazz, ".");183 // }184 // return ret;185 // }186 //187 // @Deprecated188 // private static String getMappedPythonImport(String className, String type) {189 // String[] ret = getMappedImportImport(className);190 // if (ret != null) {191 // if (type.equals("Module")) {192 // return ret[0];193 // } else if (type.equals("Class")) {194 // return ret[1];195 // }196 // }197 // return className;198 // }199 //200 // /**201 // * Returns the module from where import a given class. Is a shortway to get202 // * the first element of {@link #getMappedImportImport(String)}203 // * @param className a class name204 // * @return the module name, else return the given className205 // **/206 // @Deprecated207 // public static String getMappedModule(String className) {208 // return getMappedPythonImport(className, "Module");209 // }210 //211 // /**212 // * Returns the Class from where import a given class. Is a shortway to get213 // * the first element of {@link #getMappedImportImport(String)}214 // * @param className a class name215 // * @return the module name, else return the given className216 // **/217 // @Deprecated218 // public static String getMappedClass(String className) {219 // return getMappedPythonImport(className, "Class");220 // }221 165 222 166 private static String formatPythonImportString(UMLClassDataType umlClass, String type) { -
mauRepo/xmi2sqlalchemy/trunk/src/main/java/ndg/services/newmoon/velocity/python/PythonClassModel.java
r8085 r8455 110 110 return closure.getImportMap(); 111 111 } 112 113 /*114 private void importInheritedTypes(ClassModel classModel, List toImport) {115 if (!CollectionUtils.isEmpty(classModel.getParents())) {116 for (ClassModel cm : classModel.getParents()) {117 importInheritedTypes(cm, toImport);118 }119 }120 CollectionUtils.addAll(toImport, classModel.getAttributeModel().iterator());121 }122 */123 112 124 113 public UMLClass getStereotypeImplementation() { -
mauRepo/xmi2sqlalchemy/trunk/src/main/resources/velocity/python/pythonClass.vm
r8436 r8455 137 137 ##end 138 138 #foreach($attr in $attributes) 139 #if(!$attr.getParentName() && $attr.hasMultiplicity()) 139 #if(!$attr.getParentName() && $attr.hasMultiplicity() && $attr.subTypes) 140 ${tab}${tab}int_${attr.name} = self.${attr.name} 140 141 #foreach($type in $attr.subTypes) 141 142 #set ( $assoClassL = "$type.associatedClass.name.toLowerCase()") … … 146 147 #foreach($attr in $attributes) 147 148 #if(!$attr.getParentName() && $attr.hasMultiplicity() && $attr.subTypes) 148 ${tab}${tab}for item in self.${attr.name}: 149 ${tab}${tab}for item in int_${attr.name}: 150 ${tab}${tab}${tab}valueClass = "%s.%s" % (type(item).__module__,type(item).__name__) 149 151 #foreach($type in $attr.subTypes) 150 152 #set ( $assoClassL = "$type.associatedClass.name.toLowerCase()") 151 ${tab}${tab}${tab}valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)152 153 ${tab}${tab}${tab}if valueClass == "${vh.getMappedModule($type.associatedClass)}.${type.associatedClass.name}": 153 154 ${tab}${tab}${tab}${tab}self._${attr.name}_${assoClassL}.append(item) … … 208 209 209 210 #importing($imports) 210 from ascore.utils import has_value,collectionProofHash211 from ascore.utils import collectionProofHash 211 212 212 213 '''
Note: See TracChangeset
for help on using the changeset viewer.