Examples of UmlAssociation


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

            String fkColumnName = columnRs.getString("FKCOLUMN_NAME");
            this.addForeignKey(tableName, fkColumnName);

            // now create the association
            String foreignTableName = columnRs.getString("PKTABLE_NAME");
            UmlAssociation association =
                corePackage.getUmlAssociation().createUmlAssociation(
                    null, VisibilityKindEnum.VK_PUBLIC, false, false, false, false);

            // we set the upper range to 1 if the
            // they primary key of this table is the
            // foreign key of another table (by default
            // its set to a many multiplicity)
            int primaryUpper = -1;
            if (primaryKeys.contains(fkColumnName))
            {
                primaryUpper = 1;
            }

            String endName = null;

            // primary association
            AssociationEnd primaryEnd =
                corePackage.getAssociationEnd().createAssociationEnd(
                    endName,
                    VisibilityKindEnum.VK_PUBLIC,
                    false,
                    true,
                    OrderingKindEnum.OK_UNORDERED,
                    AggregationKindEnum.AK_NONE,
                    ScopeKindEnum.SK_INSTANCE,
                    this.createMultiplicity(
                        corePackage.getDataTypes(),
                        0,
                        primaryUpper),
                    ChangeableKindEnum.CK_CHANGEABLE);
            primaryEnd.setParticipant((Classifier)this.classes.get(tableName));
            association.getConnection().add(primaryEnd);

            boolean required = !this.isColumnNullable(metadata, tableName, fkColumnName);

            int foreignLower = 0;
            if (required)
            {
                foreignLower = 1;
            }

            int deleteRule = columnRs.getInt("DELETE_RULE");

            // determine if we should have composition for
            // the foreign association end depending on cascade delete
            AggregationKindEnum foreignAggregation = AggregationKindEnum.AK_NONE;
            if (deleteRule == DatabaseMetaData.importedKeyCascade)
            {
                foreignAggregation = AggregationKindEnum.AK_COMPOSITE;
            }

            // foriegn association
            AssociationEnd foreignEnd =
                corePackage.getAssociationEnd().createAssociationEnd(
                    endName,
                    VisibilityKindEnum.VK_PUBLIC,
                    false,
                    true,
                    OrderingKindEnum.OK_UNORDERED,
                    foreignAggregation,
                    ScopeKindEnum.SK_INSTANCE,
                    this.createMultiplicity(
                        corePackage.getDataTypes(),
                        foreignLower,
                        1),
                    ChangeableKindEnum.CK_CHANGEABLE);
            final Classifier foreignParticipant = (Classifier)this.classes.get(foreignTableName);
            if (foreignParticipant == null)
            {
                throw new SchemaTransformerException(
                    "The associated table '" + foreignTableName +
                    "' must be available in order to create the association");
            }
            foreignEnd.setParticipant(foreignParticipant);

            if (StringUtils.isNotEmpty(this.columnTaggedValue))
            {
                // add the tagged value for the foreign association end
                TaggedValue taggedValue = this.createTaggedValue(corePackage, this.columnTaggedValue, fkColumnName);
                if (taggedValue != null)
                {
                    foreignEnd.getTaggedValue().add(taggedValue);
                }
            }

            association.getConnection().add(foreignEnd);
            associations.add(association);

            if (logger.isInfoEnabled())
            {
                logger.info(
View Full Code Here

Examples of org.tinyuml.model.UmlAssociation

   * @param node1 the UmlNode 1
   * @param node2 the UmlNode 2
   * @return the UmlAssoication
   */
  private UmlAssociation createAssociationModel(UmlNode node1, UmlNode node2) {
    UmlAssociation association = (UmlAssociation)
      modelElementFactory.create(RelationType.DEPENDENCY);
    association.setElement1(node1.getModelElement());
    association.setElement2(node2.getModelElement());
    return association;
  }
View Full Code Here

Examples of org.tinyuml.model.UmlAssociation

  /**
   * {@inheritDoc}
   */
  public Connection createDependency(UmlNode sourceNode, UmlNode targetNode) {
    UmlAssociation association = (UmlAssociation)
      modelElementFactory.create(ElementType.DEPENDENCY);
    association.setSource(sourceNode.getModelElement());
    association.setTarget(targetNode.getModelElement());
    Connection connection = new Dependency(association);
    connection.setNode0(sourceNode);
    connection.setNode1(targetNode);
    return connection;
  }
View Full Code Here

Examples of org.tinyuml.model.UmlAssociation

  /**
   * {@inheritDoc}
   */
  public Association createAssociation(UmlNode node0, UmlNode node1) {
    UmlAssociation association = (UmlAssociation)
      modelElementFactory.create(ElementType.DEPENDENCY);
    association.setSource(node0.getModelElement());
    association.setTarget(node1.getModelElement());
    Association assoc = new Association(association);
    assoc.setNode0(node0);
    assoc.setNode1(node1);
    return assoc;
  }
View Full Code Here

Examples of org.tinyuml.model.UmlAssociation

 
  /**
   * Tests adding Connections.
   */
  public void testAddRemoveConnection() {
    UmlAssociation assoc = (UmlAssociation)
      UmlAssociation.getInstance().clone();
    Line2D line = new Line2D.Double();
    line.setLine(5.0, 5.0, 10.0, 5.0);
    Connection conn = new BaseConnection(assoc, line);
    diagram.addChild(conn);
View Full Code Here

Examples of org.tinyuml.model.UmlAssociation

 
  /**
   * Tests adding Connections.
   */
  public void testAddRemoveConnection() {
    UmlAssociation assoc = (UmlAssociation)
      UmlAssociation.getInstance().clone();
    Line2D line = new Line2D.Double();
    line.setLine(5.0, 5.0, 10.0, 5.0);
    Connection conn = new BaseConnection(assoc, line);
    diagram.addChild(conn);
View Full Code Here

Examples of org.tinyuml.model.UmlAssociation

   * @return the association element
   */
  private UmlAssociation createAssociation(RelationType associationType,
    Attributes attributes) {
    int id = Integer.valueOf(attributes.getValue("id"));
    UmlAssociation assoc = (UmlAssociation)
      elementFactory.create(associationType);
    assoc.setName(attributes.getValue("name"));
    int sourceId = Integer.valueOf(attributes.getValue("source"));
    int targetId = Integer.valueOf(attributes.getValue("target"));
    assoc.setElement1(elementMap.get(sourceId));
    assoc.setElement2(elementMap.get(targetId));
    elementMap.put(id, assoc);
    return assoc;
  }
View Full Code Here

Examples of org.tinyuml.model.UmlAssociation

  /**
   * Tests the run() method.
   */
  public void testRun() {
    UmlAssociation assoc = (UmlAssociation)
      UmlAssociation.getInstance().clone();
    mockFactory.expects(once()).method("create").
      with(eq(ElementType.DEPENDENCY)).will(returnValue(assoc));
    mockSourceNode.expects(once()).method("getModelElement").
      will(returnValue(source));
    mockTargetNode.expects(once()).method("getModelElement").
      will(returnValue(target));
    mockDiagram.expects(once()).method("addConnection");
    mockNotification.expects(once()).method("notifyElementAdded");
   
    command.run();
    Connection conn = command.getConnection();
    assertNotNull(conn);
    assertEquals(source, assoc.getSource());
    assertEquals(target, assoc.getTarget());
  }
View Full Code Here

Examples of org.tinyuml.model.UmlAssociation

   * @return the association element
   */
  private UmlAssociation createAssociation(ElementType elemType,
    Attributes attributes) {
    int id = Integer.valueOf(attributes.getValue("id"));
    UmlAssociation assoc = (UmlAssociation) elementFactory.create(elemType);
    assoc.setName(attributes.getValue("name"));
    int sourceId = Integer.valueOf(attributes.getValue("source"));
    int targetId = Integer.valueOf(attributes.getValue("target"));
    assoc.setSource(elementMap.get(sourceId));
    assoc.setTarget(elementMap.get(targetId));
    elementMap.put(id, assoc);
    return assoc;
  }
View Full Code Here

Examples of org.tinyuml.model.UmlAssociation

   * @return the association element
   */
  private UmlAssociation createAssociation(ElementType elemType,
    Attributes attributes) {
    int id = Integer.valueOf(attributes.getValue("id"));
    UmlAssociation assoc = (UmlAssociation) elementFactory.create(elemType);
    assoc.setName(attributes.getValue("name"));
    int sourceId = Integer.valueOf(attributes.getValue("source"));
    int targetId = Integer.valueOf(attributes.getValue("target"));
    assoc.setSource(elementMap.get(sourceId));
    assoc.setTarget(elementMap.get(targetId));
    elementMap.put(id, assoc);
    return assoc;
  }
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.