use of eu.esdihumboldt.hale.common.align.io.impl.dummy.DummyEntityResolver in project hale by halestudio.
the class JaxbToAlignment method convertEntities.
private static ListMultimap<String, Pair<Entity, Entity>> convertEntities(List<NamedEntityType> namedEntities, TypeIndex types, SchemaSpaceID schemaSpace, EntityResolver resolver) {
if (namedEntities == null || namedEntities.isEmpty()) {
return null;
}
ListMultimap<String, Pair<Entity, Entity>> result = ArrayListMultimap.create();
for (NamedEntityType namedEntity : namedEntities) {
/**
* Resolve entity.
*
* Possible results:
* <ul>
* <li>non-null entity - entity could be resolved</li>
* <li>null entity - entity could not be resolved, continue</li>
* <li>IllegalStateException - entity could not be resolved, reject
* cell</li>
* </ul>
*/
// Create a dummy entity from the original XML definition
DummyEntityResolver dummyResolver = new DummyEntityResolver();
Entity dummyEntity = dummyResolver.resolve(namedEntity.getAbstractEntity().getValue(), types, schemaSpace);
// Resolve the real entity
Entity resolvedEntity = resolver.resolve(namedEntity.getAbstractEntity().getValue(), types, schemaSpace);
if (resolvedEntity != null) {
result.put(namedEntity.getName(), new Pair<Entity, Entity>(dummyEntity, resolvedEntity));
}
}
return result;
}
Aggregations