Package de.xima.fc.gui.utils.data
Class QueryUtils
- java.lang.Object
-
- de.xima.fc.gui.utils.data.QueryUtils
-
public class QueryUtils extends Object
Utility class providing methods for handling data queries- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
formatBold(String original, String bold)
Turns sub strings within the original boldstatic String
generateUrl(Mandant client, EDatenabfrageTyp type, String queryName, List<IParameterModel> params)
static String
genreateUrl(Datenquelle source)
Generate the servlet URL for the given sourcestatic String[]
getNonEmptyArray(List<GenericStringModel> strings)
static Serializable[]
getParameterValueArray(List<IParameterModel> parameters)
Generates an array from the given list of parameters containing the parameter valuesstatic org.primefaces.model.TreeNode
getTreeNode(com.alibaba.fastjson.JSONArray jsonArray, Object data)
Generates aTreeNode
from the givenJSONArray
static org.primefaces.model.TreeNode
getTreeNode(com.alibaba.fastjson.JSONObject jsonObject, Object data)
Generates aTreeNode
from the givenJSONObject
static org.primefaces.model.TreeNode
getTreeNode(com.alibaba.fastjson.JSON json, Object data)
Generates aTreeNode
from the givenJSON
static 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 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 Detail
-
getParameterValueArray
public static final Serializable[] getParameterValueArray(List<IParameterModel> parameters)
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
public static final String[] getNonEmptyArray(List<GenericStringModel> strings)
- Parameters:
strings
-List
ofGenericStringModel
s- Returns:
String
array
-
replaceWithNumbers
public static final String replaceWithNumbers(String original, String replaceString, int start)
replaces all occurrences of a given substring in the originalString
with running numbers
-
formatBold
public static final String formatBold(String original, String bold)
Turns sub strings within the original bold
-
getTreeNode
public static final org.primefaces.model.TreeNode 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 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 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
public static final String genreateUrl(Datenquelle source)
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)
-
-