use of eu.esdihumboldt.hale.common.align.model.ChildContext in project hale by halestudio.
the class SourceListParameterPage method getVariableName.
/**
* This gets called for all variables.<br>
* Subclasses can change how they are displayed here.<br>
* The default format is like "part1.part2.name".
*
* @param variable the variable
* @return the modified name
*/
protected String getVariableName(EntityDefinition variable) {
if (variable.getPropertyPath() != null && !variable.getPropertyPath().isEmpty()) {
List<String> names = new ArrayList<String>();
for (ChildContext context : variable.getPropertyPath()) {
names.add(context.getChild().getName().getLocalPart());
}
String longName = Joiner.on('.').join(names);
return longName;
} else
return variable.getDefinition().getDisplayName();
}
use of eu.esdihumboldt.hale.common.align.model.ChildContext in project hale by halestudio.
the class FilterEditor method setValue.
/**
* @see Editor#setValue(Object)
*/
@Override
public void setValue(final Filter filter) {
filterEnabled.setSelection(false);
setControlsEnabled(false);
if (filter != null) {
filter.accept(new FilterVisitor() {
@Override
protected void visitFilter(FilterIdentifier id, String propertyName, String value) {
Boolean invalidProperty = false;
List<ChildContext> path = new ArrayList<ChildContext>();
// set the correct selected name for the property selector
List<QName> qNames = PropertyResolver.getQNamesFromPath(propertyName);
ChildDefinition<?> child = typeDefinition.getChild(qNames.get(0));
if (child != null) {
path.add(new ChildContext(child));
for (int i = 1; i < qNames.size(); i++) {
child = DefinitionUtil.getChild(child, qNames.get(i));
if (child != null) {
path.add(new ChildContext(child));
} else {
invalidProperty = true;
break;
}
}
} else {
invalidProperty = true;
}
if (!invalidProperty && !path.isEmpty()) {
PropertyEntityDefinition entity = new PropertyEntityDefinition(typeDefinition, path, null, null);
propertySelect.setSelection(new StructuredSelection(entity));
} else {
propertySelect.setSelection(new StructuredSelection());
}
// set filter
filterSelect.setSelection(new StructuredSelection(id));
// set value
literal.getDocument().set(value);
filterEnabled.setSelection(true);
setControlsEnabled(true);
}
}, null);
}
}
use of eu.esdihumboldt.hale.common.align.model.ChildContext in project hale by halestudio.
the class AppSchemaMappingGenerator method createNamespacesForPath.
private void createNamespacesForPath(List<ChildContext> propertyPath) {
if (propertyPath != null) {
for (ChildContext childContext : propertyPath) {
PropertyDefinition child = childContext.getChild().asProperty();
if (child != null) {
String namespaceURI = child.getName().getNamespaceURI();
String prefix = child.getName().getPrefix();
context.getOrCreateNamespace(namespaceURI, prefix);
}
}
}
}
use of eu.esdihumboldt.hale.common.align.model.ChildContext in project hale by halestudio.
the class AppSchemaMappingGenerator method createNamespaceForEntity.
private void createNamespaceForEntity(Entity entity) {
QName typeName = entity.getDefinition().getType().getName();
String namespaceURI = typeName.getNamespaceURI();
String prefix = typeName.getPrefix();
context.getOrCreateNamespace(namespaceURI, prefix);
List<ChildContext> propertyPath = entity.getDefinition().getPropertyPath();
createNamespacesForPath(propertyPath);
}
use of eu.esdihumboldt.hale.common.align.model.ChildContext in project hale by halestudio.
the class AbstractPropertyTransformationHandler method findChainConfiguration.
/**
* @param context the mapping context
* @return the chain configuration that applies to the current property
* mapping
*/
private ChainConfiguration findChainConfiguration(AppSchemaMappingContext context) {
ChainConfiguration chainConf = null;
PropertyEntityDefinition targetPropertyEntityDef = targetProperty.getDefinition();
FeatureChaining featureChaining = context.getFeatureChaining();
if (featureChaining != null) {
List<ChildContext> targetPropertyPath = targetPropertyEntityDef.getPropertyPath();
List<ChainConfiguration> chains = featureChaining.getChains(typeCell.getId());
chainConf = findLongestNestedPath(targetPropertyPath, chains);
}
return chainConf;
}
Aggregations