Search in sources :

Example 46 with ParameterValue

use of eu.esdihumboldt.hale.common.align.model.ParameterValue in project hale by halestudio.

the class CoordinateReferenceSystemParameterPage method getConfiguration.

@Override
public ListMultimap<String, ParameterValue> getConfiguration() {
    ListMultimap<String, ParameterValue> conf = ArrayListMultimap.create();
    String crsAsString = null;
    if (crsDef != null) {
        crsAsString = CRSDefinitionManager.getInstance().asString(crsDef);
    }
    conf.put(PARAMETER_REFERENCE_SYSTEM, new ParameterValue(crsAsString));
    return conf;
}
Also used : ParameterValue(eu.esdihumboldt.hale.common.align.model.ParameterValue)

Example 47 with ParameterValue

use of eu.esdihumboldt.hale.common.align.model.ParameterValue in project hale by halestudio.

the class JoinTypeStructureTray method createToolItem.

/**
 * Creates a tool item
 *
 * @param bar a toolbar
 * @param page hale wizard page
 * @param schemaSpace schema space
 * @param types type provider
 */
public static void createToolItem(ToolBar bar, final HaleWizardPage<?> page, final SchemaSpaceID schemaSpace, final TypeProvider types) {
    ToolItem item = new ToolItem(bar, SWT.PUSH);
    item.setImage(CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_SOURCE_SCHEMA));
    item.setToolTipText("Show source structure");
    item.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (page.getContainer() instanceof TrayDialog) {
                TrayDialog dialog = (TrayDialog) page.getContainer();
                // close existing tray
                if (dialog.getTray() != null) {
                    dialog.closeTray();
                }
                ParameterValue param = CellUtil.getFirstParameter(((GenericTypeFunctionWizard) page.getWizard()).getUnfinishedCell(), JoinFunction.PARAMETER_JOIN);
                dialog.openTray(new JoinTypeStructureTray(param, types, schemaSpace));
            } else {
            // TODO show dialog instead?
            }
        }
    });
}
Also used : ParameterValue(eu.esdihumboldt.hale.common.align.model.ParameterValue) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GenericTypeFunctionWizard(eu.esdihumboldt.hale.ui.function.generic.GenericTypeFunctionWizard) TrayDialog(org.eclipse.jface.dialogs.TrayDialog) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 48 with ParameterValue

use of eu.esdihumboldt.hale.common.align.model.ParameterValue in project hale by halestudio.

the class IdentifierParameterPage method getConfiguration.

@Override
public ListMultimap<String, ParameterValue> getConfiguration() {
    ListMultimap<String, ParameterValue> configuration = ArrayListMultimap.create(5, 1);
    configuration.put(COUNTRY_PARAMETER_NAME, new ParameterValue(countryCode.getText()));
    configuration.put(DATA_PROVIDER_PARAMETER_NAME, new ParameterValue(providerName.getText()));
    configuration.put(PRODUCT_PARAMETER_NAME, new ParameterValue(productName.getText()));
    configuration.put(VERSION, new ParameterValue(version.getText()));
    configuration.put(VERSION_NIL_REASON, new ParameterValue(nilEditor.getAsText()));
    return configuration;
}
Also used : ParameterValue(eu.esdihumboldt.hale.common.align.model.ParameterValue)

Example 49 with ParameterValue

use of eu.esdihumboldt.hale.common.align.model.ParameterValue in project hale by halestudio.

the class MergeParameterPage method setParameter.

/**
 * @see eu.esdihumboldt.hale.ui.function.generic.pages.ParameterPage#setParameter(java.util.Set,
 *      com.google.common.collect.ListMultimap)
 */
@Override
public void setParameter(Set<FunctionParameterDefinition> params, ListMultimap<String, ParameterValue> initialValues) {
    if (params.size() > 1)
        throw new IllegalArgumentException("MergeParameterPage is only for one parameter");
    parameter = params.iterator().next();
    if (parameter.getName().equals(PARAMETER_PROPERTY)) {
        setTitle("Please select the properties that have to match");
        setDescription("Instances that have equal values for these properties will be merged into one");
    } else if (parameter.getName().equals(PARAMETER_ADDITIONAL_PROPERTY)) {
        setTitle("Please select other equal properties to merge");
        setDescription("For these properties only the unique values will be retained in the merged instance");
    } else
        throw new IllegalArgumentException("MergeParameterPage is only for property or additional_property parameters");
    if (initialValues != null) {
        // cell gets edited
        List<ParameterValue> tmp = initialValues.get(parameter.getName());
        if (tmp != null) {
            initialSelection = new ArrayList<String>(tmp.size());
            for (ParameterValue value : tmp) {
                // TODO use MergeUtil helper function instead
                // XXX needs selection to be QName based
                initialSelection.add(value.as(String.class));
            }
        } else {
            initialSelection = Collections.emptyList();
        }
        setPageComplete(true);
    }
}
Also used : ParameterValue(eu.esdihumboldt.hale.common.align.model.ParameterValue)

Example 50 with ParameterValue

use of eu.esdihumboldt.hale.common.align.model.ParameterValue in project hale by halestudio.

the class MergeParameterPage method onShowPage.

/**
 * @see eu.esdihumboldt.hale.ui.HaleWizardPage#onShowPage(boolean)
 */
@Override
protected void onShowPage(boolean firstShow) {
    super.onShowPage(firstShow);
    setPageComplete(true);
    Cell unfinishedCell = getWizard().getUnfinishedCell();
    // selected target could've changed!
    TypeDefinition newSourceType = (TypeDefinition) unfinishedCell.getSource().values().iterator().next().getDefinition().getDefinition();
    if (!newSourceType.equals(sourceType)) {
        selection = new HashSet<EntityDefinition>();
        sourceType = newSourceType;
        viewer.setInput(sourceType);
    }
    // for additional_property: selected properties can change!
    if (parameter.getName().equals(PARAMETER_ADDITIONAL_PROPERTY)) {
        filtered = new HashSet<EntityDefinition>();
        List<ParameterValue> properties = unfinishedCell.getTransformationParameters().get(PARAMETER_PROPERTY);
        boolean oldSelectionChanged = false;
        for (ParameterValue propertyPath : properties) {
            EntityDefinition def = getEntityDefinition(propertyPath.as(String.class), sourceType);
            filtered.add(def);
            if (selection.remove(def))
                oldSelectionChanged = true;
        }
        if (oldSelectionChanged) {
            viewer.setCheckedElements(selection.toArray());
        }
        viewer.refresh();
    }
}
Also used : EntityDefinition(eu.esdihumboldt.hale.common.align.model.EntityDefinition) ParameterValue(eu.esdihumboldt.hale.common.align.model.ParameterValue) Cell(eu.esdihumboldt.hale.common.align.model.Cell) TypeDefinition(eu.esdihumboldt.hale.common.schema.model.TypeDefinition)

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