/**
* @see com.anasoft.os.daofusion.cto.server.CriteriaTransferObjectConverter#convert(com.anasoft.os.daofusion.cto.client.CriteriaTransferObject, java.lang.String)
*/
public PersistentEntityCriteria convert(CriteriaTransferObject transferObject, String mappingGroupName) {
NestedPropertyCriteria nestedCriteria = createCriteria();
Set<String> propertyIdSet = transferObject.getPropertyIdSet();
Map<String, List<NestedPropertyMapping>> propertyMappings = getPropertyMappings(mappingGroupName);
if (propertyMappings != null) {
for (String propertyId : propertyIdSet) {
FilterAndSortCriteria clientSideCriteria = transferObject.get(propertyId);
List<NestedPropertyMapping> mappingList = propertyMappings.get(propertyId);
if (mappingList != null) {
for (NestedPropertyMapping mapping : mappingList) {
LOG.info("Applying property mapping for propertyId '{}' within the mapping group '{}'", propertyId, mappingGroupName);
mapping.apply(clientSideCriteria, nestedCriteria);
}
} else {
LOG.warn("No mappings found for propertyId '{}' within the mapping group '{}' - skipping property conversion", propertyId, mappingGroupName);
}
}
} else {
LOG.warn("Requested property mapping group '{}' not found - did you forget to add mappings for this one?", mappingGroupName);
}
nestedCriteria.setFirstResult(transferObject.getFirstResult());
nestedCriteria.setMaxResults(transferObject.getMaxResults());
return nestedCriteria;
}