Class JSONTool

  • Direct Known Subclasses:
    JSONServletTool

    public class JSONTool
    extends java.lang.Object
    JSON toolbox
    • Constructor Summary

      Constructors 
      Constructor Description
      JSONTool()
      Constructor
      Don't instantiate this class, it only provides static variables and methods
    • Method Summary

      Modifier and Type Method Description
      static java.lang.String actionToJson​(ObjectDB obj, Action action, java.lang.String[] row, boolean create, int context)  
      static java.lang.String activityData​(Processus pcs, ActivityFile af, ObjectDB object)  
      static java.lang.String activityData​(Processus pcs, ActivityFile af, ObjectDB object, boolean metadata, boolean embedded)  
      static java.lang.String activityDataToJson​(Processus p, ActivityFile af, ObjectDB obj, boolean metadata)  
      static java.lang.String activityMetaDataToJson​(Activity a)  
      static org.json.JSONObject addActionResultSchema​(org.json.JSONObject schemas)
      Add action result Open API schemas description to schemas
      static org.json.JSONObject addAppSessionOpenAPIPath​(org.json.JSONObject paths, int openapiVersion)
      Add application and session REST services Open API paths description to paths
      static org.json.JSONObject addBusinessObjectOpenAPIPath​(org.json.JSONObject paths, ObjectDB obj, java.lang.String relPath, int openapiVersion)
      Add business object REST services Open API paths to paths
      static org.json.JSONObject addBusinessObjectOpenAPISchema​(org.json.JSONObject schemas, ObjectDB obj, int openapiVersion)
      Add business object REST services Open API schema to schemas
      static org.json.JSONObject addErrorsSchema​(org.json.JSONObject schemas)
      Add error messages Open API schemas description to schemas
      static org.json.JSONObject addLoginOpenAPIPath​(org.json.JSONObject paths, int openapiVersion)
      Add login service Open API path description to paths
      static org.json.JSONObject addLogoutOpenAPIPath​(org.json.JSONObject paths, int openapiVersion)
      Add logout service Open API path description to paths
      static org.json.JSONObject addOpenAPIOperationType​(org.json.JSONObject operation, java.lang.String requestType, java.lang.String requestSchema, java.lang.String responseType, java.lang.String responseSchema, int[] errorStatuses, int openapiVersion)
      Get OpenAPI operation types
      static org.json.JSONObject addOpenAPIOperationTypes​(org.json.JSONObject operation, java.lang.String[] requestTypes, java.lang.String requestSchema, java.lang.String[] responseTypes, java.lang.String responseSchema, int[] errorStatuses, int openapiVersion)
      Get OpenAPI operation types
      static org.json.JSONObject addOpenAPIParameterType​(org.json.JSONObject param, java.lang.String type, org.json.JSONArray values, int openapiVersion)
      Add OpenAPI parameter type
      static org.json.JSONObject addPublicationResultSchema​(org.json.JSONObject schemas)
      Add publication result Open API schemas description to schemas
      static org.json.JSONArray addTag​(org.json.JSONArray tags, java.lang.String name, java.lang.String description)
      Add a tag
      static org.json.JSONObject addTreeviewDataSchema​(org.json.JSONObject schemas)
      Add treeview data Open API schemas description to schemas
      static java.lang.String count​(ObjectDB obj)  
      static java.lang.String count​(ObjectDB obj, boolean metadata)  
      static java.lang.String document​(ObjectDB obj, java.lang.String rowId, java.lang.String field)  
      static java.lang.String document​(ObjectDB obj, java.lang.String rowId, java.lang.String field, boolean embedded, boolean copy)  
      static java.lang.String error​(int status, java.lang.String message, int level, java.lang.String metadata)
      Error response
      static java.lang.String error​(java.lang.String message, int level)
      Error response
      static java.lang.String error​(java.lang.String message, int level, java.lang.String metadata)
      Error response
      static java.lang.String errors​(int status, java.lang.String[] messages, int level, java.lang.String metadata)
      Errors response
      static java.lang.String errors​(java.lang.String[] messages, int level)
      Errors response
      static java.lang.String errors​(java.lang.String[] messages, int level, java.lang.String metadata)
      Errors response
      static java.lang.String fieldsToJson​(ObjectDB obj)  
      static java.lang.String fieldsToJson​(ObjectDB obj, Parameters.InlineParam inlines, java.lang.String[] fields, boolean onlyFunctIds, boolean timestamps)  
      static java.lang.String fieldValue​(ObjectField field)  
      static java.lang.String fieldValue​(ObjectField field, java.lang.String value)  
      static java.lang.String filters​(ObjectDB obj, boolean reset)  
      static java.lang.String filters​(ObjectDB obj, int context, boolean reset)  
      static java.lang.String filters​(ObjectDB obj, int context, boolean reset, boolean embedded)  
      static java.lang.String filtersToJson​(ObjectDB obj, boolean reset, boolean limited)
      JSON filters in service format
      static java.lang.String fromJSONName​(java.lang.String name)
      Get internal name (using dots as separator) from JSON name (using Globals.DOT_REPLACEMENT as separator)
      static org.json.JSONObject fromYAML​(java.lang.String yaml)
      Convert YAML to JSON object
      static java.lang.String functIdToJson​(ObjectDB obj)  
      static java.lang.String get​(ObjectDB obj, java.lang.String rowId)  
      static java.lang.String get​(ObjectDB obj, java.lang.String rowId, boolean embedded)  
      static java.lang.String get​(ObjectDB obj, java.lang.String rowId, int context, boolean timestamps, java.lang.String[] fields, Parameters.InlineParam inlines, boolean embedded, boolean metadata, Parameters.ParamContext parent, boolean social, boolean share, java.util.List<java.lang.String> msgs, TreeView tv, TreeView.TreeViewNode node, int tvDepth)
      Get object record as JSON
      static java.lang.String get​(ObjectDB obj, java.lang.String rowId, int context, boolean timestamps, java.lang.String[] fields, Parameters.InlineParam inlines, boolean embedded, boolean metadata, Parameters.ParamContext parent, boolean social, java.util.List<java.lang.String> msgs, TreeView tv, TreeView.TreeViewNode node, int tvDepth)
      Deprecated. 
      static java.lang.String get​(ObjectDB obj, java.lang.String rowId, int context, java.lang.String[] fields, Parameters.InlineParam inlines, boolean embedded)  
      static org.json.JSONObject getError​(int status, java.lang.Object message, int level, java.lang.Object metadata)
      Get error response
      static org.json.JSONObject getError​(java.lang.Object message, int level)
      Get error response
      static org.json.JSONObject getError​(java.lang.Object message, int level, java.lang.Object metadata)
      Get error response
      static org.json.JSONObject getErrors​(int status, java.lang.Object[] messages, int level, java.lang.Object metadata)
      Get errors response
      static org.json.JSONObject getErrors​(java.lang.Object[] messages, int level)
      Get errors response
      static org.json.JSONObject getErrors​(java.lang.Object[] messages, int level, java.lang.Object metadata)
      Get errors response
      static org.json.JSONObject getInfo​(java.lang.String message)
      Get info response
      static java.lang.String getJSONASCIILogo​(java.lang.String complement)
      Get ASCII logo as JSON comments
      static org.json.JSONObject getJSONObjectFromXML​(java.lang.String xml)
      Get JSON object from XML
      static org.json.JSONObject getJSONSchema​(ObjectDB obj)
      Get JSON Schema for specified object
      static org.json.JSONObject getOpenAPIError​(int code, int openapiVersion)
      Get OpenAPI error
      static org.json.JSONObject getOpenAPIInfo​(java.lang.String title, java.lang.String description, java.lang.String version, boolean license, boolean contact)
      Get OpenAPI info
      static java.lang.String getOpenAPIRef​(java.lang.String name, int openapiVersion)
      Get OpenAPI reference
      static org.json.JSONObject getOpenAPISchema​(Grant g, int openapiVersion, org.json.JSONObject info, org.json.JSONArray tags, java.lang.String basePath, org.json.JSONObject paths, org.json.JSONObject schemas)
      Get OpenAPI schema
      static org.json.JSONObject getResponse​(java.lang.String type, java.lang.Object response)
      Get response JSON object
      static org.json.JSONObject getResponse​(java.lang.String type, java.lang.Object response, java.lang.String msg)
      Get response JSON object
      static org.json.JSONObject getSysParam​(Grant g, java.lang.String name)
      Get a single session system parameter as JSON
      static org.json.JSONObject getSysParams​(Grant g, boolean embedded)
      Get all session system parameters as JSON oject
      static java.lang.String getTexts​(Grant g)
      Get all texts as a JSON object
      static java.lang.String getTexts​(Grant g, java.lang.String regex)
      Get all matching texts as a JSON object
      static org.json.JSONObject getWarning​(java.lang.String message)
      Get warning response
      static org.json.JSONObject getWarnings​(java.lang.String[] messages)
      Get warnings response
      static java.lang.String getXMLFromJSONObject​(org.json.JSONObject json)
      Get XML from JSON objectL
      static java.lang.String getYAMLASCIILogo​(java.lang.String complement)
      Get ASCII logo as YAML comments
      static org.yaml.snakeyaml.Yaml getYAMLProcessor()
      Get YAML processor
      static java.lang.String groupByToJson​(ObjectDB obj, java.util.List<java.lang.String[]> list)  
      static java.lang.String historic​(ObjectDB obj, int page)  
      static java.lang.String indexMetaDataToJson​(Grant g)  
      static java.lang.String info​(java.lang.String message)  
      static ObjectContextWeb initWebService​(ObjectDB obj, int context, Parameters.ParamContext p, boolean apply, java.lang.String edit)  
      static java.lang.String jsonAppInfo​(Grant g, boolean embedded)
      Application info as JSON
      static java.lang.String jsonApps​(Grant g)  
      static java.lang.String jsonArray​(double[] vals)  
      static java.lang.String jsonArray​(java.lang.Double[] vals)  
      static java.lang.String jsonArray​(java.lang.Object[] contents)  
      static java.lang.String jsonArray​(java.util.List<?> contents)  
      static java.lang.String jsonDeclaration​(ObjectField f)  
      static java.lang.String jsonDeclaration​(ObjectField f, java.lang.Object value)  
      static java.lang.String jsonDeclaration​(java.lang.String name, boolean content)  
      static java.lang.String jsonDeclaration​(java.lang.String name, double content)  
      static java.lang.String jsonDeclaration​(java.lang.String name, double[] contents)  
      static java.lang.String jsonDeclaration​(java.lang.String name, float content)  
      static java.lang.String jsonDeclaration​(java.lang.String name, float[] contents)  
      static java.lang.String jsonDeclaration​(java.lang.String name, int content)  
      static java.lang.String jsonDeclaration​(java.lang.String name, int[] contents)  
      static java.lang.String jsonDeclaration​(java.lang.String name, long content)  
      static java.lang.String jsonDeclaration​(java.lang.String name, long[] contents)  
      static java.lang.String jsonDeclaration​(java.lang.String name, java.lang.Boolean content)  
      static java.lang.String jsonDeclaration​(java.lang.String name, java.lang.Double content)  
      static java.lang.String jsonDeclaration​(java.lang.String name, java.lang.Float content)  
      static java.lang.String jsonDeclaration​(java.lang.String name, java.lang.Integer content)  
      static java.lang.String jsonDeclaration​(java.lang.String name, java.lang.Long content)  
      static java.lang.String jsonDeclaration​(java.lang.String name, java.lang.Object content)  
      static java.lang.String jsonDeclaration​(java.lang.String name, java.lang.String[] contents)  
      static java.lang.String jsonDeclaration​(java.lang.String name, java.util.List<?> contents)  
      static java.lang.String jsonDocument​(Grant g, DocumentDB doc, boolean inlineContent, boolean inlineThumbnail, boolean copy)
      Builds a JSON object for document
      static java.lang.String jsonDocument​(Grant g, java.lang.String docId, boolean inlineContent, boolean inlineThumbnail, boolean copy)
      Builds a JSON object for document
      static java.lang.String jsonEnclosedDeclaration​(java.lang.String name, java.lang.String content)  
      static java.lang.String jsonEnclosedDeclaration​(java.lang.String name, java.lang.String[] contents)  
      static java.lang.String jsonEnclosedDeclaration​(java.lang.String name, java.util.List<?> contents)  
      static java.lang.String jsonEnclosedStringDeclaration​(java.lang.String name, java.lang.String content)  
      static java.lang.String jsonEnclosedStringDeclaration​(java.lang.String name, java.lang.String[] contents)  
      static java.lang.String jsonEnclosedStringDeclaration​(java.lang.String name, java.util.List<?> contents)  
      static java.lang.String jsonExtObject​(Grant g, java.lang.String name)
      External object meta data as JSON
      static java.lang.String jsonFollow​(Grant g, SocialPost.Author a)  
      static java.lang.String jsonGetSysParam​(Grant g, java.lang.String name)
      Deprecated.
      static java.lang.String jsonGetSysParams​(Grant g, boolean embedded)
      Deprecated.
      Use getSysParams
      static java.lang.String jsonGrant​(Grant g, boolean inlinePicture, boolean web, boolean embedded)
      Full grant data as JSON
      static java.lang.String jsonListOfValue​(Grant g, java.lang.String name, boolean embedded)
      List of values as JSON
      static java.lang.String jsonMenu​(Grant g, boolean embedded)
      Menu as JSON
      static java.lang.String jsonMetaObject​(Grant g, java.lang.String val, Parameters.InlineParam inlines)
      Builds a JSON object for a meta object value
      static java.lang.String jsonNews​(Grant g, boolean inlineImages)
      News as JSON
      static java.util.Map<java.lang.String,​java.lang.Object> jsonObjectToMap​(org.json.JSONObject object)
      Convert JSONObject to plain Map
      static java.lang.String jsonPreferences​(ObjectDB obj)
      Object preferences
      static java.lang.String jsonReadDocument​(Grant g, java.lang.String docId, boolean includeContent, boolean includeThumbnail)
      Read document informations as JSON
      static java.lang.String jsonResponse​(java.lang.String type, java.lang.String response)  
      static java.lang.String jsonResponse​(java.lang.String type, java.lang.String response, java.lang.String msg)  
      static java.lang.String jsonSessionInfo​(Grant g, javax.servlet.http.HttpSession session, boolean embedded)
      Session info as JSON
      static java.lang.String jsonSetSysParam​(Grant g, java.lang.String name, java.lang.String value, boolean save)
      Set a session system parameter as JSON
      static java.lang.String jsonShortcuts​(Grant g)  
      static java.lang.String jsonString​(java.lang.Object str)  
      static java.lang.String jsonStringArray​(java.lang.Object[] strs)  
      static java.lang.String jsonStringArray​(java.util.List<?> contents)  
      static java.lang.String jsonStringDeclaration​(java.lang.String name, java.lang.Object content)  
      static java.lang.String jsonStringDeclaration​(java.lang.String name, java.lang.String[] contents)  
      static java.lang.String jsonStringDeclaration​(java.lang.String name, java.util.List<?> contents)  
      static java.lang.String jsonSysInfo​(Grant g, boolean embedded)
      System info as JSON
      static java.lang.String jsonTestData​(Grant g, java.lang.String obj, java.lang.String rowId)
      Random data
      static java.lang.String jsonText​(Grant g, java.lang.String code)
      Text as JSON
      static java.lang.String jsonTexts​(Grant g)
      All texts as JSON
      static java.lang.String jsonTextsArray​(Grant g, java.lang.String regex)
      All matching texts as a JSON array
      static DataXML JsonToXML​(org.json.JSONObject item)
      Convert a JSON item to XML data set
      static DataXML JsonToXML​(org.json.JSONObject item, org.json.JSONObject olditem, ObjectDB obj)
      Convert a JSON item to XML data set
      static java.lang.String jsonUndoRedo​(ObjectDB obj)  
      static java.lang.String jsonUser​(Grant g, java.lang.String login, boolean inlinePicture, boolean embedded)
      User as JSON
      static java.lang.String jsonWriteDocument​(Grant g, java.lang.String docId, java.lang.String name, java.lang.String path, java.lang.String content, java.lang.String object, java.lang.String field, java.lang.String rowId)
      Write document
      static java.lang.String list​(ObjectDB obj, int context, Parameters.ParamContext p, int page, Parameters.InlineParam inlines, boolean embedded, boolean metadata, boolean historic, boolean totals, boolean social, boolean timestamp, boolean visibleOnly, java.lang.String edit, boolean groupby, boolean partial, int treeDepth)  
      static java.lang.String listAuthors​(Grant g, java.lang.String req, java.lang.String object, boolean all)  
      static java.lang.String listFollows​(Grant g, java.lang.String status)  
      static java.lang.String listSocialPosts​(Grant g, java.lang.String postId, java.lang.String object, java.lang.String rowId, int page, boolean act, boolean follow, boolean countersOnly, boolean audit, java.lang.String level)
      Social as JSON
      static java.lang.String listToJson​(ObjectDB obj, java.util.List<java.lang.String[]> list, Parameters.InlineParam inlines, int context, Parameters.ParamContext p, boolean metadata, boolean timestamp, boolean visibleOnly, java.lang.String edit)  
      static java.lang.String listTotals​(ObjectDB obj)  
      static java.lang.String lovToJson​(java.util.List<EnumItem> items)  
      static java.lang.String mapToJSON​(java.util.Map<java.lang.String,​java.lang.String> map)
      Convert Map to JSON
      static java.lang.String messageToJson​(Grant g, java.lang.String msg, ObjectDB obj)
      Convert a message to JSON { code, level, text, label, field }
      static java.lang.String metadata​(ObjectDB obj, int context, Parameters.ParamContext p, java.lang.String[] row)  
      static java.lang.String metadata​(ObjectDB obj, int context, Parameters.ParamContext p, java.lang.String[] row, boolean embedded, boolean init, boolean visibleOnly, java.lang.String edit)  
      static java.lang.String objectFieldMetaDataToJson​(Grant g, ObjectField field)  
      static java.lang.String objectFieldMetaDataToJson​(Grant g, ObjectField field, ObjectDB obj, int context, java.lang.String[] row, java.lang.String edit)
      Field definition
      static java.lang.String objectMetaDataToJson​(ObjectDB obj, int context, Parameters.ParamContext params, java.lang.String[] row, boolean init, boolean visibleOnly, java.lang.String edit)  
      static java.lang.String prepareActionTarget​(Action action)  
      static java.lang.String prepareActionURL​(ObjectDB obj, java.lang.String[] row, Action action)  
      static java.lang.String printTemplateToJson​(ObjectDB obj, java.lang.String[] row, PrintTemplate prt)  
      static java.lang.String processMetadata​(Processus pcs)  
      static java.lang.String processMetadata​(Processus pcs, boolean embedded)  
      static java.lang.String processMetaDataToJson​(Processus pcs)  
      static java.lang.String resourcesToJson​(java.util.List<Resource> resources)  
      static java.lang.String resourceToJson​(Resource r)  
      static java.lang.String rowMetaDataToJson​(ObjectDB obj, int context, Parameters.ParamContext p, java.lang.String[] row, boolean visibleOnly, java.lang.String edit)
      Simplified meta for list rows
      static void savePreferences​(ObjectDB obj, java.lang.String json)  
      static java.lang.String socialCount​(ObjectDB obj)  
      static java.lang.String toJSONName​(java.lang.String name)
      Get JSON name (using Globals.DOT_REPLACEMENT as separator) from internal name (using dots as separator)
      static java.lang.String toYAML​(java.lang.String json)
      Convert JSON to YAML
      static java.lang.String toYAML​(org.json.JSONArray json)
      Convert JSON array to YAML
      static java.lang.String toYAML​(org.json.JSONObject json)
      Convert JSON object to YAML
      static java.lang.String transitionMetaDataToJson​(Grant g, Transition t)  
      static java.lang.String viewMetadataToJson​(Grant g, View view, ObjectDB parent, boolean home)  
      static java.lang.String warning​(java.lang.String message)  
      static java.lang.String warnings​(java.lang.String[] messages)  
      • Methods inherited from class java.lang.Object

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

      • JSON_DOT_REPLACEMENT

        @Deprecated
        public static final java.lang.String JSON_DOT_REPLACEMENT
        Deprecated.
        See Also:
        Constant Field Values
      • EMPTY_JSON_OBJECT

        public static final java.lang.String EMPTY_JSON_OBJECT
        Empty JSON object
        See Also:
        Constant Field Values
      • EMPTY_JSON_ARRAY

        public static final java.lang.String EMPTY_JSON_ARRAY
        Empty JSON array
        See Also:
        Constant Field Values
      • OPENAPI_OAS2_VERSION

        public static final java.lang.String OPENAPI_OAS2_VERSION
        OAS 2 version string
        See Also:
        Constant Field Values
      • OPENAPI_OAS3_VERSION

        public static final java.lang.String OPENAPI_OAS3_VERSION
        OAS 3 version string
        See Also:
        Constant Field Values
    • Constructor Detail

      • JSONTool

        public JSONTool()
        Constructor
        Don't instantiate this class, it only provides static variables and methods
    • Method Detail

      • toJSONName

        public static java.lang.String toJSONName​(java.lang.String name)
        Get JSON name (using Globals.DOT_REPLACEMENT as separator) from internal name (using dots as separator)
        Parameters:
        name - Internal name
        Returns:
        JSON name
      • fromJSONName

        public static java.lang.String fromJSONName​(java.lang.String name)
        Get internal name (using dots as separator) from JSON name (using Globals.DOT_REPLACEMENT as separator)
        Parameters:
        name - JSON name
        Returns:
        Internal name
      • jsonArray

        public static java.lang.String jsonArray​(java.lang.Object[] contents)
      • jsonArray

        public static java.lang.String jsonArray​(double[] vals)
      • jsonArray

        public static java.lang.String jsonArray​(java.lang.Double[] vals)
      • jsonArray

        public static java.lang.String jsonArray​(java.util.List<?> contents)
      • jsonString

        public static java.lang.String jsonString​(java.lang.Object str)
      • jsonStringArray

        public static java.lang.String jsonStringArray​(java.lang.Object[] strs)
      • jsonStringArray

        public static java.lang.String jsonStringArray​(java.util.List<?> contents)
      • jsonDeclaration

        public static java.lang.String jsonDeclaration​(ObjectField f)
      • jsonDeclaration

        public static java.lang.String jsonDeclaration​(ObjectField f,
                                                       java.lang.Object value)
      • jsonDeclaration

        public static java.lang.String jsonDeclaration​(java.lang.String name,
                                                       java.lang.Object content)
      • jsonDeclaration

        public static java.lang.String jsonDeclaration​(java.lang.String name,
                                                       boolean content)
      • jsonDeclaration

        public static java.lang.String jsonDeclaration​(java.lang.String name,
                                                       java.lang.Boolean content)
      • jsonDeclaration

        public static java.lang.String jsonDeclaration​(java.lang.String name,
                                                       int content)
      • jsonDeclaration

        public static java.lang.String jsonDeclaration​(java.lang.String name,
                                                       java.lang.Integer content)
      • jsonDeclaration

        public static java.lang.String jsonDeclaration​(java.lang.String name,
                                                       long content)
      • jsonDeclaration

        public static java.lang.String jsonDeclaration​(java.lang.String name,
                                                       java.lang.Long content)
      • jsonDeclaration

        public static java.lang.String jsonDeclaration​(java.lang.String name,
                                                       float content)
      • jsonDeclaration

        public static java.lang.String jsonDeclaration​(java.lang.String name,
                                                       java.lang.Float content)
      • jsonDeclaration

        public static java.lang.String jsonDeclaration​(java.lang.String name,
                                                       double content)
      • jsonDeclaration

        public static java.lang.String jsonDeclaration​(java.lang.String name,
                                                       java.lang.Double content)
      • jsonEnclosedDeclaration

        public static java.lang.String jsonEnclosedDeclaration​(java.lang.String name,
                                                               java.lang.String content)
      • jsonDeclaration

        public static java.lang.String jsonDeclaration​(java.lang.String name,
                                                       java.lang.String[] contents)
      • jsonDeclaration

        public static java.lang.String jsonDeclaration​(java.lang.String name,
                                                       int[] contents)
      • jsonDeclaration

        public static java.lang.String jsonDeclaration​(java.lang.String name,
                                                       long[] contents)
      • jsonDeclaration

        public static java.lang.String jsonDeclaration​(java.lang.String name,
                                                       float[] contents)
      • jsonDeclaration

        public static java.lang.String jsonDeclaration​(java.lang.String name,
                                                       double[] contents)
      • jsonEnclosedDeclaration

        public static java.lang.String jsonEnclosedDeclaration​(java.lang.String name,
                                                               java.lang.String[] contents)
      • jsonDeclaration

        public static java.lang.String jsonDeclaration​(java.lang.String name,
                                                       java.util.List<?> contents)
      • jsonEnclosedDeclaration

        public static java.lang.String jsonEnclosedDeclaration​(java.lang.String name,
                                                               java.util.List<?> contents)
      • jsonStringDeclaration

        public static java.lang.String jsonStringDeclaration​(java.lang.String name,
                                                             java.lang.Object content)
      • jsonEnclosedStringDeclaration

        public static java.lang.String jsonEnclosedStringDeclaration​(java.lang.String name,
                                                                     java.lang.String content)
      • jsonStringDeclaration

        public static java.lang.String jsonStringDeclaration​(java.lang.String name,
                                                             java.lang.String[] contents)
      • jsonEnclosedStringDeclaration

        public static java.lang.String jsonEnclosedStringDeclaration​(java.lang.String name,
                                                                     java.lang.String[] contents)
      • jsonStringDeclaration

        public static java.lang.String jsonStringDeclaration​(java.lang.String name,
                                                             java.util.List<?> contents)
      • jsonEnclosedStringDeclaration

        public static java.lang.String jsonEnclosedStringDeclaration​(java.lang.String name,
                                                                     java.util.List<?> contents)
      • jsonResponse

        public static java.lang.String jsonResponse​(java.lang.String type,
                                                    java.lang.String response)
      • jsonResponse

        public static java.lang.String jsonResponse​(java.lang.String type,
                                                    java.lang.String response,
                                                    java.lang.String msg)
      • getResponse

        public static org.json.JSONObject getResponse​(java.lang.String type,
                                                      java.lang.Object response)
        Get response JSON object
        Parameters:
        type - Response type
        response - Response
      • getResponse

        public static org.json.JSONObject getResponse​(java.lang.String type,
                                                      java.lang.Object response,
                                                      java.lang.String msg)
        Get response JSON object
        Parameters:
        type - Response type
        response - Response
        msg - Message
      • info

        public static java.lang.String info​(java.lang.String message)
      • getInfo

        public static org.json.JSONObject getInfo​(java.lang.String message)
        Get info response
        Parameters:
        message - Info message
      • warning

        public static java.lang.String warning​(java.lang.String message)
      • getWarning

        public static org.json.JSONObject getWarning​(java.lang.String message)
        Get warning response
        Parameters:
        message - Warning message
      • warnings

        public static java.lang.String warnings​(java.lang.String[] messages)
      • getWarnings

        public static org.json.JSONObject getWarnings​(java.lang.String[] messages)
        Get warnings response
        Parameters:
        messages - Warning messages
      • error

        public static java.lang.String error​(java.lang.String message,
                                             int level)
        Error response
        Parameters:
        message - Error message or JSON object
        level - Error level
      • error

        public static java.lang.String error​(java.lang.String message,
                                             int level,
                                             java.lang.String metadata)
        Error response
        Parameters:
        message - Error message or JSON object
        level - Error level
        metadata - Optional metadata
      • error

        public static java.lang.String error​(int status,
                                             java.lang.String message,
                                             int level,
                                             java.lang.String metadata)
        Error response
        Parameters:
        status - HTTP status value (e.g. 404)
        message - Error message or JSON object
        level - Error level
        metadata - Optional metadata
      • getError

        public static org.json.JSONObject getError​(java.lang.Object message,
                                                   int level)
        Get error response
        Parameters:
        message - Error message
        level - Error level
      • getError

        public static org.json.JSONObject getError​(java.lang.Object message,
                                                   int level,
                                                   java.lang.Object metadata)
        Get error response
        Parameters:
        message - Error message
        level - Error level
        metadata - Optional metadata
      • getError

        public static org.json.JSONObject getError​(int status,
                                                   java.lang.Object message,
                                                   int level,
                                                   java.lang.Object metadata)
        Get error response
        Parameters:
        status - HTTP status value (e.g. 404)
        message - Error message
        level - Error level
        metadata - Optional metadata
      • errors

        public static java.lang.String errors​(java.lang.String[] messages,
                                              int level)
        Errors response
        Parameters:
        messages - Error messages
        level - Errors level
      • errors

        public static java.lang.String errors​(java.lang.String[] messages,
                                              int level,
                                              java.lang.String metadata)
        Errors response
        Parameters:
        messages - Error messages
        level - Errors level
        metadata - Optional metadata
      • errors

        public static java.lang.String errors​(int status,
                                              java.lang.String[] messages,
                                              int level,
                                              java.lang.String metadata)
        Errors response
        Parameters:
        status - HTTP status value (e.g. 404)
        messages - Error messages
        level - Errors level
        metadata - Optional metadata
      • getErrors

        public static org.json.JSONObject getErrors​(java.lang.Object[] messages,
                                                    int level)
        Get errors response
        Parameters:
        messages - Error messages
        level - Error level
      • getErrors

        public static org.json.JSONObject getErrors​(java.lang.Object[] messages,
                                                    int level,
                                                    java.lang.Object metadata)
        Get errors response
        Parameters:
        messages - Error messages
        level - Error level
        metadata - Optional metadata
      • getErrors

        public static org.json.JSONObject getErrors​(int status,
                                                    java.lang.Object[] messages,
                                                    int level,
                                                    java.lang.Object metadata)
        Get errors response
        Parameters:
        messages - Error messages
        level - Error level
        metadata - Optional metadata
      • messageToJson

        public static java.lang.String messageToJson​(Grant g,
                                                     java.lang.String msg,
                                                     ObjectDB obj)
        Convert a message to JSON { code, level, text, label, field }
      • resourceToJson

        public static java.lang.String resourceToJson​(Resource r)
      • resourcesToJson

        public static java.lang.String resourcesToJson​(java.util.List<Resource> resources)
      • objectFieldMetaDataToJson

        public static java.lang.String objectFieldMetaDataToJson​(Grant g,
                                                                 ObjectField field)
      • objectFieldMetaDataToJson

        public static java.lang.String objectFieldMetaDataToJson​(Grant g,
                                                                 ObjectField field,
                                                                 ObjectDB obj,
                                                                 int context,
                                                                 java.lang.String[] row,
                                                                 java.lang.String edit)
        Field definition
        Parameters:
        g - User rights
        field - Field
        obj - Optional object
        context - Object context
        row - Current row
        edit - Optional edit list mode "new" or "rows"
        Returns:
        JSON
      • jsonUndoRedo

        public static java.lang.String jsonUndoRedo​(ObjectDB obj)
      • objectMetaDataToJson

        public static java.lang.String objectMetaDataToJson​(ObjectDB obj,
                                                            int context,
                                                            Parameters.ParamContext params,
                                                            java.lang.String[] row,
                                                            boolean init,
                                                            boolean visibleOnly,
                                                            java.lang.String edit)
      • rowMetaDataToJson

        public static java.lang.String rowMetaDataToJson​(ObjectDB obj,
                                                         int context,
                                                         Parameters.ParamContext p,
                                                         java.lang.String[] row,
                                                         boolean visibleOnly,
                                                         java.lang.String edit)
        Simplified meta for list rows
      • printTemplateToJson

        public static java.lang.String printTemplateToJson​(ObjectDB obj,
                                                           java.lang.String[] row,
                                                           PrintTemplate prt)
      • actionToJson

        public static java.lang.String actionToJson​(ObjectDB obj,
                                                    Action action,
                                                    java.lang.String[] row,
                                                    boolean create,
                                                    int context)
      • prepareActionURL

        public static java.lang.String prepareActionURL​(ObjectDB obj,
                                                        java.lang.String[] row,
                                                        Action action)
      • prepareActionTarget

        public static java.lang.String prepareActionTarget​(Action action)
      • filtersToJson

        public static java.lang.String filtersToJson​(ObjectDB obj,
                                                     boolean reset,
                                                     boolean limited)
        JSON filters in service format
        Parameters:
        obj - Object
        reset - Reset filters first ?
        limited - get valued filter only ?
        Returns:
        JSON
      • fieldValue

        public static java.lang.String fieldValue​(ObjectField field)
      • fieldValue

        public static java.lang.String fieldValue​(ObjectField field,
                                                  java.lang.String value)
      • functIdToJson

        public static java.lang.String functIdToJson​(ObjectDB obj)
      • fieldsToJson

        public static java.lang.String fieldsToJson​(ObjectDB obj)
      • fieldsToJson

        public static java.lang.String fieldsToJson​(ObjectDB obj,
                                                    Parameters.InlineParam inlines,
                                                    java.lang.String[] fields,
                                                    boolean onlyFunctIds,
                                                    boolean timestamps)
      • listToJson

        public static java.lang.String listToJson​(ObjectDB obj,
                                                  java.util.List<java.lang.String[]> list,
                                                  Parameters.InlineParam inlines,
                                                  int context,
                                                  Parameters.ParamContext p,
                                                  boolean metadata,
                                                  boolean timestamp,
                                                  boolean visibleOnly,
                                                  java.lang.String edit)
      • groupByToJson

        public static java.lang.String groupByToJson​(ObjectDB obj,
                                                     java.util.List<java.lang.String[]> list)
      • metadata

        public static java.lang.String metadata​(ObjectDB obj,
                                                int context,
                                                Parameters.ParamContext p,
                                                java.lang.String[] row,
                                                boolean embedded,
                                                boolean init,
                                                boolean visibleOnly,
                                                java.lang.String edit)
      • filters

        public static java.lang.String filters​(ObjectDB obj,
                                               boolean reset)
      • filters

        public static java.lang.String filters​(ObjectDB obj,
                                               int context,
                                               boolean reset)
      • filters

        public static java.lang.String filters​(ObjectDB obj,
                                               int context,
                                               boolean reset,
                                               boolean embedded)
      • get

        public static java.lang.String get​(ObjectDB obj,
                                           java.lang.String rowId,
                                           int context,
                                           boolean timestamps,
                                           java.lang.String[] fields,
                                           Parameters.InlineParam inlines,
                                           boolean embedded,
                                           boolean metadata,
                                           Parameters.ParamContext parent,
                                           boolean social,
                                           boolean share,
                                           java.util.List<java.lang.String> msgs,
                                           TreeView tv,
                                           TreeView.TreeViewNode node,
                                           int tvDepth)
                                    throws GetException
        Get object record as JSON
        Parameters:
        obj - business object
        rowId - object row ID
        context - context (none, update, create...) from ObjectDB.CONTEXT_*
        timestamps - true to return the timestamps of record
        fields - optional list of fields to return (default return all fields)
        inlines - options to return inlined documents
        embedded - true to return data without a json response container
        metadata - true to return metadata of object in that context
        parent - optional parent object context
        social - true to count posts for this record
        share - true to get social data to share for this record
        msgs - optional messages to return
        tv - optional treeview to get a record tree
        node - optional tree node to get
        tvDepth - optional depth in tree
        Returns:
        JSON
        Throws:
        GetException
      • document

        public static java.lang.String document​(ObjectDB obj,
                                                java.lang.String rowId,
                                                java.lang.String field)
                                         throws GetException
        Throws:
        GetException
      • document

        public static java.lang.String document​(ObjectDB obj,
                                                java.lang.String rowId,
                                                java.lang.String field,
                                                boolean embedded,
                                                boolean copy)
                                         throws GetException
        Throws:
        GetException
      • list

        public static java.lang.String list​(ObjectDB obj,
                                            int context,
                                            Parameters.ParamContext p,
                                            int page,
                                            Parameters.InlineParam inlines,
                                            boolean embedded,
                                            boolean metadata,
                                            boolean historic,
                                            boolean totals,
                                            boolean social,
                                            boolean timestamp,
                                            boolean visibleOnly,
                                            java.lang.String edit,
                                            boolean groupby,
                                            boolean partial,
                                            int treeDepth)
      • count

        public static java.lang.String count​(ObjectDB obj)
      • count

        public static java.lang.String count​(ObjectDB obj,
                                             boolean metadata)
      • listTotals

        public static java.lang.String listTotals​(ObjectDB obj)
      • historic

        public static java.lang.String historic​(ObjectDB obj,
                                                int page)
      • socialCount

        public static java.lang.String socialCount​(ObjectDB obj)
      • processMetaDataToJson

        public static java.lang.String processMetaDataToJson​(Processus pcs)
      • activityMetaDataToJson

        public static java.lang.String activityMetaDataToJson​(Activity a)
      • transitionMetaDataToJson

        public static java.lang.String transitionMetaDataToJson​(Grant g,
                                                                Transition t)
      • processMetadata

        public static java.lang.String processMetadata​(Processus pcs)
      • processMetadata

        public static java.lang.String processMetadata​(Processus pcs,
                                                       boolean embedded)
      • activityData

        public static java.lang.String activityData​(Processus pcs,
                                                    ActivityFile af,
                                                    ObjectDB object,
                                                    boolean metadata,
                                                    boolean embedded)
      • indexMetaDataToJson

        public static java.lang.String indexMetaDataToJson​(Grant g)
      • jsonSessionInfo

        public static java.lang.String jsonSessionInfo​(Grant g,
                                                       javax.servlet.http.HttpSession session,
                                                       boolean embedded)
        Session info as JSON
        Parameters:
        g - Grant
        session - Session
        embedded - Embedded ?
        Returns:
        JSON
      • jsonAppInfo

        public static java.lang.String jsonAppInfo​(Grant g,
                                                   boolean embedded)
        Application info as JSON
        Parameters:
        g - Grant
        embedded - Embedded ?
        Returns:
        JSON
      • jsonSysInfo

        public static java.lang.String jsonSysInfo​(Grant g,
                                                   boolean embedded)

        System info as JSON

        Parameters:
        g - Grant
        embedded - Embedded ?
        Returns:
        JSON
      • viewMetadataToJson

        public static java.lang.String viewMetadataToJson​(Grant g,
                                                          View view,
                                                          ObjectDB parent,
                                                          boolean home)
      • jsonGrant

        public static java.lang.String jsonGrant​(Grant g,
                                                 boolean inlinePicture,
                                                 boolean web,
                                                 boolean embedded)

        Full grant data as JSON

        Parameters:
        g - Grant
        inlinePicture - Inline picture content ?
        web - Add user's menu, texts and system parameters ?
        embedded - Embedded ?
        Returns:
        JSON
      • jsonApps

        public static java.lang.String jsonApps​(Grant g)
      • jsonShortcuts

        public static java.lang.String jsonShortcuts​(Grant g)
      • jsonUser

        public static java.lang.String jsonUser​(Grant g,
                                                java.lang.String login,
                                                boolean inlinePicture,
                                                boolean embedded)

        User as JSON

        Parameters:
        g - Grant
        login - User login
        inlinePicture - Inline picture content ?
        Returns:
        json
      • jsonListOfValue

        public static java.lang.String jsonListOfValue​(Grant g,
                                                       java.lang.String name,
                                                       boolean embedded)

        List of values as JSON

        Parameters:
        g - Grant
        name - List of value name
        Returns:
        JSON
      • lovToJson

        public static java.lang.String lovToJson​(java.util.List<EnumItem> items)
      • jsonGetSysParams

        @Deprecated
        public static java.lang.String jsonGetSysParams​(Grant g,
                                                        boolean embedded)
        Deprecated.
        Use getSysParams
      • getSysParams

        public static org.json.JSONObject getSysParams​(Grant g,
                                                       boolean embedded)

        Get all session system parameters as JSON oject

        Parameters:
        g - Grant
        Returns:
        JSON object
      • jsonGetSysParam

        @Deprecated
        public static java.lang.String jsonGetSysParam​(Grant g,
                                                       java.lang.String name)
        Deprecated.
      • getSysParam

        public static org.json.JSONObject getSysParam​(Grant g,
                                                      java.lang.String name)

        Get a single session system parameter as JSON

        Parameters:
        g - Grant
        name - System parameter name
        Returns:
        json
      • jsonSetSysParam

        public static java.lang.String jsonSetSysParam​(Grant g,
                                                       java.lang.String name,
                                                       java.lang.String value,
                                                       boolean save)

        Set a session system parameter as JSON

        Parameters:
        g - Grant
        name - System parameter name
        value - System parameter value (remove if null)
        save - Save as user system parameter
        Returns:
        json
      • jsonText

        public static java.lang.String jsonText​(Grant g,
                                                java.lang.String code)

        Text as JSON

        Parameters:
        g - Grant
        code - Text code
      • jsonTextsArray

        public static java.lang.String jsonTextsArray​(Grant g,
                                                      java.lang.String regex)

        All matching texts as a JSON array

        Parameters:
        g - Grant
        regex - Filtering regex on codes
        Returns:
        json array
      • jsonTexts

        public static java.lang.String jsonTexts​(Grant g)

        All texts as JSON

        Parameters:
        g - Grant
        Returns:
        json
      • getTexts

        public static java.lang.String getTexts​(Grant g)

        Get all texts as a JSON object

        Parameters:
        g - Grant
      • getTexts

        public static java.lang.String getTexts​(Grant g,
                                                java.lang.String regex)

        Get all matching texts as a JSON object

        Parameters:
        g - Grant
        regex - Optional filtering regular expression on codes
      • jsonMenu

        public static java.lang.String jsonMenu​(Grant g,
                                                boolean embedded)

        Menu as JSON

        Parameters:
        g - Grant
        Returns:
        json
      • jsonPreferences

        public static java.lang.String jsonPreferences​(ObjectDB obj)
        Object preferences
        Parameters:
        obj - Business object
        Returns:
        JSON
      • savePreferences

        public static void savePreferences​(ObjectDB obj,
                                           java.lang.String json)
      • listSocialPosts

        public static java.lang.String listSocialPosts​(Grant g,
                                                       java.lang.String postId,
                                                       java.lang.String object,
                                                       java.lang.String rowId,
                                                       int page,
                                                       boolean act,
                                                       boolean follow,
                                                       boolean countersOnly,
                                                       boolean audit,
                                                       java.lang.String level)

        Social as JSON

        Parameters:
        postId - Optional filter
        object - Optional filter
        rowId - Optional filter
        page - Pagination
        act - true to include activity messages
        follow - true to get follower counters
        countersOnly - true to get counters only
        audit - true to get audit messages
        level - optional filter on level
        Returns:
        json { count, posted, page, list:[], follow:{followed, follower, requested} }
      • listFollows

        public static java.lang.String listFollows​(Grant g,
                                                   java.lang.String status)
      • listAuthors

        public static java.lang.String listAuthors​(Grant g,
                                                   java.lang.String req,
                                                   java.lang.String object,
                                                   boolean all)
      • jsonNews

        public static java.lang.String jsonNews​(Grant g,
                                                boolean inlineImages)

        News as JSON

        Parameters:
        inlineImages - Inline images contents ?
        Returns:
        json
      • jsonDocument

        public static java.lang.String jsonDocument​(Grant g,
                                                    java.lang.String docId,
                                                    boolean inlineContent,
                                                    boolean inlineThumbnail,
                                                    boolean copy)

        Builds a JSON object for document

        Parameters:
        g - Grant
        docId - Document ID
        inlineContent - Include document content (base64 encoded string)
        inlineThumbnail - Include document thumbnail content (base64 encoded string)
        Returns:
        json
      • jsonMetaObject

        public static java.lang.String jsonMetaObject​(Grant g,
                                                      java.lang.String val,
                                                      Parameters.InlineParam inlines)

        Builds a JSON object for a meta object value

        Parameters:
        g - Grant
        val - Meta object value
        inlines - Inline documents options
        Returns:
        json
      • jsonDocument

        public static java.lang.String jsonDocument​(Grant g,
                                                    DocumentDB doc,
                                                    boolean inlineContent,
                                                    boolean inlineThumbnail,
                                                    boolean copy)

        Builds a JSON object for document

        Parameters:
        g - Grant
        doc - Document
        inlineContent - Include document content (base64 encoded string)
        inlineThumbnail - Inline document thumbnail content (base64 encoded string)
        copy - Serialize for copy ?
        Returns:
        json
      • jsonReadDocument

        public static java.lang.String jsonReadDocument​(Grant g,
                                                        java.lang.String docId,
                                                        boolean includeContent,
                                                        boolean includeThumbnail)

        Read document informations as JSON

        Parameters:
        g - Grant
        docId - Document ID
        includeContent - Include document content (base64 encoded string)
        includeThumbnail - Include document thumbnail content (base64 encoded string)
        Returns:
        json
      • jsonWriteDocument

        public static java.lang.String jsonWriteDocument​(Grant g,
                                                         java.lang.String docId,
                                                         java.lang.String name,
                                                         java.lang.String path,
                                                         java.lang.String content,
                                                         java.lang.String object,
                                                         java.lang.String field,
                                                         java.lang.String rowId)

        Write document

        Parameters:
        g - Grant
        name - Document name
        content - Document content (base64 encoded string)
        Returns:
        json
      • jsonExtObject

        public static java.lang.String jsonExtObject​(Grant g,
                                                     java.lang.String name)

        External object meta data as JSON

        Parameters:
        name - External object name
        Returns:
        json
      • JsonToXML

        public static DataXML JsonToXML​(org.json.JSONObject item)
        Convert a JSON item to XML data set
        Parameters:
        item - JSON object with fields
      • JsonToXML

        public static DataXML JsonToXML​(org.json.JSONObject item,
                                        org.json.JSONObject olditem,
                                        ObjectDB obj)
        Convert a JSON item to XML data set
        Parameters:
        item - JSON object with current field values
        olditem - JSON object with old field values
        obj - Optional to order fields
      • jsonObjectToMap

        public static java.util.Map<java.lang.String,​java.lang.Object> jsonObjectToMap​(org.json.JSONObject object)
        Convert JSONObject to plain Map
      • mapToJSON

        public static java.lang.String mapToJSON​(java.util.Map<java.lang.String,​java.lang.String> map)
        Convert Map to JSON
      • addOpenAPIParameterType

        public static org.json.JSONObject addOpenAPIParameterType​(org.json.JSONObject param,
                                                                  java.lang.String type,
                                                                  org.json.JSONArray values,
                                                                  int openapiVersion)
        Add OpenAPI parameter type
        Parameters:
        param - Parameter object
        type - Type
        values - Values
        openapiVersion - OpenAPI version
        Returns:
        JSON object
      • addOpenAPIOperationType

        public static org.json.JSONObject addOpenAPIOperationType​(org.json.JSONObject operation,
                                                                  java.lang.String requestType,
                                                                  java.lang.String requestSchema,
                                                                  java.lang.String responseType,
                                                                  java.lang.String responseSchema,
                                                                  int[] errorStatuses,
                                                                  int openapiVersion)
        Get OpenAPI operation types
        Parameters:
        operation - Operation
        requestType - Request type
        requestSchema - Request schema
        responseType - Response type
        responseSchema - Response schema
        errorStatuses - Error statuses
        openapiVersion - OpenAPI version
        Returns:
        JSON object
      • addOpenAPIOperationTypes

        public static org.json.JSONObject addOpenAPIOperationTypes​(org.json.JSONObject operation,
                                                                   java.lang.String[] requestTypes,
                                                                   java.lang.String requestSchema,
                                                                   java.lang.String[] responseTypes,
                                                                   java.lang.String responseSchema,
                                                                   int[] errorStatuses,
                                                                   int openapiVersion)
        Get OpenAPI operation types
        Parameters:
        operation - Operation
        requestTypes - Request types
        requestSchema - Request schema
        responseTypes - Response types
        responseSchema - Response schema
        errorStatuses - Error statuses
        openapiVersion - OpenAPI version
        Returns:
        JSON object
      • getOpenAPIRef

        public static java.lang.String getOpenAPIRef​(java.lang.String name,
                                                     int openapiVersion)
        Get OpenAPI reference
        Parameters:
        name - Reference name
        openapiVersion - OpenAPI version
        Returns:
        JSON object
      • getOpenAPIError

        public static org.json.JSONObject getOpenAPIError​(int code,
                                                          int openapiVersion)
        Get OpenAPI error
        Parameters:
        code - Error code
        openapiVersion - OpenAPI version
        Returns:
        JSON object
      • getOpenAPIInfo

        public static org.json.JSONObject getOpenAPIInfo​(java.lang.String title,
                                                         java.lang.String description,
                                                         java.lang.String version,
                                                         boolean license,
                                                         boolean contact)
        Get OpenAPI info
        Parameters:
        title - Title
        description - Description
        version - Version
        license - License?
        contact - Contact?
        Returns:
        JSON object
      • addTag

        public static org.json.JSONArray addTag​(org.json.JSONArray tags,
                                                java.lang.String name,
                                                java.lang.String description)
        Add a tag
        Parameters:
        tags - Tag list (or null)
        name - Tag name
        description - Tag description
      • getOpenAPISchema

        public static org.json.JSONObject getOpenAPISchema​(Grant g,
                                                           int openapiVersion,
                                                           org.json.JSONObject info,
                                                           org.json.JSONArray tags,
                                                           java.lang.String basePath,
                                                           org.json.JSONObject paths,
                                                           org.json.JSONObject schemas)
                                                    throws java.lang.Exception
        Get OpenAPI schema
        Parameters:
        g - Grant
        info - Info
        tags - Tags
        basePath - Base path
        paths - Paths
        schemas - Schemas
        Returns:
        JSON object
        Throws:
        java.lang.Exception
      • addLoginOpenAPIPath

        public static org.json.JSONObject addLoginOpenAPIPath​(org.json.JSONObject paths,
                                                              int openapiVersion)
        Add login service Open API path description to paths
        Parameters:
        paths - Paths
        openapiVersion - OpenAPI version
        Returns:
        JSONObject
      • addLogoutOpenAPIPath

        public static org.json.JSONObject addLogoutOpenAPIPath​(org.json.JSONObject paths,
                                                               int openapiVersion)
        Add logout service Open API path description to paths
        Parameters:
        paths - Paths
        openapiVersion - OpenAPI version
        Returns:
        JSONObject
      • addActionResultSchema

        public static org.json.JSONObject addActionResultSchema​(org.json.JSONObject schemas)
        Add action result Open API schemas description to schemas
        Parameters:
        schemas - Schemas
        Returns:
        JSONObject
      • addPublicationResultSchema

        public static org.json.JSONObject addPublicationResultSchema​(org.json.JSONObject schemas)
        Add publication result Open API schemas description to schemas
        Parameters:
        schemas - Schemas
        Returns:
        JSONObject
      • addTreeviewDataSchema

        public static org.json.JSONObject addTreeviewDataSchema​(org.json.JSONObject schemas)
        Add treeview data Open API schemas description to schemas
        Parameters:
        schemas - Schemas
        Returns:
        JSONObject
      • addErrorsSchema

        public static org.json.JSONObject addErrorsSchema​(org.json.JSONObject schemas)
        Add error messages Open API schemas description to schemas
        Parameters:
        schemas - Schemas
        Returns:
        JSONObject
      • addAppSessionOpenAPIPath

        public static org.json.JSONObject addAppSessionOpenAPIPath​(org.json.JSONObject paths,
                                                                   int openapiVersion)
        Add application and session REST services Open API paths description to paths
        Parameters:
        paths - Paths
        openapiVersion - OpenAPI version
        Returns:
        JSONObject
      • addBusinessObjectOpenAPISchema

        public static org.json.JSONObject addBusinessObjectOpenAPISchema​(org.json.JSONObject schemas,
                                                                         ObjectDB obj,
                                                                         int openapiVersion)
        Add business object REST services Open API schema to schemas
        Parameters:
        schemas - Schemas
        obj - Business object
        openapiVersion - OpenAPI version
        Returns:
        Updated schemas
      • addBusinessObjectOpenAPIPath

        public static org.json.JSONObject addBusinessObjectOpenAPIPath​(org.json.JSONObject paths,
                                                                       ObjectDB obj,
                                                                       java.lang.String relPath,
                                                                       int openapiVersion)
        Add business object REST services Open API paths to paths
        Parameters:
        paths - Paths
        obj - Business object
        relPath - Relative path to base path
        openapiVersion - OpenAPI version
        Returns:
        Updated paths
      • getJSONSchema

        public static org.json.JSONObject getJSONSchema​(ObjectDB obj)
        Get JSON Schema for specified object
        Parameters:
        obj - Object
        Returns:
        JSON schema
      • jsonTestData

        public static java.lang.String jsonTestData​(Grant g,
                                                    java.lang.String obj,
                                                    java.lang.String rowId)
        Random data
        Parameters:
        g - Grant
        obj - Object name
        rowId - Optional row ID
      • getJSONObjectFromXML

        public static org.json.JSONObject getJSONObjectFromXML​(java.lang.String xml)
        Get JSON object from XML
        Parameters:
        xml - XML string
        Returns:
        JSON object or null if XML is not parseable as JSON object
      • getXMLFromJSONObject

        public static java.lang.String getXMLFromJSONObject​(org.json.JSONObject json)
        Get XML from JSON objectL
        Parameters:
        json - JSON object
        Returns:
        XML string or null is JSON object is to parseable as XML
      • getJSONASCIILogo

        public static java.lang.String getJSONASCIILogo​(java.lang.String complement)
        Get ASCII logo as JSON comments
        Parameters:
        complement - Additonal string to append to logo
      • getYAMLASCIILogo

        public static java.lang.String getYAMLASCIILogo​(java.lang.String complement)
        Get ASCII logo as YAML comments
        Parameters:
        complement - Additonal string to append to logo
      • getYAMLProcessor

        public static org.yaml.snakeyaml.Yaml getYAMLProcessor()
        Get YAML processor
      • toYAML

        public static java.lang.String toYAML​(org.json.JSONObject json)
        Convert JSON object to YAML
        Parameters:
        json - JSON object
        Returns:
        YAML string
      • toYAML

        public static java.lang.String toYAML​(org.json.JSONArray json)
        Convert JSON array to YAML
        Parameters:
        json - JSON array
        Returns:
        YAML string
      • toYAML

        public static java.lang.String toYAML​(java.lang.String json)
        Convert JSON to YAML
        Parameters:
        json - JSON string
        Returns:
        YAML string
      • fromYAML

        public static org.json.JSONObject fromYAML​(java.lang.String yaml)
        Convert YAML to JSON object
        Parameters:
        yaml - YAML string
        Returns:
        JSON object