Search in sources :

Example 21 with EntityDefinition

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

the class EntityDefinitionServiceUndoSupport method editConditionContext.

/**
 * @see eu.esdihumboldt.hale.ui.service.entity.internal.EntityDefinitionServiceDecorator#editConditionContext(eu.esdihumboldt.hale.common.align.model.EntityDefinition,
 *      eu.esdihumboldt.hale.common.instance.model.Filter)
 */
@Override
public EntityDefinition editConditionContext(EntityDefinition sibling, Filter filter) {
    ICompositeOperation operation = new CompositeOperation("Edit condition context");
    IWorkbenchOperationSupport operationSupport = PlatformUI.getWorkbench().getOperationSupport();
    operation.addContext(operationSupport.getUndoContext());
    operationSupport.getOperationHistory().openOperation(operation, IOperationHistory.EXECUTE);
    EntityDefinition result = super.editConditionContext(sibling, filter);
    operationSupport.getOperationHistory().closeOperation(result != null, true, IOperationHistory.EXECUTE);
    return result;
}
Also used : EntityDefinition(eu.esdihumboldt.hale.common.align.model.EntityDefinition) IWorkbenchOperationSupport(org.eclipse.ui.operations.IWorkbenchOperationSupport) ICompositeOperation(org.eclipse.core.commands.operations.ICompositeOperation) ICompositeOperation(org.eclipse.core.commands.operations.ICompositeOperation)

Example 22 with EntityDefinition

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

the class AddIndexContextHandler method execute.

/**
 * @see IHandler#execute(ExecutionEvent)
 */
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    ISelection selection = HandlerUtil.getCurrentSelection(event);
    if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
        Object element = ((IStructuredSelection) selection).getFirstElement();
        if (element instanceof EntityDefinition) {
            EntityDefinitionService eds = PlatformUI.getWorkbench().getService(EntityDefinitionService.class);
            // TODO configure index
            eds.addIndexContext((EntityDefinition) element, null);
        }
    }
    return null;
}
Also used : EntityDefinition(eu.esdihumboldt.hale.common.align.model.EntityDefinition) ISelection(org.eclipse.jface.viewers.ISelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) EntityDefinitionService(eu.esdihumboldt.hale.ui.service.entity.EntityDefinitionService)

Example 23 with EntityDefinition

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

the class PurgeConditionContextHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    ISelection selection = HandlerUtil.getCurrentSelection(event);
    if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
        Object element = ((IStructuredSelection) selection).getFirstElement();
        if (element instanceof EntityDefinition) {
            EntityDefinition entityDef = (EntityDefinition) element;
            Condition condition = AlignmentUtil.getContextCondition(entityDef);
            if (condition != null && condition.getFilter() != null) {
                EntityDefinitionService eds = PlatformUI.getWorkbench().getService(EntityDefinitionService.class);
                eds.editConditionContext((EntityDefinition) element, null);
            }
        }
    }
    return null;
}
Also used : Condition(eu.esdihumboldt.hale.common.align.model.Condition) EntityDefinition(eu.esdihumboldt.hale.common.align.model.EntityDefinition) ISelection(org.eclipse.jface.viewers.ISelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) EntityDefinitionService(eu.esdihumboldt.hale.ui.service.entity.EntityDefinitionService)

Example 24 with EntityDefinition

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

the class EntityTypeIndexHierarchy method getChildren.

/**
 * @see ITreeContentProvider#getChildren(Object)
 */
@Override
public Object[] getChildren(Object parentElement) {
    if (parentElement instanceof EntityDefinition) {
        EntityDefinition parent = (EntityDefinition) parentElement;
        List<EntityDefinition> children = new ArrayList<EntityDefinition>();
        // add valid sub types and alternative type entities
        if (parent.getPropertyPath().isEmpty() && parent.getFilter() == null) {
            // add valid sub types w/o filter
            for (TypeDefinition subtype : parent.getType().getSubTypes()) {
                if (validTypes.contains(subtype)) {
                    children.add(new TypeEntityDefinition(subtype, parent.getSchemaSpace(), null));
                }
            }
            // add type contexts
            for (TypeEntityDefinition typeEntity : entityDefinitionService.getTypeEntities(parent.getType(), parent.getSchemaSpace())) {
                if (typeEntity.getFilter() != null) {
                    // only use type entities with filter defined
                    children.add(typeEntity);
                }
            }
        }
        if (!onlyTypes) {
            // add regular children
            children.addAll(entityDefinitionService.getChildren(parent));
        }
        return children.toArray();
    } else {
        throw new IllegalArgumentException("Given element not supported in schema tree structure.");
    }
}
Also used : TypeEntityDefinition(eu.esdihumboldt.hale.common.align.model.impl.TypeEntityDefinition) EntityDefinition(eu.esdihumboldt.hale.common.align.model.EntityDefinition) TypeEntityDefinition(eu.esdihumboldt.hale.common.align.model.impl.TypeEntityDefinition) ArrayList(java.util.ArrayList) TypeDefinition(eu.esdihumboldt.hale.common.schema.model.TypeDefinition)

Example 25 with EntityDefinition

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

the class PopulationServiceImpl method resetPopulation.

/**
 * @see PopulationService#resetPopulation(DataSet)
 */
@Override
public void resetPopulation(DataSet dataSet) {
    SchemaSpaceID schemaSpace;
    switch(dataSet) {
        case TRANSFORMED:
            schemaSpace = SchemaSpaceID.TARGET;
            break;
        case SOURCE:
        default:
            schemaSpace = SchemaSpaceID.SOURCE;
    }
    synchronized (this) {
        Map<EntityDefinition, PopulationImpl> population = (schemaSpace == SchemaSpaceID.TARGET) ? (targetPopulation) : (sourcePopulation);
        population.clear();
    }
// XXX rely on dataSetChanged events for update
}
Also used : TypeEntityDefinition(eu.esdihumboldt.hale.common.align.model.impl.TypeEntityDefinition) EntityDefinition(eu.esdihumboldt.hale.common.align.model.EntityDefinition) SchemaSpaceID(eu.esdihumboldt.hale.common.schema.SchemaSpaceID)

Aggregations

EntityDefinition (eu.esdihumboldt.hale.common.align.model.EntityDefinition)99 TypeEntityDefinition (eu.esdihumboldt.hale.common.align.model.impl.TypeEntityDefinition)39 PropertyEntityDefinition (eu.esdihumboldt.hale.common.align.model.impl.PropertyEntityDefinition)37 ChildContext (eu.esdihumboldt.hale.common.align.model.ChildContext)23 ArrayList (java.util.ArrayList)22 Entity (eu.esdihumboldt.hale.common.align.model.Entity)21 TypeDefinition (eu.esdihumboldt.hale.common.schema.model.TypeDefinition)20 Cell (eu.esdihumboldt.hale.common.align.model.Cell)18 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)13 PropertyDefinition (eu.esdihumboldt.hale.common.schema.model.PropertyDefinition)11 MutableCell (eu.esdihumboldt.hale.common.align.model.MutableCell)10 HashSet (java.util.HashSet)10 QName (javax.xml.namespace.QName)10 HashMap (java.util.HashMap)9 Condition (eu.esdihumboldt.hale.common.align.model.Condition)8 SimpleLog (eu.esdihumboldt.hale.common.core.report.SimpleLog)7 ISelection (org.eclipse.jface.viewers.ISelection)7 List (java.util.List)6 TreePath (org.eclipse.jface.viewers.TreePath)6 AlignmentMigration (eu.esdihumboldt.hale.common.align.migrate.AlignmentMigration)5