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;
}
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;
}
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;
}
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.");
}
}
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
}
Aggregations