Examples of UmlClass


Examples of org.omg.uml.foundation.core.UmlClass

            String tableName = tableRs.getString("TABLE_NAME");
            if (StringUtils.isNotBlank(this.tableNamePattern))
            {
                if (tableName.matches(this.tableNamePattern))
                {
                    UmlClass umlClass = this.createClass(modelPackage, metadata, corePackage, tableName);
                    this.classes.put(tableName, umlClass);
                }
            }
            else
            {
                UmlClass umlClass = this.createClass(modelPackage, metadata, corePackage, tableName);
                this.classes.put(tableName, umlClass);
            }
        }
        DbUtils.closeQuietly(tableRs);
        if (this.classes.isEmpty())
        {
            String schemaName = "";
            if (StringUtils.isNotEmpty(this.schema))
            {
                schemaName = " '" + this.schema + "' ";
            }
            StringBuffer warning = new StringBuffer("WARNING! No tables found in schema");
            warning.append(schemaName);
            if (StringUtils.isNotEmpty(this.tableNamePattern))
            {
                warning.append(" matching pattern --> '" + this.tableNamePattern + "'");
            }
            logger.warn(warning);
        }

        // add all attributes and associations to the modelPackage
        Iterator tableNameIt = this.classes.keySet().iterator();
        while (tableNameIt.hasNext())
        {
            String tableName = (String)tableNameIt.next();
            UmlClass umlClass = (UmlClass)classes.get(tableName);
            if (logger.isInfoEnabled())
            {
                logger.info("created class --> '" + umlClass.getName() + "'");
            }

            // create and add all associations to the package
            modelPackage.getOwnedElement().addAll(this.createAssociations(metadata, corePackage, tableName));

            // create and add all the attributes
            umlClass.getFeature().addAll(this.createAttributes(metadata, corePackage, tableName));

            modelPackage.getOwnedElement().add(umlClass);
        }
    }
View Full Code Here

Examples of org.omg.uml.foundation.core.UmlClass

        DatabaseMetaData metadata,
        CorePackage corePackage,
        String tableName)
    {
        String className = SqlToModelNameFormatter.toClassName(tableName);
        UmlClass umlClass =
            corePackage.getUmlClass().createUmlClass(
                className, VisibilityKindEnum.VK_PUBLIC, false, false, false, false, false);

        umlClass.getStereotype().addAll(this.getOrCreateStereotypes(corePackage, this.classStereotypes, "Classifier"));

        if (StringUtils.isNotEmpty(this.tableTaggedValue))
        {
            // add the tagged value for the table name
            TaggedValue taggedValue = this.createTaggedValue(corePackage, this.tableTaggedValue, tableName);
            if (taggedValue != null)
            {
                umlClass.getTaggedValue().add(taggedValue);
            }
        }

        return umlClass;
    }
View Full Code Here

Examples of org.omg.uml.foundation.core.UmlClass

        Model model = (Model)(modelManagementPackage.getModel().refAllOfType().iterator().next());

        // look for a class with the name 'org.EntityBean'
        String[] fullyQualifiedName = {"org", "andromda", "ClassA"};

        UmlClass umlClass = (UmlClass)getModelElement(
                model,
                fullyQualifiedName,
                0);

        // create an attribute
View Full Code Here

