@Override public EdmAssociation getRelationship() throws EdmException { final FullQualifiedName relationship = navigationProperty.getRelationship(); return edm.getAssociation(relationship.getNamespace(), relationship.getName()); }
@Override public EdmAssociation getRelationship() throws EdmException { final FullQualifiedName relationship = navigationProperty.getRelationship(); return edm.getAssociation(relationship.getNamespace(), relationship.getName()); }
@Override public EdmAssociation getRelationship() throws EdmException { final FullQualifiedName relationship = navigationProperty.getRelationship(); return edm.getAssociation(relationship.getNamespace(), relationship.getName()); }
private void validateRelationship() throws EntityProviderException { for (NavigationProperty navProperty : navProperties) { if (associationsMap.containsKey(navProperty.getRelationship())) { Association assoc = associationsMap.get(navProperty.getRelationship()); if (!(assoc.getEnd1().getRole().equals(navProperty.getFromRole()) ^ assoc.getEnd1().getRole().equals(navProperty.getToRole()) && (assoc.getEnd2().getRole().equals(navProperty.getFromRole()) ^ assoc.getEnd2().getRole().equals( navProperty.getToRole())))) { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("Invalid end of association")); } if (!entityTypesMap.containsKey(assoc.getEnd1().getType())) { validateEntityTypeWithAlias(assoc.getEnd1().getType()); } if (!entityTypesMap.containsKey(assoc.getEnd2().getType())) { validateEntityTypeWithAlias(assoc.getEnd2().getType()); } } else { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT.addContent("Invalid Relationship")); } } }
private void validateRelationship() throws EntityProviderException { for (NavigationProperty navProperty : navProperties) { if (associationsMap.containsKey(navProperty.getRelationship())) { Association assoc = associationsMap.get(navProperty.getRelationship()); if (!(assoc.getEnd1().getRole().equals(navProperty.getFromRole()) ^ assoc.getEnd1().getRole().equals(navProperty.getToRole()) && (assoc.getEnd2().getRole().equals(navProperty.getFromRole()) ^ assoc.getEnd2().getRole().equals( navProperty.getToRole())))) { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("Invalid end of association")); } if (!entityTypesMap.containsKey(assoc.getEnd1().getType())) { validateEntityTypeWithAlias(assoc.getEnd1().getType()); } if (!entityTypesMap.containsKey(assoc.getEnd2().getType())) { validateEntityTypeWithAlias(assoc.getEnd2().getType()); } } else { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT.addContent("Invalid Relationship")); } } }
private void validateRelationship() throws EntityProviderException { for (NavigationProperty navProperty : navProperties) { if (associationsMap.containsKey(navProperty.getRelationship())) { Association assoc = associationsMap.get(navProperty.getRelationship()); if (!(assoc.getEnd1().getRole().equals(navProperty.getFromRole()) ^ assoc.getEnd1().getRole().equals(navProperty.getToRole()) && (assoc.getEnd2().getRole().equals(navProperty.getFromRole()) ^ assoc.getEnd2().getRole().equals( navProperty.getToRole())))) { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("Invalid end of association")); } if (!entityTypesMap.containsKey(assoc.getEnd1().getType())) { validateEntityTypeWithAlias(assoc.getEnd1().getType()); } if (!entityTypesMap.containsKey(assoc.getEnd2().getType())) { validateEntityTypeWithAlias(assoc.getEnd2().getType()); } } else { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT.addContent("Invalid Relationship")); } } }
if (navigationProperty.getRelationship().getName().toLowerCase().contains("many_many")) { manymany = true;
xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_NAME, navigationProperty.getName()); xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_NAVIGATION_RELATIONSHIP, navigationProperty .getRelationship().toString()); xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_NAVIGATION_FROM_ROLE, navigationProperty .getFromRole());
private Association createAssociation(final Field field, final NavigationProperty navProperty) { Association association = new Association(); EdmNavigationProperty navigation = field.getAnnotation(EdmNavigationProperty.class); AssociationEnd fromEnd = new AssociationEnd(); fromEnd.setRole(navProperty.getFromRole()); String typeName = ANNOTATION_HELPER.extractEntityTypeName(field.getDeclaringClass()); fromEnd.setType(new FullQualifiedName(namespace, typeName)); fromEnd.setMultiplicity(EdmMultiplicity.ONE); association.setEnd1(fromEnd); AssociationEnd toEnd = new AssociationEnd(); toEnd.setRole(navProperty.getToRole()); String toTypeName = ANNOTATION_HELPER.extractEntitTypeName(navigation, field); toEnd.setType(new FullQualifiedName(namespace, toTypeName)); toEnd.setMultiplicity(ANNOTATION_HELPER.getMultiplicity(navigation, field)); association.setEnd2(toEnd); String associationName = navProperty.getRelationship().getName(); association.setName(associationName); return association; }
.getNavigationProperties()) { property.setRelationship(new FullQualifiedName(targetSchema .getNamespace(), property.getRelationship().getName()));
xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_NAME, navigationProperty.getName()); xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_NAVIGATION_RELATIONSHIP, navigationProperty .getRelationship().toString()); xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_NAVIGATION_FROM_ROLE, navigationProperty .getFromRole());
xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_NAME, navigationProperty.getName()); xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_NAVIGATION_RELATIONSHIP, navigationProperty .getRelationship().toString()); xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_NAVIGATION_FROM_ROLE, navigationProperty .getFromRole());
consistentNavigationProperties = new ArrayList<NavigationProperty>(); for (NavigationProperty navigationProperty : navigationProperties) { if (existingAssociationList.contains(navigationProperty.getRelationship().getName())) { consistentNavigationProperties.add(navigationProperty);
consistentNavigationProperties = new ArrayList<NavigationProperty>(); for (NavigationProperty navigationProperty : navigationProperties) { if (existingAssociationList.contains(navigationProperty.getRelationship().getName())) { consistentNavigationProperties.add(navigationProperty);
private NavigationProperty clone(NavigationProperty property) { if (property == null) { return null; } NavigationProperty newProperty = new NavigationProperty(); newProperty.setAnnotationAttributes(property.getAnnotationAttributes()); newProperty.setAnnotationElements(property.getAnnotationElements()); newProperty.setDocumentation(property.getDocumentation()); newProperty.setFromRole(property.getFromRole()); newProperty.setMapping(property.getMapping()); newProperty.setName(property.getName()); newProperty.setRelationship(property.getRelationship()); newProperty.setToRole(property.getToRole()); return newProperty; }