Package de.xima.fc.gui.utils.data
Class QueryUtils
java.lang.Object
de.xima.fc.gui.utils.data.QueryUtils
Utility class providing methods for handling data queries
- Author:
- XIMA MEDIA GmbH
-
Method Summary
Modifier and TypeMethodDescriptionstatic final String
formatBold
(String original, String bold) Turns sub strings within the original boldstatic final String
generateUrl
(Mandant client, EDatenabfrageTyp type, String queryName, List<IParameterModel> params) static final String
genreateUrl
(Datenquelle source) Generate the servlet URL for the given sourcestatic final String[]
getNonEmptyArray
(List<GenericStringModel> strings) static final Serializable[]
getParameterValueArray
(List<IParameterModel> parameters) Generates an array from the given list of parameters containing the parameter valuesstatic final org.primefaces.model.TreeNode<Object>
getTreeNode
(com.alibaba.fastjson.JSONArray jsonArray, Object data) Generates aTreeNode
from the givenJSONArray
static final org.primefaces.model.TreeNode<Object>
getTreeNode
(com.alibaba.fastjson.JSONObject jsonObject, Object data) Generates aTreeNode
from the givenJSONObject
static final org.primefaces.model.TreeNode<Object>
getTreeNode
(com.alibaba.fastjson.JSON json, Object data) Generates aTreeNode
from the givenJSON
static final List<IParameterModel>
getUpdatedParameters
(List<IParameterModel> params, String query, String placeholder) Updates the given list of parameters if new parameters have been added to the queryString
static final String
replaceWithNumbers
(String original, String replaceString, int start) replaces all occurrences of a given substring in the originalString
with running numbersstatic String
setParamValues
(String original, String replaceStr, List<IParameterModel> params, boolean withQuotes) Replaces all occurrences of the placeholder with the consecutive values of the parameter list
-
Method Details
-
getParameterValueArray
Generates an array from the given list of parameters containing the parameter values- Parameters:
parameters
-List
ofIParameterModel
s- Returns:
- an array of the parameter values
-
getNonEmptyArray
- Parameters:
strings
-List
ofGenericStringModel
s- Returns:
String
array
-
replaceWithNumbers
replaces all occurrences of a given substring in the originalString
with running numbers -
formatBold
Turns sub strings within the original bold -
getTreeNode
public static final org.primefaces.model.TreeNode<Object> getTreeNode(com.alibaba.fastjson.JSON json, Object data) Generates aTreeNode
from the givenJSON
- Parameters:
json
-JSON
containing tree information- Returns:
TreeNode
of the givenJSON
-
getTreeNode
public static final org.primefaces.model.TreeNode<Object> getTreeNode(com.alibaba.fastjson.JSONArray jsonArray, Object data) Generates aTreeNode
from the givenJSONArray
- Parameters:
jsonArray
-JSONArray
containing tree information- Returns:
TreeNode
of the givenJSONArray
-
getTreeNode
public static final org.primefaces.model.TreeNode<Object> getTreeNode(com.alibaba.fastjson.JSONObject jsonObject, Object data) Generates aTreeNode
from the givenJSONObject
- Parameters:
jsonObject
-JSONObject
containing tree information- Returns:
TreeNode
of the givenJSONObject
-
getUpdatedParameters
public static final List<IParameterModel> getUpdatedParameters(List<IParameterModel> params, String query, String placeholder) Updates the given list of parameters if new parameters have been added to the queryString
- Parameters:
params
-List
ofIParameterModel
squery
-String
placeholder
-String
for the parameters within the query- Returns:
- updated
List
of parameters
-
setParamValues
public static String setParamValues(String original, String replaceStr, List<IParameterModel> params, boolean withQuotes) Replaces all occurrences of the placeholder with the consecutive values of the parameter list -
genreateUrl
Generate the servlet URL for the given source- Parameters:
source
-Datenquelle
to generate servlet URL for- Returns:
String
servlet URL- Throws:
NullPointerException
- if source isnull
IllegalArgumentException
- if ID of source is invalid
-
generateUrl
public static final String generateUrl(Mandant client, EDatenabfrageTyp type, String queryName, List<IParameterModel> params)
-