Class DefaultModelEntityService

    • Constructor Detail

      • DefaultModelEntityService

        public DefaultModelEntityService()
    • Method Detail

      • deriveItemsReferencedInAttributeValue

        public java.util.Collection<ItemModel> deriveItemsReferencedInAttributeValue​(PersistenceContext context,
                                                                                     TypeAttributeDescriptor attribute)
        Description copied from interface: ContextReferencedItemModelService
        Derives a collection of ItemModels referenced by the specified attribute in the item payload present in the provided persistence context.
        Specified by:
        deriveItemsReferencedInAttributeValue in interface ContextReferencedItemModelService
        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 or null. Found items are already updated with the values from their payloads.
      • deriveReferencedItemModel

        public ItemModel deriveReferencedItemModel​(TypeAttributeDescriptor attribute,
                                                   PersistenceContext referencedItemContext)
        Description copied from interface: ContextReferencedItemModelService
        Using the context derives an existing ItemModel that is referenced in the payload of the item to be persisted.
        Specified by:
        deriveReferencedItemModel in interface ContextReferencedItemModelService
        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 an ItemModel.
        Returns:
        an item specified by PersistenceContext.getIntegrationItem() or null, if such item does not exist in the platform. If the item is found, then it's already updated with the values from the referencedItemContext.
      • findOrCreateItem

        public ItemModel findOrCreateItem​(PersistenceContext context)
        Description copied from interface: ContextItemModelService
        Using the context searches for an ItemModel existing 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:
        findOrCreateItem in interface ContextItemModelService
        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 the context.
      • createOrUpdateItem

        public ItemModel createOrUpdateItem​(StorageRequest request,
                                            CreateItemStrategy createItemStrategy)
                                     throws org.apache.olingo.odata2.api.edm.EdmException
        Description copied from interface: ModelEntityService
        create or update platform items based on an ODataEntry
        Specified by:
        createOrUpdateItem in interface ModelEntityService
        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.EdmException
        Deprecated, 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: ModelEntityService
        Converts an itemModel into a ODataEntry
        Specified by:
        getODataEntry in interface ModelEntityService
        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: ModelEntityService
        Adds the alias value for an item's integrationKey to the oDataEntry
        Specified by:
        addIntegrationKeyToODataEntry in interface ModelEntityService
        Parameters:
        entitySet - Edmx representation of the item
        oDataEntry - 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: ModelEntityService
        gets an itemModel based on the given information.
        Specified by:
        lookup in interface ModelEntityService
        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
      • count

        public int count​(ItemLookupRequest lookupRequest)
        Description copied from interface: ModelEntityService
        Counts how many items in the platform match the provided request conditions.
        Specified by:
        count in interface ModelEntityService
        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.
      • createItem

        protected ItemModel createItem​(StorageRequest request,
                                       CreateItemStrategy createItemStrategy)
                                throws org.apache.olingo.odata2.api.edm.EdmException
        Throws:
        org.apache.olingo.odata2.api.edm.EdmException
      • 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.
        Injects ItemLookupStrategy implementation to be used by this service
        Parameters:
        itemLookupStrategy - strategy implementation to use.
      • 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.
        Parameters:
        integrationKeyValueGenerator - implementation to use.
      • setItemModelPopulator

        public void setItemModelPopulator​(ItemModelPopulator populator)
      • setCreateItemStrategy

        public void setCreateItemStrategy​(CreateItemStrategy strategy)
      • getModelService

        protected ModelService getModelService()
      • setModelService

        public void setModelService​(ModelService modelService)
      • setItemTypeDescriptorService

        public void setItemTypeDescriptorService​(ItemTypeDescriptorService itemTypeDescriptorService)
      • setPersistenceContextValidators

        public void setPersistenceContextValidators​(java.util.List<PersistenceContextValidator> persistenceContextValidators)
      • setItemPersistRequestValidators

        public void setItemPersistRequestValidators​(java.util.List<ItemPersistRequestValidator> itemPersistRequestValidators)