Examples of AssociationEnd


Examples of org.apache.olingo.odata2.api.edm.provider.AssociationEnd

    assertTrue(objJPAEdmAssociationEnd.isConsistent());

  }

  private AssociationEnd getAssociationEnd(final String typeName, final int variant) {
    AssociationEnd associationEnd = new AssociationEnd();
    associationEnd.setType(getFullQualifiedName(typeName));
    if (variant == VARIANT1) {
      associationEnd.setMultiplicity(EdmMultiplicity.MANY);
    } else if (variant == VARIANT2) {
      associationEnd.setMultiplicity(EdmMultiplicity.ONE);
    } else if (variant == VARIANT3) {
      associationEnd.setMultiplicity(EdmMultiplicity.ZERO_TO_ONE);
    } else {
      associationEnd.setMultiplicity(EdmMultiplicity.MANY);//
    }
    return associationEnd;
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.provider.AssociationEnd

  public static void getEdmEntityContainerImpl() throws Exception {

    edmProvider = mock(EdmProvider.class);
    EdmImplProv edmImplProv = new EdmImplProv(edmProvider);

    AssociationEnd end1 =
        new AssociationEnd().setRole("end1Role").setMultiplicity(EdmMultiplicity.ONE).setType(
            EdmSimpleTypeKind.String.getFullQualifiedName());

    associationEndProv = new EdmAssociationEndImplProv(edmImplProv, end1);
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.provider.AssociationEnd

    @Override
    public void build() throws ODataJPAModelException {

      JoinColumn joinColumn = null;

      currentAssociationEnd1 = new AssociationEnd();
      currentAssociationEnd2 = new AssociationEnd();

      JPAEdmNameBuilder.build(JPAEdmAssociationEnd.this, entityTypeView, propertyView);

      currentAssociationEnd1.setRole(currentAssociationEnd1.getType().getName());
      currentAssociationEnd2.setRole(currentAssociationEnd2.getType().getName());
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.provider.AssociationEnd

    EdmImplProv edmImplProv = new EdmImplProv(edmProvider);

    EntityContainerInfo entityContainer = new EntityContainerInfo().setName("Container");
    EdmEntityContainer edmEntityContainer = new EdmEntityContainerImplProv(edmImplProv, entityContainer);

    AssociationEnd end1 =
        new AssociationEnd().setRole("end1Role").setMultiplicity(EdmMultiplicity.ONE).setType(
            EdmSimpleTypeKind.String.getFullQualifiedName());
    AssociationEnd end2 =
        new AssociationEnd().setRole("end2Role").setMultiplicity(EdmMultiplicity.ONE).setType(
            EdmSimpleTypeKind.String.getFullQualifiedName());
    Association association = new Association().setName("association").setEnd1(end1).setEnd2(end2);
    FullQualifiedName assocName = new FullQualifiedName("namespace", "association");
    when(edmProvider.getAssociation(assocName)).thenReturn(association);
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.provider.AssociationEnd

            assertEquals(ASSOCIATION, navProperty.getRelationship().getName());
          }
        }
      }
      for (Association association : schema.getAssociations()) {
        AssociationEnd end;
        assertEquals(ASSOCIATION, association.getName());
        if ("Employee".equals(association.getEnd1().getType().getName())) {
          end = association.getEnd1();
        } else {
          end = association.getEnd2();
        }
        assertEquals(EdmMultiplicity.MANY, end.getMultiplicity());
        assertEquals("r_Employees", end.getRole());
        assertEquals(EdmAction.Cascade, end.getOnDelete().getAction());
      }
    }
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.provider.AssociationEnd

  private static List<Association> createAssociations() {
    List<Association> associations = new ArrayList<Association>();
    Association association = new Association();
    association.setName(ASSOCIATION_NAME);
    association.setEnd1(new AssociationEnd().setMultiplicity(EdmMultiplicity.ONE).setRole(ASSOCIATION_ROLE_NAME_ONE)
        .setType(new FullQualifiedName(NAMESPACE, ENTITY_NAME_ONE)));
    association.setEnd2(new AssociationEnd().setMultiplicity(EdmMultiplicity.MANY).setRole(ASSOCIATION_ROLE_NAME_TWO)
        .setType(new FullQualifiedName(NAMESPACE, ENTITY_NAME_TWO)));
    associations.add(association);
    return associations;
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.provider.AssociationEnd

  @Override
  public Association getAssociation(final FullQualifiedName edmFQName) throws ODataMessageException {
    if (NAMESPACE_1.equals(edmFQName.getNamespace())) {
      if (ASSOCIATION_ET1_ET2.getName().equals(edmFQName.getName())) {
        final AssociationEnd end1 =
            new AssociationEnd().setMultiplicity(EdmMultiplicity.ONE).setRole(ROLE_1).setType(ET_KEY_IS_STRING);
        final AssociationEnd end2 =
            new AssociationEnd().setMultiplicity(EdmMultiplicity.ONE).setRole(ROLE_2).setType(ET_KEY_IS_INTEGER);
        return new Association().setName("Association").setEnd1(end1).setEnd2(end2);
      }
    }

    return null;
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.provider.AssociationEnd

    return EdmTypeKind.ASSOCIATION;
  }

  @Override
  public EdmAssociationEnd getEnd(final String role) throws EdmException {
    AssociationEnd end = association.getEnd1();
    if (end.getRole().equals(role)) {
      return new EdmAssociationEndImplProv(edm, end);
    }
    end = association.getEnd2();
    if (end.getRole().equals(role)) {
      return new EdmAssociationEndImplProv(edm, end);
    }

    return null;
  }
View Full Code Here

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

            }

            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(
                    "adding association: '" + primaryEnd.getParticipant().getName() + " <--> " +
                    foreignEnd.getParticipant().getName() + "'");
            }
        }
        DbUtils.closeQuietly(columnRs);
        return associations;
    }
View Full Code Here

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

    protected Object handleGetOtherEnd()
    {
        final Collection ends = metaObject.getAssociation().getConnection();
        for (final Iterator endIt = ends.iterator(); endIt.hasNext();)
        {
            final AssociationEnd end = (AssociationEnd)endIt.next();
            if (!metaObject.equals(end))
            {
                return end;
            }
        }
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.