/** * {@inheritDoc} */ @Override public String getMessage() { if (messageReference == null) { return "No message reference given. Inherit message is = '" + super.getMessage() + "'"; } String message = RuntimeDelegate.extractExceptionMessage(this); if (message == null) { return "Message Reference key = '" + messageReference.getKey() + "' and inherit message = '" + super.getMessage() + "'"; } return message; } }
/** * {@inheritDoc} */ @Override public String getMessage() { if (messageReference == null) { return "No message reference given. Inherit message is = '" + super.getMessage() + "'"; } String message = RuntimeDelegate.extractExceptionMessage(this); if (message == null) { return "Message Reference key = '" + messageReference.getKey() + "' and inherit message = '" + super.getMessage() + "'"; } return message; } }
/** * {@inheritDoc} */ @Override public String getMessage() { if (messageReference == null) { return "No message reference given. Inherit message is = '" + super.getMessage() + "'"; } String message = RuntimeDelegate.extractExceptionMessage(this); if (message == null) { return "Message Reference key = '" + messageReference.getKey() + "' and inherit message = '" + super.getMessage() + "'"; } return message; } }
public final UriInfo parseLink(final EdmEntitySet entitySet, final InputStream content, final String contentType) throws ODataJPARuntimeException { String uriString = null; UriInfo uri = null; try { uriString = EntityProvider.readLink(contentType, entitySet, content); ODataContext odataContext = context.getODataContext(); final String svcRoot = odataContext.getPathInfo().getServiceRoot().toString(); final String path = uriString.startsWith(svcRoot.toString()) ? uriString.substring(svcRoot.length()) : uriString; final List<PathSegment> pathSegment = getPathSegment(path); edm = getEdm(); uri = UriParser.parse(edm, pathSegment, Collections.<String, String> emptyMap()); } catch (ODataException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e); } return uri; }
public UriInfo parseLinkSegments(final List<String> linkSegments, final Map<String, String> options) throws ODataJPARuntimeException { List<PathSegment> pathSegments = new ArrayList<PathSegment>(); for (String link : linkSegments) { List<PathSegment> pathSegment = getPathSegment(link); pathSegments.addAll(pathSegment); } UriInfo uriInfo = null; try { edm = getEdm(); uriInfo = UriParser.parse(edm, pathSegments, options); } catch (ODataException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e); } return uriInfo; }
public UriInfo parseLinkSegments(final List<String> linkSegments, final Map<String, String> options) throws ODataJPARuntimeException { List<PathSegment> pathSegments = new ArrayList<PathSegment>(); for (String link : linkSegments) { List<PathSegment> pathSegment = getPathSegment(link); pathSegments.addAll(pathSegment); } UriInfo uriInfo = null; try { edm = getEdm(); uriInfo = UriParser.parse(edm, pathSegments, options); } catch (ODataException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e); } return uriInfo; }
private GenericRequest getRequestFromIRequestForBatch(IRequest irequest, UriInfo uriinfo) { GenericRequest request = getRequestFromIRequest(irequest, uriinfo); if (request == null) return request; try { if (request.getServiceName() != null) return request; List<PathSegment> precedingSegments = getODataContext().getPathInfo().getPrecedingSegments(); request.setServiceName(precedingSegments.get(precedingSegments.size() - 1).getPath()); } catch (ODataException e) { logger.error(e.getMessage()); } return request; }
public final UriInfo parseLink(final EdmEntitySet entitySet, final InputStream content, final String contentType) throws ODataJPARuntimeException { String uriString = null; UriInfo uri = null; try { uriString = EntityProvider.readLink(contentType, entitySet, content); ODataContext odataContext = context.getODataContext(); final String svcRoot = odataContext.getPathInfo().getServiceRoot().toString(); final String path = uriString.startsWith(svcRoot.toString()) ? uriString.substring(svcRoot.length()) : uriString; final List<PathSegment> pathSegment = getPathSegment(path); edm = getEdm(); uri = UriParser.parse(edm, pathSegment, Collections.<String, String> emptyMap()); } catch (ODataException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e); } return uri; }
@Override public IDataProviderResponse executeFunctionImport(GetFunctionImportUriInfo uriInfo, ODataContext context) throws ODataException { IDataProvider dataProvider = null; dataProvider = getDataProvider(getFunctionFqn(uriInfo.getFunctionImport())); try{ if (dataProvider !=null){ return dataProvider.executeFunctionImport(uriInfo, context); } else return null; } catch (ODataException e) { logger.error("Error in executeFunctionImport",e); throw new ODataException(e.getMessage(),e); } }
public final UriInfo parseURISegment(final int segmentFromIndex, final int segmentToIndex) throws ODataJPARuntimeException { UriInfo uriInfo = null; if (segmentFromIndex == segmentToIndex || segmentFromIndex > segmentToIndex || segmentFromIndex < 0) { return uriInfo; } try { edm = getEdm(); List<PathSegment> pathSegments = context.getODataContext().getPathInfo().getODataSegments(); List<PathSegment> subPathSegments = pathSegments.subList(segmentFromIndex, segmentToIndex); uriInfo = UriParser.parse(edm, subPathSegments, Collections.<String, String> emptyMap()); } catch (ODataException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e); } return uriInfo; }
public final UriInfo parseURISegment(final int segmentFromIndex, final int segmentToIndex) throws ODataJPARuntimeException { UriInfo uriInfo = null; if (segmentFromIndex == segmentToIndex || segmentFromIndex > segmentToIndex || segmentFromIndex < 0) { return uriInfo; } try { edm = getEdm(); List<PathSegment> pathSegments = context.getODataContext().getPathInfo().getODataSegments(); List<PathSegment> subPathSegments = pathSegments.subList(segmentFromIndex, segmentToIndex); uriInfo = UriParser.parse(edm, subPathSegments, Collections.<String, String> emptyMap()); } catch (ODataException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e); } return uriInfo; }
public UriInfo parseBindingLink(final String link, final Map<String, String> options) throws ODataJPARuntimeException { final List<PathSegment> pathSegment = getPathSegment(link); UriInfo uriInfo = null; try { edm = getEdm(); uriInfo = UriParser.parse(edm, pathSegment, options); } catch (ODataException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e); } return uriInfo; }
public UriInfo parseBindingLink(final String link, final Map<String, String> options) throws ODataJPARuntimeException { final List<PathSegment> pathSegment = getPathSegment(link); UriInfo uriInfo = null; try { edm = getEdm(); uriInfo = UriParser.parse(edm, pathSegment, options); } catch (ODataException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e); } return uriInfo; }
public final UriInfo parseURISegmentWithCustomOptions(final int segmentFromIndex, final int segmentToIndex, final Map<String, String> options) throws ODataJPARuntimeException { UriInfo uriInfo = null; if (segmentFromIndex == segmentToIndex || segmentFromIndex > segmentToIndex || segmentFromIndex < 0) { return uriInfo; } try { edm = getEdm(); List<PathSegment> pathSegments = context.getODataContext().getPathInfo().getODataSegments(); List<PathSegment> subPathSegments = pathSegments.subList(segmentFromIndex, segmentToIndex); uriInfo = UriParser.parse(edm, subPathSegments, options); } catch (ODataException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e); } return uriInfo; }
public final UriInfo parseURISegmentWithCustomOptions(final int segmentFromIndex, final int segmentToIndex, final Map<String, String> options) throws ODataJPARuntimeException { UriInfo uriInfo = null; if (segmentFromIndex == segmentToIndex || segmentFromIndex > segmentToIndex || segmentFromIndex < 0) { return uriInfo; } try { edm = getEdm(); List<PathSegment> pathSegments = context.getODataContext().getPathInfo().getODataSegments(); List<PathSegment> subPathSegments = pathSegments.subList(segmentFromIndex, segmentToIndex); uriInfo = UriParser.parse(edm, subPathSegments, options); } catch (ODataException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e); } return uriInfo; }
@Override public IDataProviderResponse countEntitySet(GetEntitySetCountUriInfo uriInfo, ODataContext context) throws ODataException { IDataProvider dataProvider = null; String targetEntitySet = uriInfo.getTargetEntitySet().getEntityType().getNamespace()+"."+uriInfo.getTargetEntitySet().getName(); dataProvider = getDataProvider(targetEntitySet); try{ if (dataProvider !=null){ return dataProvider.countEntitySet(uriInfo, context); } else return null; } catch (ODataException e) { logger.error("Error in countEntity",e); throw new ODataException(e.getMessage(),e); } }
@Override public IDataProviderResponse updateEntity(PutMergePatchUriInfo uriInfo, ODataEntry content,String requestContentType, boolean merge, ODataContext context) throws ODataException { IDataProvider dataProvider = null; String targetEntitySet = uriInfo.getTargetEntitySet().getEntityType().getNamespace()+"."+uriInfo.getTargetEntitySet().getName(); dataProvider = getDataProvider(targetEntitySet); try{ if (dataProvider !=null){ return dataProvider.updateEntity(uriInfo, content, requestContentType, merge, context); } else return null; } catch (ODataException e) { logger.error("Error in updateEntity",e); throw new ODataException(e.getMessage(),e); } }
@Override public IDataProviderResponse deleteEntityMedia(DeleteUriInfo uriInfo, ODataContext context) throws ODataException { IDataProvider dataProvider = null; String targetEntitySet = uriInfo.getTargetEntitySet().getEntityType().getNamespace() + "." + uriInfo.getTargetEntitySet().getName(); dataProvider = getDataProvider(targetEntitySet); try { if (dataProvider != null) { return dataProvider.deleteEntityMedia(uriInfo, context); } else return null; } catch (ODataException e) { logger.error("Error in deleteEntityMedia", e); throw new ODataException(e.getMessage(), e); } }
@Override public IDataProviderResponse updateEntityMedia(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, ODataContext context) throws ODataException { IDataProvider dataProvider = null; String targetEntitySet = uriInfo.getTargetEntitySet().getEntityType().getNamespace() + "." + uriInfo.getTargetEntitySet().getName(); dataProvider = getDataProvider(targetEntitySet); try { if (dataProvider != null) { return dataProvider.updateEntityMedia(uriInfo, content, requestContentType, context); } else return null; } catch (ODataException e) { logger.error("Error in updateEntityMedia", e); throw new ODataException(e.getMessage(), e); } }
@Override public IDataProviderResponse deleteEntity(DeleteUriInfo uriInfo, ODataContext context) throws ODataException { IDataProvider dataProvider = null; String targetEntitySet = uriInfo.getTargetEntitySet().getEntityType().getNamespace()+"."+uriInfo.getTargetEntitySet().getName(); dataProvider = getDataProvider(targetEntitySet); try { if (dataProvider !=null){ return dataProvider.deleteEntity(uriInfo, context); } else return null; } catch (ODataException e) { logger.error("Error in deleteEntity",e); throw new ODataException(e.getMessage(),e); } }