private boolean setTransaction() { ODataJPATransaction transaction = oDataJPAContext.getODataJPATransaction(); if (!transaction.isActive()) { transaction.begin(); return true; } return false; } }
@Override public ODataResponse existsEntity(final GetEntityCountUriInfo uriInfo, final String contentType) throws ODataException { ODataResponse oDataResponse = null; try { oDataJPAContext.setODataContext(getContext()); long jpaEntityCount = jpaProcessor.process(uriInfo); oDataResponse = responseBuilder.build(jpaEntityCount); } finally { close(); } return oDataResponse; }
@Override public ODataResponse updateEntitySimplePropertyValue(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType) throws ODataException { return updateEntity(uriInfo, content, requestContentType, true, contentType); } }
public JPAQueryBuilder(ODataJPAContext odataJPAContext) { this.em = odataJPAContext.getEntityManager(); this.pageSize = odataJPAContext.getPageSize(); this.odataJPAContext = odataJPAContext; }
@Override public ODataResponse readEntitySimplePropertyValue(final GetSimplePropertyUriInfo uriInfo, final String contentType) throws ODataException { return readEntitySimpleProperty(uriInfo, contentType); }
@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()); Object jpaEntity = jpaProcessor.process(uriParserResultView, content, requestContentType); oDataResponse = responseBuilder.build(uriParserResultView, jpaEntity); } finally { close(); } return oDataResponse; }
private boolean setTransaction() { ODataJPATransaction transaction = oDataJPAContext.getODataJPATransaction(); if (!transaction.isActive()) { transaction.begin(); return true; } return false; } }
@Override public ODataResponse updateEntitySimpleProperty(final PutMergePatchUriInfo uriInfo, final InputStream content, final String requestContentType, final String contentType) throws ODataException { return updateEntity(uriInfo, content, requestContentType, true, contentType); }
@Override public ODataResponse countEntitySet(final GetEntitySetCountUriInfo uriParserResultView, final String contentType) throws ODataException { ODataResponse oDataResponse = null; try { oDataJPAContext.setODataContext(getContext()); long jpaEntityCount = jpaProcessor.process(uriParserResultView); oDataResponse = responseBuilder.build(jpaEntityCount); } finally { close(); } return oDataResponse; }
@Override public ODataResponse deleteEntity(final DeleteUriInfo uriParserResultView, final String contentType) throws ODataException { ODataResponse oDataResponse = null; try { oDataJPAContext.setODataContext(getContext()); Object deletedObj = jpaProcessor.process(uriParserResultView, contentType); oDataResponse = responseBuilder.build(uriParserResultView, deletedObj); } finally { close(); } return oDataResponse; }
@Override public ODataResponse readEntitySet(final GetEntitySetUriInfo uriParserResultView, final String contentType) throws ODataException { ODataResponse oDataResponse = null; try { oDataJPAContext.setODataContext(getContext()); List<Object> jpaEntities = jpaProcessor.process(uriParserResultView); oDataResponse = responseBuilder.build(uriParserResultView, jpaEntities, contentType); } finally { close(); } return oDataResponse; }
@Override public ODataResponse createEntity(final PostUriInfo uriParserResultView, final InputStream content, final String requestContentType, final String contentType) throws ODataException { ODataResponse oDataResponse = null; try { oDataJPAContext.setODataContext(getContext()); Object createdJpaEntity = jpaProcessor.process(uriParserResultView, content, requestContentType); oDataResponse = responseBuilder.build(uriParserResultView, createdJpaEntity, contentType); } finally { close(); } return oDataResponse; }
@Override public ODataResponse readEntity(final GetEntityUriInfo uriParserResultView, final String contentType) throws ODataException { ODataResponse oDataResponse = null; try { oDataJPAContext.setODataContext(getContext()); Object jpaEntity = jpaProcessor.process(uriParserResultView); oDataResponse = responseBuilder.build(uriParserResultView, jpaEntity, contentType); } finally { close(); } return oDataResponse; }
@Override public ODataResponse readEntity(final GetEntityUriInfo uriParserResultView, final String contentType) throws ODataException { ODataResponse oDataResponse = null; try { oDataJPAContext.setODataContext(getContext()); Object jpaEntity = jpaProcessor.process(uriParserResultView); oDataResponse = responseBuilder.build(uriParserResultView, jpaEntity, contentType); } finally { close(); } return oDataResponse; }
@Override public ODataResponse countEntitySet(final GetEntitySetCountUriInfo uriParserResultView, final String contentType) throws ODataException { ODataResponse oDataResponse = null; try { oDataJPAContext.setODataContext(getContext()); long jpaEntityCount = jpaProcessor.process(uriParserResultView); oDataResponse = responseBuilder.build(jpaEntityCount); } finally { close(); } return oDataResponse; }
@Override public ODataResponse existsEntity(final GetEntityCountUriInfo uriInfo, final String contentType) throws ODataException { ODataResponse oDataResponse = null; try { oDataJPAContext.setODataContext(getContext()); long jpaEntityCount = jpaProcessor.process(uriInfo); oDataResponse = responseBuilder.build(jpaEntityCount); } finally { close(); } return oDataResponse; }
@Override public ODataResponse deleteEntity(final DeleteUriInfo uriParserResultView, final String contentType) throws ODataException { ODataResponse oDataResponse = null; try { oDataJPAContext.setODataContext(getContext()); Object deletedObj = jpaProcessor.process(uriParserResultView, contentType); oDataResponse = responseBuilder.build(uriParserResultView, deletedObj); } finally { close(); } return oDataResponse; }
@Override public ODataResponse executeFunctionImport(final GetFunctionImportUriInfo uriParserResultView, final String contentType) throws ODataException { ODataResponse oDataResponse = null; try { oDataJPAContext.setODataContext(getContext()); List<Object> resultEntity = jpaProcessor.process(uriParserResultView); oDataResponse = responseBuilder.build(uriParserResultView, resultEntity, contentType); } finally { close(); } return oDataResponse; }
@Override public ODataResponse readEntityLinks(final GetEntitySetLinksUriInfo uriParserResultView, final String contentType) throws ODataException { ODataResponse oDataResponse = null; try { oDataJPAContext.setODataContext(getContext()); List<Object> jpaEntity = jpaProcessor.process(uriParserResultView); oDataResponse = responseBuilder.build(uriParserResultView, jpaEntity, contentType); } finally { close(); } return oDataResponse; }
@Override public ODataResponse executeFunctionImport(final GetFunctionImportUriInfo uriParserResultView, final String contentType) throws ODataException { ODataResponse oDataResponse = null; try { oDataJPAContext.setODataContext(getContext()); List<Object> resultEntity = jpaProcessor.process(uriParserResultView); oDataResponse = responseBuilder.build(uriParserResultView, resultEntity, contentType); } finally { close(); } return oDataResponse; }