@Override public boolean exec(MethodContext methodContext) throws MiniLangException { try { Delegator delegator = getDelegator(methodContext); String entityName = this.entityNameFse.expandString(methodContext.getEnvMap()); ModelEntity modelEntity = delegator.getModelEntity(entityName); EntityCondition whereEntityCondition = null; if (this.whereCondition != null) { whereEntityCondition = this.whereCondition.createCondition( methodContext.getEnvMap(), modelEntity, delegator.getModelFieldTypeReader(modelEntity)); } EntityCondition havingEntityCondition = null; if (this.havingCondition != null) { havingEntityCondition = this.havingCondition.createCondition( methodContext.getEnvMap(), modelEntity, delegator.getModelFieldTypeReader(modelEntity)); } long count = delegator.findCountByCondition( entityName, whereEntityCondition, havingEntityCondition, null); this.countFma.put(methodContext.getEnvMap(), count); } catch (GeneralException e) { String errMsg = "Exception thrown while performing entity count: " + e.getMessage(); Debug.logWarning(e, errMsg, module); simpleMethod.addErrorMessage(methodContext, errMsg); return false; } return true; }