@Override public ODataResponse readEntitySimpleProperty(GetSimplePropertyUriInfo uriInfo, String contentType) throws ODataException { ODataResponse oDataResponse = null; try { EdmType type = uriInfo.getTargetType(); ((UriInfoImpl) uriInfo).setTargetType(uriInfo.getTargetEntitySet().getEntityType()); oDataJPAContext.setODataContext(getContext()); Object jpaEntity = jpaProcessor.process((GetEntityUriInfo) uriInfo); ((UriInfoImpl) uriInfo).setTargetType(type); oDataResponse = responseBuilder.build((GetEntityUriInfo) uriInfo, jpaEntity, contentType); } finally { close(); } return oDataResponse; }
public static UriInfoImpl constructDeepReadForRoot(EdmEntitySet edmEntitySet, String serviceName, List<KeyPredicate> keyPredicates) throws ODataException { UriInfoImpl uriInfoForRead = new UriInfoImpl(); uriInfoForRead.setStartEntitySet(edmEntitySet); uriInfoForRead.setTargetEntitySet(edmEntitySet); Map<String,List<String>> compositionTree = CSNUtil.getCompositionTree(serviceName, edmEntitySet.getName()); List<ArrayList<NavigationPropertySegment>> expandOption = new ArrayList<>(); constructTreeExpand(edmEntitySet, serviceName, compositionTree, new ArrayList<>(), expandOption); uriInfoForRead.setKeyPredicates(keyPredicates); uriInfoForRead.setTargetType(edmEntitySet.getEntityType()); uriInfoForRead.setExpand(expandOption); return uriInfoForRead; }
@Override public ODataResponse updateEntity(final PutMergePatchUriInfo uriParserResultView, final InputStream content, final String requestContentType, final boolean merge, final String contentType) throws ODataException { ODataResponse oDataResponse = null; try { oDataJPAContext.setODataContext(getContext()); EdmType type = null; if (!(uriParserResultView.getTargetType() instanceof EdmEntityType)) { type = uriParserResultView.getTargetType(); ((UriInfoImpl) uriParserResultView).setTargetType(uriParserResultView.getTargetEntitySet().getEntityType()); } Object jpaEntity = jpaProcessor.process(uriParserResultView, content, requestContentType); if (type != null) { ((UriInfoImpl) uriParserResultView).setTargetType(type); } oDataResponse = responseBuilder.build(uriParserResultView, jpaEntity, contentType); } finally { close(); } return oDataResponse; }
private void handleEntitySet(final EdmEntitySet entitySet, final String keyPredicate) throws UriSyntaxException, UriNotMatchingException, EdmException { final EdmEntityType entityType = entitySet.getEntityType(); uriResult.setTargetType(entityType); uriResult.setTargetEntitySet(entitySet); if (keyPredicate == null) { if (pathSegments.isEmpty()) { uriResult.setUriType(UriType.URI1); } else { currentPathSegment = pathSegments.remove(0); checkCount(); if (uriResult.isCount()) { uriResult.setUriType(UriType.URI15); } else { throw new UriSyntaxException(UriSyntaxException.ENTITYSETINSTEADOFENTITY.addContent(entitySet.getName())); } } } else { uriResult.setKeyPredicates(parseKey(keyPredicate, entityType)); if (pathSegments.isEmpty()) { uriResult.setUriType(UriType.URI2); } else { handleNavigationPathOptions(); } } }
private void handleEntitySet(final EdmEntitySet entitySet, final String keyPredicate) throws UriSyntaxException, UriNotMatchingException, EdmException { final EdmEntityType entityType = entitySet.getEntityType(); uriResult.setTargetType(entityType); uriResult.setTargetEntitySet(entitySet); if (keyPredicate == null) { if (pathSegments.isEmpty()) { uriResult.setUriType(UriType.URI1); } else { currentPathSegment = pathSegments.remove(0); checkCount(); if (uriResult.isCount()) { uriResult.setUriType(UriType.URI15); } else { throw new UriSyntaxException(UriSyntaxException.ENTITYSETINSTEADOFENTITY.addContent(entitySet.getName())); } } } else { uriResult.setKeyPredicates(parseKey(keyPredicate, entityType)); if (pathSegments.isEmpty()) { uriResult.setUriType(UriType.URI2); } else { handleNavigationPathOptions(); } } }
private void handleEntitySet(final EdmEntitySet entitySet, final String keyPredicate) throws UriSyntaxException, UriNotMatchingException, EdmException { final EdmEntityType entityType = entitySet.getEntityType(); uriResult.setTargetType(entityType); uriResult.setTargetEntitySet(entitySet); if (keyPredicate == null) { if (pathSegments.isEmpty()) { uriResult.setUriType(UriType.URI1); } else { currentPathSegment = pathSegments.remove(0); checkCount(); if (uriResult.isCount()) { uriResult.setUriType(UriType.URI15); } else { throw new UriSyntaxException(UriSyntaxException.ENTITYSETINSTEADOFENTITY.addContent(entitySet.getName())); } } } else { uriResult.setKeyPredicates(parseKey(keyPredicate, entityType)); if (pathSegments.isEmpty()) { uriResult.setUriType(UriType.URI2); } else { handleNavigationPathOptions(); } } }
private void addNavigationSegment(final String keyPredicateName, final EdmNavigationProperty navigationProperty) throws UriSyntaxException, EdmException { final EdmEntitySet targetEntitySet = uriResult.getTargetEntitySet().getRelatedEntitySet(navigationProperty); final EdmEntityType targetEntityType = targetEntitySet.getEntityType(); uriResult.setTargetEntitySet(targetEntitySet); uriResult.setTargetType(targetEntityType); NavigationSegmentImpl navigationSegment = new NavigationSegmentImpl(); navigationSegment.setEntitySet(targetEntitySet); navigationSegment.setNavigationProperty(navigationProperty); if (keyPredicateName != null) { navigationSegment.setKeyPredicates(parseKey(keyPredicateName, targetEntityType)); } uriResult.addNavigationSegment(navigationSegment); }
private void addNavigationSegment(final String keyPredicateName, final EdmNavigationProperty navigationProperty) throws UriSyntaxException, EdmException { final EdmEntitySet targetEntitySet = uriResult.getTargetEntitySet().getRelatedEntitySet(navigationProperty); final EdmEntityType targetEntityType = targetEntitySet.getEntityType(); uriResult.setTargetEntitySet(targetEntitySet); uriResult.setTargetType(targetEntityType); NavigationSegmentImpl navigationSegment = new NavigationSegmentImpl(); navigationSegment.setEntitySet(targetEntitySet); navigationSegment.setNavigationProperty(navigationProperty); if (keyPredicateName != null) { navigationSegment.setKeyPredicates(parseKey(keyPredicateName, targetEntityType)); } uriResult.addNavigationSegment(navigationSegment); }
private void addNavigationSegment(final String keyPredicateName, final EdmNavigationProperty navigationProperty) throws UriSyntaxException, EdmException { final EdmEntitySet targetEntitySet = uriResult.getTargetEntitySet().getRelatedEntitySet(navigationProperty); final EdmEntityType targetEntityType = targetEntitySet.getEntityType(); uriResult.setTargetEntitySet(targetEntitySet); uriResult.setTargetType(targetEntityType); NavigationSegmentImpl navigationSegment = new NavigationSegmentImpl(); navigationSegment.setEntitySet(targetEntitySet); navigationSegment.setNavigationProperty(navigationProperty); if (keyPredicateName != null) { navigationSegment.setKeyPredicates(parseKey(keyPredicateName, targetEntityType)); } uriResult.addNavigationSegment(navigationSegment); }
throw new UriSyntaxException(UriSyntaxException.INVALIDPROPERTYTYPE.addContent(type.getKind())); uriResult.setTargetType(type); } else { throw new UriSyntaxException(UriSyntaxException.INVALIDSEGMENT.addContent(currentPathSegment)); uriResult.setTargetType(type); break;
throw new UriSyntaxException(UriSyntaxException.INVALIDPROPERTYTYPE.addContent(type.getKind())); uriResult.setTargetType(type); } else { throw new UriSyntaxException(UriSyntaxException.INVALIDSEGMENT.addContent(currentPathSegment)); uriResult.setTargetType(type); break;
clone.setTargetEntitySet(createView.getStartEntitySet()); clone.getNavigationSegments().clear(); clone.setTargetType(clone.getTargetEntitySet().getEntityType()); Object relatedEntity = readEntity(new JPAQueryBuilder(oDataJPAContext).build((PutMergePatchUriInfo) clone), (UriInfo) clone);
throw new UriSyntaxException(UriSyntaxException.INVALIDPROPERTYTYPE.addContent(type.getKind())); uriResult.setTargetType(type); } else { throw new UriSyntaxException(UriSyntaxException.INVALIDSEGMENT.addContent(currentPathSegment)); uriResult.setTargetType(type); break;
uriResult.setTargetType(type); switch (type.getKind()) { case SIMPLE:
uriResult.setTargetType(type); switch (type.getKind()) { case SIMPLE:
uriResult.setTargetType(type); switch (type.getKind()) { case SIMPLE: