Author: ashish
Date: Thu Dec 24 13:21:59 2009
New Revision: 893756

URL: http://svn.apache.org/viewvc?rev=893756&view=rev
Log:
Applied patch from jira issue - OFBIZ-3380 - Convert simple events in 
FixedAssetMaintEvents.xml to services.

Thanks Mridul for the contribution.

Added:
    
ofbiz/trunk/specialpurpose/assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintServices.xml
   (with props)
Removed:
    
ofbiz/trunk/specialpurpose/assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintEvents.xml
Modified:
    ofbiz/trunk/specialpurpose/assetmaint/servicedef/services.xml
    
ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml

Added: 
ofbiz/trunk/specialpurpose/assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintServices.xml?rev=893756&view=auto
==============================================================================
--- 
ofbiz/trunk/specialpurpose/assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintServices.xml
 (added)
+++ 
ofbiz/trunk/specialpurpose/assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintServices.xml
 Thu Dec 24 13:21:59 2009
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+        
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd";>
+
+    <simple-method method-name="createFixedAssetMaintUpdateWorkEffort" 
login-required="true"
+        short-description="Create FixedAssetMaint and Update Schedule 
information in WorkEffort">
+        <set-service-fields map="parameters" 
service-name="createFixedAssetMaint" to-map="createFixedAssetMaintCtx"/>
+        <call-service service-name="createFixedAssetMaint" 
in-map-name="createFixedAssetMaintCtx">
+            <result-to-field result-name="maintHistSeqId" 
field="findAssetMaintLookup.maintHistSeqId"/>
+            <result-to-result result-name="maintHistSeqId"/>
+        </call-service>
+        <check-errors/>
+        <set from-field="parameters.fixedAssetId" 
field="findAssetMaintLookup.fixedAssetId"/>
+        <find-by-primary-key entity-name="FixedAssetMaint" 
map="findAssetMaintLookup" value-field="findAssetMaint"/>
+        <set from-field="findAssetMaint.scheduleWorkEffortId" 
field="updateWorkEffortCtx.workEffortId"/>
+        <set-service-fields map="parameters" service-name="updateWorkEffort" 
to-map="updateWorkEffortCtx"/>
+        <!-- Maintenance WorkEffort entity -->
+        <call-service service-name="updateWorkEffort" 
in-map-name="updateWorkEffortCtx"/>
+    </simple-method>
+
+    <simple-method method-name="updateFixedAssetMaintAndWorkEffort" 
login-required="true"
+        short-description="Update FixedAssetMaint and Schedule information in 
WorkEffort">
+        <set-service-fields map="parameters" 
service-name="updateFixedAssetMaint" to-map="updateFixedAssetMaintCtx"/>
+        <call-service service-name="updateFixedAssetMaint" 
in-map-name="updateFixedAssetMaintCtx"/>
+        <check-errors/>
+        <if-compare field="parameters.statusId" operator="equals" 
value="FAM_CANCELLED">
+            <set field="updateWorkEffortCtx.currentStatusId" 
value="CAL_CANCELLED"/>
+        </if-compare>
+        <set-service-fields map="parameters" service-name="updateWorkEffort" 
to-map="updateWorkEffortCtx"/>
+        <set from-field="parameters.scheduleWorkEffortId" 
field="updateWorkEffortCtx.workEffortId"/>
+        <set from-field="parameters.scheduleWorkEffortId" 
field="workEffortId"/>
+        <entity-one value-field="workEffort" entity-name="WorkEffort"/>
+        <set field="updateWorkEffortCtx.actualCompletionDate" 
from-field="parameters.actualCompletionDate" 
default-value="${workEffort.actualCompletionDate}"/>
+        <call-service service-name="updateWorkEffort" 
in-map-name="updateWorkEffortCtx"/>
+    </simple-method>
+
+    <simple-method method-name="createWorkEffortAndAssocWithParent" 
login-required="true"
+        short-description="Create WorkEffort and Associate it with Parent 
(identified by workEffortFromId)">
+        <set from-field="parameters.workEffortIdTo" 
field="parameters.workEffortId"/>
+        <set-service-fields map="parameters" 
service-name="createWorkEffortAndAssoc" to-map="createWorkEffortAndAssocCtx"/>
+        <call-service service-name="createWorkEffortAndAssoc" 
in-map-name="createWorkEffortAndAssocCtx"/>
+        <check-errors/>
+    </simple-method>
+
+    <!-- ==============Permission Checking Service============= -->
+    <simple-method method-name="assetMaintPermissionCheck" 
short-description="Asset Maintenance permission logic">
+        <set field="primaryPermission" value="ASSETMAINT"/>
+        <call-simple-method method-name="genericBasePermissionCheck" 
xml-resource="component://common/script/org/ofbiz/common/permission/CommonPermissionServices.xml"/>
+    </simple-method>
+
+</simple-methods>
\ No newline at end of file

