Class DefaultModelEntityService
- java.lang.Object
-
- de.hybris.platform.odata2services.odata.persistence.impl.DefaultModelEntityService
-
- All Implemented Interfaces:
ContextItemModelService,ContextReferencedItemModelService,ModelEntityService
public class DefaultModelEntityService extends java.lang.Object implements ModelEntityService, ContextItemModelService, ContextReferencedItemModelService
Default implementation forModelEntityService
-
-
Constructor Summary
Constructors Constructor Description DefaultModelEntityService()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.StringaddIntegrationKeyToODataEntry(org.apache.olingo.odata2.api.edm.EdmEntitySet entitySet, org.apache.olingo.odata2.api.ep.entry.ODataEntry oDataEntry)Adds the alias value for an item's integrationKey to the oDataEntryintcount(ItemLookupRequest lookupRequest)Counts how many items in the platform match the provided request conditions.protected ItemModelcreateItem(StorageRequest request, CreateItemStrategy createItemStrategy)ItemModelcreateOrUpdateItem(StorageRequest request, CreateItemStrategy createItemStrategy)create or update platform items based on an ODataEntryjava.util.Collection<ItemModel>deriveItemsReferencedInAttributeValue(PersistenceContext context, TypeAttributeDescriptor attribute)Deprecated, for removal: This API element is subject to removal in a future version.ItemModelderiveReferencedItemModel(TypeAttributeDescriptor attribute, PersistenceContext referencedItemContext)Deprecated, for removal: This API element is subject to removal in a future version.ItemModelfindOrCreateItem(PersistenceContext context)Deprecated, for removal: This API element is subject to removal in a future version.protected CreateItemStrategygetCreateItemStrategy()protected java.util.List<CreateItemValidator>getCreateItemValidators()protected EntityModelPopulatorgetEntityModelPopulator()protected ItemModelgetItem(StorageRequest request, CreateItemStrategy createItemStrategy)Deprecated, for removal: This API element is subject to removal in a future version.No alternative methodprotected ItemModelPopulatorgetItemModelPopulator()protected ItemTypeDescriptorServicegetItemTypeDescriptorService()protected IntegrationKeyValueGenerator<TypeDescriptor,org.apache.olingo.odata2.api.ep.entry.ODataEntry>getKeyValueGenerator()protected ModelServicegetModelService()org.apache.olingo.odata2.api.ep.entry.ODataEntrygetODataEntry(ItemConversionRequest conversionRequest)Converts an itemModel into a ODataEntryItemModellookup(ItemLookupRequest lookupRequest)gets an itemModel based on the given information.ItemLookupResult<ItemModel>lookupItems(ItemLookupRequest lookupRequest)Searches for item models matching the conditions in the specified request.protected voidpopulateItem(StorageRequest request, ItemModel item)voidsetContextItemModelService(ContextItemModelService contextItemModelService)voidsetContextReferencedItemModelService(ContextReferencedItemModelService contextReferencedItemModelService)voidsetCreateItemStrategy(CreateItemStrategy strategy)voidsetCreateItemValidators(java.util.List<CreateItemValidator> createItemValidators)voidsetEntityModelPopulator(EntityModelPopulator entityModelPopulator)voidsetIntegrationKeyValueGenerator(IntegrationKeyValueGenerator<org.apache.olingo.odata2.api.edm.EdmEntitySet,org.apache.olingo.odata2.api.ep.entry.ODataEntry> integrationKeyValueGenerator)Deprecated, for removal: This API element is subject to removal in a future version.usesetKeyValueGenerator(IntegrationKeyValueGenerator)instead.voidsetItemLookupStrategy(ItemLookupStrategy itemLookupStrategy)Deprecated, for removal: This API element is subject to removal in a future version.usesetSearchService(ItemSearchService)instead.voidsetItemModelPopulator(ItemModelPopulator populator)voidsetItemPersistRequestValidators(java.util.List<ItemPersistRequestValidator> itemPersistRequestValidators)voidsetItemTypeDescriptorService(ItemTypeDescriptorService itemTypeDescriptorService)voidsetKeyValueGenerator(IntegrationKeyValueGenerator<TypeDescriptor,org.apache.olingo.odata2.api.ep.entry.ODataEntry> keyValueGenerator)voidsetModelService(ModelService modelService)voidsetPersistenceContextValidators(java.util.List<PersistenceContextValidator> persistenceContextValidators)voidsetSearchService(ItemSearchService service)
-
-
-
Method Detail
-
deriveItemsReferencedInAttributeValue
@Deprecated(since="21.05.0-RC1", forRemoval=true) public java.util.Collection<ItemModel> deriveItemsReferencedInAttributeValue(PersistenceContext context, TypeAttributeDescriptor attribute)Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ContextReferencedItemModelServiceDerives a collection ofItemModels referenced by the specified attribute in the item payload present in the provided persistence context.- Specified by:
deriveItemsReferencedInAttributeValuein interfaceContextReferencedItemModelService- Parameters:
context- a persistence context containing information about the item being persisted.attribute- an attribute in the context item payload referencing a collection of items to be derived.- Returns:
- a collection of items corresponding to the values of the specified attribute in
PersistenceContext.getIntegrationItem()or an empty collection, if the payload either does not contain the attribute or the attribute value in the payload is empty ornull. Found items are already updated with the values from their payloads.
-
deriveReferencedItemModel
@Deprecated(since="21.05.0-RC1", forRemoval=true) public ItemModel deriveReferencedItemModel(TypeAttributeDescriptor attribute, PersistenceContext referencedItemContext)Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ContextReferencedItemModelServiceUsing the context derives an existingItemModelthat is referenced in the payload of the item to be persisted.- Specified by:
deriveReferencedItemModelin interfaceContextReferencedItemModelService- Parameters:
attribute- an attribute that represents the relationship between the item model and the referenced item model that will be derived.referencedItemContext- a persistence context containing information about the item to be found or, in other words, payload of the item to be resolved and converted to anItemModel.- Returns:
- an item specified by
PersistenceContext.getIntegrationItem()ornull, if such item does not exist in the platform. If the item is found, then it's already updated with the values from thereferencedItemContext.
-
findOrCreateItem
@Deprecated(since="21.05.0-RC1", forRemoval=true) public ItemModel findOrCreateItem(PersistenceContext context)Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ContextItemModelServiceUsing the context searches for anItemModelexisting in context or in the platform; if not found creates a new item model from the information available in the context. This method should be used when creating a new item for the root or nested integration item is desired in cases when the item was not found.- Specified by:
findOrCreateItemin interfaceContextItemModelService- Parameters:
context- a persistence context containing information about the item to be persisted.- Returns:
- an item specified by
PersistenceContext.getIntegrationItem(). It may be an item existing in the platform or a new item instance, if such item does not exist yet. In either case the item is already updated/populated with values provided in thecontext.
-
createOrUpdateItem
public ItemModel createOrUpdateItem(StorageRequest request, CreateItemStrategy createItemStrategy) throws org.apache.olingo.odata2.api.edm.EdmException
Description copied from interface:ModelEntityServicecreate or update platform items based on an ODataEntry- Specified by:
createOrUpdateItemin interfaceModelEntityService- Parameters:
request- Parameter object that holds values for creating or updating an item.createItemStrategy- strategy used to create non-existing items- Returns:
- the ItemModel that was created or updated
- Throws:
org.apache.olingo.odata2.api.edm.EdmException- in case there is an OData related issue
-
getItem
@Deprecated(since="1905.07-CEP", forRemoval=true) protected ItemModel getItem(StorageRequest request, CreateItemStrategy createItemStrategy) throws org.apache.olingo.odata2.api.edm.EdmExceptionDeprecated, for removal: This API element is subject to removal in a future version.No alternative method- Throws:
org.apache.olingo.odata2.api.edm.EdmException
-
getODataEntry
public org.apache.olingo.odata2.api.ep.entry.ODataEntry getODataEntry(ItemConversionRequest conversionRequest) throws org.apache.olingo.odata2.api.edm.EdmException
Description copied from interface:ModelEntityServiceConverts an itemModel into a ODataEntry- Specified by:
getODataEntryin interfaceModelEntityService- Parameters:
conversionRequest- Parameter object that holds values for getting an ODataEntry- Returns:
- The ODataEntry representation
- Throws:
org.apache.olingo.odata2.api.edm.EdmException- in case there is an OData related issue
-
addIntegrationKeyToODataEntry
public java.lang.String addIntegrationKeyToODataEntry(org.apache.olingo.odata2.api.edm.EdmEntitySet entitySet, org.apache.olingo.odata2.api.ep.entry.ODataEntry oDataEntry)Description copied from interface:ModelEntityServiceAdds the alias value for an item's integrationKey to the oDataEntry- Specified by:
addIntegrationKeyToODataEntryin interfaceModelEntityService- Parameters:
entitySet- Edmx representation of the itemoDataEntry- request body represented as xml or json- Returns:
- The calculated integration key.
-
lookup
public ItemModel lookup(ItemLookupRequest lookupRequest) throws org.apache.olingo.odata2.api.edm.EdmException
Description copied from interface:ModelEntityServicegets an itemModel based on the given information.- Specified by:
lookupin interfaceModelEntityService- Parameters:
lookupRequest- Parameter object that holds values for getting an itemModel- Returns:
- the itemModel
- Throws:
org.apache.olingo.odata2.api.edm.EdmException- in case there is an OData related issue
-
lookupItems
public ItemLookupResult<ItemModel> lookupItems(ItemLookupRequest lookupRequest)
Description copied from interface:ModelEntityServiceSearches for item models matching the conditions in the specified request.- Specified by:
lookupItemsin interfaceModelEntityService- Parameters:
lookupRequest- Parameter object that holds values for getting an itemModel- Returns:
- result searching item models by the specified request
-
count
public int count(ItemLookupRequest lookupRequest)
Description copied from interface:ModelEntityServiceCounts how many items in the platform match the provided request conditions.- Specified by:
countin interfaceModelEntityService- Parameters:
lookupRequest- a request specifying an item type, at a minimum, and possibly other conditions. For example, the request may point to the objects nested in the request's base item type and referred by the navigation segments.- Returns:
- number of items in the platform matching the request conditions.
-
populateItem
protected void populateItem(StorageRequest request, ItemModel item)
-
createItem
protected ItemModel createItem(StorageRequest request, CreateItemStrategy createItemStrategy) throws org.apache.olingo.odata2.api.edm.EdmException
- Throws:
org.apache.olingo.odata2.api.edm.EdmException
-
setSearchService
public void setSearchService(ItemSearchService service)
-
setItemLookupStrategy
@Deprecated(since="1905.2002-CEP", forRemoval=true) public void setItemLookupStrategy(ItemLookupStrategy itemLookupStrategy)Deprecated, for removal: This API element is subject to removal in a future version.usesetSearchService(ItemSearchService)instead.InjectsItemLookupStrategyimplementation to be used by this service- Parameters:
itemLookupStrategy- strategy implementation to use.
-
getEntityModelPopulator
protected EntityModelPopulator getEntityModelPopulator()
-
setEntityModelPopulator
public void setEntityModelPopulator(EntityModelPopulator entityModelPopulator)
-
getCreateItemValidators
protected java.util.List<CreateItemValidator> getCreateItemValidators()
-
setCreateItemValidators
public void setCreateItemValidators(java.util.List<CreateItemValidator> createItemValidators)
-
setIntegrationKeyValueGenerator
@Deprecated(since="1905.2002-CEP", forRemoval=true) public void setIntegrationKeyValueGenerator(IntegrationKeyValueGenerator<org.apache.olingo.odata2.api.edm.EdmEntitySet,org.apache.olingo.odata2.api.ep.entry.ODataEntry> integrationKeyValueGenerator)Deprecated, for removal: This API element is subject to removal in a future version.usesetKeyValueGenerator(IntegrationKeyValueGenerator)instead.- Parameters:
integrationKeyValueGenerator- implementation to use.
-
getItemModelPopulator
protected ItemModelPopulator getItemModelPopulator()
-
setItemModelPopulator
public void setItemModelPopulator(ItemModelPopulator populator)
-
getCreateItemStrategy
protected CreateItemStrategy getCreateItemStrategy()
-
setCreateItemStrategy
public void setCreateItemStrategy(CreateItemStrategy strategy)
-
getModelService
protected ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
-
getKeyValueGenerator
protected IntegrationKeyValueGenerator<TypeDescriptor,org.apache.olingo.odata2.api.ep.entry.ODataEntry> getKeyValueGenerator()
-
setKeyValueGenerator
public void setKeyValueGenerator(IntegrationKeyValueGenerator<TypeDescriptor,org.apache.olingo.odata2.api.ep.entry.ODataEntry> keyValueGenerator)
-
getItemTypeDescriptorService
protected ItemTypeDescriptorService getItemTypeDescriptorService()
-
setItemTypeDescriptorService
public void setItemTypeDescriptorService(ItemTypeDescriptorService itemTypeDescriptorService)
-
setPersistenceContextValidators
public void setPersistenceContextValidators(java.util.List<PersistenceContextValidator> persistenceContextValidators)
-
setItemPersistRequestValidators
public void setItemPersistRequestValidators(java.util.List<ItemPersistRequestValidator> itemPersistRequestValidators)
-
setContextReferencedItemModelService
public void setContextReferencedItemModelService(ContextReferencedItemModelService contextReferencedItemModelService)
-
setContextItemModelService
public void setContextItemModelService(ContextItemModelService contextItemModelService)
-
-