Class ObjectFieldList

  • All Implemented Interfaces:
    java.io.Serializable

    public class ObjectFieldList
    extends java.lang.Object
    implements java.io.Serializable
    Contextual Field List
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  ObjectFieldList.ListLink
      Linked lists mapped with codes
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void changeValues​(java.lang.String[] values, boolean all)
      Force translation of each items
      boolean containsCode​(java.lang.String code, boolean all)
      Contains a code ?
      boolean containsCodes​(java.lang.String[] codes, boolean all)
      Contains a list of codes ?
      boolean containsValue​(java.lang.String value, boolean all)
      Contains a value ?
      java.util.List<EnumItem> getAllItems()
      Get all list items (simple list, union of linked lists or all status)
      java.lang.String getCode​(int index)
      Code at position index
      java.lang.String[] getCodes​(boolean all)
      Get all codes as an array
      java.lang.String getDefaultLabel()
      Default label to display
      ObjectField getField()
      Related object field
      java.lang.String getId()
      Get the list ID
      EnumItem getItem​(int index)
      Item at position index
      EnumItem getItem​(java.lang.String code, boolean all)
      Get the item matching with the code
      EnumItem getItemByValue​(java.lang.String value, boolean all)
      Get the item matching with the value
      int getItemIndex​(java.lang.String code, boolean all)
      Get the item index matching with the code
      java.util.List<EnumItem> getItems()
      Get current items (simple list, linked list or allowed status)
      java.lang.String getLinkedFieldList​(java.lang.String object, java.lang.String field, java.lang.String code)
      Get the linked list name
      java.util.Iterator<java.lang.String> getLinkedFields()
      Get all linked object:inputs
      java.util.Map<java.lang.String,​ObjectFieldList.ListLink> getLinkedLists()
      object:input => code => linked list
      static java.util.List<java.lang.String[]> getListObjects​(java.lang.String list)
      List objects containing the list
      java.lang.String getName()
      Get the list name
      static java.util.List<java.lang.String[]> getObjectLov​(java.lang.String object)
      List LOV containing the object
      ObjectField getParentField()
      Parent field (when linked to this parent values)
      java.lang.String getValue​(int index)
      Translated value at position index
      java.lang.String[] getValues​(boolean all)
      Get all values as an array
      ObjectField initLinkedField​(ObjectDB obj, java.lang.String field, java.lang.String code)
      Prepare the linked list
      ObjectField initLinkedField​(ObjectDB obj, java.lang.String field, java.lang.String code, boolean search)
      Prepare the linked list
      void initList​(ObjectDB obj, boolean create)
      Prepare the list of values: including the state model specification, or enable current items when field is updatable
      void load​(ObjectDB obj, java.lang.String name, Grant g)
      Load the contextual list of values
      void putItem​(EnumItem item)
      Append or replace an item in the list
      void putItem​(java.lang.String code, java.lang.String value, boolean enabled)
      Append or replace a code/value in the list
      void putItem​(java.lang.String code, java.lang.String value, boolean enabled, int order)
      Append or replace a code/value in the list
      void setDefaultLabel​(java.lang.String defaultLabel)
      Change the default label
      void setField​(ObjectField field)
      Set the related enumerated field
      void setItems​(java.util.List<EnumItem> items)
      Set current items
      void setLinkedLists​(java.util.HashMap<java.lang.String,​ObjectFieldList.ListLink> links)  
      void setName​(java.lang.String name)
      Set the list name
      void setParentField​(ObjectField parent)
      Set the parent field (when linked to this parent values)
      void showIconsAndLabels​(boolean icon, boolean label)
      Show icons and labels
      org.json.JSONObject toJSONObject()
      Generates a JSON object representation of the list
      java.lang.String toString()
      Generates a string representation of the list
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ObjectFieldList

        public ObjectFieldList​(ObjectField field)
        Constructor
        Parameters:
        field - Related enumerate field
    • Method Detail

      • load

        public void load​(ObjectDB obj,
                         java.lang.String name,
                         Grant g)
        Load the contextual list of values
        Parameters:
        obj - Business object (required to load its linked lists)
        name - List name
        g - User rights
      • getId

        public java.lang.String getId()
        Get the list ID
      • getName

        public java.lang.String getName()
        Get the list name
      • setName

        public void setName​(java.lang.String name)
        Set the list name
      • getField

        public ObjectField getField()
        Related object field
      • setField

        public void setField​(ObjectField field)
        Set the related enumerated field
      • getParentField

        public ObjectField getParentField()
        Parent field (when linked to this parent values)
      • setParentField

        public void setParentField​(ObjectField parent)
        Set the parent field (when linked to this parent values)
      • getAllItems

        public java.util.List<EnumItem> getAllItems()
        Get all list items (simple list, union of linked lists or all status)
      • getItems

        public java.util.List<EnumItem> getItems()
        Get current items (simple list, linked list or allowed status)
      • setItems

        public void setItems​(java.util.List<EnumItem> items)
        Set current items
      • getDefaultLabel

        public java.lang.String getDefaultLabel()
        Default label to display
      • setDefaultLabel

        public void setDefaultLabel​(java.lang.String defaultLabel)
        Change the default label
      • getItem

        public EnumItem getItem​(int index)
        Item at position index
      • getCode

        public java.lang.String getCode​(int index)
        Code at position index
      • getValue

        public java.lang.String getValue​(int index)
        Translated value at position index
      • getCodes

        public java.lang.String[] getCodes​(boolean all)
        Get all codes as an array
        Parameters:
        all - union of lists or current one
      • containsCode

        public boolean containsCode​(java.lang.String code,
                                    boolean all)
        Contains a code ?
        Parameters:
        code - Code to search among codes
        all - search in union of lists or current one
      • containsCodes

        public boolean containsCodes​(java.lang.String[] codes,
                                     boolean all)
        Contains a list of codes ?
        Parameters:
        codes - codes to search among codes
        all - search in union of lists or current one
      • getValues

        public java.lang.String[] getValues​(boolean all)
        Get all values as an array
        Parameters:
        all - union of lists or current one
      • containsValue

        public boolean containsValue​(java.lang.String value,
                                     boolean all)
        Contains a value ?
        Parameters:
        value - Value to search among values
        all - search in union of lists or current one
      • changeValues

        public void changeValues​(java.lang.String[] values,
                                 boolean all)
        Force translation of each items
      • putItem

        public void putItem​(java.lang.String code,
                            java.lang.String value,
                            boolean enabled)
        Append or replace a code/value in the list
      • putItem

        public void putItem​(java.lang.String code,
                            java.lang.String value,
                            boolean enabled,
                            int order)
        Append or replace a code/value in the list
      • putItem

        public void putItem​(EnumItem item)
        Append or replace an item in the list
      • getItem

        public EnumItem getItem​(java.lang.String code,
                                boolean all)
        Get the item matching with the code
      • getItemByValue

        public EnumItem getItemByValue​(java.lang.String value,
                                       boolean all)
        Get the item matching with the value
      • getItemIndex

        public int getItemIndex​(java.lang.String code,
                                boolean all)
        Get the item index matching with the code
      • getListObjects

        public static java.util.List<java.lang.String[]> getListObjects​(java.lang.String list)

        List objects containing the list

        Parameters:
        list - List name
        Returns:
        list of (objectName, objectId)
      • getObjectLov

        public static java.util.List<java.lang.String[]> getObjectLov​(java.lang.String object)

        List LOV containing the object

        Parameters:
        object - Object name or null to get all lists
      • initList

        public void initList​(ObjectDB obj,
                             boolean create)
        Prepare the list of values: including the state model specification, or enable current items when field is updatable
        Parameters:
        obj - selected object with grants
        create - indicate if the initial state must be set
      • getLinkedLists

        public java.util.Map<java.lang.String,​ObjectFieldList.ListLink> getLinkedLists()
        object:input => code => linked list
      • setLinkedLists

        public void setLinkedLists​(java.util.HashMap<java.lang.String,​ObjectFieldList.ListLink> links)
      • getLinkedFields

        public java.util.Iterator<java.lang.String> getLinkedFields()
        Get all linked object:inputs
      • getLinkedFieldList

        public java.lang.String getLinkedFieldList​(java.lang.String object,
                                                   java.lang.String field,
                                                   java.lang.String code)
        Get the linked list name
        Parameters:
        object - Object
        field - Linked field name
        code - Original code
        Returns:
        List of value name to apply to the linked field
      • initLinkedField

        public ObjectField initLinkedField​(ObjectDB obj,
                                           java.lang.String field,
                                           java.lang.String code)
        Prepare the linked list
        Parameters:
        obj - Object
        field - Linked field name
        code - Original code(s) separated with ';'
        Returns:
        Reloaded Linked field, or null if unknown
      • initLinkedField

        public ObjectField initLinkedField​(ObjectDB obj,
                                           java.lang.String field,
                                           java.lang.String code,
                                           boolean search)
        Prepare the linked list
        Parameters:
        obj - Object
        field - Linked field name
        code - Selected code(s) separated with ';'
        search - Get all linked values when code is empty in a search context
        Returns:
        Reloaded Linked field, or null if unknown
      • showIconsAndLabels

        public void showIconsAndLabels​(boolean icon,
                                       boolean label)
        Show icons and labels
        Parameters:
        icon - true to show icons (if exists on code)
        label - true to show labels
      • toJSONObject

        public org.json.JSONObject toJSONObject()
        Generates a JSON object representation of the list
        Returns:
        list as JSON object
      • toString

        public java.lang.String toString()
        Generates a string representation of the list
        Overrides:
        toString in class java.lang.Object
        Returns:
        list as string