private List<String> getOnlyInterfacesAndClasses(Package package1) { List<String> elements = new ArrayList<String>(); for (Element element : package1.getElements()) { if (!(element instanceof Package)) { elements.add(element.getId()); } } return elements; }
public RealizationRelationship(Element client, Element supplier, String name, String id) { setClient(client); setSupplier(supplier); setId(id); super.setName(name); super.setType(ElementsTypes.REALIZATION); if ((client instanceof Package) && (supplier instanceof Interface)) { ((Package) client).addImplementedInterface((Interface) supplier); } if ((client instanceof Class) && (supplier instanceof Interface)) { ((Class) client).addImplementedInterface((Interface) supplier); } }
private void buildPackage(Operations op, Package pack) throws CustonTypeNotFound, NodeNotFound, InvalidMultiplictyForAssociationException { List<String> nestedIds = new ArrayList<String>(); for (Package p : pack.getNestedPackages()) { nestedIds.add(p.getId()); if (!p.getNestedPackages().isEmpty()) { buildPackage(op, p); } if (!packageCreated.contains(p.getId())) { op.forPackage().createPacakge(p).withClass(getOnlyInterfacesAndClasses(p)).build(); packageCreated.add(p.getId()); } } nestedIds.clear(); }
public DependencyRelationship create(Dependency element) { EList<NamedElement> suppliers = element.getSuppliers(); EList<NamedElement> clieents = element.getClients(); Element client = architecture.findElementById(getModelHelper().getXmiId(clieents.get(0))); Element supplier = architecture.findElementById(getModelHelper().getXmiId(suppliers.get(0))); if ((client instanceof Class) && (supplier instanceof Interface)) ((Class) client).addRequiredInterface((Interface) supplier); if ((client instanceof Package) && (supplier instanceof Interface)) ((Package) client).addRequiredInterface((Interface) supplier); DependencyRelationship dependency = new DependencyRelationship( supplier, client, element.getName(), getModelHelper().getXmiId(element)); dependency.setStereotypes(StereotypeHelper.getAllRelationshipStereotypes(element)); return dependency; }