Java Code Examples for org.apache.olingo.odata2.api.edm.provider.Association#setName()
The following examples show how to use
org.apache.olingo.odata2.api.edm.provider.Association#setName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnnotationEdmProvider.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private Association createAssociation(final AnnotationHelper.AnnotatedNavInfo info) { Association association = new Association(); AssociationEnd fromEnd = new AssociationEnd(); fromEnd.setRole(info.getFromRoleName()); fromEnd.setType(new FullQualifiedName(namespace, info.getFromTypeName())); fromEnd.setMultiplicity(info.getFromMultiplicity()); association.setEnd1(fromEnd); AssociationEnd toEnd = new AssociationEnd(); toEnd.setRole(info.getToRoleName()); toEnd.setType(new FullQualifiedName(namespace, info.getToTypeName())); toEnd.setMultiplicity(info.getToMultiplicity()); association.setEnd2(toEnd); String associationName = info.getRelationshipName(); association.setName(associationName); return association; }
Example 2
Source File: JPAEdmAssociation.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private void copyAssociation(final Association copyToAssociation, final Association copyFromAssociation) { copyToAssociation.setEnd1(copyFromAssociation.getEnd1()); copyToAssociation.setEnd2(copyFromAssociation.getEnd2()); copyToAssociation.setName(copyFromAssociation.getName()); copyToAssociation.setAnnotationAttributes(copyFromAssociation.getAnnotationAttributes()); copyToAssociation.setAnnotationElements(copyFromAssociation.getAnnotationElements()); copyToAssociation.setDocumentation(copyFromAssociation.getDocumentation()); }
Example 3
Source File: JPAEdmNameBuilder.java From olingo-odata2 with Apache License 2.0 | 5 votes |
public static void build(final JPAEdmAssociationView view, final int count) { Association association = view.getEdmAssociation(); String associationName = null; String end1Name = association.getEnd1().getType().getName(); String end2Name = association.getEnd2().getType().getName(); associationName = end1Name + UNDERSCORE + end2Name; associationName = associationName + UNDERSCORE + multiplicityToString(association.getEnd1().getMultiplicity()) + UNDERSCORE + multiplicityToString(association.getEnd2().getMultiplicity()) + Integer.toString(count); association.setName(associationName); }
Example 4
Source File: EdmSchemaMock.java From olingo-odata2 with Apache License 2.0 | 5 votes |
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; }
Example 5
Source File: JPAEdmAssociationSetTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private List<Association> getEdmAssociationListLocal() { List<Association> associationList = new ArrayList<Association>(); Association association = new Association(); association.setName("Assoc_SalesOrderHeader_SalesOrderItem"); association.setEnd1(new AssociationEnd().setType(new FullQualifiedName("salesorderprocessing", "String")).setRole( "SalesOrderHeader")); association.setEnd2(new AssociationEnd().setType(new FullQualifiedName("salesorderprocessing", "SalesOrderItem")) .setRole("SalesOrderItem")); associationList.add(association); return associationList; }
Example 6
Source File: JPAEdmReferentialConstraintRoleTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override public Association getEdmAssociation() { Association association = new Association(); association.setName("Assoc_SalesOrderHeader_SalesOrderItem"); association.setEnd1(new AssociationEnd().setType(new FullQualifiedName("salesorderprocessing", "String")).setRole( "SalesOrderHeader")); association.setEnd2(new AssociationEnd().setType(new FullQualifiedName("salesorderprocessing", "SalesOrderItem")) .setRole("SalesOrderItem")); return association; }
Example 7
Source File: JPAEdmReferentialConstraintTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override public Association getEdmAssociation() { Association association = new Association(); association.setName("Assoc_SalesOrderHeader_SalesOrderItem"); association.setEnd1(new AssociationEnd().setType(new FullQualifiedName("salesorderprocessing", "String")).setRole( "SalesOrderHeader")); association.setEnd2(new AssociationEnd().setType(new FullQualifiedName("salesorderprocessing", "SalesOrderItem")) .setRole("SalesOrderItem")); return association; }
Example 8
Source File: JPAEdmNavigationPropertyTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override public Association getEdmAssociation() { Association association = new Association(); association.setName("Assoc_SalesOrderHeader_SalesOrderItem"); association.setEnd1(new AssociationEnd().setType( new FullQualifiedName("salesorderprocessing", "String")) .setRole("SalesOrderHeader")); association.setEnd2(new AssociationEnd() .setType( new FullQualifiedName("salesorderprocessing", "SalesOrderItem")).setRole("SalesOrderItem")); return association; }
Example 9
Source File: XmlMetadataConsumer.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private Association readAssociation(final XMLStreamReader reader) throws XMLStreamException, EntityProviderException { reader.require(XMLStreamConstants.START_ELEMENT, edmNamespace, XmlMetadataConstants.EDM_ASSOCIATION); Association association = new Association(); association.setName(reader.getAttributeValue(null, XmlMetadataConstants.EDM_NAME)); List<AssociationEnd> associationEnds = new ArrayList<AssociationEnd>(); List<AnnotationElement> annotationElements = new ArrayList<AnnotationElement>(); association.setAnnotationAttributes(readAnnotationAttribute(reader)); while (reader.hasNext() && !(reader.isEndElement() && edmNamespace.equals(reader.getNamespaceURI()) && XmlMetadataConstants.EDM_ASSOCIATION.equals(reader.getLocalName()))) { reader.next(); if (reader.isStartElement()) { extractNamespaces(reader); currentHandledStartTagName = reader.getLocalName(); if (XmlMetadataConstants.EDM_ASSOCIATION_END.equals(currentHandledStartTagName)) { associationEnds.add(readAssociationEnd(reader)); } else if (XmlMetadataConstants.EDM_ASSOCIATION_CONSTRAINT.equals(currentHandledStartTagName)) { association.setReferentialConstraint(readReferentialConstraint(reader)); } else { annotationElements.add(readAnnotationElement(reader)); } } } if (associationEnds.size() < 2 && associationEnds.size() > 2) { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("Count of association ends should be 2")); } if (!annotationElements.isEmpty()) { association.setAnnotationElements(annotationElements); } association.setEnd1(associationEnds.get(0)).setEnd2(associationEnds.get(1)); associationsMap.put(new FullQualifiedName(currentNamespace, association.getName()), association); return association; }
Example 10
Source File: UserEntitySet.java From DataHubSystem with GNU Affero General Public License v3.0 | 4 votes |
@Override public List<Association> getAssociations () { List<Association> associations = new ArrayList<Association> (); if (Security.currentUserHasRole(Role.SYSTEM_MANAGER, Role.STATISTICS)) { associations.add (new Association () .setName (ASSO_USER_CONNECTION.getName ()) .setEnd1 ( new AssociationEnd () .setType(Model.CONNECTION.getFullQualifiedName()) .setRole (ROLE_USER_CONNECTIONS) .setMultiplicity (EdmMultiplicity.MANY)) .setEnd2 ( new AssociationEnd ().setType (getFullQualifiedName ()) .setRole (ROLE_CONNECTION_USER) .setMultiplicity (EdmMultiplicity.ONE))); } // User restriction association Association user_restriction = new Association (); user_restriction.setName (ASSO_USER_RESTRICTION.getName ()); user_restriction.setEnd1 (new AssociationEnd () .setType(Model.RESTRICTION.getFullQualifiedName()) .setRole (ROLE_USER_RESTRICTIONS) .setMultiplicity (EdmMultiplicity.MANY)); user_restriction.setEnd2 (new AssociationEnd () .setType (getFullQualifiedName ()) .setRole (ROLE_RESTRICTION_USER) .setMultiplicity (EdmMultiplicity.ONE)); associations.add (user_restriction); // User system role association Association user_role = new Association (); user_role.setName (ASSO_USER_SYSTEMROLE.getName ()); user_role.setEnd1 (new AssociationEnd () .setType(Model.SYSTEM_ROLE.getFullQualifiedName()) .setRole (ROLE_USER_SYSTEMROLES) .setMultiplicity (EdmMultiplicity.MANY)); user_role.setEnd2 (new AssociationEnd () .setType (getFullQualifiedName ()) .setRole (ROLE_SYSTEMROLE_USER) .setMultiplicity (EdmMultiplicity.ONE)); associations.add (user_role); // User Product (cart) association Association user_prod = new Association(); user_prod.setName(ASSO_USER_PRODUCT.getName()); user_prod.setEnd1(new AssociationEnd() .setType(Model.PRODUCT.getFullQualifiedName()) .setRole(ROLE_USER_PRODUCTS) .setMultiplicity(EdmMultiplicity.MANY)); user_prod.setEnd2(new AssociationEnd() .setType(getFullQualifiedName()) .setRole(ROLE_PRODUCTS_USER) .setMultiplicity(EdmMultiplicity.MANY)); associations.add(user_prod); return associations; }