Propchange: 
ofbiz/trunk/specialpurpose/assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintServices.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ofbiz/trunk/specialpurpose/assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintServices.xml
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: 
ofbiz/trunk/specialpurpose/assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintServices.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: ofbiz/trunk/specialpurpose/assetmaint/servicedef/services.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/assetmaint/servicedef/services.xml?rev=893756&r1=893755&r2=893756&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/assetmaint/servicedef/services.xml (original)
+++ ofbiz/trunk/specialpurpose/assetmaint/servicedef/services.xml Thu Dec 24 
13:21:59 2009
@@ -32,8 +32,30 @@
     </service>
 
     <service name="assetMaintPermissionCheck" engine="simple"
-            
location="component://assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintEvents.xml"
 invoke="assetMaintPermissionCheck">
+            
location="component://assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintServices.xml"
 invoke="assetMaintPermissionCheck">
         <description>Asset Maintentance Permission Checking Logic</description>
         <implements service="permissionInterface"/>
     </service>
+    
+    <service name="createFixedAssetMaintUpdateWorkEffort" engine="simple" 
default-entity-name="FixedAssetMaint"
+            
location="component://assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintServices.xml"
 invoke="createFixedAssetMaintUpdateWorkEffort">
+        <description>Create FixedAssetMaint and Update Schedule information in 
WorkEffort</description>
+        <auto-attributes include="all" mode="IN" optional="true"/>
+        <auto-attributes include="all" mode="IN" entity-name="WorkEffort" 
optional="true"/>
+        <override name="fixedAssetId" mode="IN" optional="false"/>
+        <override name="maintHistSeqId" mode="OUT" optional="false"/>
+    </service>
+    <service name="updateFixedAssetMaintAndWorkEffort" engine="simple" 
default-entity-name="FixedAssetMaint"
+            
location="component://assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintServices.xml"
 invoke="updateFixedAssetMaintAndWorkEffort">
+        <description>Update FixedAssetMaint and Schedule information in 
WorkEffort</description>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+        <auto-attributes include="all" mode="IN" entity-name="WorkEffort" 
optional="true"/>
+    </service>
+    
+    <service name="createWorkEffortAndAssocWithParent" engine="simple" 
default-entity-name="WorkEffort"
+            
location="component://assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintServices.xml"
 invoke="createWorkEffortAndAssocWithParent">
+        <description>Create WorkEffort and Associate it with Parent 
(identified by workEffortFromId)</description>
+        <implements service="createWorkEffortAndAssoc"/>
+    </service>
 </services>

Modified: 
ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml?rev=893756&r1=893755&r2=893756&view=diff
==============================================================================
--- 
ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml 
(original)
+++ 
ofbiz/trunk/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml 
Thu Dec 24 13:21:59 2009
@@ -40,13 +40,13 @@
     </request-map>
     <request-map uri="createFixedAssetMaintUpdateWorkEffort">
         <security https="true" auth="true"/>
-        <event type="simple" 
path="component://assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintEvents.xml"
 invoke="createFixedAssetMaintUpdateWorkEffort"/>
+        <event type="service" invoke="createFixedAssetMaintUpdateWorkEffort"/>
         <response name="success" type="view" value="EditFixedAssetMaint"/>
         <response name="error" type="view" value="EditFixedAssetMaint"/>
     </request-map>
     <request-map uri="updateFixedAssetMaintAndWorkEffort">
         <security https="true" auth="true"/>
-        <event type="simple" 
path="component://assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintEvents.xml"
 invoke="updateFixedAssetMaintAndWorkEffort"/>
+        <event type="service" invoke="updateFixedAssetMaintAndWorkEffort"/>
         <response name="success" type="view" value="EditFixedAssetMaint"/>
         <response name="error" type="view" value="EditFixedAssetMaint"/>
     </request-map>
@@ -87,7 +87,7 @@
 
     <request-map uri="createWorkEffortAndAssoc">
         <security https="true" auth="true"/>
-        <event type="simple" 
path="component://assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintEvents.xml"
 invoke="createWorkEffortAndAssoc"/>
+        <event type="service" invoke="createWorkEffortAndAssocWithParent"/>
         <response name="success" type="view" value="EditWorkEfforts"/>
         <response name="error" type="view" value="EditWorkEfforts"/>
     </request-map>


Reply via email to