Class ListClass

    • Method Detail

      • setSeparators

        public void setSeparators​(String separators)
        Parameters:
        separators - a string of characters used to split/deserialize an input string coming from the UI (filled by the user) that represents a serialized list
      • getDisplayType

        public String getDisplayType()
      • setDisplayType

        public void setDisplayType​(String type)
      • getSort

        public String getSort()
      • setSort

        public void setSort​(String sort)
      • getSize

        public int getSize()
      • setSize

        public void setSize​(int size)
      • isCache

        public boolean isCache()
      • setCache

        public void setCache​(boolean cache)
      • isMultiSelect

        public boolean isMultiSelect()
      • setMultiSelect

        public void setMultiSelect​(boolean multiSelect)
      • isRelationalStorage

        public boolean isRelationalStorage()
      • setRelationalStorage

        public void setRelationalStorage​(boolean relationalStorage)
        Parameters:
        relationalStorage - if false, the list items will be concatenated into a VARCHAR column on a single row. Otherwise, items are stored in their own entries in the database. In most cases, this property should have the same value as the multiSelect property
      • isPicker

        public boolean isPicker()
      • setPicker

        public void setPicker​(boolean picker)
      • isLargeStorage

        public boolean isLargeStorage()
        Since:
        11.5RC1
      • setLargeStorage

        public void setLargeStorage​(boolean largeStorage)
        Since:
        11.5RC1
      • setSeparator

        public void setSeparator​(String separator)
        Parameters:
        separator - a string (usually just 1 character long) used to join this list's items when displaying it in the UI in view mode.
      • getDefaultValue

        public String getDefaultValue()
        Returns:
        the default value used in the select editor
        Since:
        10.9, 10.8.1
      • setDefaultValue

        public void setDefaultValue​(String separator)
        Parameters:
        separator - the default value used in the select editor
        Since:
        10.9, 10.8.1
      • getFreeText

        public String getFreeText()
        Returns:
        the value of freeText (forbidden, discouraged or allowed)
        Since:
        10.11RC1
      • setFreeText

        public void setFreeText​(String type)
        Parameters:
        type - the value of freeText (forbidden, discouraged or allowed)
        Since:
        10.11RC1
      • getListFromString

        public static List<String> getListFromString​(String value)
        Convenience method, using "|" as separator and parsing key=value items.
        Parameters:
        value - the string holding a serialized list
        Returns:
        the list that was stored in the input string
        See Also:
        getListFromString(String, String, boolean)
      • getFirstSeparator

        protected String getFirstSeparator()
        Returns:
        the first separator of the list of separators, or fallback on DEFAULT_SEPARATOR.
        Since:
        14.2RC1
      • getListFromString

        public static List<String> getListFromString​(String value,
                                                     String separators,
                                                     boolean withMap)
        Parameters:
        value - the string holding a serialized list
        separators - the separator characters (given as a string) used to delimit the list's items inside the input string. These separators can also be present, in escaped (92) form, inside list items
        withMap - set to true if the list's values contain map entries (key=value pairs) that should also be parsed. Only the keys are extracted from such list items
        Returns:
        the list that was stored in the input string
      • getListFromString

        protected static List<String> getListFromString​(String value,
                                                        String separators,
                                                        boolean withMap,
                                                        boolean filterEmptyValues)
        Parameters:
        value - the string holding a serialized list
        separators - the separator characters (given as a string) used to delimit the list's items inside the input string. These separators can also be present, in escaped (92) form, inside list items
        withMap - set to true if the list's values contain map entries (key=value pairs) that should also be parsed. Only the keys are extracted from such list items
        filterEmptyValues - true if the result should not contain any empty values.
        Returns:
        the list that was stored in the input string
      • getStringFromList

        public static String getStringFromList​(List<String> list)
        Convenience method, using "|" as separator.
        Parameters:
        list - the list to serialize
        Returns:
        a string representing a serialized list, delimited by the first separator character (from the ones inside the separators string). Separators inside list items are safely escaped (92).
        See Also:
        getStringFromList(List, String)
      • getStringFromList

        public static String getStringFromList​(List<String> list,
                                               String separators)
        Parameters:
        list - the list to serialize
        separators - the separator characters (given as a string) used when the list was populated with values. The list's items can contain these separators in plain/unescaped form. The first separator character will be used to join the list in the output.
        Returns:
        a string representing a serialized list, delimited by the first separator character (from the ones inside the separators string). Separators inside list items are safely escaped (92).
      • getDisplayValue

        public String getDisplayValue​(String value,
                                      String name,
                                      Map<String,​ListItem> map,
                                      XWikiContext context)
        Search for an internationalizable display text for the current value. The search process is:
        1. let V = the internal value of the option, used as the "value" attribute of the <option> element, and D = the displayed value
        2. if a message with the key <fieldFullName>_<V> exists, return it as D
        3. else, if a message with the key option_<fieldName>_<V> exists, return it as D
        4. else, if a message with the key option_<V> exists, return it as D
        5. else, D can be specified in the values parameter of the property by using V=D
        6. else return V
        Parameters:
        value - The internal value.
        name - The name of the ListProperty.
        map - The value=name mapping specified in the "values" parameter of the property.
        context - The request context.
        Returns:
        The text that should be displayed, representing a human-understandable name for the internal value.
        Since:
        13.10RC1
      • getDisplayValue

        protected String getDisplayValue​(Object rawvalue,
                                         String name,
                                         Map<String,​ListItem> map,
                                         XWikiContext context)
        Search for an internationalizable display text for the current value. The value can be either a simple string, or a value=name pair selected from the database.
        Parameters:
        rawvalue - The internal value, or a value=name pair.
        name - The name of the ListProperty.
        map - The value=name mapping specified in the "values" parameter of the property.
        context - The request context.
        Returns:
        The text that should be displayed, representing a human-understandable name for the internal value.
        See Also:
        getDisplayValue(String, String, Map, XWikiContext)
      • getElementValue

        protected String getElementValue​(Object rawvalue)
        If the list is populated with value=name pairs selected from the database, then return only the value. Otherwise, it is a simple value.
        Parameters:
        rawvalue -
        Returns:
        The list value
      • toList

        public List<String> toList​(BaseProperty<?> property)
        ListClass does not produce only ListPropertys and this method allows to access the value as List whatever property is actually storing it.

        There is no guarantees the returned List will be modifiable.

        Parameters:
        property - the property created by this class
        Returns:
        the List representation of this property
        Since:
        6.2M1
      • fromList

        public void fromList​(BaseProperty<?> property,
                             List<String> list)
        Set the passed List into the passed property.
        Parameters:
        property - the property to modify
        list - the list to set
        Since:
        6.2M1
      • fromList

        protected void fromList​(BaseProperty<?> property,
                                List<String> list,
                                boolean filterEmptyValues)
        Set the passed List into the passed property.
        Parameters:
        property - the property to modify
        list - the list to set
        filterEmptyValues - if true filter out the empty values from the list.
        Since:
        14.2RC1
      • mergeProperty

        public <T extends EntityReference> void mergeProperty​(BaseProperty<T> currentProperty,
                                                              BaseProperty<T> previousProperty,
                                                              BaseProperty<T> newProperty,
                                                              MergeConfiguration configuration,
                                                              XWikiContext context,
                                                              MergeResult mergeResult)
        Description copied from class: PropertyClass
        Apply a 3 ways merge on passed current, previous and new version of the same property. The passed current version is modified as result of the merge.
        Overrides:
        mergeProperty in class PropertyClass
        Parameters:
        currentProperty - the current version of the element and the one to modify
        previousProperty - the previous version of the element
        newProperty - the new version of the property
        configuration - the configuration of the merge Indicate how to deal with some conflicts use cases, etc.
        context - the XWiki context
        mergeResult - the merge report