public static Set<Property> getPropertiesOnRealizedInterfaces(org.eclipse.uml2.uml.Class clazz) { Set<Property> result = new HashSet<Property>(); List<Interface> interfaces = clazz.getImplementedInterfaces(); for (Interface inf : interfaces) { Set<Property> properties = UmlgInterfaceOperations.getAllProperties(inf); for (Property p : properties) { result.add(p); } } return result; }
private static boolean realizesHierarchy(org.eclipse.uml2.uml.Class clazz) { List<Interface> realizedInterfaces = clazz.getImplementedInterfaces(); for (Interface interface1 : realizedInterfaces) { if (interface1.getQualifiedName().equals("umlglib::org::umlg::hierarchy::Hierarchy")) { return true; } } return false; }
/** * Collects all attributes the classifier and their interfaces have. * * @param classifier * The classifier the attributes should be collected * @return An <code>EList</code> with all collected attributes */ public EList<Property> getAllAttributes(Classifier classifier) { EList<Property> attributes = new UniqueEList<Property>(); attributes.addAll(classifier.getAttributes()); if (classifier instanceof org.eclipse.uml2.uml.Class) { Class clazz = (Class) classifier; for (int i = 0; i < clazz.getImplementedInterfaces().size(); i++) { attributes.addAll(getAllInterfaceAttributes(clazz .getImplementedInterfaces().get(i))); } } return attributes; }
/** * Collects all operations the classifier and their interfaces have. * * @param classifier * The classifier the operations should be collected * @return An <code>EList</code> with all collected operations */ public EList<Operation> getAllOperations(Classifier classifier) { EList<Operation> operations = new UniqueEList<Operation>(); operations.addAll(classifier.getOperations()); if (classifier instanceof org.eclipse.uml2.uml.Class) { Class clazz = (Class) classifier; for (int i = 0; i < clazz.getImplementedInterfaces().size(); i++) { operations.addAll(getAllInterfaceOperations(clazz .getImplementedInterfaces().get(i))); } } return operations; }
/** * Collects all associations the classifier and their interfaces have. * * @param classifier * The classifier the associations should be collected * @return An <code>EList</code> with all collected associations */ @SuppressWarnings("unchecked") public EList<Association> getAllAssociations(Classifier classifier) { EList<Association> associations = new UniqueEList<Association>(); associations.addAll(classifier.getAssociations()); if (classifier instanceof org.eclipse.uml2.uml.Class) { Class clazz = (Class) classifier; for (int i = 0; i < clazz.getImplementedInterfaces().size(); i++) { associations.addAll(getAllInterfaceAssociations(clazz .getImplementedInterfaces().get(i))); } } return associations; }
/** * Collects all dependencies the NamedElement has. In the case of a Class * the dependencies of its interfaces will be processed too. * * @param element * The NamedElement the dependencies should be collected * @return An <code>EList</code> with all collected dependencies */ @SuppressWarnings("unchecked") public EList<Dependency> getAllDependencies(NamedElement element) { EList<Dependency> dependencies = new UniqueEList<Dependency>(); dependencies.addAll(element.getClientDependencies()); if (element instanceof org.eclipse.uml2.uml.Class) { Class clazz = (Class) element; for (int i = 0; i < clazz.getImplementedInterfaces().size(); i++) { dependencies.addAll(getAllInterfaceAssociations(clazz .getImplementedInterfaces().get(i))); } } EList<Dependency> depsFiltered = new UniqueEList<Dependency>(); for (Iterator<Dependency> iter = dependencies.iterator(); iter .hasNext();) { Dependency e = iter.next(); if (!(e instanceof InterfaceRealization)) { depsFiltered.add(e); } } return depsFiltered; }
private void addImplementedInterfaces(OJAnnotatedClass annotatedClass, Class clazz) { List<Interface> interfaces = clazz.getImplementedInterfaces(); for (Interface interface1 : interfaces) { OJAnnotatedInterface ojInterface = (OJAnnotatedInterface) findOJClass(interface1); annotatedClass.addToImplementedInterfaces(ojInterface.getPathName()); } }
public void setUpMocks() throws Exception { String fullQualifiedName = "de::crowdcode::kissmda::testapp::components::Company"; clazz = mock(Class.class); when(clazz.getQualifiedName()).thenReturn(fullQualifiedName); when(clazz.getName()).thenReturn("Company"); when(clazz.getAssociations()) .thenReturn(new UniqueEList<Association>()); when(clazz.getImplementedInterfaces()).thenReturn( new UniqueEList<Interface>()); }
public void setUpMocks() throws Exception { String fullQualifiedName = "de::crowdcode::kissmda::testapp::components::CompanyException"; clazz = mock(Class.class); when(clazz.getQualifiedName()).thenReturn(fullQualifiedName); when(clazz.getName()).thenReturn("CompanyException"); when(clazz.getAssociations()) .thenReturn(new UniqueEList<Association>()); when(clazz.getImplementedInterfaces()).thenReturn( new UniqueEList<Interface>()); when(clazz.getGeneralizations()).thenReturn( new UniqueEList<Generalization>()); }
public void setUpMocks() throws Exception { String fullQualifiedName = "de::crowdcode::kissmda::testapp::components::Company"; clazz = mock(Class.class); when(clazz.getQualifiedName()).thenReturn(fullQualifiedName); when(clazz.getName()).thenReturn("Company"); when(clazz.getAssociations()) .thenReturn(new UniqueEList<Association>()); when(clazz.getImplementedInterfaces()).thenReturn( new UniqueEList<Interface>()); when(clazz.getGeneralizations()).thenReturn( new UniqueEList<Generalization>()); when(clazz.getOwnedComments()).thenReturn(new UniqueEList<Comment>()); }