Examples of org.omg.uml.foundation.core.UmlClass

     * Returns the first class this method can find with the given tagged value or hyperlink. Both arguments are used to
     * look for the tagged value but only <code>value</code> is used to search for the hyperlink.
     */
    static UmlClass findClassWithTaggedValueOrHyperlink(String tag, String value)
    {
        UmlClass classWithTaggedValue = null;

        Collection classes = getModel().getCore().getUmlClass().refAllOfType();
        for (final Iterator classIterator = classes.iterator(); classIterator.hasNext() && classWithTaggedValue == null;)
        {
            // loop over all classes
            UmlClass clazz = (UmlClass)classIterator.next();
            if (isTagPresent(clazz, tag, value) || isHyperlinkPresent(clazz, value))
            {
                classWithTaggedValue = clazz;
            }
        }
View Full Code Here

Examples of org.tinyuml.model.UmlClass

 
  /**
   * Initial state.
   */
  public void testInitial() {
    UmlClass umlclass = UmlClass.getPrototype();
    assertFalse(umlclass.isAbstract());
    assertEquals(0, umlclass.getMethods().size());
  }
View Full Code Here

Examples of org.tinyuml.model.UmlClass

  /**
   * Tests the setAbstract method.
   */
  public void testSetters() {
    Mock mockListener = mock(UmlModelElementListener.class);
    UmlClass umlclass = UmlClass.getPrototype();
    UmlClass clonedClass = (UmlClass) UmlClass.getPrototype().clone();
    clonedClass.addModelElementListener((UmlModelElementListener)
      mockListener.proxy());
    mockListener.expects(once()).method("elementChanged").with(eq(clonedClass));
    clonedClass.setAbstract(true);
    assertTrue(clonedClass.isAbstract());
    assertFalse(umlclass.isAbstract());
  }
View Full Code Here

Examples of org.tinyuml.model.UmlClass

  /**
   * Tests the setMethods() method.
   */
  public void testSetMethods() {
    Mock mockListener = mock(UmlModelElementListener.class);
    UmlClass clonedClass = (UmlClass) UmlClass.getPrototype().clone();
    clonedClass.addModelElementListener((UmlModelElementListener)
      mockListener.proxy());
    List<UmlProperty> methodList = new ArrayList<UmlProperty>();
    UmlProperty method1 = (UmlProperty) UmlProperty.getPrototype().clone();
    UmlProperty method2 = (UmlProperty) UmlProperty.getPrototype().clone();
    UmlProperty method3 = (UmlProperty) UmlProperty.getPrototype().clone();
    methodList.add(method1);
    methodList.add(method2);
    methodList.add(method3);
   
    mockListener.expects(once()).method("elementChanged").with(eq(clonedClass));
    clonedClass.setMethods(methodList);
    assertEquals(methodList, clonedClass.getMethods());
  }
View Full Code Here

Examples of org.tinyuml.model.UmlClass

  /**
   * Tests the setAttributes() method.
   */
  public void testSetAttributes() {
    Mock mockListener = mock(UmlModelElementListener.class);
    UmlClass clonedClass = (UmlClass) UmlClass.getPrototype().clone();
    clonedClass.addModelElementListener((UmlModelElementListener)
      mockListener.proxy());
    List<UmlProperty> attributeList = new ArrayList<UmlProperty>();
    UmlProperty attrib1 = (UmlProperty) UmlProperty.getPrototype().clone();
    UmlProperty attrib2 = (UmlProperty) UmlProperty.getPrototype().clone();
    UmlProperty attrib3 = (UmlProperty) UmlProperty.getPrototype().clone();
    attributeList.add(attrib1);
    attributeList.add(attrib2);
    attributeList.add(attrib3);
   
    mockListener.expects(once()).method("elementChanged").with(eq(clonedClass));
    clonedClass.setAttributes(attributeList);
    assertEquals(attributeList, clonedClass.getAttributes());
  }
View Full Code Here

Examples of org.tinyuml.model.UmlClass

  /**
   * Tests the setStereotypes() method.
   */
  public void testSetStereotypes() {
    Mock mockListener = mock(UmlModelElementListener.class);
    UmlClass clonedClass = (UmlClass) UmlClass.getPrototype().clone();
    clonedClass.addModelElementListener((UmlModelElementListener)
      mockListener.proxy());
    List<UmlStereotype> stereotypeList = new ArrayList<UmlStereotype>();
    UmlStereotype stereo1 = (UmlStereotype) UmlStereotype.getPrototype().clone();
    UmlStereotype stereo2 = (UmlStereotype) UmlStereotype.getPrototype().clone();
    UmlStereotype stereo3 = (UmlStereotype) UmlStereotype.getPrototype().clone();
    stereotypeList.add(stereo1);
    stereotypeList.add(stereo2);
    stereotypeList.add(stereo3);
   
    mockListener.expects(once()).method("elementChanged").with(eq(clonedClass));
    clonedClass.setStereotypes(stereotypeList);
    assertEquals(stereotypeList, clonedClass.getStereotypes());
  }
View Full Code Here

Examples of org.tinyuml.model.UmlClass

      UmlStereotype stereo = (UmlStereotype) UmlStereotype.getPrototype().clone();
      stereo.setName("stereotype" + i);
      stereotypes.add(stereo);
    }
   
    UmlClass original = UmlClass.getPrototype();
    original.setAttributes(attributes);
    original.setMethods(methods);
    original.setStereotypes(stereotypes);
   
    UmlClass cloned = (UmlClass) original.clone();
    assertTrue(original.getAttributes() != cloned.getAttributes());
    assertEquals(original.getAttributes().size(),
      cloned.getAttributes().size());
    for (int i = 0; i < cloned.getAttributes().size(); i++) {
      assertTrue(original.getAttributes().get(i) ==
        cloned.getAttributes().get(i));
    }
   
    assertTrue(original.getMethods() != cloned.getMethods());
    assertEquals(original.getMethods().size(), cloned.getMethods().size());
    for (int i = 0; i < cloned.getMethods().size(); i++) {
      assertTrue(original.getMethods().get(i) ==
        cloned.getMethods().get(i));
    }
   
    assertTrue(original.getStereotypes() != cloned.getStereotypes());
    assertEquals(original.getStereotypes().size(),
      cloned.getStereotypes().size());
    for (int i = 0; i < cloned.getStereotypes().size(); i++) {
      assertTrue(original.getStereotypes().get(i) ==
        cloned.getStereotypes().get(i));
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.