private AssociationSetEnd clone(AssociationSetEnd setEnd) { if (setEnd == null) { return null; } AssociationSetEnd newSetEnd = new AssociationSetEnd(); newSetEnd.setAnnotationAttributes(setEnd.getAnnotationAttributes()); newSetEnd.setAnnotationElements(setEnd.getAnnotationElements()); newSetEnd.setDocumentation(setEnd.getDocumentation()); newSetEnd.setEntitySet(setEnd.getEntitySet()); newSetEnd.setRole(setEnd.getRole()); return newSetEnd; }
@Override public EdmAnnotations getAnnotations() throws EdmException { if (annotations == null) { annotations = new EdmAnnotationsImplProv(end.getAnnotationAttributes(), end.getAnnotationElements()); } return annotations; } }
private static void writeAssociationSetEnd(final AssociationSetEnd end, final Map<String, String> predefinedNamespaces, final XMLStreamWriter xmlStreamWriter) throws XMLStreamException { xmlStreamWriter.writeStartElement(XmlMetadataConstants.EDM_ASSOCIATION_END); xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_ENTITY_SET, end.getEntitySet().toString()); if (end.getRole() != null) { xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_ROLE, end.getRole()); } writeAnnotationAttributes(end.getAnnotationAttributes(), predefinedNamespaces, null, xmlStreamWriter); writeDocumentation(end.getDocumentation(), predefinedNamespaces, xmlStreamWriter); writeAnnotationElements(end.getAnnotationElements(), predefinedNamespaces, xmlStreamWriter); xmlStreamWriter.writeEndElement(); }
public void addAssociationSets(final Collection<Association> associations) throws ODataException { for (Association association : associations) { AssociationSet as = new AssociationSet(); as.setName(association.getName()); FullQualifiedName asAssociationFqn = new FullQualifiedName(namespace, association.getName()); as.setAssociation(asAssociationFqn); AssociationSetEnd asEnd1 = new AssociationSetEnd(); asEnd1.setEntitySet(getEntitySetName(association.getEnd1())); asEnd1.setRole(association.getEnd1().getRole()); as.setEnd1(asEnd1); AssociationSetEnd asEnd2 = new AssociationSetEnd(); asEnd2.setEntitySet(getEntitySetName(association.getEnd2())); asEnd2.setRole(association.getEnd2().getRole()); as.setEnd2(asEnd2); associationSets.add(as); } }
@Override public AssociationSet getAssociationSet(final String entityContainer, final FullQualifiedName association, final String sourceEntitySetName, final String sourceEntitySetRole) throws ODataException { EntityContainer container = name2Container.get(entityContainer); if (container != null) { List<AssociationSet> associations = container.getAssociationSets(); for (AssociationSet associationSet : associations) { if (associationSet.getAssociation().equals(association)) { final AssociationSetEnd endOne = associationSet.getEnd1(); if (endOne.getRole().equals(sourceEntitySetRole) && endOne.getEntitySet().equals(sourceEntitySetName)) { return associationSet; } final AssociationSetEnd endTwo = associationSet.getEnd2(); if (endTwo.getRole().equals(sourceEntitySetRole) && endTwo.getEntitySet().equals(sourceEntitySetName)) { return associationSet; } } } } return null; }
public EdmAssociationSetEndImplProv(final AssociationSetEnd end, final EdmEntitySet entitySet) throws EdmException { this.end = end; this.entitySet = entitySet; role = end.getRole(); }
private void validateAssociation() throws EntityProviderException { for (Map.Entry<FullQualifiedName, EntityContainer> container : containerMap.entrySet()) { for (AssociationSet associationSet : container.getValue().getAssociationSets()) { FullQualifiedName association = associationSet.getAssociation(); if (associationsMap.containsKey(association)) { validateAssociationEnd(associationSet.getEnd1(), associationsMap.get(association)); validateAssociationEnd(associationSet.getEnd2(), associationsMap.get(association)); boolean end1 = false; boolean end2 = false; for (EntitySet entitySet : container.getValue().getEntitySets()) { if (entitySet.getName().equals(associationSet.getEnd1().getEntitySet())) { end1 = true; } if (entitySet.getName().equals(associationSet.getEnd2().getEntitySet())) { end2 = true; } } if (!(end1 && end2)) { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("Invalid AssociationSet")); } } else { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("Invalid AssociationSet")); } } } }
associationName)); AssociationSetEnd end1 = new AssociationSetEnd(); end1.setEntitySet(sourceEntitySetName); end1.setRole(sourceRoleName); set.setEnd1(end1); AssociationSetEnd end2 = new AssociationSetEnd(); end2.setEntitySet(targetEntitySetName); end2.setRole(targetRoleName); set.setEnd2(end2);
@Override public AssociationSet getAssociationSet(final String entityContainer, final FullQualifiedName association, final String sourceEntitySetName, final String sourceEntitySetRole) throws ODataException { EntityContainer container = name2Container.get(entityContainer); if (container != null) { List<AssociationSet> associations = container.getAssociationSets(); for (AssociationSet associationSet : associations) { if (associationSet.getAssociation().equals(association)) { final AssociationSetEnd endOne = associationSet.getEnd1(); if (endOne.getRole().equals(sourceEntitySetRole) && endOne.getEntitySet().equals(sourceEntitySetName)) { return associationSet; } final AssociationSetEnd endTwo = associationSet.getEnd2(); if (endTwo.getRole().equals(sourceEntitySetRole) && endTwo.getEntitySet().equals(sourceEntitySetName)) { return associationSet; } } } } return null; }
private static void writeAssociationSetEnd(final AssociationSetEnd end, final Map<String, String> predefinedNamespaces, final XMLStreamWriter xmlStreamWriter) throws XMLStreamException { xmlStreamWriter.writeStartElement(XmlMetadataConstants.EDM_ASSOCIATION_END); xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_ENTITY_SET, end.getEntitySet().toString()); if (end.getRole() != null) { xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_ROLE, end.getRole()); } writeAnnotationAttributes(end.getAnnotationAttributes(), predefinedNamespaces, null, xmlStreamWriter); writeDocumentation(end.getDocumentation(), predefinedNamespaces, xmlStreamWriter); writeAnnotationElements(end.getAnnotationElements(), predefinedNamespaces, xmlStreamWriter); xmlStreamWriter.writeEndElement(); }
public EdmAssociationSetEndImplProv(final AssociationSetEnd end, final EdmEntitySet entitySet) throws EdmException { this.end = end; this.entitySet = entitySet; role = end.getRole(); }
private void validateAssociation() throws EntityProviderException { for (Map.Entry<FullQualifiedName, EntityContainer> container : containerMap.entrySet()) { for (AssociationSet associationSet : container.getValue().getAssociationSets()) { FullQualifiedName association = associationSet.getAssociation(); if (associationsMap.containsKey(association)) { validateAssociationEnd(associationSet.getEnd1(), associationsMap.get(association)); validateAssociationEnd(associationSet.getEnd2(), associationsMap.get(association)); boolean end1 = false; boolean end2 = false; for (EntitySet entitySet : container.getValue().getEntitySets()) { if (entitySet.getName().equals(associationSet.getEnd1().getEntitySet())) { end1 = true; } if (entitySet.getName().equals(associationSet.getEnd2().getEntitySet())) { end2 = true; } } if (!(end1 && end2)) { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("Invalid AssociationSet")); } } else { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("Invalid AssociationSet")); } } } }
@Override public EdmAnnotations getAnnotations() throws EdmException { if (annotations == null) { annotations = new EdmAnnotationsImplProv(end.getAnnotationAttributes(), end.getAnnotationElements()); } return annotations; } }
public void addAssociationSets(final Collection<Association> associations) throws ODataException { for (Association association : associations) { AssociationSet as = new AssociationSet(); as.setName(association.getName()); FullQualifiedName asAssociationFqn = new FullQualifiedName(namespace, association.getName()); as.setAssociation(asAssociationFqn); AssociationSetEnd asEnd1 = new AssociationSetEnd(); asEnd1.setEntitySet(getEntitySetName(association.getEnd1())); asEnd1.setRole(association.getEnd1().getRole()); as.setEnd1(asEnd1); AssociationSetEnd asEnd2 = new AssociationSetEnd(); asEnd2.setEntitySet(getEntitySetName(association.getEnd2())); asEnd2.setRole(association.getEnd2().getRole()); as.setEnd2(asEnd2); associationSets.add(as); } }
@Override public AssociationSet getAssociationSet(final String entityContainer, final FullQualifiedName association, final String sourceEntitySetName, final String sourceEntitySetRole) throws ODataException { EntityContainer container = name2Container.get(entityContainer); if (container != null) { List<AssociationSet> associations = container.getAssociationSets(); for (AssociationSet associationSet : associations) { if (associationSet.getAssociation().equals(association)) { final AssociationSetEnd endOne = associationSet.getEnd1(); if (endOne.getRole().equals(sourceEntitySetRole) && endOne.getEntitySet().equals(sourceEntitySetName)) { return associationSet; } final AssociationSetEnd endTwo = associationSet.getEnd2(); if (endTwo.getRole().equals(sourceEntitySetRole) && endTwo.getEntitySet().equals(sourceEntitySetName)) { return associationSet; } } } } return null; }
private static void writeAssociationSetEnd(final AssociationSetEnd end, final Map<String, String> predefinedNamespaces, final XMLStreamWriter xmlStreamWriter) throws XMLStreamException { xmlStreamWriter.writeStartElement(XmlMetadataConstants.EDM_ASSOCIATION_END); xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_ENTITY_SET, end.getEntitySet().toString()); if (end.getRole() != null) { xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_ROLE, end.getRole()); } writeAnnotationAttributes(end.getAnnotationAttributes(), predefinedNamespaces, null, xmlStreamWriter); writeDocumentation(end.getDocumentation(), predefinedNamespaces, xmlStreamWriter); writeAnnotationElements(end.getAnnotationElements(), predefinedNamespaces, xmlStreamWriter); xmlStreamWriter.writeEndElement(); }
public EdmAssociationSetEndImplProv(final AssociationSetEnd end, final EdmEntitySet entitySet) throws EdmException { this.end = end; this.entitySet = entitySet; role = end.getRole(); }
private void validateAssociation() throws EntityProviderException { for (Map.Entry<FullQualifiedName, EntityContainer> container : containerMap.entrySet()) { for (AssociationSet associationSet : container.getValue().getAssociationSets()) { FullQualifiedName association = associationSet.getAssociation(); if (associationsMap.containsKey(association)) { validateAssociationEnd(associationSet.getEnd1(), associationsMap.get(association)); validateAssociationEnd(associationSet.getEnd2(), associationsMap.get(association)); boolean end1 = false; boolean end2 = false; for (EntitySet entitySet : container.getValue().getEntitySets()) { if (entitySet.getName().equals(associationSet.getEnd1().getEntitySet())) { end1 = true; } if (entitySet.getName().equals(associationSet.getEnd2().getEntitySet())) { end2 = true; } } if (!(end1 && end2)) { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("Invalid AssociationSet")); } } else { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("Invalid AssociationSet")); } } } }
@Override public EdmAnnotations getAnnotations() throws EdmException { if (annotations == null) { annotations = new EdmAnnotationsImplProv(end.getAnnotationAttributes(), end.getAnnotationElements()); } return annotations; } }
public void addAssociationSets(final Collection<Association> associations) { for (Association association : associations) { AssociationSet as = new AssociationSet(); as.setName(association.getName()); FullQualifiedName asAssociationFqn = new FullQualifiedName(namespace, association.getName()); as.setAssociation(asAssociationFqn); AssociationSetEnd asEnd1 = new AssociationSetEnd(); asEnd1.setEntitySet(getEntitySetName(association.getEnd1())); asEnd1.setRole(association.getEnd1().getRole()); as.setEnd1(asEnd1); AssociationSetEnd asEnd2 = new AssociationSetEnd(); asEnd2.setEntitySet(getEntitySetName(association.getEnd2())); asEnd2.setRole(association.getEnd2().getRole()); as.setEnd2(asEnd2); associationSets.add(as); } }