@Override public String getSegmentValue() { return navigationProperty.getName(); } }
@Override public String getSegmentValue() { return navigationProperty.getName(); } }
private static List<List<String>> getComplexSelectedPaths(EdmNavigationProperty edmProperty) { List<List<String>> result = new ArrayList<List<String>>(); List<String> path = new LinkedList<String>(); path.add(edmProperty.getName()); result.add(path); return result; }
private static List<List<String>> getComplexSelectedPaths(EdmNavigationProperty edmProperty) { List<List<String>> result = new ArrayList<List<String>>(); List<String> path = new LinkedList<String>(); path.add(edmProperty.getName()); result.add(path); return result; }
/** * Check if jsonNode is not null or if null but nullable or collection navigationProperty * * @param jsonNode related json node * @param edmNavigationProperty related navigation property * @throws DeserializerException if jsonNode is not null or if null but nullable or collection navigationProperty */ private void checkNotNullOrValidNull(final JsonNode jsonNode, final EdmNavigationProperty edmNavigationProperty) throws DeserializerException { boolean isNullable = edmNavigationProperty.isNullable(); if ((jsonNode.isNull() && !isNullable) || (jsonNode.isNull() && edmNavigationProperty.isCollection())) { throw new DeserializerException("Property: " + edmNavigationProperty.getName() + " must not be null.", MessageKeys.INVALID_NULL_PROPERTY, edmNavigationProperty.getName()); } }
/** * Check if jsonNode is not null or if null but nullable or collection navigationProperty * * @param jsonNode related json node * @param edmNavigationProperty related navigation property * @throws DeserializerException if jsonNode is not null or if null but nullable or collection navigationProperty */ private void checkNotNullOrValidNull(final JsonNode jsonNode, final EdmNavigationProperty edmNavigationProperty) throws DeserializerException { boolean isNullable = edmNavigationProperty.isNullable(); if ((jsonNode.isNull() && !isNullable) || (jsonNode.isNull() && edmNavigationProperty.isCollection())) { throw new DeserializerException("Property: " + edmNavigationProperty.getName() + " must not be null.", MessageKeys.INVALID_NULL_PROPERTY, edmNavigationProperty.getName()); } }
public static Set<String> getExpandedPropertyNames(final List<ExpandItem> expandItems) throws SerializerException { Set<String> expanded = new HashSet<String>(); for (final ExpandItem item : expandItems) { final List<UriResource> resourceParts = item.getResourcePath().getUriResourceParts(); final UriResource resource = resourceParts.get(0); if (resource instanceof UriResourceNavigation) { expanded.add(((UriResourceNavigation) resource).getProperty().getName()); } } return expanded; }
public static Set<String> getExpandedPropertyNames(final List<ExpandItem> expandItems) throws SerializerException { Set<String> expanded = new HashSet<String>(); for (final ExpandItem item : expandItems) { final List<UriResource> resourceParts = item.getResourcePath().getUriResourceParts(); final UriResource resource = resourceParts.get(0); if (resource instanceof UriResourceNavigation) { expanded.add(((UriResourceNavigation) resource).getProperty().getName()); } } return expanded; }
/** * Check if jsonNode is not null or if null but nullable or collection * navigationProperty * * @param jsonNode * related json node * @param edmNavigationProperty * related navigation property * @throws DeserializerException * if jsonNode is not null or if null but nullable or collection * navigationProperty */ private void checkNotNullOrValidNull(final JsonNode jsonNode, final EdmNavigationProperty edmNavigationProperty) throws DeserializerException { boolean isNullable = edmNavigationProperty.isNullable(); if ((jsonNode.isNull() && !isNullable) || (jsonNode.isNull() && edmNavigationProperty.isCollection())) { throw new DeserializerException("Property: " + edmNavigationProperty.getName() + " must not be null.", MessageKeys.INVALID_NULL_PROPERTY, edmNavigationProperty.getName()); } }
/** * @param propertyName * @param item * @param matched * @param resource */ private static ExpandItem getMatchedExpandItem(final String propertyName, final ExpandItem item, boolean matched, UriResource resource) { if (matched && ((resource instanceof UriResourceNavigation && propertyName.equals(((UriResourceNavigation) resource).getProperty().getName())) || resource instanceof UriResourceProperty && propertyName.equals(((UriResourceProperty) resource).getProperty().getName()))) { return item; } return null; }
/** * @param propertyName * @param item * @param matched * @param resource */ private static ExpandItem getMatchedExpandItem(final String propertyName, final ExpandItem item, boolean matched, UriResource resource) { if (matched && ((resource instanceof UriResourceNavigation && propertyName.equals(((UriResourceNavigation) resource).getProperty().getName())) || resource instanceof UriResourceProperty && propertyName.equals(((UriResourceProperty) resource).getProperty().getName()))) { return item; } return null; }
public static ExpandItem getExpandItem(final List<ExpandItem> expandItems, final String propertyName) { for (final ExpandItem item : expandItems) { if (item.isStar()) { continue; } final List<UriResource> resourceParts = item.getResourcePath().getUriResourceParts(); UriResource resource = null; if (resourceParts.get(resourceParts.size() - 1) instanceof UriResourceRef || resourceParts.get(resourceParts.size() - 1) instanceof UriResourceCount) { resource = resourceParts.get(resourceParts.size() - 2); } else { resource = resourceParts.get(resourceParts.size() - 1); } if ((resource instanceof UriResourceNavigation && propertyName.equals(((UriResourceNavigation) resource).getProperty().getName())) || resource instanceof UriResourceProperty && propertyName.equals(((UriResourceProperty) resource).getProperty().getName())) { return item; } } return null; }
@Override public ExpandTreeBuilder expand(final EdmNavigationProperty edmNavigationProperty) { if (expandOption == null) { expandOption = new ExpandOptionImpl(); if(parentItem != null && parentItem.getExpandOption() == null){ parentItem.setSystemQueryOption(expandOption); } } ExpandTreeBuilder builder = childBuilderCache.get(edmNavigationProperty.getName()); if(builder == null){ ExpandItemImpl expandItem = buildExpandItem(edmNavigationProperty); expandOption.addExpandItem(expandItem); builder = new ExpandTreeBuilderImpl(expandItem); childBuilderCache.put(edmNavigationProperty.getName(), builder); } return builder; }
@Override public ExpandTreeBuilder expand(final EdmNavigationProperty edmNavigationProperty) { if (expandOption == null) { expandOption = new ExpandOptionImpl(); if(parentItem != null && parentItem.getExpandOption() == null){ parentItem.setSystemQueryOption(expandOption); } } ExpandTreeBuilder builder = childBuilderCache.get(edmNavigationProperty.getName()); if(builder == null){ ExpandItemImpl expandItem = buildExpandItem(edmNavigationProperty); expandOption.addExpandItem(expandItem); builder = new ExpandTreeBuilderImpl(expandItem); childBuilderCache.put(edmNavigationProperty.getName(), builder); } return builder; }
private EdmBindingTarget getEntitySetFromNavigation(final EdmBindingTarget lastFoundEntitySetOrSingleton, final UriResourceNavigation uriResourceNavigation) { if (lastFoundEntitySetOrSingleton != null && !uriResourceNavigation.isCollection()) { EdmNavigationProperty navProp = uriResourceNavigation.getProperty(); return lastFoundEntitySetOrSingleton.getRelatedBindingTarget(navProp.getName()); } return null; } }
private EdmBindingTarget getEntitySetFromNavigation(final EdmBindingTarget lastFoundEntitySetOrSingleton, final UriResourceNavigation uriResourceNavigation) { if (lastFoundEntitySetOrSingleton != null && !uriResourceNavigation.isCollection()) { EdmNavigationProperty navProp = uriResourceNavigation.getProperty(); return lastFoundEntitySetOrSingleton.getRelatedBindingTarget(navProp.getName()); } return null; } }
public static Set<String> getSelectedPropertyNames(final List<SelectItem> selectItems) { Set<String> selected = new HashSet<String>(); for (final SelectItem item : selectItems) { final UriResource resource = item.getResourcePath().getUriResourceParts().get(0); if (resource instanceof UriResourceProperty) { selected.add(((UriResourceProperty) resource).getProperty().getName()); } else if (resource instanceof UriResourceNavigation) { selected.add(((UriResourceNavigation) resource).getProperty().getName()); } else if (resource instanceof UriResourceAction) { selected.add(((UriResourceAction) resource).getAction().getName()); } else if (resource instanceof UriResourceFunction) { selected.add(((UriResourceFunction) resource).getFunction().getName()); } } return selected; }
public static Set<String> getSelectedPropertyNames(final List<SelectItem> selectItems) { Set<String> selected = new HashSet<String>(); for (final SelectItem item : selectItems) { final UriResource resource = item.getResourcePath().getUriResourceParts().get(0); if (resource instanceof UriResourceProperty) { selected.add(((UriResourceProperty) resource).getProperty().getName()); } else if (resource instanceof UriResourceNavigation) { selected.add(((UriResourceNavigation) resource).getProperty().getName()); } else if (resource instanceof UriResourceAction) { selected.add(((UriResourceAction) resource).getAction().getName()); } else if (resource instanceof UriResourceFunction) { selected.add(((UriResourceFunction) resource).getFunction().getName()); } } return selected; }
private static KeyInfo joinFK(Table currentTable, Table referenceTable, EdmNavigationProperty property) { for (ForeignKey fk : currentTable.getForeignKeys()) { String refSchemaName = fk.getReferenceKey().getParent().getParent().getName(); if (!referenceTable.getParent().getName().equals(refSchemaName) || !referenceTable.getName().equals(fk.getReferenceTableName())) { continue; } if (!property.isCollection() && property.getName().equals(fk.getName())) { return new KeyInfo(false, fk); } if (property.getName().equals(currentTable.getName() + "_" + fk.getName())) { //$NON-NLS-1$ return new KeyInfo(true, fk); } } return null; }
public static ExpandDocumentNode buildExpand(EdmNavigationProperty property, MetadataStore metadata, OData odata, UniqueNameGenerator nameGenerator, boolean useAlias, UriInfo uriInfo, URLParseService parseService, DocumentNode context) throws TeiidException { EdmEntityType type = property.getType(); ExpandDocumentNode resource = new ExpandDocumentNode(); build(resource, type, null, metadata, odata, nameGenerator, useAlias, uriInfo, parseService); resource.setNavigationName(property.getName()); resource.setCollection(property.isCollection()); resource.collectionContext = context; return resource; }