public void partialSelect(GenericEntity entity, Set<String> keys) throws GenericEntityException {
ModelEntity modelEntity = entity.getModelEntity();
if (modelEntity == null) {
throw new GenericModelException("Could not find ModelEntity record for entityName: " + entity.getEntityName());
}
if (modelEntity instanceof ModelViewEntity) {
throw new org.ofbiz.entity.GenericNotImplementedException("Operation partialSelect not supported yet for view entities");
}
/*
if (entity == null || entity.<%=modelEntity.pkNameString(" == null || entity."," == null")%>) {
Debug.logWarning("[GenericDAO.select]: Cannot select GenericEntity: required primary key field(s) missing.", module);
return false;
}
*/
// we don't want to select ALL fields, just the nonpk fields that are in the passed GenericEntity
List<ModelField> partialFields = FastList.newInstance();
Set<String> tempKeys = new TreeSet<String>(keys);
Iterator<ModelField> nopkIter = modelEntity.getNopksIterator();
while (nopkIter.hasNext()) {
ModelField curField = nopkIter.next();
if (tempKeys.contains(curField.getName())) {
partialFields.add(curField);
tempKeys.remove(curField.getName());
}
}
if (tempKeys.size() > 0) {
throw new GenericModelException("In partialSelect invalid field names specified: " + tempKeys.toString());
}
StringBuilder sqlBuffer = new StringBuilder("SELECT ");
if (partialFields.size() > 0) {