diff --git a/framework/service/dtd/services.xsd b/framework/service/dtd/services.xsd index 1ca88d1870..4bd18e58e9 100644 --- a/framework/service/dtd/services.xsd +++ b/framework/service/dtd/services.xsd @@ -401,6 +401,8 @@ under the License. + + diff --git a/framework/service/src/org/ofbiz/service/ModelParam.java b/framework/service/src/org/ofbiz/service/ModelParam.java index 14689099e2..325da1d157 100644 --- a/framework/service/src/org/ofbiz/service/ModelParam.java +++ b/framework/service/src/org/ofbiz/service/ModelParam.java @@ -61,6 +61,12 @@ public class ModelParam implements Serializable { /** The entity field name */ public String fieldName; + /** Request attribute to look for if not defined as a parameter */ + public String requestAttributeName; + + /** Session attribute to look for if not defined as a parameter */ + public String sessionAttributeName; + /** Parameter prefix for creating an attribute Map */ public String stringMapPrefix; @@ -97,6 +103,8 @@ public class ModelParam implements Serializable { this.formLabel = param.formLabel; this.entityName = param.entityName; this.fieldName = param.fieldName; + this.requestAttributeName = param.requestAttributeName; + this.sessionAttributeName = param.sessionAttributeName; this.stringMapPrefix = param.stringMapPrefix; this.stringListSuffix = param.stringListSuffix; this.validators = param.validators; diff --git a/framework/service/src/org/ofbiz/service/ModelServiceReader.java b/framework/service/src/org/ofbiz/service/ModelServiceReader.java index fe2a490a97..4a862b0484 100644 --- a/framework/service/src/org/ofbiz/service/ModelServiceReader.java +++ b/framework/service/src/org/ofbiz/service/ModelServiceReader.java @@ -504,6 +504,8 @@ public class ModelServiceReader implements Serializable { param.mode = UtilXml.checkEmpty(attribute.getAttribute("mode")).intern(); param.entityName = UtilXml.checkEmpty(attribute.getAttribute("entity-name")).intern(); param.fieldName = UtilXml.checkEmpty(attribute.getAttribute("field-name")).intern(); + param.requestAttributeName = UtilXml.checkEmpty(attribute.getAttribute("request-attribute-name")).intern(); + param.sessionAttributeName = UtilXml.checkEmpty(attribute.getAttribute("session-attribute-name")).intern(); param.stringMapPrefix = UtilXml.checkEmpty(attribute.getAttribute("string-map-prefix")).intern(); param.stringListSuffix = UtilXml.checkEmpty(attribute.getAttribute("string-list-suffix")).intern(); param.formLabel = attribute.hasAttribute("form-label")?attribute.getAttribute("form-label").intern():null; diff --git a/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java b/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java index 64e87f3b9c..c492b3fcce 100644 --- a/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java +++ b/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java @@ -257,7 +257,7 @@ public class ServiceEventHandler implements EventHandler { // next check attributes; do this before parameters so that attribute which can be changed by code can override parameters which can't if (UtilValidate.isEmpty(value)) { - Object tempVal = request.getAttribute(name); + Object tempVal = request.getAttribute(UtilValidate.isEmpty(modelParam.requestAttributeName) ? name : modelParam.requestAttributeName); if (tempVal != null) { value = tempVal; } @@ -283,7 +283,7 @@ public class ServiceEventHandler implements EventHandler { // then session if (UtilValidate.isEmpty(value)) { - Object tempVal = request.getSession().getAttribute(name); + Object tempVal = request.getSession().getAttribute(UtilValidate.isEmpty(modelParam.sessionAttributeName) ? name : modelParam.sessionAttributeName); if (tempVal != null) { value = tempVal; }