Interface ContextReferencedItemModelService
- All Known Implementing Classes:
DefaultContextReferencedItemModelService,DefaultModelEntityService
public interface ContextReferencedItemModelService
A service for looking up items nested in the payload of the item to be persisted.
-
Method Summary
Modifier and TypeMethodDescriptionderiveItemsReferencedInAttributeValue(PersistenceContext context, TypeAttributeDescriptor attribute) Derives a collection ofItemModels referenced by the specified attribute in the item payload present in the provided persistence context.deriveReferencedItemModel(TypeAttributeDescriptor attribute, PersistenceContext referencedItemContext) Using the context derives an existingItemModelthat is referenced in the payload of the item to be persisted.
-
Method Details
-
deriveReferencedItemModel
ItemModel deriveReferencedItemModel(TypeAttributeDescriptor attribute, PersistenceContext referencedItemContext) Using the context derives an existingItemModelthat is referenced in the payload of the item to be persisted.- 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.
-
deriveItemsReferencedInAttributeValue
Collection<ItemModel> deriveItemsReferencedInAttributeValue(PersistenceContext context, TypeAttributeDescriptor attribute) Derives a collection ofItemModels referenced by the specified attribute in the item payload present in the provided persistence context.- 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.
-