|
From: jistrawn <jis...@us...> - 2006-10-13 20:31:39
|
Update of /cvsroot/modelwizard/source/Chameleon Plugin/src/net/sourceforge/modelWizard/chameleon/exporters In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv6999/src/net/sourceforge/modelWizard/chameleon/exporters Modified Files: SubModelGenerator.java Log Message: reformatted Index: SubModelGenerator.java =================================================================== RCS file: /cvsroot/modelwizard/source/Chameleon Plugin/src/net/sourceforge/modelWizard/chameleon/exporters/SubModelGenerator.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SubModelGenerator.java 2 Oct 2006 17:25:40 -0000 1.7 --- SubModelGenerator.java 13 Oct 2006 20:31:34 -0000 1.8 *************** *** 54,593 **** import org.eclipse.uml2.UML2Package; - public class SubModelGenerator - { - public static SubModelGenerator INSTANCE = new SubModelGenerator(); private TreeMap rqdElements; ! /** ! * This method returns a new model that is a subset of ! * @param model ! * @param classeNames Iterator for required class names (each a string). ! * @return pointer to new model. ! * @throws IOException ! * @throws InterruptedException ! * @throws InvocationTargetException ! * @throws ModelTransformationException ! */ ! public Model getSubModel( ! Iterator classNames, ! IProgressMonitor parentMonitor, ! ModelModel model, ! String modelName, ! String modelDesc, ! String basePackageName) ! throws IOException, InvocationTargetException, InterruptedException, ModelTransformationException ! { ! IProgressMonitor monitor = new SubProgressMonitor(parentMonitor, 2); ! monitor.beginTask( ! "Creating sub model", ! 3); ! rqdElements = new TreeMap(); ! //for each class add the class and any superclasses to the rqdClasses treemap ! int n = 0; ! while (classNames.hasNext()) ! { ! n++; ! String cN = (String)classNames.next(); ! Classifier theElement = (Classifier)model.findRealElement(cN); ! if (theElement == null) ! { ! throw new ModelTransformationException(cN + " does not exist in model!"); ! } ! addDependencies( ! rqdElements, ! theElement, ! false); ! if (monitor.isCanceled()) ! { ! throw new InterruptedException(); ! } ! } ! monitor.worked(1); ! //now create the new model with the required elements. ! Copier copier = new Copier(); ! Model newModel = UML2Factory.eINSTANCE.createModel(); ! newModel.setName(modelName); ! Package basePackage = newModel; ! if (basePackageName != null && !basePackageName.equals("")) ! { ! basePackage = createPackageHierachy( ! basePackageName, ! newModel); ! } ! ! //add profile applications... ! ArrayList pList = new ArrayList(); ! for (Iterator p = model.getRealModel().getAppliedProfiles().iterator(); p.hasNext();) ! { ! ProfileApplication pa = (ProfileApplication)p.next(); ! if (!pa.getImportedProfile().eIsProxy()) ! { ! EObject o = copier.copy(pa); ! newModel.getAppliedProfiles().add(o); ! pList.add(pa.getImportedProfile().eResource().getURI().toString()); ! } ! else ! { ! // System.out.println("Ignoring "+((InternalEObject)pa.getImportedProfile()).eProxyURI().toString()); ! continue; ! } ! } ! ! //add packageImports... ! for (Iterator p = model.getRealModel().getPackageImports().iterator(); p.hasNext();) ! { ! PackageImport pi = (PackageImport)p.next(); ! if (!pi.getImportedPackage().eIsProxy() && ! !pList.contains(pi.getImportedPackage().eResource().getURI().toString())) ! { ! EObject o = copier.copy(pi); ! newModel.getPackageImports().add(o); ! } ! else ! { ! // System.out.println("Ignoring "+((InternalEObject)pi.getImportedPackage()).eProxyURI().toString()); ! continue; ! } ! } ! ! if ((modelDesc != null) & !modelDesc.equals("")) ! { ! Comment newComment = newModel.createOwnedComment(UML2Package.eINSTANCE.getComment()); ! newComment.setBody(modelDesc); ! Stereotype s = newComment.getApplicableStereotype("Default::documentation"); ! if (s != null) ! { ! newComment.apply(s); ! } ! } ! monitor.worked(2); ! Iterator keys = rqdElements.keySet().iterator(); ! while (keys.hasNext()) ! { ! NamedElement el = (NamedElement)rqdElements.get(keys.next()); ! Package owner = addPackageHierarchy( ! basePackage, ! el); ! EObject o = copier.copy(el); ! deleteUnneededAssocEnds( ! el, ! o, ! rqdElements); ! owner.getOwnedMembers().add(o); ! } ! copier.copyReferences(); ! Stereotype stereo = newModel.getApplicableStereotype("MODEL::Version"); ! String version = (String)model.getRealModel().getValue( ! stereo, ! "value"); ! String derived = "Derived from " + version.replaceAll( ! "\\$", ! ""); ! // newModel.apply(stereo); ! newModel.setValue( ! stereo, ! "value", ! derived); ! monitor.worked(3); ! monitor.done(); ! return newModel; ! } ! private Package createPackageHierachy( ! String basePackage, ! Package parent) ! { ! String top = basePackage.split("\\.")[0]; ! Package newPackage = (Package)parent.createOwnedMember(UML2Package.eINSTANCE.getPackage()); ! newPackage.setName(top); ! if (top.equals(basePackage)) ! { ! return newPackage; ! } ! else ! { ! String rest = basePackage.substring( ! top.length() + 1, ! basePackage.length()); ! return createPackageHierachy( ! rest, ! newPackage); ! } ! } ! private void deleteUnneededAssocEnds( ! NamedElement sourceEl, ! EObject targetEl, ! TreeMap rqdElements) ! { ! if (sourceEl instanceof Class) ! { ! Class src = (Class)sourceEl; ! Class tgt = (Class)targetEl; ! for (Iterator i = src.getOwnedAttributes().iterator(); i.hasNext();) ! { ! Property p = (Property)i.next(); ! if (p.getAssociation() == null) ! { ! continue; ! } ! if (!rqdElements.containsKey(p.getAssociation().getQualifiedName())) ! { ! Property excessProp = tgt.getAttribute(p.getName()); ! tgt.getOwnedAttributes().remove(excessProp); ! } ! } ! } ! if (sourceEl instanceof Interface) ! { ! Interface src = (Interface)sourceEl; ! Interface tgt = (Interface)targetEl; ! for (Iterator i = src.getOwnedAttributes().iterator(); i.hasNext();) ! { ! Property p = (Property)i.next(); ! if (p.getAssociation() == null) ! { ! continue; ! } ! if (!rqdElements.containsKey(p.getAssociation().getQualifiedName())) ! { ! Property excessProp = tgt.getAttribute(p.getName()); ! tgt.getOwnedAttributes().remove(excessProp); ! } ! } ! } ! } ! /** ! * @param basePackage ! * @param el ! * @return ! */ ! private Package addPackageHierarchy( ! Package basePackage, ! NamedElement el) ! { ! String qName = el.getQualifiedName(); ! String[] str = qName.split("::"); ! if (str.length <= 1) ! { ! return basePackage; ! } ! Package owner = basePackage; ! for (int i = 1; i < (str.length - 1); i++) ! { ! if (owner.getNestedPackage(str[i]) == null) ! { ! Package p = UML2Factory.eINSTANCE.createPackage(); ! p.setName(str[i]); ! owner.getOwnedMembers().add(p); ! owner = p; ! } ! else ! { ! owner = owner.getNestedPackage(str[i]); ! } ! } ! return owner; ! } ! /** ! * @param monitor ! * @param model ! */ ! public void saveModel( ! IProgressMonitor monitor, ! Model model, ! String file) ! { ! monitor.subTask("Saving file"); ! URI fileUri = URI.createFileURI(file); ! Resource resource1 = new ResourceSetImpl().createResource(fileUri); ! resource1.getContents().add(model); ! try ! { ! resource1.save(null); ! } ! catch (IOException e) ! { ! e.printStackTrace(); ! } ! monitor.worked(1); ! } ! /** ! * Check theClass for dependencies on other classes (other than superclass and add them to rqdElements ! * @param rqdElements ! * @param theElement ! * @throws ModelTransformationException ! */ ! private void addDependencies( ! TreeMap rqdElements, ! Classifier theElement, ! boolean ignoreSuper) ! throws ModelTransformationException ! { ! String qName = theElement.getQualifiedName(); ! if (!rqdElements.containsKey(qName)) ! { ! rqdElements.put( ! qName, ! theElement); ! } ! else ! { ! return; ! } ! //if this is a complex type add the subtypes and their dependencies ... ! if (theElement.getAppliedStereotype("MODEL::TypeDefinition") != null) ! { ! ArrayList a = UmlUtilities.getSpecializations(theElement); ! Iterator i = a.iterator(); ! while (i.hasNext()) ! { ! Classifier s = (Classifier)i.next(); ! if (!rqdElements.containsKey(s.getQualifiedName())) ! { ! addDependencies( ! rqdElements, ! s, ! true); ! } ! } ! } ! if (theElement instanceof Class || theElement instanceof Interface) ! { ! //add the superclass ! if (!ignoreSuper) ! { ! Classifier sc = (Classifier)UmlUtilities.getGeneral(theElement); ! if (sc != null) ! { ! addDependencies( ! rqdElements, ! sc, ! false); ! } ! } ! ! Iterator props = null; ! Iterator methods = null; ! if (theElement instanceof Class){ ! Class c = (Class)theElement; ! props = UmlUtilities.getProperties(c.getAttributes(),c.getInheritedMembers(),false); ! methods = UmlUtilities.getMethods(c.getOwnedOperations(),c.getInheritedMembers(),false); ! } ! if (theElement instanceof Interface){ ! Interface intfc = (Interface)theElement; ! props = UmlUtilities.getProperties(intfc.getAttributes(),intfc.getInheritedMembers(),false); ! methods = UmlUtilities.getMethods(intfc.getOwnedOperations(),intfc.getInheritedMembers(),false); ! } ! ! while (props.hasNext()) ! { ! Property p = (Property)props.next(); ! // ignore associations for now. ! if (p.getAssociation() != null) ! { ! continue; ! } ! Type t = p.getType(); ! if (t instanceof PrimitiveType) ! { ! continue; ! } ! if (t == null) ! throw new ModelTransformationException("Type of "+p.getQualifiedName()+" is null"); ! ! String tQname = t.getQualifiedName(); ! if (t instanceof Classifier) ! { ! // if (!rqdElements.containsKey(tQname)) { ! // rqdElements.put(tQname, t); ! // } ! addDependencies( ! rqdElements, ! (Classifier)t, ! false); ! } ! if (t instanceof Enumeration) ! { ! if (!rqdElements.containsKey(tQname)) ! { ! rqdElements.put( ! tQname, ! t); ! } ! Enumeration en = (Enumeration)t; ! while (UmlUtilities.getGeneral(en) != null) ! { ! en = (Enumeration)UmlUtilities.getGeneral(en); ! if (!rqdElements.containsKey(en.getQualifiedName())) ! { ! rqdElements.put( ! en.getQualifiedName(), ! en); ! } ! } ! } ! // if (t instanceof DataType) { ! // if (!rqdElements.containsKey(tQname)) { ! // rqdElements.put(tQname, t); ! // } ! // } ! } ! while (methods.hasNext()) ! { ! Operation theMethod = (Operation)methods.next(); ! Type mt = theMethod.getType(); ! if (mt != null && !(mt instanceof PrimitiveType) ) ! { ! if (mt instanceof Enumeration && !rqdElements.containsKey(mt.getQualifiedName())) ! { ! rqdElements.put( ! mt.getQualifiedName(), ! mt); ! } ! if (mt instanceof Classifier) ! { ! addDependencies( ! rqdElements, ! (Classifier)mt, ! false); ! } ! } ! Iterator p = theMethod.getOwnedParameters().iterator(); ! while (p.hasNext()) ! { ! Parameter param = (Parameter)p.next(); ! Type t = param.getType(); ! String pQname = t.getQualifiedName(); ! if (t instanceof PrimitiveType) ! { ! continue; ! } ! if (t instanceof Class) ! { ! // if (!rqdElements.containsKey(pQname)) ! // { ! // rqdElements.put( ! // pQname, ! // t); ! // } ! addDependencies( ! rqdElements, ! (Class)t, ! false); ! } ! if (t instanceof Enumeration) ! { ! if (!rqdElements.containsKey(pQname)) ! { ! rqdElements.put( ! pQname, ! t); ! } ! } ! if (t instanceof PrimitiveType) ! { ! continue; ! } ! if (t instanceof DataType) ! { ! if (!rqdElements.containsKey(pQname)) ! { ! rqdElements.put( ! pQname, ! t); ! } ! } ! } ! } ! } ! // and finally look at the MemberEnds if it is an association ! if (theElement instanceof Association) ! { ! Iterator ends = ((Association)theElement).getMemberEnds().iterator(); ! while (ends.hasNext()) ! { ! Property p = (Property)ends.next(); ! Type t = p.getType(); ! String pQname = t.getQualifiedName(); ! if (t instanceof Classifier) ! { ! // if (!rqdElements.containsKey(pQname)) ! // { ! // rqdElements.put( ! // pQname, ! // t); ! // } ! addDependencies( ! rqdElements, ! (Classifier)t, ! false); ! } ! else ! { ! throw new ModelTransformationException("AssociationEnd " + pQname + " not a class"); ! } ! } ! } ! } } \ No newline at end of file --- 54,476 ---- import org.eclipse.uml2.UML2Package; + public class SubModelGenerator { + public static SubModelGenerator INSTANCE = new SubModelGenerator(); private TreeMap rqdElements; ! /** ! * This method returns a new model that is a subset of ! * ! * @param model ! * @param classeNames ! * Iterator for required class names (each a string). ! * @return pointer to new model. ! * @throws IOException ! * @throws InterruptedException ! * @throws InvocationTargetException ! * @throws ModelTransformationException ! */ ! public Model getSubModel(Iterator classNames, ! IProgressMonitor parentMonitor, ModelModel model, String modelName, ! String modelDesc, String basePackageName) throws IOException, ! InvocationTargetException, InterruptedException, ! ModelTransformationException { ! IProgressMonitor monitor = new SubProgressMonitor(parentMonitor, 2); ! monitor.beginTask("Creating sub model", 3); ! rqdElements = new TreeMap(); ! // for each class add the class and any superclasses to the rqdClasses ! // treemap ! int n = 0; ! while (classNames.hasNext()) { ! n++; ! String cN = (String) classNames.next(); ! Classifier theElement = (Classifier) model.findRealElement(cN); ! if (theElement == null) { ! throw new ModelTransformationException(cN ! + " does not exist in model!"); ! } ! addDependencies(rqdElements, theElement, false); ! if (monitor.isCanceled()) { ! throw new InterruptedException(); ! } ! } ! monitor.worked(1); ! // now create the new model with the required elements. ! Copier copier = new Copier(); ! Model newModel = UML2Factory.eINSTANCE.createModel(); ! newModel.setName(modelName); ! Package basePackage = newModel; ! if (basePackageName != null && !basePackageName.equals("")) { ! basePackage = createPackageHierachy(basePackageName, newModel); ! } ! // add profile applications... ! ArrayList pList = new ArrayList(); ! for (Iterator p = model.getRealModel().getAppliedProfiles().iterator(); p ! .hasNext();) { ! ProfileApplication pa = (ProfileApplication) p.next(); ! if (!pa.getImportedProfile().eIsProxy()) { ! EObject o = copier.copy(pa); ! newModel.getAppliedProfiles().add(o); ! pList.add(pa.getImportedProfile().eResource().getURI() ! .toString()); ! } else { ! // System.out.println("Ignoring ! // "+((InternalEObject)pa.getImportedProfile()).eProxyURI().toString()); ! continue; ! } ! } ! // add packageImports... ! for (Iterator p = model.getRealModel().getPackageImports().iterator(); p ! .hasNext();) { ! PackageImport pi = (PackageImport) p.next(); ! if (!pi.getImportedPackage().eIsProxy() ! && !pList.contains(pi.getImportedPackage().eResource() ! .getURI().toString())) { ! EObject o = copier.copy(pi); ! newModel.getPackageImports().add(o); ! } else { ! // System.out.println("Ignoring ! // "+((InternalEObject)pi.getImportedPackage()).eProxyURI().toString()); ! continue; ! } ! } ! if ((modelDesc != null) & !modelDesc.equals("")) { ! Comment newComment = newModel ! .createOwnedComment(UML2Package.eINSTANCE.getComment()); ! newComment.setBody(modelDesc); ! Stereotype s = newComment ! .getApplicableStereotype("Default::documentation"); ! if (s != null) { ! newComment.apply(s); ! } ! } ! monitor.worked(2); ! Iterator keys = rqdElements.keySet().iterator(); ! while (keys.hasNext()) { ! NamedElement el = (NamedElement) rqdElements.get(keys.next()); ! Package owner = addPackageHierarchy(basePackage, el); ! EObject o = copier.copy(el); ! deleteUnneededAssocEnds(el, o, rqdElements); ! owner.getOwnedMembers().add(o); ! } ! copier.copyReferences(); ! Stereotype stereo = newModel.getApplicableStereotype("MODEL::Version"); ! String version = (String) model.getRealModel() ! .getValue(stereo, "value"); ! String derived = "Derived from " + version.replaceAll("\\$", ""); ! // newModel.apply(stereo); ! newModel.setValue(stereo, "value", derived); ! monitor.worked(3); ! monitor.done(); ! return newModel; ! } ! private Package createPackageHierachy(String basePackage, Package parent) { ! String top = basePackage.split("\\.")[0]; ! Package newPackage = (Package) parent ! .createOwnedMember(UML2Package.eINSTANCE.getPackage()); ! newPackage.setName(top); ! if (top.equals(basePackage)) { ! return newPackage; ! } else { ! String rest = basePackage.substring(top.length() + 1, basePackage ! .length()); ! return createPackageHierachy(rest, newPackage); ! } ! } ! private void deleteUnneededAssocEnds(NamedElement sourceEl, ! EObject targetEl, TreeMap rqdElements) { ! if (sourceEl instanceof Class) { ! Class src = (Class) sourceEl; ! Class tgt = (Class) targetEl; ! for (Iterator i = src.getOwnedAttributes().iterator(); i.hasNext();) { ! Property p = (Property) i.next(); ! if (p.getAssociation() == null) { ! continue; ! } ! if (!rqdElements.containsKey(p.getAssociation() ! .getQualifiedName())) { ! Property excessProp = tgt.getAttribute(p.getName()); ! tgt.getOwnedAttributes().remove(excessProp); ! } ! } ! } ! if (sourceEl instanceof Interface) { ! Interface src = (Interface) sourceEl; ! Interface tgt = (Interface) targetEl; ! for (Iterator i = src.getOwnedAttributes().iterator(); i.hasNext();) { ! Property p = (Property) i.next(); ! if (p.getAssociation() == null) { ! continue; ! } ! if (!rqdElements.containsKey(p.getAssociation() ! .getQualifiedName())) { ! Property excessProp = tgt.getAttribute(p.getName()); ! tgt.getOwnedAttributes().remove(excessProp); ! } ! } ! } ! } ! /** ! * @param basePackage ! * @param el ! * @return ! */ ! private Package addPackageHierarchy(Package basePackage, NamedElement el) { ! String qName = el.getQualifiedName(); ! String[] str = qName.split("::"); ! if (str.length <= 1) { ! return basePackage; ! } ! Package owner = basePackage; ! for (int i = 1; i < (str.length - 1); i++) { ! if (owner.getNestedPackage(str[i]) == null) { ! Package p = UML2Factory.eINSTANCE.createPackage(); ! p.setName(str[i]); ! owner.getOwnedMembers().add(p); ! owner = p; ! } else { ! owner = owner.getNestedPackage(str[i]); ! } ! } ! return owner; ! } ! /** ! * @param monitor ! * @param model ! */ ! public void saveModel(IProgressMonitor monitor, Model model, String file) { ! monitor.subTask("Saving file"); ! URI fileUri = URI.createFileURI(file); ! Resource resource1 = new ResourceSetImpl().createResource(fileUri); ! resource1.getContents().add(model); ! try { ! resource1.save(null); ! } catch (IOException e) { ! e.printStackTrace(); ! } ! monitor.worked(1); ! } ! /** ! * Check theClass for dependencies on other classes (other than superclass ! * and add them to rqdElements ! * ! * @param rqdElements ! * @param theElement ! * @throws ModelTransformationException ! */ ! private void addDependencies(TreeMap rqdElements, Classifier theElement, ! boolean ignoreSuper) throws ModelTransformationException { ! String qName = theElement.getQualifiedName(); ! if (!rqdElements.containsKey(qName)) { ! rqdElements.put(qName, theElement); ! } else { ! return; ! } ! // if this is a complex type add the subtypes and their dependencies ... ! if (theElement.getAppliedStereotype("MODEL::TypeDefinition") != null) { ! ArrayList a = UmlUtilities.getSpecializations(theElement); ! Iterator i = a.iterator(); ! while (i.hasNext()) { ! Classifier s = (Classifier) i.next(); ! if (!rqdElements.containsKey(s.getQualifiedName())) { ! addDependencies(rqdElements, s, true); ! } ! } ! } ! if (theElement instanceof Class || theElement instanceof Interface) { ! // add the superclass ! if (!ignoreSuper) { ! Classifier sc = (Classifier) UmlUtilities ! .getGeneral(theElement); ! if (sc != null) { ! addDependencies(rqdElements, sc, false); ! } ! } ! Iterator props = null; ! Iterator methods = null; ! if (theElement instanceof Class) { ! Class c = (Class) theElement; ! props = UmlUtilities.getProperties(c.getAttributes(), c ! .getInheritedMembers(), false); ! methods = UmlUtilities.getMethods(c.getOwnedOperations(), c ! .getInheritedMembers(), false); ! } ! if (theElement instanceof Interface) { ! Interface intfc = (Interface) theElement; ! props = UmlUtilities.getProperties(intfc.getAttributes(), intfc ! .getInheritedMembers(), false); ! methods = UmlUtilities.getMethods(intfc.getOwnedOperations(), ! intfc.getInheritedMembers(), false); ! } ! while (props.hasNext()) { ! Property p = (Property) props.next(); ! // ignore associations for now. ! if (p.getAssociation() != null) { ! continue; ! } ! Type t = p.getType(); ! if (t instanceof PrimitiveType) { ! continue; ! } ! if (t == null) ! throw new ModelTransformationException("Type of " ! + p.getQualifiedName() + " is null"); ! String tQname = t.getQualifiedName(); + if (t instanceof Classifier) { + // if (!rqdElements.containsKey(tQname)) { + // rqdElements.put(tQname, t); + // } + addDependencies(rqdElements, (Classifier) t, false); + } ! if (t instanceof Enumeration) { ! if (!rqdElements.containsKey(tQname)) { ! rqdElements.put(tQname, t); ! } ! Enumeration en = (Enumeration) t; ! while (UmlUtilities.getGeneral(en) != null) { ! en = (Enumeration) UmlUtilities.getGeneral(en); ! if (!rqdElements.containsKey(en.getQualifiedName())) { ! rqdElements.put(en.getQualifiedName(), en); ! } ! } ! } ! // if (t instanceof DataType) { ! // if (!rqdElements.containsKey(tQname)) { ! // rqdElements.put(tQname, t); ! // } ! // } ! } ! while (methods.hasNext()) { ! Operation theMethod = (Operation) methods.next(); ! Type mt = theMethod.getType(); ! if (mt != null && !(mt instanceof PrimitiveType)) { ! if (mt instanceof Enumeration ! && !rqdElements.containsKey(mt.getQualifiedName())) { ! rqdElements.put(mt.getQualifiedName(), mt); ! } ! if (mt instanceof Classifier) { ! addDependencies(rqdElements, (Classifier) mt, false); ! } ! } ! Iterator p = theMethod.getOwnedParameters().iterator(); ! while (p.hasNext()) { ! Parameter param = (Parameter) p.next(); ! Type t = param.getType(); ! String pQname = t.getQualifiedName(); ! if (t instanceof PrimitiveType) { ! continue; ! } ! if (t instanceof Class) { ! // if (!rqdElements.containsKey(pQname)) ! // { ! // rqdElements.put( ! // pQname, ! // t); ! // } ! addDependencies(rqdElements, (Class) t, false); ! } ! if (t instanceof Enumeration) { ! if (!rqdElements.containsKey(pQname)) { ! rqdElements.put(pQname, t); ! } ! } ! if (t instanceof PrimitiveType) { ! continue; ! } ! if (t instanceof DataType) { ! if (!rqdElements.containsKey(pQname)) { ! rqdElements.put(pQname, t); ! } ! } ! } ! } ! } ! ! // and finally look at the MemberEnds if it is an association ! if (theElement instanceof Association) { ! Iterator ends = ((Association) theElement).getMemberEnds() ! .iterator(); ! ! while (ends.hasNext()) { ! Property p = (Property) ends.next(); ! Type t = p.getType(); ! String pQname = t.getQualifiedName(); ! ! if (t instanceof Classifier) { ! // if (!rqdElements.containsKey(pQname)) ! // { ! // rqdElements.put( ! // pQname, ! // t); ! // } ! ! addDependencies(rqdElements, (Classifier) t, false); ! } else { ! throw new ModelTransformationException("AssociationEnd " ! + pQname + " not a class"); ! } ! } ! } ! } } \ No newline at end of file |