@Override protected EdmTyped getPropertyInternal(final String name) throws EdmException { EdmTyped edmProperty = super.getPropertyInternal(name); if (edmProperty != null) { return edmProperty; } for (EdmNavigationProperty navigations : navigationProperties) { if (navigations.getName().equals(name)) { return navigations; } } return edmProperty; }
private void addNavigationSegment(EdmNavigationProperty property) { try { state = property.getMultiplicity() == EdmMultiplicity.MANY? SegmentType.NAVIGATION_TO_MANY: SegmentType.NAVIGATION_TO_ONE; segments.add(new Segment(state, property.getName())); } catch (EdmException e) { throw new RuntimeException("Unexpected EDM Exception: ", e);//NOSONAR } }
private boolean testNavPropertySegment( final EdmNavigationProperty navProperty, final EdmEntityType sourceEntityType, final EdmNavigationProperty navigationProperty) throws EdmException { if(navigationProperty.getFromRole().toLowerCase(Locale.ENGLISH).startsWith( sourceEntityType.getName().toLowerCase(Locale.ENGLISH))) { final String roleNum = navigationProperty.getFromRole().substring(sourceEntityType.getName().length()); if(roleNum.length() > 0) { try { Integer.parseInt(roleNum); } catch (NumberFormatException e) { return false; } } } return navProperty.getName().equals(navigationProperty.getName()); }
private EdmEntitySet getTargetEntitySetFromNavigation(UriInfoImpl uriInfoForRead, String navigationName) throws EdmException { EdmEntitySet entitySet = null; for(ArrayList<NavigationPropertySegment> expand : uriInfoForRead.getExpand()) { Iterator<NavigationPropertySegment> navigationIterator = expand.iterator(); while(navigationIterator.hasNext()) { NavigationPropertySegment navName = navigationIterator.next(); if(navigationName.equals(navName.getNavigationProperty().getName())) { entitySet = navName.getTargetEntitySet(); break; } } } return entitySet; }
static NavigationPropertyInfo create(final EdmNavigationProperty property) throws EdmException { NavigationPropertyInfo info = new NavigationPropertyInfo(); info.name = property.getName(); info.multiplicity = property.getMultiplicity(); return info; }
private String getRelationShipName(final EdmNavigationProperty navigationProperty) throws EdmException { EdmMapping mapping = navigationProperty.getMapping(); String relationShipName = null; if (mapping != null) { relationShipName = mapping.getInternalName(); } else { relationShipName = navigationProperty.getName(); } return relationShipName; }
private String getRelationShipName(final EdmNavigationProperty navigationProperty) throws EdmException { EdmMapping mapping = navigationProperty.getMapping(); String relationShipName = null; if (mapping != null) { relationShipName = mapping.getInternalName(); } else { relationShipName = navigationProperty.getName(); } return relationShipName; }
static NavigationPropertyInfo create(final EdmNavigationProperty property) throws EdmException { NavigationPropertyInfo info = new NavigationPropertyInfo(); info.name = property.getName(); info.multiplicity = property.getMultiplicity(); return info; }
private void mergeExpandTree(final ExpandSelectTreeNodeImpl root) throws EdmException { for (ArrayList<NavigationPropertySegment> singleExpand : initialExpand) { ExpandSelectTreeNodeImpl actualNode = root; for (NavigationPropertySegment navSegment : singleExpand) { actualNode = addExpandNode(actualNode, navSegment.getNavigationProperty().getName()); if (actualNode == null) { break; } } } }
static NavigationPropertyInfo create(final EdmNavigationProperty property) throws EdmException { NavigationPropertyInfo info = new NavigationPropertyInfo(); info.name = property.getName(); info.multiplicity = property.getMultiplicity(); return info; }
private void mergeExpandTree(final ExpandSelectTreeNodeImpl root) throws EdmException { for (ArrayList<NavigationPropertySegment> singleExpand : initialExpand) { ExpandSelectTreeNodeImpl actualNode = root; for (NavigationPropertySegment navSegment : singleExpand) { actualNode = addExpandNode(actualNode, navSegment.getNavigationProperty().getName()); if (actualNode == null) { break; } } } }
private String getRelationShipName(final EdmNavigationProperty navigationProperty) throws EdmException { EdmMapping mapping = navigationProperty.getMapping(); String relationShipName = null; if (mapping != null) { relationShipName = mapping.getInternalName(); } else { relationShipName = navigationProperty.getName(); } return relationShipName; }
private void mergeExpandTree(final ExpandSelectTreeNodeImpl root) throws EdmException { for (ArrayList<NavigationPropertySegment> singleExpand : initialExpand) { ExpandSelectTreeNodeImpl actualNode = root; for (NavigationPropertySegment navSegment : singleExpand) { actualNode = addExpandNode(actualNode, navSegment.getNavigationProperty().getName()); if (actualNode == null) { break; } } } }
private String getRelationShipName(final EdmNavigationProperty navigationProperty) throws EdmException { EdmMapping mapping = navigationProperty.getMapping(); String relationShipName = null; if (mapping != null) { relationShipName = mapping.getInternalName(); } else { relationShipName = navigationProperty.getName(); } return relationShipName; }
public Map<String, List<String>> getAllNavigationUUIDColumns(UriInfo uriInfo) throws EdmException{ Map<String, List<String>> navigationsUUIDs = new HashMap<>(); if(uriInfo.getEntityContainer() == null){ return navigationsUUIDs; } List<EdmEntitySet> entitySets = uriInfo.getEntityContainer().getEntitySets(); for(int i=0; i<entitySets.size(); i++){ EdmEntitySet entitySet = entitySets.get(i); EdmEntityType entityType = entitySet.getEntityType(); List<String> navigationProperties = entityType.getNavigationPropertyNames(); for(int j=0; j<navigationProperties.size(); j++){ EdmNavigationProperty navigationProperty = (EdmNavigationProperty) entityType.getProperty(navigationProperties.get(j)); EdmEntitySet navigatedEntitySet = entitySet.getRelatedEntitySet(navigationProperty); navigationsUUIDs.put(navigationProperty.getName(), this.getNavigationUUIDColumns(navigatedEntitySet)); } } return navigationsUUIDs; }
@Override public EdmEntitySet getRelatedEntitySet(final EdmNavigationProperty navigationProperty) throws EdmException { EdmAssociationSet associationSet = edmEntityContainer.getAssociationSet(edmEntityContainer.getEntitySet(name), navigationProperty); if(associationSet == null){ return null; } EdmAssociationSetEnd toEnd = associationSet.getEnd(navigationProperty.getToRole()); if (toEnd == null) { throw new EdmException(EdmException.NAVIGATIONPROPERTYNOTFOUND,navigationProperty.getName()); } EdmEntitySet targetEntitySet = toEnd.getEntitySet(); if (targetEntitySet == null) { throw new EdmException(EdmException.NAVIGATIONPROPERTYNOTFOUND,navigationProperty.getName()); } return targetEntitySet; }
private EdmEntitySet getTargetEntitySet(Edm edm, EdmEntitySet srcEtySet, EdmNavigationProperty navigationProp) throws EdmException, ODataException{ //Look for Target EntitySet Type based on Navigation Property --> Association --> AssociationSet EdmAssociationSet associationSet = null; associationSet = edm.getDefaultEntityContainer().getAssociationSet(srcEtySet, navigationProp ); if(associationSet == null){ throw new ODataException( ODataExceptionType.METADATA_PARSING_FAILED, "The association, referred by the navigation property "+ navigationProp.getName() + ", is not contained in an association set."); } EdmAssociationSetEnd end = null; if(navigationProp!= null){ end = associationSet.getEnd(navigationProp.getToRole()) ; return end.getEntitySet() ; } return null; } private String handleNavigation(String completeUrl, EdmEntityType entityType) throws EdmException, ODataException {
private void createSelectTree(final ExpandSelectTreeNodeImpl root) throws EdmException { for (SelectItem item : initialSelect) { ExpandSelectTreeNodeImpl actualNode = root; for (NavigationPropertySegment navSegement : item.getNavigationPropertySegments()) { actualNode = addSelectNode(actualNode, navSegement.getNavigationProperty().getName()); } if (item.getProperty() != null) { actualNode.addProperty(item.getProperty()); } else if (item.isStar()) { actualNode.setAllExplicitly(); } else { // The actual node is a navigation property and has no property or star so it is explicitly selected actualNode.setExplicitlySelected(); } } }
private void createSelectTree(final ExpandSelectTreeNodeImpl root) throws EdmException { for (SelectItem item : initialSelect) { ExpandSelectTreeNodeImpl actualNode = root; for (NavigationPropertySegment navSegement : item.getNavigationPropertySegments()) { actualNode = addSelectNode(actualNode, navSegement.getNavigationProperty().getName()); } if (item.getProperty() != null) { actualNode.addProperty(item.getProperty()); } else if (item.isStar()) { actualNode.setAllExplicitly(); } else { // The actual node is a navigation property and has no property or star so it is explicitly selected actualNode.setExplicitlySelected(); } } }
private void createSelectTree(final ExpandSelectTreeNodeImpl root) throws EdmException { for (SelectItem item : initialSelect) { ExpandSelectTreeNodeImpl actualNode = root; for (NavigationPropertySegment navSegement : item.getNavigationPropertySegments()) { actualNode = addSelectNode(actualNode, navSegement.getNavigationProperty().getName()); } if (item.getProperty() != null) { actualNode.addProperty(item.getProperty()); } else if (item.isStar()) { actualNode.setAllExplicitly(); } else { // The actual node is a navigation property and has no property or star so it is explicitly selected actualNode.setExplicitlySelected(); } } }