Author: nmalin
Date: Fri Dec 5 14:49:36 2014
New Revision: 1643303
URL: http://svn.apache.org/r1643303
Log:
Complete the entity-auto engine for manage a service can be wait a pk or not.
In this last case the field need to present on OUT part. This appears when you
have a fromDate and you offer the possibility to user to indicate it, otherwise
it's instantiate with now. It's a small improvement to complete the issue
OFBIZ-5800, you have an example with entity PartyQual and the screen
humanres/control/EditEmployeeQuals?partyId=DemoEmployee
Modified:
ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/EntityAutoEngine.java
Modified:
ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/EntityAutoEngine.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/EntityAutoEngine.java?rev=1643303&r1=1643302&r2=1643303&view=diff
==============================================================================
---
ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/EntityAutoEngine.java
(original)
+++
ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/EntityAutoEngine.java
Fri Dec 5 14:49:36 2014
@@ -90,13 +90,20 @@ public final class EntityAutoEngine exte
try {
boolean allPksInOnly = true;
LinkedList<String> pkFieldNameOutOnly = null;
+ /* Check for each pk if it's :
+ * 1. part IN
+ * 2. or part IN and OUT, but without value but present on
parameters map
+ * Help the engine to determinate the operation to realize for a
create call or validate that
+ * any pk is present for update/delete call.
+ */
for (ModelField pkField: modelEntity.getPkFieldsUnmodifiable()) {
ModelParam pkParam = modelService.getParam(pkField.getName());
- if (pkParam.isOut()) {
- allPksInOnly = false;
- }
- if (pkParam.isOut() && !pkParam.isIn()) {
- if (pkFieldNameOutOnly == null) pkFieldNameOutOnly = new
LinkedList();
+ boolean pkValueInParameters = pkParam.isIn() &&
UtilValidate.isNotEmpty(parameters.get(pkParam.getFieldName()));
+ if (pkParam.isOut() && !pkValueInParameters) {
+ if (pkFieldNameOutOnly == null) {
+ pkFieldNameOutOnly = new LinkedList();
+ allPksInOnly = false;
+ }
pkFieldNameOutOnly.add(pkField.getName());
}
}