Skip to main content

Utils Component

net.democritus:base-components::2024.7.2

ParamTargetValue

The ParamTargetValue DataElement can be used to store configuration for your application.

ParamTargetValue instances are triplets:

FieldDescription
ParamName for the parameter
TargetAdditional tag. At least one triplet should have target default.
ValueValue for this param-target combination

The ParamTargetValueAgent exposes 2 methods:

public String getParamTargetValue(String paramName, String targetName) {}
public boolean isParamTargetValueActive(String paramName, String targetName, boolean defaultValue) {}

getParamTargetValue() returns the value associated with the given paramName and targetName. In case this combination is not defined, the method returns the value associated with paramName and target default.

isParamTargetValueActive() returns true if the associated value is true, false if it is false and otherwise defaults to the default value. This method also defaults to target default if the given target is not defined.

TagValuePair

You can enable dropdowns for String ValueFields by adding isListField:

Starship
<dataElement name="Starship">
<fields>
<field name="status">
<isListField value="true"/>
<valueField>
<valueFieldType name="String"/>
</valueField>
</field>
</fields>
</dataElement>

The options can be provided by inserting TagValuePair instances in the Application

FieldDescription
TagCombination of DataElement name and field ({dataElementName}_{fieldName})
ValueValue option
caution

This feature does not work if 2 DataElements in different Components have the same name.