David,
I was wondering how much trouble it would be to make simple methods available as scripts in the widgets. I did a quick proof-of-concept and it turned out not to be much trouble at all. Are there reasons for not doing this? Basically, I just added a "setEnvMap" method to MethodContext, so I could replace its auto-generated HashMap with the MapStack context from the widget environment. Then I modified the ModelScreenAction class with the code that is in the diff. I have only done a simple test so far. The "location" attribute needs to use the combined naming style (location#methodname). -Al Binary files ofbiz-ref/applications/party/build/lib/ofbiz-party.jar and ofbiz-mf/applications/party/build/lib/ofbiz-party.jar differ diff -u -r ofbiz-ref/applications/party/entitydef/entitymodel.xml ofbiz-mf/applications/party/entitydef/entitymodel.xml --- ofbiz-ref/applications/party/entitydef/entitymodel.xml 2005-11-14 16:55:23.000000000 -0700 +++ ofbiz-mf/applications/party/entitydef/entitymodel.xml 2005-11-15 19:54:39.000000000 -0700 @@ -2107,7 +2107,7 @@ <alias-all prefix="pc" entity-alias="PC"/> <alias-all prefix="pr" entity-alias="PR"/> <view-link entity-alias="PR" rel-entity-alias="PC"> - <key-map field-name="partyIdTo" rel-field-name="partyId"/> + <key-map field-name="partyIdFrom" rel-field-name="partyId"/> </view-link> <view-link entity-alias="PC" rel-entity-alias="PCG"> <key-map field-name="partyClassificationGroupId"/> diff -u -r ofbiz-ref/applications/party/script/org/ofbiz/masterfile/MasterfileServices.xml ofbiz-mf/applications/party/script/org/ofbiz/masterfile/MasterfileServices.xml --- ofbiz-ref/applications/party/script/org/ofbiz/masterfile/MasterfileServices.xml 2005-11-14 16:55:23.000000000 -0700 +++ ofbiz-mf/applications/party/script/org/ofbiz/masterfile/MasterfileServices.xml 2005-11-15 17:49:10.000000000 -0700 @@ -116,6 +116,7 @@ <set field="partyClassification.partyClassificationGroupId" from-field="parameters.partyClassificationGroupId"/> <set field="partyClassification.fromDate" from-field="nowTimestamp"/> <create-value value-name="partyClassification"/> + <log level="always" message="new partyClassification:${partyClassification}"></log> </simple-method> @@ -520,7 +521,6 @@ </condition-list> <order-by field-name="thruDate"/> <order-by field-name="fromDate"/> -<log level="always" message="(to)prList: ${prList}"/> </entity-condition> </then> <else> @@ -652,8 +652,8 @@ <if-empty field-name="relPrList"/> <if-compare field-name="parameters.agent" operator="equals" value="Y"/> <or> - <if-empty field-name="partyRelationship.thruDate" type="Date"/> - <if-compare field-name="partyRelationship.thruDate" operator="greater" value="${nowTimestamp}" type="java.sql.Timestamp"/> + <if-empty field-name="partyRelationship.thruDate"/> + <if-compare field-name="partyRelationship.thruDate" operator="greater" value="${nowTimestamp}" type="Timestamp"/> </or> </and> </condition> @@ -758,7 +758,7 @@ <not> <if-empty field-name="agentPartyRelationship"/> </not> - <if-compare field-name="agentPartyRelationship.thruDate" operator="less" value="${nowTimestamp}" type="java.sql.Timestamp"/> + <if-compare field-name="agentPartyRelationship.thruDate" operator="less" value="${nowTimestamp}" type="Timestamp"/> <if-compare field-name="parameters.agent" operator="equals" value="Y"/> </and> </condition> @@ -779,7 +779,7 @@ </not> <or> <if-compare field-name="agentPartyRelationship.thruDate" operator="equals"/> - <if-compare field-name="agentPartyRelationship.thruDate" operator="greater" value="${nowTimestamp}" type="java.sql.Timestamp"/> + <if-compare field-name="agentPartyRelationship.thruDate" operator="greater" value="${nowTimestamp}" type="Timestamp"/> </or> <if-compare field-name="parameters.agent" operator="equals" value="Y"/> </and> @@ -839,7 +839,6 @@ </condition-list> <order-by field-name="thruDate"/> <order-by field-name="fromDate"/> -<log level="always" message="existingList: ${existingList}"/> </entity-condition> <if-not-empty field-name="existingList"> diff -u -r ofbiz-ref/applications/party/webapp/partymgr/party/BusinessType.ftl ofbiz-mf/applications/party/webapp/partymgr/party/BusinessType.ftl --- ofbiz-ref/applications/party/webapp/partymgr/party/BusinessType.ftl 2005-11-14 16:55:23.000000000 -0700 +++ ofbiz-mf/applications/party/webapp/partymgr/party/BusinessType.ftl 2005-11-15 22:18:51.000000000 -0700 @@ -22,7 +22,6 @@ * @created October 10 2005 */ --> - <div> <table width="100%"> <#assign currentPartyId=""/> @@ -56,6 +55,7 @@ <td class="mfhead3">Business Type</td> <td class="mfhead3"> <select name="partyClassificationGroupId"> + <option value=""></option> <#list partyClassGroups as grp> <#assign isSelected=""/> <#if currentPartyClassificationGroupId==grp.partyClassificationGroupId> @@ -78,6 +78,7 @@ <td class="mfhead3">Job Title</td> <td class="mfhead3"> <select name="partyClassificationGroupId"> + <option value=""></option> <#list partyClassificationGroupList as grp> <#assign isSelected=""/> <#if currentPartyClassificationGroupId==grp.partyClassificationGroupId> diff -u -r ofbiz-ref/applications/party/webapp/partymgr/party/ContactInfo.ftl ofbiz-mf/applications/party/webapp/partymgr/party/ContactInfo.ftl --- ofbiz-ref/applications/party/webapp/partymgr/party/ContactInfo.ftl 2005-11-14 16:55:23.000000000 -0700 +++ ofbiz-mf/applications/party/webapp/partymgr/party/ContactInfo.ftl 2005-11-15 14:34:01.000000000 -0700 @@ -65,7 +65,7 @@ </div> <div class="subcat"> - <#if rowMap.employee.extension?has_content && rowMap.employee.extension?has_content> + <#if rowMap.employee?has_content && rowMap.employee.extension?has_content && rowMap.employee.extension?has_content> <div class="txt-left"> ${rowMap.employee.extension} </div> diff -u -r ofbiz-ref/applications/party/webapp/partymgr/relationship/listPartyRelationshipAndAgent.ftl ofbiz-mf/applications/party/webapp/partymgr/relationship/listPartyRelationshipAndAgent.ftl --- ofbiz-ref/applications/party/webapp/partymgr/relationship/listPartyRelationshipAndAgent.ftl 2005-11-14 16:55:23.000000000 -0700 +++ ofbiz-mf/applications/party/webapp/partymgr/relationship/listPartyRelationshipAndAgent.ftl 2005-11-15 15:34:41.000000000 -0700 @@ -54,6 +54,7 @@ </form> <#assign rowCount = rowCount + 1/> </#list> + <#else> No ${sectionType} records found. </#if> diff -u -r ofbiz-ref/applications/party/webapp/partymgr/relationship/newPartyRelationshipAndAgent.ftl ofbiz-mf/applications/party/webapp/partymgr/relationship/newPartyRelationshipAndAgent.ftl --- ofbiz-ref/applications/party/webapp/partymgr/relationship/newPartyRelationshipAndAgent.ftl 2005-11-14 16:55:23.000000000 -0700 +++ ofbiz-mf/applications/party/webapp/partymgr/relationship/newPartyRelationshipAndAgent.ftl 2005-11-15 17:26:57.000000000 -0700 @@ -24,3 +24,13 @@ <input name="partyRelationshipTypeId" type="hidden" value="${sectionPartyRelationshipTypeId}"/> <input name="partyId" type="hidden" value="${partyId}"/> </form> + + <!-- create new button --> + <tr> + <td colspan="6"> + <div class=""> + <a href="${createRequest}?relatedPartyId=${partyId}">Create New ${sectionTitle}</a> + </div> + </td> + </tr> + diff -u -r ofbiz-ref/applications/party/webapp/partymgr/relationship/Presumptive.ftl ofbiz-mf/applications/party/webapp/partymgr/relationship/Presumptive.ftl --- ofbiz-ref/applications/party/webapp/partymgr/relationship/Presumptive.ftl 2005-11-14 16:55:23.000000000 -0700 +++ ofbiz-mf/applications/party/webapp/partymgr/relationship/Presumptive.ftl 2005-11-11 11:22:55.000000000 -0700 @@ -1,132 +1,23 @@ - <div class="mfhead3">Employees</div> - -<table border="0"> - <tr> - <td>Name</td> - <td></td> - <td>Start Date</td> - <td>End Date</td> - <td>Bill Acct Access</td> - <td></td> - </tr> -<#if employeeList?has_content && employeeList?size > 0> -<#assign rowCount = 0 /> -<#list employeeList as rowMap> - <#assign actionName="updateEmploymentAndAgentRelationship" /> - <#if rowMap.partyRelationship.thruDate?has_content && rowMap.partyRelationship.thruDate < nowTimestamp > - <#assign actionName="reviveEmploymentAndAgentRelationship" /> - </#if> - <form name="frm_${rowCount}" mode="POST" action="${actionName}"> - <tr> - <td> - <a href="<@ofbizUrl>/viewprofile?partyId=${rowMap.party.partyId}</@ofbizUrl>">${rowMap.person.firstName} ${rowMap.person.lastName}</a> - </td> - <td> - <a href="<@ofbizUrl>/request?partyId=${rowMap.party.partyId}</@ofbizUrl>">Request</a> - </td> - <td> - ${rowMap.partyRelationship.fromDate} - <input name="fromDate" type="hidden" value="${rowMap.partyRelationship.fromDate}"/> - </td> - <td> - <#if rowMap.partyRelationship.thruDate?has_content && rowMap.partyRelationship.thruDate < nowTimestamp > - ${rowMap.partyRelationship.thruDate} - <input name="thruDate" type="hidden" value="${rowMap.partyRelationship.thruDate}"/> - <#else> - <#assign thruVal = "" /> - <#if rowMap.partyRelationship.thruDate?has_content> - <#assign thruVal = rowMap.partyRelationship.thruDate /> - </#if> - <input name="thruDate" type="text" size="20" value="${thruVal}"/><a href="javascript:call_cal(document.frm_${rowCount}.thruDate, '');"><img src="/content/images/cal.gif" width="16" height="16" border="0" alt="Calendar"/></a> - </#if> - </td> - <td> - <#assign disabled=""/> - <#if rowMap.partyRelationship.thruDate?has_content && rowMap.partyRelationship.thruDate < nowTimestamp > - <#assign disabled="disabled"/> - </#if> - <#assign checked=""/> - <#if rowMap.relPartyRelationship?has_content && rowMap.relPartyRelationship.partyRelationshipTypeId?has_content && rowMap.relPartyRelationship.partyRelationshipTypeId == "AGENT" - && (!rowMap.relPartyRelationship.thruDate?has_content || rowMap.relPartyRelationship.thruDate > nowTimestamp) > - <#assign checked=" checked "/> - </#if> - <input name="agent" type="checkbox" value="Y" ${checked} ${disabled} /> - </td> - <td> - <#assign submitName="Update" /> - <#if rowMap.partyRelationship.thruDate?has_content && rowMap.partyRelationship.thruDate < nowTimestamp > - <#assign submitName="Revive" /> - </#if> - <a href="javascript:document.frm_${rowCount}.submit()">${submitName}</a> - </td> - </tr> - <input name="partyIdTo" type="hidden" value="${rowMap.partyRelationship.partyIdTo}"/> - <input name="partyIdFrom" type="hidden" value="${rowMap.partyRelationship.partyIdFrom}"/> - <input name="roleTypeIdTo" type="hidden" value="${rowMap.partyRelationship.roleTypeIdTo}"/> - <input name="roleTypeIdFrom" type="hidden" value="${rowMap.partyRelationship.roleTypeIdFrom}"/> - <input name="partyId" type="hidden" value="${partyId}"/> - <input name="partyRelationshipTypeId" type="hidden" value="${rowMap.partyRelationship.partyRelationshipTypeId}"/> - </form> -<#assign rowCount = rowCount + 1/> -</#list> -<#else> -<tr> - <td> - No employee records found. - </td> -</tr> -</#if> - <form name="frnew" mode="POST" action="createEmploymentAndAgentRelationship"> - <tr> - <td> - <input name="partyIdTo" type="text" size="20"/><a href="javascript:call_fieldlookup2(document.frnew.partyIdTo, '/partymgr/control/LookupPartyName');"><img src="/content/images/fieldlookup.gif" width="16" height="16" border="0" alt="Lookup"/></a> - </td> - <td> - </td> - <td> - <input name="fromDate" type="text" size="20"/><a href="javascript:call_cal(document.frnew.fromDate, '${nowTimestamp}');"><img src="/content/images/cal.gif" width="16" height="16" border="0" alt="Calendar"/></a> - </td> - <td> - <input name="thruDate" type="text" size="20"/><a href="javascript:call_cal(document.frnew.thruDate, '');"><img src="/content/images/cal.gif" width="16" height="16" border="0" alt="Calendar"/></a> - </td> - <td> - <input name="agent" type="checkbox" value="Y" /> - </td> - <td> - <a href="javascript:document.frnew.submit()">Create Relationship</a> - </td> - </tr> - <input name="partyIdFrom" type="hidden" value="${partyId}"/> - <input name="roleTypeIdFrom" type="hidden" value="ORGANIZATION"/> - <input name="roleTypeIdTo" type="hidden" value="EMPLOYEE"/> - <input name="partyRelationshipTypeId" type="hidden" value="EMPLOYMENT"/> - <input name="partyId" type="hidden" value="${partyId}"/> - </form> -</table> <#if partyAttribute?has_content> <table> - <form name="frpresumptive" mode="POST" action="/partymgr/control/something"> <tr> <td> Presumptive Employer: ${partyAttribute.attrValue} </td> <td> - <input name="fromDate" type="text" size="20"/><a href="javascript:call_cal(document.frpresumptive.fromDate, '${nowTimestamp}');"><img src="/content/images/cal.gif" width="16" height="16" border="0" alt="Calendar"/></a> </td> <td> - <input name="thruDate" type="text" size="20"/><a href="javascript:call_cal(document.frpresumptive.thruDate, '');"><img src="/content/images/cal.gif" width="16" height="16" border="0" alt="Calendar"/></a> </td> <td> </td> <td> - <a href="javascript:document.frpresumptive.submit()">Update</a> + <a href="<@ofbizUrl>clearPresumptive?partyId=${partyId}</@ofbizUrl>">Clear</a> + </td> + <td> + <a href="<@ofbizUrl>editpartygroup?create_new=Y&partyId=${partyId}</@ofbizUrl>">Convert to Company</a> </td> </tr> - </form> </table> </#if> - <div class=""> - <a href="editpartygroup?create_new=Y&relation=${partyId}&relationType=EMPLOYMENT">Create New Employee</a> - </div> diff -u -r ofbiz-ref/applications/party/widget/partymgr/RelationshipScreens.xml ofbiz-mf/applications/party/widget/partymgr/RelationshipScreens.xml --- ofbiz-ref/applications/party/widget/partymgr/RelationshipScreens.xml 2005-11-14 16:55:23.000000000 -0700 +++ ofbiz-mf/applications/party/widget/partymgr/RelationshipScreens.xml 2005-11-15 17:29:37.000000000 -0700 @@ -150,6 +150,7 @@ <set field="sectionType" value="employer"/> </actions> <widgets> + <label text="before list:"/> <platform-specific> <html> <html-template location="component://party/webapp/partymgr/relationship/listPartyRelationshipAndAgent.ftl"/> @@ -167,7 +168,8 @@ <set field="sectionFormPrefix" value="frmnew"/> <set field="sectionPartyRelationshipTypeId" value="EMPLOYMENT"/> <set field="displayPartyFieldName" value="partyIdTo"/> - <set field="targetPartyFieldName" value="partyIdFrom"/> + <set field="targetPartyFieldName" value="partyIdFrom"/> + <set field="createRequest" value="createPartyGroup"/> </actions> <widgets> <platform-specific> @@ -253,6 +255,7 @@ <set field="sectionPartyRelationshipTypeId" value="FREELANCE"/> <set field="displayPartyFieldName" value="partyIdTo"/> <set field="targetPartyFieldName" value="partyIdFrom"/> + <set field="createRequest" value="createPartyGroup"/> </actions> <widgets> <platform-specific> @@ -334,6 +337,7 @@ <set field="sectionPartyRelationshipTypeId" value="EMPLOYMENT"/> <set field="displayPartyFieldName" value="partyIdFrom"/> <set field="targetPartyFieldName" value="partyIdTo"/> + <set field="createRequest" value="createPerson"/> </actions> <widgets> <platform-specific> @@ -402,6 +406,7 @@ <set field="sectionPartyRelationshipTypeId" value="FREELANCE"/> <set field="displayPartyFieldName" value="partyIdFrom"/> <set field="targetPartyFieldName" value="partyIdTo"/> + <set field="createRequest" value="createPerson"/> </actions> <widgets> <platform-specific> @@ -421,78 +426,6 @@ </widgets> </section> </decorator-section> - <!-- - <platform-specific> - <html> - <html-template location="component://party/webapp/partymgr/relationship/Employers.ftl"/> - </html> - </platform-specific> - </widgets> - </section> - </decorator-section> - <decorator-section name="freelance"> - <section> - <actions> - <service service-name="getEmployersAndAgents" result-map-name="result"> - <field-map field-name="partyId" env-name="partyId"/> - <field-map field-name="partyRelationshipTypeId" value="FREELANCE"/> - </service> - <set field="freelanceList" from-field="result.partyRelationshipAndRelatedList"/> - </actions> - <widgets> - <platform-specific> - <html> - <html-template location="component://party/webapp/partymgr/relationship/FreelanceEmployers.ftl"/> - </html> - </platform-specific> - </widgets> - </section> - </decorator-section> - </decorator-screen> - </widgets> - </section> - <section> - <condition> - <if-compare field-name="party.partyTypeId" operator="equals" value="PARTY_GROUP"/> - </condition> - <widgets> - <decorator-screen name="rel-employer-decorator"> - <decorator-section name="employee"> - <section> - <actions> - <service service-name="getEmployeesAndAgents" result-map-name="result"> - <field-map field-name="partyId" env-name="partyId"/> - <field-map field-name="partyRelationshipTypeId" value="EMPLOYMENT"/> - </service> - <set field="employeeList" from-field="result.partyRelationshipAndRelatedList"/> - </actions> - <widgets> - <platform-specific> - <html> - <html-template location="component://party/webapp/partymgr/relationship/Employees.ftl"/> - </html> - </platform-specific> - </widgets> - </section> - </decorator-section> - <decorator-section name="freelance"> - <section> - <actions> - <service service-name="getEmployeesAndAgents" result-map-name="result"> - <field-map field-name="partyId" env-name="partyId"/> - <field-map field-name="partyRelationshipTypeId" value="FREELANCE"/> - </service> - <set field="freelanceList" from-field="result.partyRelationshipAndRelatedList"/> - </actions> - <widgets> - <platform-specific> - <html> - <html-template location="component://party/webapp/partymgr/relationship/FreelanceEmployees.ftl"/> - </html> - </platform-specific> - </widgets> - </section> - </decorator-section> --> <decorator-section name="relatedcompany"> <section> <actions> diff -u -r ofbiz-ref/applications/party/widget/partymgr/SummaryScreens.xml ofbiz-mf/applications/party/widget/partymgr/SummaryScreens.xml --- ofbiz-ref/applications/party/widget/partymgr/SummaryScreens.xml 2005-11-14 16:55:23.000000000 -0700 +++ ofbiz-mf/applications/party/widget/partymgr/SummaryScreens.xml 2005-11-15 19:54:52.000000000 -0700 @@ -131,7 +131,7 @@ <entity-condition entity-name="BusinessTypeView" list-name="bizTypeViewList"> <condition-list combine="and"> <condition-expr field-name="prRoleTypeIdTo" value="EMPLOYEE"/> - <condition-expr field-name="prPartyIdTo" env-name="partyId"/> + <condition-expr field-name="prPartyIdTo" env-name="partyId"/> <condition-expr field-name="pcgPartyClassificationTypeId" value="INDUSTRY_CLASSIFICAT"/> <condition-list combine="and" > Index: src/org/ofbiz/widget/screen/ModelScreenAction.java =================================================================== --- src/org/ofbiz/widget/screen/ModelScreenAction.java (revision 6470) +++ src/org/ofbiz/widget/screen/ModelScreenAction.java (working copy) @@ -39,6 +39,8 @@ import javolution.util.FastMap; import org.ofbiz.base.util.BshUtil; +import org.ofbiz.minilang.SimpleMethod; +import org.ofbiz.minilang.method.MethodContext; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.ObjectType; @@ -387,15 +389,27 @@ } public void runAction(Map context) throws GeneralException { - if (location.endsWith(".bsh")) { + if (this.location.endsWith(".bsh")) { try { - BshUtil.runBshAtLocation(location, context); + BshUtil.runBshAtLocation(this.location, context); } catch (GeneralException e) { String errMsg = "Error running BSH script at location [" + location + "]: " + e.toString(); // throwing nested exception instead of logging full detail: Debug.logError(e, errMsg, module); throw new GeneralException(errMsg, e); } - } else { + } else if (this.location.indexOf(".xml") >= 0) { + String resourceName = ScreenFactory.getResourceNameFromCombined(this.location); + String methodName = ScreenFactory.getScreenNameFromCombined(this.location); + try { + MethodContext methodContext = new MethodContext(context, null, MethodContext.SERVICE); + methodContext.setEnvMap(context); + SimpleMethod.runSimpleMethod(resourceName, methodName, methodContext); + } catch (GeneralException e) { + String errMsg = "Error running BSH script at location [" + location + "]: " + e.toString(); + // throwing nested exception instead of logging full detail: Debug.logError(e, errMsg, module); + throw new GeneralException(errMsg, e); + } + } else { throw new GeneralException("For screen script actions the script type is not yet support for location:" + location); } } _______________________________________________ Dev mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/dev |
Sorry, i included the wrong diffs.
If this is a good idea, would it be better to add another constructor to ModelScreenAction, instead of the setEnvMap methods? -Al Index: src/org/ofbiz/widget/screen/ModelScreenAction.java =================================================================== --- src/org/ofbiz/widget/screen/ModelScreenAction.java (revision 6470) +++ src/org/ofbiz/widget/screen/ModelScreenAction.java (working copy) @@ -39,6 +39,8 @@ import javolution.util.FastMap; import org.ofbiz.base.util.BshUtil; +import org.ofbiz.minilang.SimpleMethod; +import org.ofbiz.minilang.method.MethodContext; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.ObjectType; @@ -387,15 +389,27 @@ } public void runAction(Map context) throws GeneralException { - if (location.endsWith(".bsh")) { + if (this.location.endsWith(".bsh")) { try { - BshUtil.runBshAtLocation(location, context); + BshUtil.runBshAtLocation(this.location, context); } catch (GeneralException e) { String errMsg = "Error running BSH script at location [" + location + "]: " + e.toString(); // throwing nested exception instead of logging full detail: Debug.logError(e, errMsg, module); throw new GeneralException(errMsg, e); } - } else { + } else if (this.location.indexOf(".xml") >= 0) { + String resourceName = ScreenFactory.getResourceNameFromCombined(this.location); + String methodName = ScreenFactory.getScreenNameFromCombined(this.location); + try { + MethodContext methodContext = new MethodContext(context, null, MethodContext.SERVICE); + methodContext.setEnvMap(context); + SimpleMethod.runSimpleMethod(resourceName, methodName, methodContext); + } catch (GeneralException e) { + String errMsg = "Error running BSH script at location [" + location + "]: " + e.toString(); + // throwing nested exception instead of logging full detail: Debug.logError(e, errMsg, module); + throw new GeneralException(errMsg, e); + } + } else { throw new GeneralException("For screen script actions the script type is not yet support for location:" + location); } } Index: src/org/ofbiz/minilang/method/MethodContext.java =================================================================== --- src/org/ofbiz/minilang/method/MethodContext.java (revision 6470) +++ src/org/ofbiz/minilang/method/MethodContext.java (working copy) @@ -172,6 +172,10 @@ return this.env; } + public void setEnvMap(Map map) { + this.env = map; + } + /** Gets the named value from the environment. Supports the "." (dot) syntax to access Map members and the * "[]" (bracket) syntax to access List entries. This value is expanded, supporting the insertion of other * environment values using the "${}" notation. _______________________________________________ Dev mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/dev |
In reply to this post by byersa
Al, What would the purpose of this be? It seems like the only benefit is to avoid creating a service definition. If I understand what you are proposing correctly you would be calling the simple-method as a service, and it is simulating the service environment. If we were to do this then it should be more complete, like doing something with the results coming back. In general one of the dangerous and difficult things about scripts is that there is no really easy way of identifying, defining, or restricting input and output parameters. This is a large part of the point of the whole service model, and other reasons for using service defs include: reusability, easier locating of potentially usable code, easier and more consistent control of transactions, and so on. For those reasons I think having to define a service for each such method is a small price to pay. What's more, for these reasons I'd much rather see services used in general than bsh scripts... Of course, we could put something like this in and it wouldn't hurt anything and might help with prototyping and eventual transition to services implemented in simple-methods instead of in Java, but that seems a little bit thin to me... -David On Jan 20, 2006, at 10:09 AM, Al Byers wrote: > David, > > I was wondering how much trouble it would be to make simple methods > available as scripts in the widgets. I did a quick proof-of-concept > and it turned out not to be much trouble at all. Are there reasons > for not doing this? > > Basically, I just added a "setEnvMap" method to MethodContext, so I > could replace its auto-generated HashMap with the MapStack context > from the widget environment. Then I modified the ModelScreenAction > class with the code that is in the diff. > > I have only done a simple test so far. The "location" attribute > needs to use the combined naming style (location#methodname). > > -Al _______________________________________________ Dev mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/dev smime.p7s (3K) Download Attachment |
Free forum by Nabble | Edit this page |