private Map<String,String> getReferenceMap(PostUriInfo uriInfo) throws EdmException, ODataApplicationException{ // Is navigation segment always of size one? // // add try catch // Map<String,String> referenceMap = new HashMap<>(); EdmReferentialConstraint refConstraint = uriInfo.getNavigationSegments().get(0).getNavigationProperty().getRelationship().getReferentialConstraint(); if(refConstraint == null) throw new ODataApplicationException (NO_REF_CONSTRAINT, LocaleUtil.getLocaleforException()); List<String> principalPropertyList = refConstraint.getPrincipal().getPropertyRefNames(); List<String> dependentPropertList = refConstraint.getDependent().getPropertyRefNames(); for (int i = 0; i < principalPropertyList.size(); i++) { referenceMap.put(principalPropertyList.get(i), dependentPropertList.get(i)); } return referenceMap; }
String customLinkSegment = context.getODataContext().getPathInfo().getODataSegments().get(0).getPath(); linkSegments.add(customLinkSegment); customLinkSegment = uriInfo.getNavigationSegments().get(0).getNavigationProperty().getName(); linkSegments.add(customLinkSegment); EdmNavigationProperty navigationProperty = navigationSegment.getNavigationProperty(); delinkJPAEntities(targetJPAEntity, relatedEntities, navigationProperty);
String customLinkSegment = context.getODataContext().getPathInfo().getODataSegments().get(0).getPath(); linkSegments.add(customLinkSegment); customLinkSegment = uriInfo.getNavigationSegments().get(0).getNavigationProperty().getName(); linkSegments.add(customLinkSegment); EdmNavigationProperty navigationProperty = navigationSegment.getNavigationProperty(); delinkJPAEntities(targetJPAEntity, relatedEntities, navigationProperty);
public static EdmEntitySet getEdmEntitySet(final UriInfo uriInfo, Locale locale) throws ODataException { EdmEntitySet entitySet = null; // First must be an entity or a function import. if (uriInfo.getStartEntitySet() != null) { entitySet = uriInfo.getStartEntitySet(); } else if (uriInfo.getFunctionImport() != null) { entitySet = uriInfo.getFunctionImport().getEntitySet(); } else { throw new ODataApplicationException("INVALID_RESOURCE_TYPE", locale, HttpStatusCodes.NOT_IMPLEMENTED, "INVALID_RESOURCE_TYPE_CODE"); } int navigationCount = 0; while (entitySet != null && navigationCount < uriInfo.getNavigationSegments().size()) { final NavigationSegment uriResourceNavigation = uriInfo.getNavigationSegments().get(navigationCount); try { if(entitySet.getRelatedEntitySet(uriResourceNavigation.getNavigationProperty()) == null) { entitySet.getEntityContainer().getEntitySet(uriResourceNavigation.getNavigationProperty().getType().getName()); break; }else { entitySet = entitySet.getRelatedEntitySet(uriResourceNavigation.getNavigationProperty()); } } catch (EdmException e) { throw new ODataApplicationException("NAVIGATION_NOT_SUPPORTED", locale, HttpStatusCodes.NOT_IMPLEMENTED, "NAVIGATION_NOT_SUPPORTED_CODE", e); } navigationCount++; } return entitySet; } }
final NavigationSegment lastSegment = segments.get(segments.size() - 1); many = lastSegment.getKeyPredicates().isEmpty() && lastSegment.getNavigationProperty().getMultiplicity() == EdmMultiplicity.MANY;
final NavigationSegment lastSegment = segments.get(segments.size() - 1); many = lastSegment.getKeyPredicates().isEmpty() && lastSegment.getNavigationProperty().getMultiplicity() == EdmMultiplicity.MANY;
protected List<JPAJoinClause> generateJoinClauses() throws ODataJPARuntimeException, EdmException { List<JPAJoinClause> jpaOuterJoinClauses = new ArrayList<JPAJoinClause>(); JPAJoinClause jpaOuterJoinClause = null; String joinCondition = null; String entityAlias = generateJPAEntityAlias(); joinCondition = ODataExpressionParser.parseKeyPredicates(entitySetView.getKeyPredicates(), entityAlias); EdmEntityType entityType = entitySetView.getStartEntitySet().getEntityType(); Mapping mapping = (Mapping) entityType.getMapping(); String entityTypeName = null; if (mapping != null) { entityTypeName = mapping.getInternalName(); } else { entityTypeName = entityType.getName(); } jpaOuterJoinClause = new JPAJoinClause(entityTypeName, entityAlias, null, null, joinCondition, JPAJoinClause.JOIN.INNER); jpaOuterJoinClauses.add(jpaOuterJoinClause); for (NavigationSegment navigationSegment : entitySetView.getNavigationSegments()) { EdmNavigationProperty navigationProperty = navigationSegment.getNavigationProperty(); String relationShipAlias = generateRelationShipAlias(); joinCondition = ODataExpressionParser.parseKeyPredicates(navigationSegment.getKeyPredicates(), relationShipAlias); jpaOuterJoinClause = new JPAJoinClause(getFromEntityName(navigationProperty), entityAlias, getRelationShipName(navigationProperty), relationShipAlias, joinCondition, JPAJoinClause.JOIN.INNER); jpaOuterJoinClauses.add(jpaOuterJoinClause); } return jpaOuterJoinClauses; }
protected List<JPAJoinClause> generateJoinClauses() throws ODataJPARuntimeException, EdmException { List<JPAJoinClause> jpaOuterJoinClauses = new ArrayList<JPAJoinClause>(); JPAJoinClause jpaOuterJoinClause = null; String joinCondition = null; String entityAlias = generateJPAEntityAlias(); joinCondition = ODataExpressionParser.parseKeyPredicates(entityView.getKeyPredicates(), entityAlias); EdmEntityType entityType = entityView.getStartEntitySet().getEntityType(); Mapping mapping = (Mapping) entityType.getMapping(); String entityTypeName = null; if (mapping != null) { entityTypeName = mapping.getInternalName(); } else { entityTypeName = entityType.getName(); } jpaOuterJoinClause = new JPAJoinClause(entityTypeName, entityAlias, null, null, joinCondition, JPAJoinClause.JOIN.INNER); jpaOuterJoinClauses.add(jpaOuterJoinClause); for (NavigationSegment navigationSegment : entityView.getNavigationSegments()) { EdmNavigationProperty navigationProperty = navigationSegment.getNavigationProperty(); String relationShipAlias = generateRelationShipAlias(); joinCondition = ODataExpressionParser.parseKeyPredicates(navigationSegment.getKeyPredicates(), relationShipAlias); jpaOuterJoinClause = new JPAJoinClause(getFromEntityName(navigationProperty), entityAlias, getRelationShipName(navigationProperty), relationShipAlias, joinCondition, JPAJoinClause.JOIN.INNER); jpaOuterJoinClauses.add(jpaOuterJoinClause); } return jpaOuterJoinClauses; }
protected List<JPAJoinClause> generateJoinClauses() throws ODataJPARuntimeException, EdmException { List<JPAJoinClause> jpaOuterJoinClauses = new ArrayList<JPAJoinClause>(); JPAJoinClause jpaOuterJoinClause = null; String joinCondition = null; String entityAlias = generateJPAEntityAlias(); joinCondition = ODataExpressionParser.parseKeyPredicates(entitySetView.getKeyPredicates(), entityAlias); EdmEntityType entityType = entitySetView.getStartEntitySet().getEntityType(); Mapping mapping = (Mapping) entityType.getMapping(); String entityTypeName = null; if (mapping != null) { entityTypeName = mapping.getInternalName(); } else { entityTypeName = entityType.getName(); } jpaOuterJoinClause = new JPAJoinClause(entityTypeName, entityAlias, null, null, joinCondition, JPAJoinClause.JOIN.INNER); jpaOuterJoinClauses.add(jpaOuterJoinClause); for (NavigationSegment navigationSegment : entitySetView.getNavigationSegments()) { EdmNavigationProperty navigationProperty = navigationSegment.getNavigationProperty(); String relationShipAlias = generateRelationShipAlias(); joinCondition = ODataExpressionParser.parseKeyPredicates(navigationSegment.getKeyPredicates(), relationShipAlias); jpaOuterJoinClause = new JPAJoinClause(getFromEntityName(navigationProperty), entityAlias, getRelationShipName(navigationProperty), relationShipAlias, joinCondition, JPAJoinClause.JOIN.INNER); jpaOuterJoinClauses.add(jpaOuterJoinClause); } return jpaOuterJoinClauses; }
protected List<JPAJoinClause> generateJoinClauses() throws ODataJPARuntimeException, EdmException { List<JPAJoinClause> jpaOuterJoinClauses = new ArrayList<JPAJoinClause>(); JPAJoinClause jpaOuterJoinClause = null; String joinCondition = null; String entityAlias = generateJPAEntityAlias(); joinCondition = ODataExpressionParser.parseKeyPredicates(entityView.getKeyPredicates(), entityAlias); EdmEntityType entityType = entityView.getStartEntitySet().getEntityType(); Mapping mapping = (Mapping) entityType.getMapping(); String entityTypeName = null; if (mapping != null) { entityTypeName = mapping.getInternalName(); } else { entityTypeName = entityType.getName(); } jpaOuterJoinClause = new JPAJoinClause(entityTypeName, entityAlias, null, null, joinCondition, JPAJoinClause.JOIN.INNER); jpaOuterJoinClauses.add(jpaOuterJoinClause); for (NavigationSegment navigationSegment : entityView.getNavigationSegments()) { EdmNavigationProperty navigationProperty = navigationSegment.getNavigationProperty(); String relationShipAlias = generateRelationShipAlias(); joinCondition = ODataExpressionParser.parseKeyPredicates(navigationSegment.getKeyPredicates(), relationShipAlias); jpaOuterJoinClause = new JPAJoinClause(getFromEntityName(navigationProperty), entityAlias, getRelationShipName(navigationProperty), relationShipAlias, joinCondition, JPAJoinClause.JOIN.INNER); jpaOuterJoinClauses.add(jpaOuterJoinClause); } return jpaOuterJoinClauses; }
NavigationProperty navigationProperty = ((EdmEntityTypeImplProv) createView.getStartEntitySet().getEntityType()).getNavigationProperties().get(createView.getNavigationSegments().get(0).getNavigationProperty().getName()); property = createView.getNavigationSegments().get(0).getNavigationProperty().getRelationship().getReferentialConstraint().getDependent().getPropertyRefNames().get(0);
EdmNavigationProperty np = segment.getNavigationProperty(); if (np == null) { return uriInfo; // navigation without property? Keep off! EdmNavigationProperty np = segment.getNavigationProperty(); EdmAssociation association = np.getRelationship(); AssociationBundle bundle = MashServiceRegistry.getAssociationBundle(_service, association.getNamespace(), association.getName());
navigationProperty = uriInfo.getNavigationSegments().get(0).getNavigationProperty(); } else { return;
navigationProperty = uriInfo.getNavigationSegments().get(0).getNavigationProperty(); } else { return;