Interface ReferencePath


  • public interface ReferencePath
    Represents a reference path from one item to another as a sequence of some Java property or attribute invocation. For example, let's say we have Address type, with attributes owner, which is a Customer; the Customer has attribute organization, which is a Company. Then a path that contains owner and organization attributes would lead us from a specific instance of Address to the corresponding instance of Company.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.Collection<java.lang.Object> execute​(ItemModel item)
      Performs navigation to the referenced item(s) by following this reference path.
      java.util.Collection<ReferencePath> expand()
      Expands current path into all possible references from the current destination in this path to other integration items.
      TypeDescriptor getDestination()
      Retrieves destination type for this path.
      int length()
      Determines how many attributes need to be called in the navigation process until the destination item is reached.
      boolean reaches​(TypeDescriptor type)
      Determines whether this path navigates through the specified integration item type.
    • Method Detail

      • getDestination

        TypeDescriptor getDestination()
        Retrieves destination type for this path.
        Returns:
        destination type of this navigation path
      • length

        int length()
        Determines how many attributes need to be called in the navigation process until the destination item is reached.
        Returns:
        number of attribute calls chained to form this path. 0 means no attribute invocation is involved and the source TypeDescriptor matches the destination TypeDescriptor
      • reaches

        boolean reaches​(TypeDescriptor type)
        Determines whether this path navigates through the specified integration item type.
        Parameters:
        type - integration item type to check
        Returns:
        true, if this path has the specified item type as its source or its destination or it's present anywhere in between the source and destination; false, if this path does not navigate through the specified type at all.
      • expand

        java.util.Collection<ReferencePath> expand()
        Expands current path into all possible references from the current destination in this path to other integration items. For example, let's say current path contains navigation from Category to Product and Product has references to Unit and CatalogVersion, then the result of the expansion will contain two paths:
        1. Category -> Product -> Unit
        2. Category -> Product -> CatalogVersion
        Returns:
        a collection of all paths expanded from the destination. If the destination references itself as possible navigation, this reference will be excluded from the result. For example, if a Category has a property/attribute that references another Category item instance, e.g. its supercategory, this navigation from Category to Category is excluded. Moreover, the navigation is excluded, if it forms a loop in the path. For example, current path contains navigation from Category to Product. If product has navigation back to the Category or one of its predecessors such reference from the Product will be ignored and not expanded. If the destination in this path does not have references to other integration items, then it cannot be expanded and therefore an empty Collection is returned.
        See Also:
        getDestination()
      • execute

        java.util.Collection<java.lang.Object> execute​(ItemModel item)
        Performs navigation to the referenced item(s) by following this reference path.
        Parameters:
        item - an item to resolve attribute references from.
        Returns:
        a collection of the items or values referenced by this path from the specified item. The collection contains multiple elements, if some reference along the path resolves to a collection of values. For example, first attribute in this path resolves to a collection of items [a1, a2], then next attribute in this path resolves to [b11, b12] values for a1 and to [b21, b22] for a2. The resulting collection will contain values of [b11, b12, b21, b22]. If this path does not resolve to collections along the way, then the resulting collection will have only one element of the destination type. If this path resolves to null somewhere along the way, then the resulting collection is empty.