Class BiContext


  • public class BiContext
    extends Object
    Contains all required BI data for MessageML instrumentation. It's composed by a list of BiItem, one per element found inside the message along with the current messageML-utils version.
    • Field Detail

      • LIBRARY_VERSION

        public static final String LIBRARY_VERSION
    • Constructor Detail

      • BiContext

        public BiContext()
    • Method Detail

      • addItem

        public void addItem​(BiItem item)
        Adds a specific item to the context. No check if an item with same name already exists, the item will be added in any case.
        Parameters:
        item - to be added
      • addItemWithValue

        public void addItemWithValue​(String itemName,
                                     Object itemValue)
        Add a specific item to the context. Used for simple items where we want to keep track of the size/value of the entity
        Parameters:
        itemName - name of the item to be added
        itemValue - value to be assigned
      • updateItemCount

        public void updateItemCount​(String itemName,
                                    String attributeName)
        Used for simple messageML elements (like Paragraphs, Links, Headers) where we only want to keep the count of attributes found. It checks if the context already has an item for the element and if that's the case it will increase the count of the specific attribute found with attributeName. If context does not have the item it will create a new one with default values.
        Parameters:
        itemName - name of the element to be checked
        attributeName - name of the attribute to be increased
      • updateItemCount

        public void updateItemCount​(String itemName)
        Used for simple messageML elements (like Paragraphs, Links, Headers) where we only want to keep the count of attributes found. It checks if the context already has an item for the element and if that's the case it will increase the count of the specific attribute. If context does not have the item it will create a new one with default values.
        Parameters:
        itemName - name of the element to be checked
      • updateItemCount

        public void updateItemCount​(String itemName,
                                    Map<String,​Object> attributes)
        Used for elements where we want to increase attribute's value. If the element does not exist in the context yet, it is put. If the element exists in the context but no value found for the attribute, it is put. If the element and its attribute exist in the context, then the value is increased.
        Parameters:
        itemName - name of the element to be checked
        attributes - map of attributes for the given element
      • updateItemWithMaxValue

        public void updateItemWithMaxValue​(String itemName,
                                           Integer attributeValue)
        Used for messageML elements in which we want to keep track of the maximum value found inside the message (like max number of columns used for a table). It checks if the context already has an item for that element and if that's the case it will copute the max value and update the item accordingly. If context does not have the item it will create a new one with max value the one passed in input.
        Parameters:
        itemName - name of the element to be checked
      • isAttributeSet

        public boolean isAttributeSet​(String itemName,
                                      String attributeName)
        Used to check if an attribute is present in the BI context for a given item.
        Parameters:
        itemName - name of the element to be checked
        attributeName - name of the attribute to be checked