Class XSDTool


  • public class XSDTool
    extends java.lang.Object
    Simplicite XSD toolbox
    • Method Summary

      Modifier and Type Method Description
      static java.lang.String activityToXsd​(ActivityFile context)
      Converts process into XSD XML data (as XML String)
      static java.lang.String activityXsdMetaData​(Activity a, ActivityFile af, boolean data, java.lang.String ns)
      Converts activity into XSD XML data (as XML String)
      static java.lang.String crosstabToXsdData​(ObjectDB obj, Crosstab crosstab)
      Convert a document into XSD XML data
      static java.lang.String dbdocToXsdData​(Grant g, ObjectField f, boolean client)
      Convert a document into XSD XML data
      static java.lang.String fieldsToXsdData​(ObjectDB obj, java.lang.String ns)
      Converts object fields into XSD XML data (as XML String)
      static java.lang.String fieldsToXsdData​(ObjectDB obj, java.lang.String ns, boolean dbdoc, boolean client)
      Converts object fields into XSD XML data (as XML String)
      static java.lang.String filtersToXsdData​(ObjectDB obj, java.lang.String ns, boolean pagine, boolean more)
      Converts object filters into XSD XML data (as XML String)
      static java.lang.String fromXsdBoolean​(java.lang.String b)
      Converts XSD XML boolean into internal boolean value
      static java.lang.String fromXsdDateTime​(java.lang.String d)
      Converts XSD XML datetime string value into internal datetime value
      static java.lang.String fromXsdName​(java.lang.String fieldXsdName)
      Converts from XSD element name into internal field input name
      static java.lang.String fromXsdName​(java.lang.String fieldXsdName, boolean dotReplacement)
      Converts from XSD element name into internal field input name
      static java.lang.String get​(ObjectDB obj, java.lang.String row_id, java.lang.String xmlns, java.lang.String ns)  
      static java.lang.String listItemToXsdData​(ObjectDB obj, java.lang.String[] vals, java.lang.String ns)
      Convert object list item data into XSD XML data
      static java.lang.String listToXsdData​(ObjectDB obj, java.util.List<java.lang.String[]> res, java.lang.String ns)
      Convert object list item data into XSD XML data
      static java.lang.String message​(java.lang.String message, java.lang.String xmlns, java.lang.String ns)  
      static java.lang.String metadata​(ObjectDB obj, int context, java.lang.String xmlns, java.lang.String ns)  
      static java.lang.String objectXsdMetaData​(ObjectDB obj, boolean fieldsMetaData, java.lang.String ns)
      Converts object fields into XSD XML data (as XML String)
      static java.lang.String processXsdMetaData​(Processus p, boolean activities, boolean context, java.lang.String ns)
      Converts process into XSD XML data (as XML String)
      static java.lang.String simpleXmlField​(java.lang.String name, java.lang.String value)
      Generates simple XML entry
      static java.lang.String simpleXmlField​(java.lang.String name, java.lang.String value, boolean cdata)
      Generates simple XML tag
      static java.lang.Boolean toXsdBoolean​(java.lang.String b)
      Converts internal boolean value into XSD XML boolean
      static java.lang.String toXsdDateTime​(java.lang.String d)
      Converts internal datetime value into XSD XML date string
      static java.lang.String toXsdDecimal​(java.lang.String f)
      Converts internal decimal value into XSD XML decimal
      static java.lang.Double toXsdFloat​(java.lang.String f)
      Converts internal decimal value into XSD XML float
      static java.lang.Integer toXsdInt​(java.lang.String i)
      Converts internal integer field value into XSD XML integer
      static java.lang.String toXsdName​(java.lang.String fieldInputName)
      Converts internal field input name into XSD element name
      static java.lang.String toXsdString​(java.lang.String s)
      Converts and encode internal string value into XSD XML string
      static java.lang.String toXsdString​(java.lang.String s, boolean cdata)
      Converts and encode internal string value into XSD XML string
      static java.lang.String treeviewToXsdData​(TreeView tv, java.lang.String id, boolean withDoc)  
      static ActivityFile xsdActivityContext​(Processus p, org.w3c.dom.Node node)
      Converts XSD XML data (as a DOM node) to activity context
      static java.lang.String xsdContextSchema​(ObjectDB obj)
      Generates XSD schema for object's context
      static java.lang.String xsdCrosstabSchema()
      Generates XSD schema for cross table
      static java.lang.String xsdCrosstabSchema​(ObjectDB obj)
      Generates XSD schema for cross table
      static void xsdDataToContext​(ActivityFile context, org.w3c.dom.NodeList data)  
      static Crosstab xsdDataToCrosstab​(ObjectDB obj, org.w3c.dom.Node message)
      Converts XSD XML data (as a DOM node) to pivot table (and sets filters)
      static java.lang.String xsdDataToFields​(ObjectDB obj, org.w3c.dom.Node node)
      Converts XSD XML data (as a DOM node) to object fields and complete data with DB
      static java.lang.String xsdDataToFields​(ObjectDB obj, org.w3c.dom.Node node, boolean client)
      Converts XSD XML data (as a DOM node) to object fields
      static boolean xsdDataToFilters​(ObjectDB obj, org.w3c.dom.Node node)
      Converts XSD XML filters (as a DOM node) to object filters
      static DocumentDB xsdDbdoc​(org.w3c.dom.Node node)
      Converts Dbdoc XSD data (as a DOM node) to a DocumentDB structure
      static java.lang.String xsdDbdocSchema()
      Generates XSD schema for document
      static java.lang.String xsdFieldSchema​(ObjectField field, boolean filter, boolean order)  
      static java.lang.String xsdFieldSchema​(java.lang.String name, java.lang.String type, boolean nillable, boolean oldvalue)  
      static java.lang.String xsdMetaDataSchema​(ObjectDB obj)
      Generates XSD schema for object's meta data
      static void xsdProcessContext​(Processus p, org.w3c.dom.Node node)
      Converts XSD XML data (as a DOM node) to process context
      static java.lang.String[] xsdReadContext​(org.w3c.dom.NodeList attributes)  
      static java.lang.String xsdSchema​(Processus p)
      Generates XSD schema for processus
      static java.lang.String xsdSchema​(ObjectDB obj, boolean filter, boolean action, java.lang.String extraElements)
      Generates XSD schema for fields of filters (depending on filter parameter) for object
      static java.lang.String xsdSchema​(TreeView tv)
      Generates XSD schema for tree view
      static java.lang.String xsdType​(int type)
      Converts internal type into XSD type
      static java.lang.String xsdValueSchema​(java.lang.String type)
      Generates XSD schema with old value for a type of value
      static java.lang.String xsdValueSchemas()
      Generates XSD schemas for any types of value
      • Methods inherited from class java.lang.Object

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

      • simpleXmlField

        public static java.lang.String simpleXmlField​(java.lang.String name,
                                                      java.lang.String value)

        Generates simple XML entry

        Parameters:
        name - tag name
        value - value
        Returns:
        XML tag
      • simpleXmlField

        public static java.lang.String simpleXmlField​(java.lang.String name,
                                                      java.lang.String value,
                                                      boolean cdata)

        Generates simple XML tag

        Parameters:
        name - tag name
        value - value
        cdata - enclose value in <[CDATA[]]> ?
        Returns:
        XML tag
      • xsdType

        public static java.lang.String xsdType​(int type)

        Converts internal type into XSD type

        Parameters:
        type - Internal type
        Returns:
        XSD type
      • toXsdName

        public static java.lang.String toXsdName​(java.lang.String fieldInputName)

        Converts internal field input name into XSD element name

        Parameters:
        fieldInputName - Internal field input name
        Returns:
        XSD name
      • fromXsdName

        public static java.lang.String fromXsdName​(java.lang.String fieldXsdName)

        Converts from XSD element name into internal field input name

        Parameters:
        fieldXsdName - XSD XML field input name
        Returns:
        Internal input name
      • fromXsdName

        public static java.lang.String fromXsdName​(java.lang.String fieldXsdName,
                                                   boolean dotReplacement)

        Converts from XSD element name into internal field input name

        Parameters:
        fieldXsdName - XSD XML field input name
        dotReplacement - Replace dot replacement string by dot ?
        Returns:
        Internal input name
      • toXsdString

        public static java.lang.String toXsdString​(java.lang.String s)

        Converts and encode internal string value into XSD XML string

        Parameters:
        s - Internal string value
        Returns:
        Encoded XSD XML string
      • toXsdString

        public static java.lang.String toXsdString​(java.lang.String s,
                                                   boolean cdata)

        Converts and encode internal string value into XSD XML string

        Parameters:
        s - Internal string value
        cdata - Enclose raw string value in CDATA block, otherwise simply encodes XML critical characters (> into &gt;, etc.)
        Returns:
        Encoded XSD XML string
      • toXsdDateTime

        public static java.lang.String toXsdDateTime​(java.lang.String d)

        Converts internal datetime value into XSD XML date string

        Parameters:
        d - Internal datetime value to encode
        Returns:
        XSD XML datetime string (i.e. Java String)
      • fromXsdDateTime

        public static java.lang.String fromXsdDateTime​(java.lang.String d)

        Converts XSD XML datetime string value into internal datetime value

        Parameters:
        d - XSD XML date value
        Returns:
        Internal datetime value
      • toXsdBoolean

        public static java.lang.Boolean toXsdBoolean​(java.lang.String b)

        Converts internal boolean value into XSD XML boolean

        Parameters:
        b - Internal boolean value
        Returns:
        XSD XML boolean value
      • fromXsdBoolean

        public static java.lang.String fromXsdBoolean​(java.lang.String b)

        Converts XSD XML boolean into internal boolean value

        Parameters:
        b - XSD XML boolean value
        Returns:
        Internal boolean value
      • toXsdFloat

        public static java.lang.Double toXsdFloat​(java.lang.String f)

        Converts internal decimal value into XSD XML float

        Parameters:
        f - Internal float value
        Returns:
        XSD XML float
      • toXsdDecimal

        public static java.lang.String toXsdDecimal​(java.lang.String f)

        Converts internal decimal value into XSD XML decimal

        Parameters:
        f - Internal float value
        Returns:
        XSD XML decimal
      • toXsdInt

        public static java.lang.Integer toXsdInt​(java.lang.String i)

        Converts internal integer field value into XSD XML integer

        Parameters:
        i - Field value to encode
        Returns:
        Encoded XSD XML boolean
      • xsdContextSchema

        public static java.lang.String xsdContextSchema​(ObjectDB obj)

        Generates XSD schema for object's context

        Parameters:
        obj - Object
        Returns:
        XSD schema
      • xsdMetaDataSchema

        public static java.lang.String xsdMetaDataSchema​(ObjectDB obj)

        Generates XSD schema for object's meta data

        Parameters:
        obj - Object
        Returns:
        XSD schema
      • xsdFieldSchema

        public static java.lang.String xsdFieldSchema​(ObjectField field,
                                                      boolean filter,
                                                      boolean order)
      • xsdFieldSchema

        public static java.lang.String xsdFieldSchema​(java.lang.String name,
                                                      java.lang.String type,
                                                      boolean nillable,
                                                      boolean oldvalue)
      • xsdSchema

        public static java.lang.String xsdSchema​(ObjectDB obj,
                                                 boolean filter,
                                                 boolean action,
                                                 java.lang.String extraElements)

        Generates XSD schema for fields of filters (depending on filter parameter) for object

        Parameters:
        obj - Object
        filter - Generate filter definitions ?
        action - Adds action field definition ?
        extraElements - Adds extra elements to XSD schema
        Returns:
        XSD schema
      • xsdSchema

        public static java.lang.String xsdSchema​(Processus p)

        Generates XSD schema for processus

        Parameters:
        p - Processus
        Returns:
        XSD schema
      • xsdSchema

        public static java.lang.String xsdSchema​(TreeView tv)

        Generates XSD schema for tree view

        Parameters:
        tv - Tree view
        Returns:
        XSD schema
      • treeviewToXsdData

        public static java.lang.String treeviewToXsdData​(TreeView tv,
                                                         java.lang.String id,
                                                         boolean withDoc)
      • objectXsdMetaData

        public static java.lang.String objectXsdMetaData​(ObjectDB obj,
                                                         boolean fieldsMetaData,
                                                         java.lang.String ns)

        Converts object fields into XSD XML data (as XML String)

        Parameters:
        obj - Object
        ns - Namespace prefix
        Returns:
        XSD XML data
      • processXsdMetaData

        public static java.lang.String processXsdMetaData​(Processus p,
                                                          boolean activities,
                                                          boolean context,
                                                          java.lang.String ns)

        Converts process into XSD XML data (as XML String)

        Parameters:
        p - Process
        activities - true to retrieve Activities and Transitions
        context - true to retrieve context informations (pid, display, status, dates...)
        ns - Namespace prefix
        Returns:
        XSD XML data
      • activityXsdMetaData

        public static java.lang.String activityXsdMetaData​(Activity a,
                                                           ActivityFile af,
                                                           boolean data,
                                                           java.lang.String ns)

        Converts activity into XSD XML data (as XML String)

        Parameters:
        a - Activity
        af - Optional activity file to retrieve activity context (aid, display, status, dates...) and data values
        data - true to retrieve Data
        ns - Namespace prefix
        Returns:
        XSD XML data
      • fieldsToXsdData

        public static java.lang.String fieldsToXsdData​(ObjectDB obj,
                                                       java.lang.String ns)

        Converts object fields into XSD XML data (as XML String)

        Parameters:
        obj - Object
        ns - Namespace prefix
        Returns:
        XSD XML data
      • fieldsToXsdData

        public static java.lang.String fieldsToXsdData​(ObjectDB obj,
                                                       java.lang.String ns,
                                                       boolean dbdoc,
                                                       boolean client)

        Converts object fields into XSD XML data (as XML String)

        Parameters:
        obj - Object
        ns - Namespace prefix
        dbdoc - true to serialize Dbdoc
        client - true when called by the client side
        Returns:
        XSD XML data
      • activityToXsd

        public static java.lang.String activityToXsd​(ActivityFile context)

        Converts process into XSD XML data (as XML String)

        Parameters:
        context - Activity file
        Returns:
        XSD XML data
      • filtersToXsdData

        public static java.lang.String filtersToXsdData​(ObjectDB obj,
                                                        java.lang.String ns,
                                                        boolean pagine,
                                                        boolean more)

        Converts object filters into XSD XML data (as XML String)

        Parameters:
        obj - Object
        ns - Namespace prefix
        pagine - true to insert the page number of current object
        more - Retrieve the min/max rows
        Returns:
        XSD XML data
      • xsdDataToFields

        public static java.lang.String xsdDataToFields​(ObjectDB obj,
                                                       org.w3c.dom.Node node)

        Converts XSD XML data (as a DOM node) to object fields and complete data with DB

        Parameters:
        obj - Object
        node - DOM node
        Returns:
        action name or null
      • xsdDataToFields

        public static java.lang.String xsdDataToFields​(ObjectDB obj,
                                                       org.w3c.dom.Node node,
                                                       boolean client)

        Converts XSD XML data (as a DOM node) to object fields

        Parameters:
        obj - Object
        node - DOM node
        client - Client side call (false = complete data on the server side with DB selections)
        Returns:
        action name or null
      • xsdDbdoc

        public static DocumentDB xsdDbdoc​(org.w3c.dom.Node node)

        Converts Dbdoc XSD data (as a DOM node) to a DocumentDB structure

        Parameters:
        node - Dbdoc node
        Returns:
        Document with data contained in the XML
      • xsdDataToFilters

        public static boolean xsdDataToFilters​(ObjectDB obj,
                                               org.w3c.dom.Node node)

        Converts XSD XML filters (as a DOM node) to object filters

        Parameters:
        obj - Object
        node - DOM node
        Returns:
        true if pagination is required for search, false otherwise.
      • listItemToXsdData

        public static java.lang.String listItemToXsdData​(ObjectDB obj,
                                                         java.lang.String[] vals,
                                                         java.lang.String ns)

        Convert object list item data into XSD XML data

        Parameters:
        obj - Object
        vals - List item values
        ns - Namespace prefix
        Returns:
        XSD XML data
      • xsdReadContext

        public static java.lang.String[] xsdReadContext​(org.w3c.dom.NodeList attributes)
      • xsdDataToContext

        public static void xsdDataToContext​(ActivityFile context,
                                            org.w3c.dom.NodeList data)
      • xsdProcessContext

        public static void xsdProcessContext​(Processus p,
                                             org.w3c.dom.Node node)

        Converts XSD XML data (as a DOM node) to process context

        Parameters:
        p - Process
        node - DOM node
      • xsdActivityContext

        public static ActivityFile xsdActivityContext​(Processus p,
                                                      org.w3c.dom.Node node)

        Converts XSD XML data (as a DOM node) to activity context

        Parameters:
        p - Process
        node - DOM node
      • listToXsdData

        public static java.lang.String listToXsdData​(ObjectDB obj,
                                                     java.util.List<java.lang.String[]> res,
                                                     java.lang.String ns)

        Convert object list item data into XSD XML data

        Parameters:
        obj - Object
        res - Search result
        ns - Namespace prefix
        Returns:
        XSD XML data
      • message

        public static java.lang.String message​(java.lang.String message,
                                               java.lang.String xmlns,
                                               java.lang.String ns)
      • metadata

        public static java.lang.String metadata​(ObjectDB obj,
                                                int context,
                                                java.lang.String xmlns,
                                                java.lang.String ns)
      • get

        public static java.lang.String get​(ObjectDB obj,
                                           java.lang.String row_id,
                                           java.lang.String xmlns,
                                           java.lang.String ns)
                                    throws GetException
        Throws:
        GetException
      • xsdDbdocSchema

        public static java.lang.String xsdDbdocSchema()

        Generates XSD schema for document

        Returns:
        XSD schema
      • xsdValueSchema

        public static java.lang.String xsdValueSchema​(java.lang.String type)

        Generates XSD schema with old value for a type of value

        Returns:
        type XSD simple type
      • xsdValueSchemas

        public static java.lang.String xsdValueSchemas()

        Generates XSD schemas for any types of value

        Returns:
        type XSD simple type
      • dbdocToXsdData

        public static java.lang.String dbdocToXsdData​(Grant g,
                                                      ObjectField f,
                                                      boolean client)
                                               throws java.lang.Exception

        Convert a document into XSD XML data

        Parameters:
        g - User grants
        f - Document field
        client - client side flag
        Returns:
        XSD XML data
        Throws:
        java.lang.Exception
      • xsdCrosstabSchema

        public static java.lang.String xsdCrosstabSchema()

        Generates XSD schema for cross table

        Returns:
        XSD schema
      • xsdCrosstabSchema

        public static java.lang.String xsdCrosstabSchema​(ObjectDB obj)

        Generates XSD schema for cross table

        Returns:
        XSD schema
      • xsdDataToCrosstab

        public static Crosstab xsdDataToCrosstab​(ObjectDB obj,
                                                 org.w3c.dom.Node message)
                                          throws java.lang.Exception

        Converts XSD XML data (as a DOM node) to pivot table (and sets filters)

        Parameters:
        obj - Object
        message - DOM node
        Throws:
        java.lang.Exception
      • crosstabToXsdData

        public static java.lang.String crosstabToXsdData​(ObjectDB obj,
                                                         Crosstab crosstab)
                                                  throws java.lang.Exception

        Convert a document into XSD XML data

        Parameters:
        crosstab - Pivot table
        Returns:
        XSD XML data
        Throws:
        java.lang.Exception