Class DefaultIntegrationItem

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      java.lang.Object getAttribute​(java.lang.String name)
      Retrieves value of an attribute.
      java.lang.String getIntegrationKey()
      Retrieves integration key value for this item.
      java.lang.String getIntegrationObjectCode()
      Retrieves code of the IntegrationObjectModel this item belongs to.
      java.lang.String getLocalizedAttribute​(java.lang.String attribute, java.lang.String lang)
      Reads value of a localized attribute.
      java.lang.String getLocalizedAttribute​(java.lang.String attribute, java.util.Locale lang)
      Reads value of a localized attribute.
      IntegrationItem getReferencedItem​(java.lang.String attribute)
      Retrieves an integration item referenced by specified attribute.
      java.util.Collection<IntegrationItem> getReferencedItems​(java.lang.String attribute)
      Retrieves multiple integration items referenced by specified attribute.
      int hashCode()  
      boolean setAttribute​(java.lang.String attrName, java.lang.Object value)
      Sets value of an attribute in this item.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DefaultIntegrationItem

        public DefaultIntegrationItem​(@NotNull
                                      @NotNull TypeDescriptor type,
                                      java.lang.String key)
        Instantiates this integration item.
        Parameters:
        type - descriptor of the item type this new instance will have
        key - integration key of this item. Integration key can be null
    • Method Detail

      • getIntegrationKey

        public java.lang.String getIntegrationKey()
        Description copied from interface: IntegrationItem
        Retrieves integration key value for this item.
        Specified by:
        getIntegrationKey in interface IntegrationItem
        Returns:
        calculated integration key value for the item content.
      • setAttribute

        public boolean setAttribute​(java.lang.String attrName,
                                    java.lang.Object value)
        Sets value of an attribute in this item.

        This method does enforce any invariants, e.g. attribute existence, match of the value type to the declared in the metadata, etc.

        Specified by:
        setAttribute in interface IntegrationItem
        Parameters:
        attrName - name of the attribute whose value needs to be set.
        value - a value for the attribute. In order to set a value for a localized attribute, LocalizedValue should be passed as the value.
        Returns:
        true, if the value was successfully set, or false, if the specified attribute does not exist for this item.
      • getAttribute

        public java.lang.Object getAttribute​(java.lang.String name)
        Description copied from interface: IntegrationItem
        Retrieves value of an attribute.
        Specified by:
        getAttribute in interface IntegrationItem
        Parameters:
        name - name of the attribute to read.
        Returns:
        value for the specified attribute in this item or null, if the attribute has not been set yet or does not exist.
      • getLocalizedAttribute

        public java.lang.String getLocalizedAttribute​(java.lang.String attribute,
                                                      java.lang.String lang)
        Reads value of a localized attribute.
        Specified by:
        getLocalizedAttribute in interface IntegrationItem
        Parameters:
        attribute - name of the attribute to read
        lang - ISO code of the language, e.g. 'en' or 'es_CO', for which the attribute should be read. This is the value that can be read from Locale as Locale.toLanguageTag()
        Returns:
        value of the specified attribute in the specified language or null, if either the attribute or the language does not have a value set.
        Throws:
        java.lang.IllegalArgumentException - when the attribute is not localized
      • getLocalizedAttribute

        public java.lang.String getLocalizedAttribute​(java.lang.String attribute,
                                                      java.util.Locale lang)
        Reads value of a localized attribute. This method should ensure the specified attribute is indeed localized. Otherwise, the implementations should not return a value or indicate the problem by throwing an exception.
        Specified by:
        getLocalizedAttribute in interface IntegrationItem
        Parameters:
        attribute - name of the attribute to read
        lang - language, for which the attribute should be read
        Returns:
        value of the specified attribute in the specified language or null, if either the attribute or the language does not have a value set.
        Throws:
        java.lang.IllegalArgumentException - when the attribute is not localized
      • getReferencedItem

        public IntegrationItem getReferencedItem​(java.lang.String attribute)
        Description copied from interface: IntegrationItem
        Retrieves an integration item referenced by specified attribute. It does the same as calling IntegrationItem.getAttribute(String) but there is no need to cast result of that call to IntegrationItem.
        Specified by:
        getReferencedItem in interface IntegrationItem
        Parameters:
        attribute - name of the attribute, whose value is a nested IntegrationItem
        Returns:
        the referenced item or null, if this item does not contain the referenced item for the specified attribute name.
      • getReferencedItems

        public java.util.Collection<IntegrationItem> getReferencedItems​(java.lang.String attribute)
        Description copied from interface: IntegrationItem
        Retrieves multiple integration items referenced by specified attribute. It does the same as calling IntegrationItem.getAttribute(String) but there is no need to cast result of that call to Collection<IntegrationItem>.
        Specified by:
        getReferencedItems in interface IntegrationItem
        Parameters:
        attribute - name of the attribute, whose value is a collection of nested IntegrationItems
        Returns:
        the referenced items. if this item does not contain referenced items for the specified attribute name, an empty collection is returned. If the attribute references a single instance of an IntegrationItem instead of a collection, then a collection with that single item will be returned.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object