private EdmNavigationProperty getNavigationProperty(EdmEntitySet srcEtySet) throws EdmException{ if(srcKeyMap == null || navigationProperty== null || srcKeyMap.isEmpty()) return null; EdmEntityType srcEtytype = srcEtySet.getEntityType(); EdmNavigationProperty navigationProp = (EdmNavigationProperty) srcEtytype.getProperty(navigationProperty) ; return navigationProp; }
private static boolean hasConcurrencyControl(final EdmEntityType entityType) throws EdmException { boolean concurrency = false; for (final String propertyName : entityType.getPropertyNames()) { final EdmFacets facets = ((EdmProperty) entityType.getProperty(propertyName)).getFacets(); if (facets != null && facets.getConcurrencyMode() != null && facets.getConcurrencyMode() == EdmConcurrencyMode.Fixed) { concurrency = true; break; } } return concurrency; }
private void handleCustomLinks(final EdmEntityType entityType) throws EdmException { for (Map.Entry<String, ExpandSelectTreeNode> entry : customExpandedNavigationProperties.entrySet()) { EdmTyped navigationProperty = entityType.getProperty(entry.getKey()); if (navigationProperty == null) { throw new EdmException(EdmException.NAVIGATIONPROPERTYNOTFOUND.addContent(entry.getKey())); } if (!(navigationProperty instanceof EdmNavigationProperty)) { throw new EdmException(EdmException.MUSTBENAVIGATIONPROPERTY.addContent(entry.getKey())); } putLink(entry.getKey(), (ExpandSelectTreeNodeImpl) entry.getValue()); } }
private static boolean hasConcurrencyControl(final EdmEntityType entityType) throws EdmException { boolean concurrency = false; for (final String propertyName : entityType.getPropertyNames()) { final EdmFacets facets = ((EdmProperty) entityType.getProperty(propertyName)).getFacets(); if (facets != null && facets.getConcurrencyMode() != null && facets.getConcurrencyMode() == EdmConcurrencyMode.Fixed) { concurrency = true; break; } } return concurrency; }
private void handleCustomLinks(final EdmEntityType entityType) throws EdmException { for (Map.Entry<String, ExpandSelectTreeNode> entry : customExpandedNavigationProperties.entrySet()) { EdmTyped navigationProperty = entityType.getProperty(entry.getKey()); if (navigationProperty == null) { throw new EdmException(EdmException.NAVIGATIONPROPERTYNOTFOUND.addContent(entry.getKey())); } if (!(navigationProperty instanceof EdmNavigationProperty)) { throw new EdmException(EdmException.MUSTBENAVIGATIONPROPERTY.addContent(entry.getKey())); } putLink(entry.getKey(), (ExpandSelectTreeNodeImpl) entry.getValue()); } }
private static boolean hasConcurrencyControl(final EdmEntityType entityType) throws EdmException { boolean concurrency = false; for (final String propertyName : entityType.getPropertyNames()) { final EdmFacets facets = ((EdmProperty) entityType.getProperty(propertyName)).getFacets(); if (facets != null && facets.getConcurrencyMode() != null && facets.getConcurrencyMode() == EdmConcurrencyMode.Fixed) { concurrency = true; break; } } return concurrency; }
private void handleCustomLinks(final EdmEntityType entityType) throws EdmException { for (Map.Entry<String, ExpandSelectTreeNode> entry : customExpandedNavigationProperties.entrySet()) { EdmTyped navigationProperty = entityType.getProperty(entry.getKey()); if (navigationProperty == null) { throw new EdmException(EdmException.NAVIGATIONPROPERTYNOTFOUND.addContent(entry.getKey())); } if (!(navigationProperty instanceof EdmNavigationProperty)) { throw new EdmException(EdmException.MUSTBENAVIGATIONPROPERTY.addContent(entry.getKey())); } putLink(entry.getKey(), (ExpandSelectTreeNodeImpl) entry.getValue()); } }
private <T> String constructETag(final EdmEntitySet entitySet, final T data) throws ODataException { final EdmEntityType entityType = entitySet.getEntityType(); String eTag = null; for (final String propertyName : entityType.getPropertyNames()) { final EdmProperty property = (EdmProperty) entityType.getProperty(propertyName); if (property.getFacets() != null && property.getFacets().getConcurrencyMode() == EdmConcurrencyMode.Fixed) { final EdmSimpleType type = (EdmSimpleType) property.getType(); final String component = type.valueToString(valueAccess.getPropertyValue(data, property), EdmLiteralKind.DEFAULT, property.getFacets()); eTag = eTag == null ? component : eTag + Edm.DELIMITER + component; } } return eTag == null ? null : "W/\"" + eTag + "\""; }
private List<KeyPredicate> getPropertyValuesAsKeyPredicates(EdmEntityType entityType, Map<String, Object> result, List<String> propertyNames) throws EdmException { List<KeyPredicate> keyPredicates = new ArrayList<KeyPredicate>(); for(String property:propertyNames){ Object value = result.get(property); EdmProperty entityProperty = (EdmProperty) entityType.getProperty(property); EdmSimpleType edmSimpleType = (EdmSimpleType) entityProperty.getType(); String literal = edmSimpleType.valueToString(value, EdmLiteralKind.DEFAULT, entityProperty.getFacets()); keyPredicates.add(new GWKeyPredicate(literal, entityProperty)); } return keyPredicates; }
@Override public ElementType getElementType(String elementName) { try { if(entityType.getProperty(elementName).getType().getKind().equals(EdmTypeKind.COMPLEX)) return ElementType.STRUCTURED_TYPE; } catch (EdmException e) { return null; } return ElementType.SIMPLE_TYPE; }
private EdmEntityType getTargetEntityTypeFromNavigationProperty(EdmEntityType entityType, String navigationProperty) throws EdmException { EdmNavigationProperty navProp = (EdmNavigationProperty) entityType.getProperty(navigationProperty); String toRole = navProp.getToRole(); return (EdmEntityType) navProp.getRelationship().getEnd(toRole).getEntityType(); }
private void handleProperties(final EdmEntityType entityType) throws EdmException { for (String propertyName : selectedPropertyNames) { EdmTyped property = entityType.getProperty(propertyName); if (property == null) { throw new EdmException(EdmException.PROPERTYNOTFOUND.addContent(propertyName)); } else if (!(property instanceof EdmProperty)) { throw new EdmException(EdmException.MUSTBEPROPERTY.addContent(propertyName)); } addProperty((EdmProperty) property); } }
private String createCustomTargetLink(final EntityInfoAggregator entityInfo, final String navigationPropertyName, final Map<String, Object> key) throws EntityProviderException, EdmException { String target; final EntityInfoAggregator targetEntityInfo = EntityInfoAggregator.create( entityInfo.getEntitySet().getRelatedEntitySet( (EdmNavigationProperty) entityInfo.getEntityType().getProperty(navigationPropertyName))); target = (properties.getServiceRoot() == null ? "" : properties.getServiceRoot().toASCIIString()) + AtomEntryEntityProducer.createSelfLink(targetEntityInfo, key, null); return target; }
private void handleLinks(final EdmEntityType entityType, final List<String> names, final ExpandSelectTreeNodeImpl subNode) throws EdmException { for (String navigationPropertyName : names) { EdmTyped navigationProperty = entityType.getProperty(navigationPropertyName); if (navigationProperty == null) { throw new EdmException(EdmException.NAVIGATIONPROPERTYNOTFOUND.addContent(navigationPropertyName)); } else if (!(navigationProperty instanceof EdmNavigationProperty)) { throw new EdmException(EdmException.MUSTBENAVIGATIONPROPERTY.addContent(navigationPropertyName)); } putLink(navigationPropertyName, subNode); } }
private String createCustomTargetLink(final EntityInfoAggregator entityInfo, final String navigationPropertyName, final Map<String, Object> key) throws EntityProviderException, EdmException { String target; final EntityInfoAggregator targetEntityInfo = EntityInfoAggregator.create( entityInfo.getEntitySet().getRelatedEntitySet( (EdmNavigationProperty) entityInfo.getEntityType().getProperty(navigationPropertyName))); target = (properties.getServiceRoot() == null ? "" : properties.getServiceRoot().toASCIIString()) + AtomEntryEntityProducer.createSelfLink(targetEntityInfo, key, null); return target; }
private void handleProperties(final EdmEntityType entityType) throws EdmException { for (String propertyName : selectedPropertyNames) { EdmTyped property = entityType.getProperty(propertyName); if (property == null) { throw new EdmException(EdmException.PROPERTYNOTFOUND.addContent(propertyName)); } else if (!(property instanceof EdmProperty)) { throw new EdmException(EdmException.MUSTBEPROPERTY.addContent(propertyName)); } addProperty((EdmProperty) property); } }
private void handleLinks(final EdmEntityType entityType, final List<String> names, final ExpandSelectTreeNodeImpl subNode) throws EdmException { for (String navigationPropertyName : names) { EdmTyped navigationProperty = entityType.getProperty(navigationPropertyName); if (navigationProperty == null) { throw new EdmException(EdmException.NAVIGATIONPROPERTYNOTFOUND.addContent(navigationPropertyName)); } else if (!(navigationProperty instanceof EdmNavigationProperty)) { throw new EdmException(EdmException.MUSTBENAVIGATIONPROPERTY.addContent(navigationPropertyName)); } putLink(navigationPropertyName, subNode); } }
private void handleLinks(final EdmEntityType entityType, final List<String> names, final ExpandSelectTreeNodeImpl subNode) throws EdmException { for (String navigationPropertyName : names) { EdmTyped navigationProperty = entityType.getProperty(navigationPropertyName); if (navigationProperty == null) { throw new EdmException(EdmException.NAVIGATIONPROPERTYNOTFOUND.addContent(navigationPropertyName)); } else if (!(navigationProperty instanceof EdmNavigationProperty)) { throw new EdmException(EdmException.MUSTBENAVIGATIONPROPERTY.addContent(navigationPropertyName)); } putLink(navigationPropertyName, subNode); } }
private void handleProperties(final EdmEntityType entityType) throws EdmException { for (String propertyName : selectedPropertyNames) { EdmTyped property = entityType.getProperty(propertyName); if (property == null) { throw new EdmException(EdmException.PROPERTYNOTFOUND.addContent(propertyName)); } else if (!(property instanceof EdmProperty)) { throw new EdmException(EdmException.MUSTBEPROPERTY.addContent(propertyName)); } addProperty((EdmProperty) property); } }
private String createCustomTargetLink(final EntityInfoAggregator entityInfo, final String navigationPropertyName, final Map<String, Object> key) throws EntityProviderException, EdmException { String target; final EntityInfoAggregator targetEntityInfo = EntityInfoAggregator.create( entityInfo.getEntitySet().getRelatedEntitySet( (EdmNavigationProperty) entityInfo.getEntityType().getProperty(navigationPropertyName))); target = (properties.getServiceRoot() == null ? "" : properties.getServiceRoot().toASCIIString()) + AtomEntryEntitySerializer.createSelfLink(targetEntityInfo, key, null, properties.isKeyAutoGenerated(), false); return target; }