You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by su...@apache.org on 2020/05/16 08:16:22 UTC
[ofbiz-framework] branch trunk updated: Improved: Converted all
Timesheet related CRUD services from simple to entity-auto (#88)
This is an automated email from the ASF dual-hosted git repository.
surajk pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new c7ae78d Improved: Converted all Timesheet related CRUD services from simple to entity-auto (#88)
c7ae78d is described below
commit c7ae78d551574f81bef9d5ddbbf5aaa0a934dfe1
Author: Suraj Khurana <64...@users.noreply.github.com>
AuthorDate: Sat May 16 13:46:12 2020 +0530
Improved: Converted all Timesheet related CRUD services from simple to entity-auto (#88)
* Improved: Converted all Timesheet related CRUD entities from simple to entity-auto
(OFBIZ-11616)
---
.../workeffort/minilang/test/WorkEffortTests.xml | 16 --------------
.../minilang/timesheet/TimesheetServices.xml | 25 ----------------------
applications/workeffort/servicedef/secas.xml | 6 ++++++
.../workeffort/servicedef/services_timesheet.xml | 15 ++++---------
4 files changed, 10 insertions(+), 52 deletions(-)
diff --git a/applications/workeffort/minilang/test/WorkEffortTests.xml b/applications/workeffort/minilang/test/WorkEffortTests.xml
index 6df2933..f30adf9 100644
--- a/applications/workeffort/minilang/test/WorkEffortTests.xml
+++ b/applications/workeffort/minilang/test/WorkEffortTests.xml
@@ -384,22 +384,6 @@ under the License.
</assert>
<check-errors/>
</simple-method>
- <simple-method method-name="testUpdateTimesheetToInProcess" short-description="Test the service updateTimesheetToInProcess" login-required="false">
- <set field="serviceCtx.timesheetId" value="TestTimesheet-1"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="updateTimesheetToInProcess" in-map-name="serviceCtx"/>
- <entity-one entity-name="Timesheet" value-field="timesheet">
- <field-map field-name="timesheetId" value="TestTimesheet-1"/>
- </entity-one>
- <assert>
- <not><if-empty field="timesheet"/></not>
- <if-compare operator="equals" field="timesheet.statusId" value="TIMESHEET_IN_PROCESS"/>
- </assert>
- <check-errors/>
- </simple-method>
<simple-method method-name="testUpdateTimesheet" short-description="Test the service updateTimesheet" login-required="false">
<set field="serviceCtx.timesheetId" value="TestTimesheet-2"/>
<set field="serviceCtx.clientPartyId" value="TestParty"/>
diff --git a/applications/workeffort/minilang/timesheet/TimesheetServices.xml b/applications/workeffort/minilang/timesheet/TimesheetServices.xml
index ebf546b..0dafbf2 100644
--- a/applications/workeffort/minilang/timesheet/TimesheetServices.xml
+++ b/applications/workeffort/minilang/timesheet/TimesheetServices.xml
@@ -22,31 +22,6 @@ under the License.
xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd">
<!-- Timesheet Services -->
- <simple-method method-name="createTimesheet" short-description="Create Timesheet">
- <make-value entity-name="Timesheet" value-field="newEntity"/>
- <sequenced-id sequence-name="Timesheet" field="newEntity.timesheetId"/>
- <field-to-result field="newEntity.timesheetId" result-name="timesheetId"/>
-
- <set-nonpk-fields map="parameters" value-field="newEntity"/>
- <if-empty field="newEntity.statusId">
- <set field="newEntity.statusId" value="TIMESHEET_IN_PROCESS"/>
- </if-empty>
- <create-value value-field="newEntity"/>
- </simple-method>
- <simple-method method-name="updateTimesheet" short-description="Update Timesheet">
- <call-simple-method method-name="checkTimesheetStatus"/>
- <set-nonpk-fields map="parameters" value-field="timesheet"/>
- <store-value value-field="timesheet"/>
- </simple-method>
- <simple-method method-name="updateTimesheetToInProcess" short-description="Updates the Timesheet status back to in process to be able to correct errors">
- <entity-one entity-name="Timesheet" value-field="timesheet"/>
- <set field="timesheet.statusId" value="TIMESHEET_IN_PROCESS"/>
- <store-value value-field="timesheet"/>
- </simple-method>
- <simple-method method-name="deleteTimesheet" short-description="Delete Timesheet">
- <call-simple-method method-name="checkTimesheetStatus"/>
- <remove-value value-field="timesheet"/>
- </simple-method>
<simple-method method-name="createTimesheetForThisWeek" short-description="Create Timesheet For This Week of no date provided, otherwise for a specific week">
<if-empty field="parameters.requiredDate">
<now-timestamp field="nowTimestamp"/>
diff --git a/applications/workeffort/servicedef/secas.xml b/applications/workeffort/servicedef/secas.xml
index a29dd25..ca516f4 100644
--- a/applications/workeffort/servicedef/secas.xml
+++ b/applications/workeffort/servicedef/secas.xml
@@ -65,6 +65,12 @@ under the License.
<eca service="createTimeEntry" event="invoke">
<action service="checkTimesheetStatus" mode="sync"/>
</eca>
+ <eca service="updateTimesheet" event="invoke">
+ <action service="checkTimesheetStatus" mode="sync"/>
+ </eca>
+ <eca service="deleteTimesheet" event="invoke">
+ <action service="checkTimesheetStatus" mode="sync"/>
+ </eca>
<eca service="createTimesheetRole" event="invoke">
<action service="ensurePartyRole" mode="sync"/>
</eca>
diff --git a/applications/workeffort/servicedef/services_timesheet.xml b/applications/workeffort/servicedef/services_timesheet.xml
index e7e232b..1526b9f 100644
--- a/applications/workeffort/servicedef/services_timesheet.xml
+++ b/applications/workeffort/servicedef/services_timesheet.xml
@@ -25,26 +25,19 @@ under the License.
<version>1.0</version>
<!-- Timesheet Services -->
- <service name="createTimesheet" default-entity-name="Timesheet" engine="simple" auth="true"
- location="component://workeffort/minilang/timesheet/TimesheetServices.xml" invoke="createTimesheet">
+ <service name="createTimesheet" default-entity-name="Timesheet" engine="entity-auto" auth="true" invoke="create">
<description>Creates Timesheet</description>
<permission-service service-name="workEffortGenericPermission" main-action="CREATE"/>
<auto-attributes include="pk" mode="OUT" optional="false"/>
<auto-attributes include="nonpk" mode="IN" optional="true"/>
+ <override name="statusId" default-value="TIMESHEET_IN_PROCESS"/>
</service>
- <service name="updateTimesheetToInProcess" default-entity-name="Timesheet" engine="simple" auth="true"
- location="component://workeffort/minilang/timesheet/TimesheetServices.xml" invoke="updateTimesheetToInProcess">
- <description>Updates the Timesheet status back to in process to be able to correct errors</description>
- <auto-attributes include="pk" mode="IN" optional="false"/>
- </service>
- <service name="updateTimesheet" default-entity-name="Timesheet" engine="simple" auth="true"
- location="component://workeffort/minilang/timesheet/TimesheetServices.xml" invoke="updateTimesheet">
+ <service name="updateTimesheet" default-entity-name="Timesheet" engine="entity-auto" auth="true" invoke="update">
<description>Updates Timesheet</description>
<auto-attributes include="pk" mode="IN" optional="false"/>
<auto-attributes include="nonpk" mode="IN" optional="true"/>
</service>
- <service name="deleteTimesheet" default-entity-name="Timesheet" engine="simple" auth="true"
- location="component://workeffort/minilang/timesheet/TimesheetServices.xml" invoke="deleteTimesheet">
+ <service name="deleteTimesheet" default-entity-name="Timesheet" engine="entity-auto" auth="true" invoke="delete">
<description>Deletes Timesheet</description>
<auto-attributes include="pk" mode="IN" optional="false"/>
</service>