Author: adrianc
Date: Wed Jul 15 17:12:46 2009 New Revision: 794327 URL: http://svn.apache.org/viewvc?rev=794327&view=rev Log: Fixed Work Effort Find screen that didn't work. Cleaned up layout and labels. Modified: ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml ofbiz/trunk/applications/workeffort/servicedef/services.xml ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortWorker.java ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml Modified: ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml?rev=794327&r1=794326&r2=794327&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml (original) +++ ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml Wed Jul 15 17:12:46 2009 @@ -283,6 +283,32 @@ <key-map field-name="workEffortIdTo" rel-field-name="workEffortId"/> </view-link> </view-entity> + + <view-entity entity-name="WorkEffortFindView" + package-name="org.ofbiz.workeffort.workeffort" + title="Find Work Efforts View"> + <member-entity entity-alias="WE" entity-name="WorkEffort"/> + <member-entity entity-alias="WEA" entity-name="WorkEffortAssoc"/> + <member-entity entity-alias="WEPA" entity-name="WorkEffortPartyAssignment"/> + <member-entity entity-alias="WEFAA" entity-name="WorkEffortFixedAssetAssign"/> + <alias-all entity-alias="WE"> + <exclude field="workEffortParentId"/> + <exclude field="fixedAssetId"/> + </alias-all> + <alias name="workEffortParentId" entity-alias="WEA" field="workEffortIdFrom"/> + <alias name="partyId" entity-alias="WEPA" field="partyId"/> + <alias name="fixedAssetId" entity-alias="WEFAA" field="fixedAssetId"/> + <view-link entity-alias="WE" rel-entity-alias="WEA" rel-optional="true"> + <key-map field-name="workEffortId" rel-field-name="workEffortIdTo"/> + </view-link> + <view-link entity-alias="WE" rel-entity-alias="WEPA" rel-optional="true"> + <key-map field-name="workEffortId"/> + </view-link> + <view-link entity-alias="WE" rel-entity-alias="WEFAA" rel-optional="true"> + <key-map field-name="workEffortId"/> + </view-link> + </view-entity> + <!-- <view-entity entity-name="WorkEffortAssocFromView" package-name="org.ofbiz.workeffort.workeffort" @@ -844,4 +870,4 @@ </view-link> </view-entity> -</entitymodel> \ No newline at end of file +</entitymodel> Modified: ofbiz/trunk/applications/workeffort/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/servicedef/services.xml?rev=794327&r1=794326&r2=794327&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/servicedef/services.xml (original) +++ ofbiz/trunk/applications/workeffort/servicedef/services.xml Wed Jul 15 17:12:46 2009 @@ -239,6 +239,12 @@ <attribute name="periods" type="java.util.List" mode="OUT" optional="false"/> <attribute name="maxConcurrentEntries" type="java.lang.Integer" mode="OUT" optional="false"/> </service> + <service name="removeDuplicateWorkEfforts" auth="true" engine="java" + location="org.ofbiz.workeffort.workeffort.WorkEffortServices" invoke="removeDuplicateWorkEfforts"> + <description>Removes duplicate work efforts from a list of work efforts.</description> + <attribute name="workEffortIterator" type="java.util.ListIterator" mode="IN" optional="true"/> + <attribute name="workEfforts" type="java.util.List" mode="INOUT" optional="true"/> + </service> <service name="getProductManufacturingSummaryByFacility" engine="java" location="org.ofbiz.workeffort.workeffort.WorkEffortServices" invoke="getProductManufacturingSummaryByFacility"> <description> Modified: ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java?rev=794327&r1=794326&r2=794327&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java (original) +++ ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java Wed Jul 15 17:12:46 2009 @@ -51,6 +51,7 @@ import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.model.ModelEntity; import org.ofbiz.entity.model.ModelField; +import org.ofbiz.entity.util.EntityListIterator; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.security.Security; import org.ofbiz.service.DispatchContext; @@ -1016,4 +1017,25 @@ } return ServiceUtil.returnSuccess(); } + + public static Map<String, Object> removeDuplicateWorkEfforts(DispatchContext ctx, Map<String, ? extends Object> context) { + Map<String, Object> result = ServiceUtil.returnSuccess(); + List<GenericValue> resultList = null; + EntityListIterator eli = (EntityListIterator) context.get("workEffortIterator"); + if (eli != null) { + resultList = WorkEffortWorker.removeDuplicateWorkEfforts(eli); + try { + eli.close(); + } catch (Exception e) { + Debug.logError(e, "Error while closing EntityListIterator: ", module); + } + } else { + List<GenericValue> workEfforts = UtilGenerics.checkList(context.get("workEfforts")); + if (workEfforts != null) { + resultList = WorkEffortWorker.removeDuplicateWorkEfforts(workEfforts); + } + } + result.put("workEfforts", resultList); + return result; + } } Modified: ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortWorker.java?rev=794327&r1=794326&r2=794327&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortWorker.java (original) +++ ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortWorker.java Wed Jul 15 17:12:46 2009 @@ -20,6 +20,7 @@ package org.ofbiz.workeffort.workeffort; import java.util.Collection; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -201,17 +202,20 @@ } public static List<GenericValue> removeDuplicateWorkEfforts(List<GenericValue> workEfforts) { + return removeDuplicateWorkEfforts(workEfforts.iterator()); + } + + public static List<GenericValue> removeDuplicateWorkEfforts(Iterator<GenericValue> workEfforts) { Set<String> keys = FastSet.newInstance(); - Set<GenericValue> exclusions = FastSet.newInstance(); - for (GenericValue workEffort : workEfforts) { + List<GenericValue> resultList = FastList.newInstance(); + while (workEfforts.hasNext()) { + GenericValue workEffort = workEfforts.next(); String workEffortId = workEffort.getString("workEffortId"); - if (keys.contains(workEffortId)) { - exclusions.add(workEffort); - } else { + if (!keys.contains(workEffortId)) { + resultList.add(workEffort); keys.add(workEffortId); } } - workEfforts.removeAll(exclusions); - return workEfforts; + return resultList; } } Modified: ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml?rev=794327&r1=794326&r2=794327&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml (original) +++ ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml Wed Jul 15 17:12:46 2009 @@ -186,19 +186,17 @@ </sort-order> </form> - <form name="FindWorkEffort" default-map-name="workEffort" target="ListWorkEfforts" title="" type="single" - header-row-style="header-row" default-table-style="basic-table"> - <!-- auto-fields-entity entity-name="WorkEffort" default-field-type="find"/--> + <form name="FindWorkEffort" default-map-name="workEffort" target="FindWorkEffort" type="single"> <field name="workEffortId" title="${uiLabelMap.WorkEffortWorkEffortId}"><text-find/></field> <field name="workEffortParentId" position="2"><text-find/></field> - <field name="workEffortTypeId"> + <field name="workEffortTypeId" title="${uiLabelMap.CommonType}"> <drop-down allow-empty="true"> <entity-options description="${description}" entity-name="WorkEffortType" key-field-name="workEffortTypeId"> <entity-order-by field-name="description"/> </entity-options> </drop-down> </field> - <field name="workEffortPurposeTypeId" position="2"> + <field name="workEffortPurposeTypeId" position="2" title="${uiLabelMap.CommonPurpose}"> <drop-down allow-empty="true"> <entity-options description="${description}" entity-name="WorkEffortPurposeType" key-field-name="workEffortPurposeTypeId"> <entity-order-by field-name="description"/> @@ -254,6 +252,7 @@ </entity-options> </drop-down> </field> + <field name="partyId"><lookup target-form-name="LookupPartyName"/></field> <field name="workflowPackageId"><ignored/></field> <field name="workflowPackageVersion"><ignored/></field> @@ -395,23 +394,26 @@ </sort-order> </form> - <form name="ListWorkEfforts" type="list" list-name="listIt" paginate-target="ListWorkEfforts" + <form name="ListWorkEfforts" type="list" list-name="workEfforts" paginate-target="ListWorkEfforts" odd-row-style="alternate-row" default-table-style="basic-table hover-bar"> <actions> <service service-name="performFind" result-map="result" result-map-list="listIt"> <field-map field-name="inputFields" from-field="parameters"/> - <field-map field-name="entityName" value="WorkEffort"/> + <field-map field-name="entityName" value="WorkEffortFindView"/> <field-map field-name="orderBy" value="lastModifiedDate DESC"/> </service> + <service service-name="removeDuplicateWorkEfforts" result-map="result" result-map-list="workEfforts"> + <field-map field-name="workEffortIterator" from-field="listIt"/> + </service> </actions> <field name="workEffortId" title="${uiLabelMap.WorkEffortWorkEffortId}" widget-style="buttontext"> <hyperlink also-hidden="false" description="${workEffortName} [${workEffortId}]" target="EditWorkEffort"> <parameter param-name="workEffortId"/> </hyperlink> </field> - <field name="workEffortTypeId"><display-entity entity-name="WorkEffortType"/></field> - <field name="currentStatusId"><display-entity entity-name="StatusItem" key-field-name="statusId" description="${description}"/></field> - <field name="workEffortPurposeTypeId"><display-entity entity-name="WorkEffortPurposeType"/></field> + <field name="workEffortTypeId" title="${uiLabelMap.CommonType}"><display-entity entity-name="WorkEffortType"/></field> + <field name="currentStatusId" title="${uiLabelMap.CommonStatus}"><display-entity entity-name="StatusItem" key-field-name="statusId" description="${description}"/></field> + <field name="workEffortPurposeTypeId" title="${uiLabelMap.CommonPurpose}"><display-entity entity-name="WorkEffortPurposeType"/></field> <field name="description"><display/></field> <field name="priority"><display/></field> <field name="estimatedStartDate"><display type="date"/></field> @@ -444,6 +446,9 @@ </hyperlink> </field> </form> + + <form name="FoundWorkEfforts" extends="ListWorkEfforts" paginate-target="FindWorkEffort" header-row-style="header-row-2"/> + <form name="WorkEffortTreeLine" hide-header="true" target="ListWorkEfforts" title="" type="list" list-name="listIt" odd-row-style="alternate-row" default-table-style="basic-table hover-bar"> <field name="workEffortId" title="${uiLabelMap.WorkEffortWorkEffortId}" widget-style="buttontext"> Modified: ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml?rev=794327&r1=794326&r2=794327&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml (original) +++ ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml Wed Jul 15 17:12:46 2009 @@ -151,35 +151,33 @@ </widgets> </section> </screen> + <screen name="FindWorkEffort"> <section> <actions> + <set field="headerItem" value="workeffort"/> <set field="titleProperty" value="PageTitleFindWorkEffort"/> - <set field="tabButtonItem" value="WorkEffort"/> - <set field="labelTitleProperty" value="PageTitleFindWorkEffort"/> - <set field="workEffortId" from-field="parameters.workEffortId"/> + <set field="donePage" from-field="parameters.DONE_PAGE"/> </actions> <widgets> - <decorator-screen name="CommonWorkEffortDecorator" location="${parameters.mainDecoratorLocation}"> + <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> <decorator-section name="body"> - <container style="screenlet"> - <container style="screenlet-title-bar"> - <container style="h3"> - <label text="${uiLabelMap.PageTitleFindWorkEffort}"/> + <decorator-screen name="FindScreenDecorator" location="component://common/widget/CommonScreens.xml"> + <decorator-section name="menu-bar"> + <container style="button-bar"> + <link text="${uiLabelMap.WorkEffortCreate}" target="EditWorkEffort" style="buttontext"> + <parameter param-name="DONE_PAGE" from-field="donePage"/> + </link> + <link text="${uiLabelMap.CommonAdvancedSearch}" target="WorkEffortSearchOptions" style="buttontext"/> </container> - </container> - <container style="screenlet-body"> - <section> - <widgets> - <link text="${uiLabelMap.WorkEffortCreate}" target="EditWorkEffort" style="buttontext"> - <parameter param-name="DONE_PAGE" from-field="donePage"/> - </link> - <link text="${uiLabelMap.CommonAdvancedSearch}" target="WorkEffortSearchOptions" style="buttontext"/> - <include-form name="FindWorkEffort" location="component://workeffort/widget/WorkEffortForms.xml"/> - </widgets> - </section> - </container> - </container> + </decorator-section> + <decorator-section name="search-options"> + <include-form name="FindWorkEffort" location="component://workeffort/widget/WorkEffortForms.xml"/> + </decorator-section> + <decorator-section name="search-results"> + <include-form name="FoundWorkEfforts" location="component://workeffort/widget/WorkEffortForms.xml"/> + </decorator-section> + </decorator-screen> </decorator-section> </decorator-screen> </widgets> |
Free forum by Nabble | Edit this page |