use of eu.esdihumboldt.hale.common.align.model.ParameterValue in project hale by halestudio.
the class ClassificationMappingParameterPage method setParameter.
@Override
public void setParameter(Set<FunctionParameterDefinition> params, ListMultimap<String, ParameterValue> initialValues) {
// this page is only for parameter classificationMapping, ignore params
if (initialValues == null)
return;
// Load the lookupTableConfiguration
List<ParameterValue> lookupTableId = initialValues.get(PARAMETER_LOOKUPTABLE_ID);
if (!lookupTableId.isEmpty()) {
selectedLookupTableID = lookupTableId.get(0).as(String.class);
}
// Load the complex value configuration
List<ParameterValue> lookupTableComplex = initialValues.get(PARAMETER_LOOKUPTABLE);
if (!lookupTableComplex.isEmpty()) {
LookupTable table = (LookupTable) lookupTableComplex.get(0).getValue();
lookupTable.putAll(table.asMap());
}
// For reason of compatibility we need the following code
List<ParameterValue> mappings = initialValues.get(PARAMETER_CLASSIFICATIONS);
for (ParameterValue value : mappings) {
String s = value.as(String.class);
String[] splitted = s.split(" ");
try {
for (int i = 0; i < splitted.length; i++) splitted[i] = URLDecoder.decode(splitted[i], "UTF-8");
} catch (UnsupportedEncodingException e) {
// UTF-8 should be everywhere
}
Value targetValue = Value.of(splitted[0]);
for (int i = 1; i < splitted.length; i++) lookupTable.put(Value.of(splitted[i]), targetValue);
}
List<ParameterValue> notClassifiedActionParams = initialValues.get(PARAMETER_NOT_CLASSIFIED_ACTION);
if (!notClassifiedActionParams.isEmpty())
notClassifiedAction = notClassifiedActionParams.get(0).as(String.class);
}
use of eu.esdihumboldt.hale.common.align.model.ParameterValue in project hale by halestudio.
the class ClassificationMappingParameterPage method getConfiguration.
/**
* @see eu.esdihumboldt.hale.ui.function.generic.pages.ParameterPage#getConfiguration()
*/
@Override
public ListMultimap<String, ParameterValue> getConfiguration() {
ListMultimap<String, ParameterValue> configuration = ArrayListMultimap.create();
for (TabItem tabItem : tabs.getSelection()) {
if (tabItem.equals(fromFileItem)) {
// Set the selected lookupTable
IStructuredSelection selection = (IStructuredSelection) lookupTableComboViewer.getSelection();
configuration.put(PARAMETER_LOOKUPTABLE_ID, new ParameterValue(selection.getFirstElement().toString()));
} else {
if (tabItem.equals(manualItem)) {
LookupTable realLookupTable = new LookupTableImpl(lookupTable);
configuration.put(PARAMETER_LOOKUPTABLE, new ParameterValue(Value.complex(realLookupTable)));
}
}
}
switch(notClassifiedActionOptions.indexOf(((IStructuredSelection) notClassifiedActionViewer.getSelection()).getFirstElement())) {
case 1:
notClassifiedAction = "source";
break;
case 2:
notClassifiedAction = "fixed:" + fixedValueText.getText();
break;
case 0:
case -1:
default:
notClassifiedAction = "null";
}
configuration.put(PARAMETER_NOT_CLASSIFIED_ACTION, new ParameterValue(notClassifiedAction));
return configuration;
}
use of eu.esdihumboldt.hale.common.align.model.ParameterValue in project hale by halestudio.
the class JoinParameterPage method getConfiguration.
/**
* @see eu.esdihumboldt.hale.ui.function.generic.pages.ParameterPage#getConfiguration()
*/
@Override
public ListMultimap<String, ParameterValue> getConfiguration() {
ListMultimap<String, ParameterValue> result = ArrayListMultimap.create(1, 1);
Set<JoinCondition> conditions = new HashSet<>();
for (ConditionPage page : pages) {
conditions.addAll(page.conditions);
}
JoinParameter param = new JoinParameter(types, conditions);
result.put(PARAMETER_JOIN, new ParameterValue(new ComplexValue(param)));
return result;
}
use of eu.esdihumboldt.hale.common.align.model.ParameterValue in project hale by halestudio.
the class SourceListParameterPage method getConfiguration.
/**
* @see ParameterPage#getConfiguration()
*/
@Override
public ListMultimap<String, ParameterValue> getConfiguration() {
ListMultimap<String, ParameterValue> params = ArrayListMultimap.create();
params.put(getParameterName(), new ParameterValue(getText(textField)));
return params;
}
use of eu.esdihumboldt.hale.common.align.model.ParameterValue in project hale by halestudio.
the class PropertyFunctionScriptPage method createContent.
@Override
protected void createContent(Composite page) {
getConfiguration().clear();
DefaultCustomPropertyFunction cf = getWizard().getResultFunction();
if (cf.getFunctionDefinition() != null) {
ListMultimap<String, ParameterValue> initialValues = ArrayListMultimap.create();
initialValues.put(PARAMETER_SCRIPT, new ParameterValue(cf.getFunctionDefinition()));
setParameter(Collections.<FunctionParameterDefinition>emptySet(), initialValues);
}
super.createContent(page);
}
Aggregations