Debug.logError("[findOneRelated] User info object is required.", module);
return null;
}
GenericPK entityPK = null;
String entityKeyString = null;
List relatedGVL = null;
if (findAll) {
// Need to find all entity instances, not just the ones related to
// the main entity instance.
try {
if (TIMER) {
timer.timerString(2,
"[EntityReplicator.findOneRelated] Start findByAnd");
}
relatedGVL = delegator.findByAnd(relatedEntityName, filterMap);
if (TIMER) {
timer.timerString(2,
"[EntityReplicator.findOneRelated] Finished findByAnd");
}
return relatedGVL;
} catch (GenericEntityException e) {
Debug.logError("[findOneRelated] Error getting " +
relatedEntityName + " records by and: " +
e.getLocalizedMessage(), module);
return null;
}
} else {
// Need to find just the entity instances related to the main entity instance.
if (mainInstance == null) {
Debug.logError(
"[findOneRelated] Main instance is required if findAll is false.", module);
return null;
}
entityPK = mainInstance.getPrimaryKey();
entityKeyString = entityPK.toString();
Debug.logVerbose("[findOneRelated] Retrieving all " +
relatedEntityName + " records related to " +
entityKeyString, module);
try {