Search in sources :

Example 1 with ParameterValue

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);
}
Also used : ParameterValue(eu.esdihumboldt.hale.common.align.model.ParameterValue) LookupTable(eu.esdihumboldt.hale.common.lookup.LookupTable) Value(eu.esdihumboldt.hale.common.core.io.Value) ParameterValue(eu.esdihumboldt.hale.common.align.model.ParameterValue) UnsupportedEncodingException(java.io.UnsupportedEncodingException) StyledString(org.eclipse.jface.viewers.StyledString) Point(org.eclipse.swt.graphics.Point)

Example 2 with ParameterValue

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;
}
Also used : TabItem(org.eclipse.swt.widgets.TabItem) ParameterValue(eu.esdihumboldt.hale.common.align.model.ParameterValue) LookupTable(eu.esdihumboldt.hale.common.lookup.LookupTable) StyledString(org.eclipse.jface.viewers.StyledString) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) LookupTableImpl(eu.esdihumboldt.hale.common.lookup.impl.LookupTableImpl)

Example 3 with ParameterValue

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;
}
Also used : ComplexValue(eu.esdihumboldt.hale.common.core.io.impl.ComplexValue) ParameterValue(eu.esdihumboldt.hale.common.align.model.ParameterValue) JoinParameter(eu.esdihumboldt.hale.common.align.model.functions.join.JoinParameter) JoinCondition(eu.esdihumboldt.hale.common.align.model.functions.join.JoinParameter.JoinCondition) HashSet(java.util.HashSet)

Example 4 with ParameterValue

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;
}
Also used : ParameterValue(eu.esdihumboldt.hale.common.align.model.ParameterValue)

Example 5 with ParameterValue

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);
}
Also used : DefaultCustomPropertyFunction(eu.esdihumboldt.hale.common.align.custom.DefaultCustomPropertyFunction) ParameterValue(eu.esdihumboldt.hale.common.align.model.ParameterValue)

Aggregations

ParameterValue (eu.esdihumboldt.hale.common.align.model.ParameterValue)80 Test (org.junit.Test)29 Cell (eu.esdihumboldt.hale.common.align.model.Cell)28 DefaultCell (eu.esdihumboldt.hale.common.align.model.impl.DefaultCell)21 AttributeMappingType (eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.AttributeMappingType)14 AppSchemaMappingContext (eu.esdihumboldt.hale.io.appschema.writer.internal.mapping.AppSchemaMappingContext)13 ArrayList (java.util.ArrayList)13 MutableCell (eu.esdihumboldt.hale.common.align.model.MutableCell)9 Property (eu.esdihumboldt.hale.common.align.model.Property)9 ClientProperty (eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.AttributeMappingType.ClientProperty)9 Entity (eu.esdihumboldt.hale.common.align.model.Entity)8 DefaultProperty (eu.esdihumboldt.hale.common.align.model.impl.DefaultProperty)8 Value (eu.esdihumboldt.hale.common.core.io.Value)8 TypeDefinition (eu.esdihumboldt.hale.common.schema.model.TypeDefinition)8 TransformationException (eu.esdihumboldt.hale.common.align.transformation.function.TransformationException)7 Type (eu.esdihumboldt.hale.common.align.model.Type)6 AssignHandler (eu.esdihumboldt.hale.io.appschema.writer.internal.AssignHandler)6 JoinParameter (eu.esdihumboldt.hale.common.align.model.functions.join.JoinParameter)5 HashSet (java.util.HashSet)5 EntityDefinition (eu.esdihumboldt.hale.common.align.model.EntityDefinition)4