Author: jacopoc
Date: Tue Mar 20 00:20:30 2007 New Revision: 520300 URL: http://svn.apache.org/viewvc?view=rev&rev=520300 Log: Added new field ('authUserlLoginId') to the JobSandbox entity to store the user login of the user that submitted the async job. The content for the field is retrieved from the context (using the 'userLogin' object, if available). Modified: ofbiz/trunk/framework/service/entitydef/entitymodel.xml ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GenericAsyncEngine.java Modified: ofbiz/trunk/framework/service/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/entitydef/entitymodel.xml?view=diff&rev=520300&r1=520299&r2=520300 ============================================================================== --- ofbiz/trunk/framework/service/entitydef/entitymodel.xml (original) +++ ofbiz/trunk/framework/service/entitydef/entitymodel.xml Tue Mar 20 00:20:30 2007 @@ -53,6 +53,7 @@ <field name="serviceName" type="name"></field> <field name="loaderName" type="name"></field> <field name="maxRetry" type="numeric"></field> + <field name="authUserLoginId" type="id-vlong"></field> <field name="runAsUser" type="id-vlong"></field> <field name="runtimeDataId" type="id"></field> <field name="recurrenceInfoId" type="id"></field> @@ -66,6 +67,9 @@ </relation> <relation type="one" fk-name="JOB_SNDBX_RNTMDTA" rel-entity-name="RuntimeData"> <key-map field-name="runtimeDataId"/> + </relation> + <relation type="one" fk-name="JOB_SNDBX_AUSRLGN" title="Auth" rel-entity-name="UserLogin"> + <key-map field-name="authUserLoginId" rel-field-name="userLoginId"/> </relation> <relation type="one" fk-name="JOB_SNDBX_USRLGN" title="RunAs" rel-entity-name="UserLogin"> <key-map field-name="runAsUser" rel-field-name="userLoginId"/> Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GenericAsyncEngine.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GenericAsyncEngine.java?view=diff&rev=520300&r1=520299&r2=520300 ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GenericAsyncEngine.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GenericAsyncEngine.java Tue Mar 20 00:20:30 2007 @@ -28,6 +28,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.serialize.SerializeException; @@ -97,6 +98,13 @@ runtimeData.set("runtimeInfo", XmlSerializer.serialize(context)); toBeStored.add(runtimeData); + // Get the userLoginId out of the context + String authUserLoginId = null; + if (context.containsKey("userLogin")) { + GenericValue userLogin = (GenericValue)context.get("userLogin"); + authUserLoginId = userLogin.getString("userLoginId"); + } + // Create the job info String jobId = dispatcher.getDelegator().getNextSeqId("JobSandbox"); String jobName = Long.toString((new Date().getTime())); @@ -108,6 +116,9 @@ jFields.put("loaderName", localName); jFields.put("maxRetry", new Long(modelService.maxRetry)); jFields.put("runtimeDataId", dataId); + if (UtilValidate.isNotEmpty(authUserLoginId)) { + jFields.put("authUserLoginId", authUserLoginId); + } jobV = dispatcher.getDelegator().makeValue("JobSandbox", jFields); toBeStored.add(jobV); |
Free forum by Nabble | Edit this page |