Interface PersistenceContext

  • All Known Implementing Classes:
    StorageRequest

    public interface PersistenceContext
    Captures all parameters related to persistence of an item data. While persisting a complex item with nested item(s), a context is created for each item being persisted.
    • Method Detail

      • getIntegrationItem

        IntegrationItem getIntegrationItem()
        Retrieves item data to be persisted.
        Returns:
        item data to be persisted into an ItemModel.
      • getReferencedContext

        PersistenceContext getReferencedContext​(TypeAttributeDescriptor attribute)
        Retrieves the persistence context for an item referenced by the specified attribute
        Parameters:
        attribute - specifies referenced item
        Returns:
        the context containing information about the referenced item
      • getReferencedContexts

        java.util.Collection<PersistenceContext> getReferencedContexts​(TypeAttributeDescriptor attribute)
        Retrieves the persistence contexts for the items referenced by the specified attribute
        Parameters:
        attribute - specifies referenced items
        Returns:
        the context containing information about the referenced items
      • getSourceContext

        java.util.Optional<PersistenceContext> getSourceContext()
        Retrieves the persistence context that the referenced context was gotten from
        Returns:
        the source context. If the context is already the source, Optional.empty is returned
      • getRootContext

        PersistenceContext getRootContext()
        Retrieves the top most persistence context
        Returns:
        the root context
      • isReplaceAttributes

        default boolean isReplaceAttributes()
        Indicates the persistence is to replace the item attributes with what's provided in the IntegrationItem. This is primarily applicable to collections. The default behavior is to append to the collection. With this method being true, the item's collection attribute will be replaced instead of appended.
        Returns:
        true means to replace attributes, otherwise false.
      • isItemCanBeCreated

        boolean isItemCanBeCreated()
        Determines whether a new item model can be created for the context payload.
        Returns:
        true, when new item can be create, if an item matching the context was not found in the persistent storage; false, if the context implies update only and therefore the item should not be created, if it does not exist yet.
      • getContentLocale

        default java.util.Locale getContentLocale()
        Indicates the language, in which localized attributes content is provided.
        Returns:
        Locale or null