AnnotationType annotation,
DProperty property,
DPropertyDefinition propDef,
MappingEngine engine) {
RepositoryAccess accessor = engine.getRepositoryAccess();
Object session = engine.getSession();
OntologyResourceHelper orh = engine.getOntologyResourceHelper();
// get referenced values
List<CMSObject> referencedObjects = new ArrayList<CMSObject>();
CMSObject parentObject = null;
PropType type = propDef.getPropertyType();
if (type == PropType.REFERENCE) {
for (String referencedObject : property.getValue()) {
try {
parentObject = accessor.getFirstNodeById(referencedObject, session);
if (parentObject != null) {
referencedObjects.add(parentObject);
}
} catch (RepositoryAccessException e) {
logger.warn("Error while getting referenced value {} ", referencedObject, e);
}
}
} else if (type == PropType.NAME) {
for (String referencedName : property.getValue()) {
List<CMSObject> names;
try {
names = accessor.getNodeByName(referencedName, session);
referencedObjects.addAll(names);
} catch (RepositoryAccessException e) {
logger.warn("Error while getting referenced value {} ", referencedName, e);
}
}
} else if (type == PropType.PATH) {
for (String referencedPath : property.getValue()) {
try {
parentObject = accessor.getFirstNodeByPath(referencedPath, session);
if (parentObject != null) {
referencedObjects.add(parentObject);
}
} catch (RepositoryAccessException e) {
logger.warn("Error while getting referenced value {} ", referencedPath, e);