Package org.eclipse.uml2.uml

Examples of org.eclipse.uml2.uml.Class


                (Package)eo
            );

        }
        else if(eo instanceof Class) {
          Class cl = (Class)eo;
          name =
            ClassHandler.buildFullyQualifiedName(
                cl
            );
        }
View Full Code Here


   * @param p
   * Edit part for which a handler must be found
   * @return Handler corresponding to the given edit part
   */
  public IElementHandling findHandler(EditPart p) {
    Class classSel = null;
    Property propSel = null;
    Operation opSel = null;
    Package packSel = null;
    String name = new String();
    // We get the underlying UML element in its specialized form
View Full Code Here

    EList<NamedElement> elms = dm.getMembers();
    for (NamedElement namedElement : elms) {
      EList<Element> elements = namedElement.allOwnedElements();
      for (Element element : elements) {
        if (element instanceof Class) {
          Class impl = (Class) element;
          classes.add(impl);
        }
      }
    }
    return classes;
View Full Code Here

      EList<NamedElement> elms = dm.getMembers();
      for (NamedElement namedElement : elms) {
        EList<Element> elements = namedElement.allOwnedElements();
        for (Element element : elements) {
          if (element instanceof Class) {
            Class impl = (Class) element;

            EList<Stereotype> stetyp = impl
                .getApplicableStereotypes();
            for (Stereotype stereotype : stetyp) {
              String nameOld = stereotype.getName();

              // Prüfen ob der Stereotyp den Namen Entity enhält
              // -> dieser darf nicht verändert werden
              if ((!nameOld.contains("Entity"))

              // Prüfen ob der Postfix JPA bereits am
                  // Namen hängt -> dann muss nach nicht
                  // mehr angepasst werden
                  && (!nameOld
                      .substring(nameOld.length() - 3)
                      .equals("JPA"))

                  // Prüfen ob der Name des Stereotyp mit
                  // dem Präfix JPA_ beginnt
                  // -> dann handelt es sich um einen
                  // JPA-Stereotyp
                  && (nameOld.startsWith("JPA_"))) {
                stereotype.setName(nameOld + "JPA");
              }
            }

            EList<Operation> operations = impl.getAllOperations();
            for (Operation operation : operations) {
              EList<Stereotype> stetp = operation
                  .getApplicableStereotypes();
              for (Stereotype stereotpy : stetp) {
                String nameTemp = stereotpy.getName();
                if ((!nameTemp.substring(nameTemp.length() - 3)
                    .equals("JPA"))
                    && (nameTemp.startsWith("JPA_"))) {
                  stereotpy.setName(nameTemp + "JPA");
                }
              }
            }

            EList<Property> attr = impl.getAllAttributes();
            for (Property property : attr) {
              EList<Stereotype> st = property
                  .getApplicableStereotypes();
              for (Stereotype stereotpy : st) {
                String nameTemp = stereotpy.getName();
View Full Code Here

      for (NamedElement namedElement : elms) {
        // System.out.println(namedElement);
        EList<Element> elements = namedElement.allOwnedElements();
        for (Element element : elements) {
          if (element instanceof Class) {
            Class impl = (Class) element;

            removePrefix(impl.getAppliedStereotypes());

            EList<Operation> operations = impl.getAllOperations();
            for (Operation operation : operations) {
              removePrefix(operation.getAppliedStereotypes());
            }

            EList<Property> attr = impl.getAllAttributes();
            for (Property property : attr) {
              removePrefix(property.getAppliedStereotypes());
            }
          }
        }
View Full Code Here

  }

  private void generateInterfaceForEntityAndService(Element element,
      Stereotype stereotype) throws IOException {
    // Stereotype Interface
    Class clazz = (Class) element;
    logger.log(Level.FINE, "Class: " + clazz.getName() + " - "
        + "Stereotype: " + stereotype.getName());
    // Generate the interface for this class
    CompilationUnit compilationUnit = interfaceGenerator.generateInterface(
        clazz, sourceDirectoryPackageName);
    generateClassFile(clazz, compilationUnit);
View Full Code Here

  }

  private void generateCheckedException(Element element, Stereotype stereotype)
      throws IOException {
    // Stereotype Interface
    Class clazz = (Class) element;
    logger.log(Level.FINE, "Class: " + clazz.getName() + " - "
        + "Stereotype: " + stereotype.getName());
    // Generate the exception for this class
    CompilationUnit compilationUnit = exceptionGenerator
        .generateCheckedException(clazz, sourceDirectoryPackageName);
    generateClassFile(clazz, compilationUnit);
View Full Code Here

  }

  private void generateUncheckedException(Element element,
      Stereotype stereotype) throws IOException {
    // Stereotype Interface
    Class clazz = (Class) element;
    logger.log(Level.FINE, "Class: " + clazz.getName() + " - "
        + "Stereotype: " + stereotype.getName());
    // Generate the exception for this class
    CompilationUnit compilationUnit = exceptionGenerator
        .generateUncheckedException(clazz, sourceDirectoryPackageName);
    generateClassFile(clazz, compilationUnit);
View Full Code Here

  @Test
  public void testGenerateClassCheckedExceptionWithInheritance() {
    EList<Generalization> generalizations = new UniqueEList<Generalization>();
    Generalization generalization = mock(Generalization.class);
    Class clazzGeneralization = mock(Class.class);
    generalizations.add(generalization);
    when(generalization.getGeneral()).thenReturn(clazzGeneralization);
    when(clazzGeneralization.getQualifiedName()).thenReturn(
        "de::test::SuperCompanyException");
    when(clazz.getGeneralizations()).thenReturn(generalizations);

    AST ast = AST.newAST(AST.JLS3);
    CompilationUnit cu = ast.newCompilationUnit();
View Full Code Here

  @Test
  public void testGenerateClassUncheckedExceptionWithMultipleInheritance() {
    EList<Generalization> generalizations = new UniqueEList<Generalization>();
    Generalization generalization1 = mock(Generalization.class);
    Generalization generalization2 = mock(Generalization.class);
    Class clazzGeneralization1 = mock(Class.class);
    Class clazzGeneralization2 = mock(Class.class);
    generalizations.add(generalization1);
    generalizations.add(generalization2);
    when(generalization1.getGeneral()).thenReturn(clazzGeneralization1);
    when(clazzGeneralization1.getQualifiedName()).thenReturn(
        "de::test::SuperCompanyException");
    when(generalization2.getGeneral()).thenReturn(clazzGeneralization2);
    when(clazzGeneralization2.getQualifiedName()).thenReturn(
        "de::test::SuperDuperCompanyException");
    when(clazz.getGeneralizations()).thenReturn(generalizations);

    AST ast = AST.newAST(AST.JLS3);
    CompilationUnit cu = ast.newCompilationUnit();
View Full Code Here

TOP

Related Classes of org.eclipse.uml2.uml.Class

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.