.addContent(XmlMetadataConstants.EDM_TYPE).addContent(XmlMetadataConstants.EDM_ASSOCIATION_END)); associationEnd.setType(extractFQName(type)); associationEnd.setAnnotationAttributes(readAnnotationAttribute(reader)); while (reader.hasNext() && !(reader.isEndElement() && edmNamespace.equals(reader.getNamespaceURI())
.addContent(XmlMetadataConstants.EDM_TYPE).addContent(XmlMetadataConstants.EDM_ASSOCIATION_END)); associationEnd.setType(extractFQName(type)); associationEnd.setAnnotationAttributes(readAnnotationAttribute(reader)); while (reader.hasNext() && !(reader.isEndElement() && edmNamespace.equals(reader.getNamespaceURI())
.addContent(XmlMetadataConstants.EDM_TYPE).addContent(XmlMetadataConstants.EDM_ASSOCIATION_END)); associationEnd.setType(extractFQName(type)); associationEnd.setAnnotationAttributes(readAnnotationAttribute(reader)); while (reader.hasNext() && !(reader.isEndElement() && edmNamespace.equals(reader.getNamespaceURI())
private void includeAssociation(Schema targetSchema, IServiceInfo service, Association sourceAssociation) throws ODataException { List<Association> associations = targetSchema.getAssociations(); if (associations != null) { for (Association type : associations) { if (type.getName().equals(sourceAssociation.getName())) { throw new ODataException("association " + sourceAssociation.getName() + " already defined"); } } } else { associations = new ArrayList<Association>(); } Association newAssociation = clone(sourceAssociation); newAssociation.getEnd1().setType( new FullQualifiedName(targetSchema.getNamespace(), newAssociation.getEnd1().getType().getName())); newAssociation.getEnd2().setType( new FullQualifiedName(targetSchema.getNamespace(), newAssociation.getEnd2().getType().getName())); associations.add(newAssociation); targetSchema.setAssociations(associations); }
public static void build(final JPAEdmAssociationEndView assocaitionEndView, final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView) { String namespace = buildNamespace(assocaitionEndView); String name = entityTypeView.getEdmEntityType().getName(); FullQualifiedName fQName = new FullQualifiedName(namespace, name); assocaitionEndView.getEdmAssociationEnd1().setType(fQName); name = null; String jpaEntityTypeName = null; Attribute<?, ?> jpaAttribute = propertyView.getJPAAttribute(); if (jpaAttribute.isCollection()) { jpaEntityTypeName = ((PluralAttribute<?, ?, ?>) jpaAttribute).getElementType().getJavaType() .getSimpleName(); } else { jpaEntityTypeName = propertyView.getJPAAttribute().getJavaType() .getSimpleName(); } JPAEdmMappingModelAccess mappingModelAccess = assocaitionEndView.getJPAEdmMappingModelAccess(); if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) { name = mappingModelAccess.mapJPAEntityType(jpaEntityTypeName); } if (name == null) { name = jpaEntityTypeName; } fQName = new FullQualifiedName(namespace, name); assocaitionEndView.getEdmAssociationEnd2().setType(fQName); }
public static void build(final JPAEdmAssociationEndView assocaitionEndView, final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView) { String namespace = buildNamespace(assocaitionEndView); String name = entityTypeView.getEdmEntityType().getName(); FullQualifiedName fQName = new FullQualifiedName(namespace, name); assocaitionEndView.getEdmAssociationEnd1().setType(fQName); name = null; String jpaEntityTypeName = null; Attribute<?, ?> jpaAttribute = propertyView.getJPAAttribute(); if (jpaAttribute.isCollection()) { jpaEntityTypeName = ((PluralAttribute<?, ?, ?>) jpaAttribute).getElementType().getJavaType() .getSimpleName(); } else { jpaEntityTypeName = propertyView.getJPAAttribute().getJavaType() .getSimpleName(); } JPAEdmMappingModelAccess mappingModelAccess = assocaitionEndView.getJPAEdmMappingModelAccess(); if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) { name = mappingModelAccess.mapJPAEntityType(jpaEntityTypeName); } if (name == null) { name = jpaEntityTypeName; } fQName = new FullQualifiedName(namespace, name); assocaitionEndView.getEdmAssociationEnd2().setType(fQName); }
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; }
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; }
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; }