Class DBTreeListClass

    • Constructor Detail

      • DBTreeListClass

        public DBTreeListClass()
    • Method Detail

      • getParentField

        public String getParentField()
      • setParentField

        public void setParentField​(String parentField)
      • getCachedDBTreeList

        protected List<ListItem> getCachedDBTreeList​(XWikiContext context)
        Get the ordered list of tree nodes that is currently cached, if any.
        context - the current request context
        the cached list, or null if not already cached
      • setCachedDBTreeList

        protected void setCachedDBTreeList​(List<ListItem> cachedDBTreeList,
                                           XWikiContext context)
        Store the ordered list of tree nodes in a cache.
        cachedDBTreeList - the list to cache
        context - the current request context
      • getTreeList

        protected List<ListItem> getTreeList​(Map<String,​List<ListItem>> treemap,
                                             Map<String,​ListItem> map,
                                             XWikiContext context)
        Gets an ordered list of items in the tree. This is necessary to make sure children are coming right after their parents.
        treemap - the unordered list of tree nodes
        map - the mapping between a node name and its corresponding tree node
        context - the current request context
        ordered list of ListItem tree nodes
      • getQuery

        public String getQuery​(XWikiContext context)

        Computes the query corresponding to the current XProperty. The query is either manually specified by the XClass creator in the sql field, or, if the query field is blank, constructed using the classname, idField, valueField and parentField properties. The query is constructed according to the following rules:

        • If no classname, id and value fields are selected, return a query that return no rows, as the parent is not enough to make a query.
        • If no parent field is provided, use the document "parent" medatada.
        • If only the classname is provided, select all document names which have an object of that type, preserving the hierarchy defined by the parent field.
        • If only one of id and value is provided, use it for both columns.
        • If no classname is provided, assume the fields are document properties.
        • If the document is not used at all, don't put it in the query.
        • If the object is not used at all, don't put it in the query.

        The generated query always selects 3 columns, the first one is used as the stored value, the second one as the displayed value, and the third one defines the "parent" of the current value.

        getQuery in class DBListClass
        context - The current context.
        The HQL query corresponding to this property.