Class TreeViewModule


  • public class TreeViewModule
    extends java.lang.Object
    TreeView of module
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String MODULE_TREE_NAME  
    • Constructor Summary

      Constructors 
      Constructor Description
      TreeViewModule()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.json.JSONObject exportModule​(Grant g, java.lang.String module)
      Full module tree with inlined documents
      static org.json.JSONObject exportModule​(Grant g, java.lang.String module, java.io.File cfgDir, java.io.File docDir, boolean verbose, boolean withIds, boolean exploded)
      Full module tree
      static TreeView getModuleTreeView()
      Get the module tree definition
      static org.json.JSONObject mergeModule​(Grant g, java.lang.String module, org.json.JSONObject remote, boolean onlyDiff)
      Compare with a module tree scan
      static org.json.JSONObject mergeModule​(Grant g, org.json.JSONObject local, org.json.JSONObject remote, boolean onlyDiff)
      Compare with a module tree scan
      static void sortRepository​(FlowXML xml)
      Reorder objects to respect Repository dependencies and to group data per object
      static void sortRepository​(org.json.JSONArray list)
      Reorder objects list to respect Repository dependencies
      static org.json.JSONObject toJSONObject​(java.lang.String module, java.io.File zip, boolean inline)
      Convert ZIP .json to JSON object
      static FlowXML toXML​(java.lang.String module, java.io.File dir)
      Convert exploded .json to ordered XML flow
      static FlowXML toXML​(org.json.JSONObject module)
      Convert the tree to XML to import
      static FlowXML toXML​(org.json.JSONObject module, FlowXML xml)
      Convert the tree to XML to import
      static void toXML​(org.json.JSONObject module, java.io.OutputStream out)
      Convert the tree to XML to import
      static boolean useFullTree()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MODULE_TREE_NAME

        public static final java.lang.String MODULE_TREE_NAME
        See Also:
        Constant Field Values
    • Constructor Detail

      • TreeViewModule

        public TreeViewModule()
    • Method Detail

      • useFullTree

        public static boolean useFullTree()
      • getModuleTreeView

        public static TreeView getModuleTreeView()
        Get the module tree definition
        Returns:
        Tree
      • exportModule

        public static org.json.JSONObject exportModule​(Grant g,
                                                       java.lang.String module)
                                                throws java.io.IOException
        Full module tree with inlined documents
        Parameters:
        g - Grant admin
        module - module name
        Returns:
        JSON repository without local Ids
        Throws:
        java.io.IOException
      • exportModule

        public static org.json.JSONObject exportModule​(Grant g,
                                                       java.lang.String module,
                                                       java.io.File cfgDir,
                                                       java.io.File docDir,
                                                       boolean verbose,
                                                       boolean withIds,
                                                       boolean exploded)
                                                throws java.io.IOException
        Full module tree
        Parameters:
        g - Grant admin
        module - module name
        cfgDir - Optional directory to serialize the hierarchy
        docDir - Optional directory to serialize the attached documents (default to docDir)
        verbose - with node Ids and count?
        withIds - with item Ids?
        exploded - Exploded JSON in dir?
        Returns:
        JSON repository
        Throws:
        java.io.IOException
      • mergeModule

        public static org.json.JSONObject mergeModule​(Grant g,
                                                      java.lang.String module,
                                                      org.json.JSONObject remote,
                                                      boolean onlyDiff)
                                               throws java.io.IOException
        Compare with a module tree scan
        Parameters:
        g - Grant admin
        module - Module name
        remote - Optional JSON to compare
        onlyDiff - do not return equals data/branches
        Returns:
        JSON difference with the json content
        Throws:
        java.io.IOException
      • mergeModule

        public static org.json.JSONObject mergeModule​(Grant g,
                                                      org.json.JSONObject local,
                                                      org.json.JSONObject remote,
                                                      boolean onlyDiff)
                                               throws java.io.IOException
        Compare with a module tree scan
        Parameters:
        g - Grant admin
        local - Json Module
        remote - Optional JSON to compare
        onlyDiff - do not return equals data/branches
        Returns:
        JSON difference with the json content
        Throws:
        java.io.IOException
      • toXML

        public static FlowXML toXML​(org.json.JSONObject module)
                             throws java.io.IOException
        Convert the tree to XML to import
        Parameters:
        module - Tree
        Returns:
        XML
        Throws:
        java.io.IOException
      • toXML

        public static void toXML​(org.json.JSONObject module,
                                 java.io.OutputStream out)
                          throws java.io.IOException
        Convert the tree to XML to import
        Parameters:
        module - Tree
        out - Output stream
        Throws:
        java.io.IOException
      • toXML

        public static FlowXML toXML​(org.json.JSONObject module,
                                    FlowXML xml)
                             throws java.io.IOException
        Convert the tree to XML to import
        Parameters:
        module -
        xml - optional flow to use
        Returns:
        XML
        Throws:
        java.io.IOException
      • toXML

        public static FlowXML toXML​(java.lang.String module,
                                    java.io.File dir)
        Convert exploded .json to ordered XML flow
        Parameters:
        module - Module name
        dir - exploded directory
        Returns:
        XML flow
      • toJSONObject

        public static org.json.JSONObject toJSONObject​(java.lang.String module,
                                                       java.io.File zip,
                                                       boolean inline)
                                                throws org.json.JSONException,
                                                       java.io.IOException
        Convert ZIP .json to JSON object
        Parameters:
        module - Module name
        zip - Directory of files
        inline - inline documents or keep the relative paths?
        Returns:
        JSON object with root module
        Throws:
        org.json.JSONException
        java.io.IOException
      • sortRepository

        public static void sortRepository​(org.json.JSONArray list)
        Reorder objects list to respect Repository dependencies
        Parameters:
        list - List of objects
      • sortRepository

        public static void sortRepository​(FlowXML xml)
        Reorder objects to respect Repository dependencies and to group data per object
        Parameters:
        xml - Unordered XML flow to sort