Package com.sap.cds.services.impl.utils
Class CdsServiceUtils
java.lang.Object
com.sap.cds.services.impl.utils.CdsServiceUtils
Utility class for CDS Services
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PersistenceServicegetDefaultPersistenceService(EventContext context) Returns the default persistence service.getEntities(EventContext context) Returns the list of entity maps present in theEventContext.getEntitiesResolved(EventContext context) Returns the list of entity maps present in theEventContext.static EventContextSPIgetEventContextSPI(EventContext eventContext) Returns the EventContext casted to theEventContextSPIstatic com.sap.cds.ResultgetResult(EventContext context) Returns theResultpresent in theEventContext.static ServiceSPIgetServiceSPI(Service service) Returns the Service casted to theServiceSPI
-
Constructor Details
-
CdsServiceUtils
public CdsServiceUtils()
-
-
Method Details
-
getDefaultPersistenceService
Returns the default persistence service.- Parameters:
context- the current context- Returns:
- the default persistence service
-
getServiceSPI
Returns the Service casted to theServiceSPI- Parameters:
service- theServiceto be casted- Returns:
- the Service casted to the
ServiceSPI, or null
-
getEntities
Returns the list of entity maps present in theEventContext. This method only works forCqnService.EVENT_CREATE,CqnService.EVENT_UPDATEandCqnService.EVENT_UPSERT. It inspects the CQN of these events and returns the entity data from it.- Parameters:
context- theEventContext- Returns:
- the list of entity maps available in the CQN of the
EventContext
-
getEntitiesResolved
Returns the list of entity maps present in theEventContext. This method only works forCqnService.EVENT_CREATE,CqnService.EVENT_UPDATEandCqnService.EVENT_UPSERT. It inspects the CQN of these events and returns the entity data from it. In contrast to {linkgetEntities(EventContext)the data also contains the resolved foreign keys from parent entities in path expressions.- Parameters:
context- theEventContext- Returns:
- the list of entity maps available in the CQN of the
EventContext
-
getResult
Returns theResultpresent in theEventContext. This method only works for the default CRUD events.- Parameters:
context- theEventContext- Returns:
- the
Resultpresent in theEventContext
-
getEventContextSPI
Returns the EventContext casted to theEventContextSPI- Parameters:
eventContext- theEventContextto be casted- Returns:
- the Service casted to the
EventContextSPI, or null
-