net.simplace.core.FWFrameworkHelper

Provides some static method for working with strings.


public final class FWFrameworkHelper {

// Constants
public static final char WEBEUROSIGN;
public static final Pattern PARAMPATTERN;
public static final Pattern EXPRESSIONPATTERN;
public static final OperationTreeParser MATHRULE_PARSER;

// Class Methods
public static Object getParameterFromMap(Map aParamMap, String aKey, Object
aDefault);

getting parameter value from key if value is Map or Date using '!' as a seperator.
returns parameter value from key if value is Map or Date using '!' as a seperator
public static String getStringParameterFromMap(Map aParamMap, String aKey,
Object aDefault);

getting parameter value from map as string.
returns parameter value from map as string
public static Number getNumberParameterFromMap(Map aParamMap, String aKey,
Class aNumberType, Number aDefault);

Getting parameter value from map as a number.
returns parameter value from map as a number
public static String replaceParamTokens(Map aParamMap, String aValue, Object
aDefault);

replaces Parameters in
returns aNewValue
public static String replaceParamTokens(Map aParamMap, String aValue, Object
aDefault, boolean aIgnoreNull);

replaces Parameters in
returns aNewValue
public static Object getValueFromSpecialParameter(Map aParamMap, String aKey,
Object aDefault);

getting parameter value from key if value is Map or Date using '!' as a separator.
returns parameter value from key if value is Map or Date using '!' as a separator
public static double evaluateExpression(String aValue, Map aParameterMap);

evaluates expressions fith arithmetric operations
returns the double result value
public static double evaluateMathematicalRule(String aRule);

Parst einen String, erstellt daraus einen de.schmitzm.lang.tree.OperationTreeOperator-Baum und wertet diesen aus. Fuer die Syntax gelten die gleichen Regeln, wie fuer net.simplace.core.FWFrameworkHelper.evaluateRule(String). Das Ergebnis wird jedoch immer als numerisch interpretiert. Ist das Ergebnis keine Instanz von java.lang.Number, wird 0 zurueckgegeben.
returns the result ot the rule or 0 if the result is not numeric
public static Object evaluateRule(String aRule);


returns resulting object
public static Object evaluateRule(String aRule, OperationTreeParser aParser);

Evaluation of Rules in SIMPLACE Framework with the SchmitzM Operation Tree Parser

The Operation Tree Parser evaluates mathematical rules of different type. Logical or numerical operations can be evaluated. Before evaluating the given rules the parameters given in the algorithm are replaced. If a parameter was not correctly found the rule cannot be evaluated. Make sure that either a value or a default is given for the specific parameter.

Variables enclosed in ${variable.name}

First parameters have to be replaced hierarchically (not within this method), then calculation takes place (here!).

 ${some.parameter.name} * 15 / ${some.other.param${param.index.param}}

Constant numerical values:

Constant String values

2-partner arithmetic operation

The 2-partner Boolean operator

The 2-partner character operation

The singular operation

The singular Boolean operation

The singular String operation

The 3-partner operation ITE(.,.,.)

First parameter is replaced, then checked first partner. Result (0) if parameter was > 5, (1) if not

To combine Boolean and arithmetic operations the operands have to be coded as (1) or (0), not as TRUE or FALSE where op > 0 is TRUE and 0 is FALSE.


returns the result ot the rule
public static String processTemplate(String aTemplate, SimpleFeature
tFeatureToUse, ResultSet aResultSet, Map aParameterMap);


returns a processed Template
public static String combineHTML(String aHTMLBefore, String aStyleSheet)
throws IOException;

Reads the html and the stylesheet from the parameters and returns a combined html.
returns a combined html
public static void saveProblemReport();

public static Map transformMapToStringValue(Map aParameterMap);


returns Map, transformed to String value
public static Map getParametersMatchingRegex(Map aMap, String aRegexString);


returns parameters, which match the given Regex
public static Set getParametersFromString(String aString);


returns a Set of all Parameters within the given String
public static void replaceParamsInFile(FWObservable aObservable, File aFile);

public static Map createMapFromCollection(Collection tLoopList);


returns Map, created from Collection
public static String createFormComponentLocaleBundleKey(FWObservable
aObservable, String aFormComponentID, String aShortKey);

Creates a locale bundle key for the specified short key. Parameter wildcards in short key are replaced from parameter map. Spaces in short key are replaced by "_". If form component ID is specified, it is used as prefix for locale bundle key (besides standard prefix: .FormComponent).
returns {@code null} if {@code aShortKey} is {@code null}
public static String localizeFormComponentValue(FWObservable aObservable,
String aFormComponentID, String aFormComponentValue);

Localizes a form component value (e.g. table cell value from database) by generating a locale bundle key from value as follows: Parameter wildcards in form component value are replaced from parameter map. Spaces in form component value are replaced by "_". If form component ID is specified, it is used as prefix for locale bundle key (besides standard prefix: .FormComponent).
returns unchanged form component value, if no localization can be found


}