use of eu.esdihumboldt.hale.common.instance.groovy.InstanceAccessor in project hale by halestudio.
the class PropertiesMergeHandler method getMergeKey.
@Override
protected DeepIterableKey getMergeKey(Instance instance, PropertiesMergeConfig mergeConfig) {
if (mergeConfig.keyProperties.isEmpty()) {
// merge all instances
return DeepIterableKey.KEY_ALL;
}
List<Object> valueList = new ArrayList<Object>(mergeConfig.keyProperties.size());
for (List<QName> propertyPath : mergeConfig.keyProperties) {
// retrieve values from instance
// XXX should nulls be listed?
InstanceAccessor accessor = new InstanceAccessor(instance);
for (QName name : propertyPath) {
accessor.findChildren(name.getLocalPart(), Collections.singletonList(name.getNamespaceURI()));
}
valueList.add(accessor.list(true));
}
return new DeepIterableKey(valueList);
}
Aggregations