Skip to content
Permalink
Browse files

Improved: Convert Shipment Crud simple service to entity-auto

(OFBIZ-6996)
I converted all available shipment entities crud currently on simple service to entity-auto service :
 * ItemIssuanceRole
 * ShipmentItem
 * ShipmentPackageContent
 * ShipmentPackageRouteSeg
 * ShipmentRouteSegment
 * QuantityBreak

I also transformed a simple method call to a permission service: checkCanChangeShipmentStatus, who check for a shipment is it on good status for the change.
With this last conversion, the permission control set on the service definition instead of core service

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866286 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
nmalin committed Sep 2, 2019
1 parent 899bc6f commit 609ade46f205057ea1720fb8db01e10dd6b173f3
@@ -1489,6 +1489,10 @@
<value xml:lang="zh">创建快速添加变型数据时发生交易错误:${errMessage}。</value>
<value xml:lang="zh-TW">新建快速增加變型資料時發生交易錯誤: ${errMessage}.</value>
</property>
<property key="ShipmentCanChangeStatusPermissionError">
<value xml:lang="en">Cannot perform this operation when the shipment [${testShipment.shipmentId}] is in the ${testShipmentStatus.description} [${testShipment.statusId}] status."</value>
<value xml:lang="fr">Impossible de réaliser l'opération demandée quand l'expédition [${testShipment.shipmentId}] est dans le statut ${testShipmentStatus.description} [${testShipment.statusId}]</value>
</property>
<property key="variantevents.variantProductId_required_but_missing_enter_an_id">
<value xml:lang="de">variantProductId wir benötigt, fehlt aber, bitte geben Sie eine ID für die neue Produktvariante an.</value>
<value xml:lang="en">variantProductId is required but missing, please enter an id for the new variant product.</value>
@@ -22,10 +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">
<!-- ItemIssuance services -->
<simple-method method-name="createItemIssuance" short-description="Create ItemIssuance">
<set value="Create ItemIssuance" field="operationName"/>
<call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="component://product/minilang/shipment/shipment/ShipmentServices.xml"/>
<check-errors/>

<make-value entity-name="ItemIssuance" value-field="newEntity"/>
<sequenced-id sequence-name="ItemIssuance" field="newEntity.itemIssuanceId"/>
<field-to-result field="newEntity.itemIssuanceId" result-name="itemIssuanceId"/>
@@ -64,48 +60,9 @@ under the License.
</if-not-empty>
<field-to-result field="affectAccounting" result-name="affectAccounting"/>
</simple-method>
<simple-method method-name="updateItemIssuance" short-description="Update ItemIssuance">
<set value="Update ItemIssuance" field="operationName"/>
<call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="component://product/minilang/shipment/shipment/ShipmentServices.xml"/>
<check-errors/>

<entity-one entity-name="ItemIssuance" value-field="lookedUpValue"/>
<set-nonpk-fields map="parameters" value-field="lookedUpValue"/>
<store-value value-field="lookedUpValue"/>
</simple-method>
<simple-method method-name="deleteItemIssuance" short-description="Delete ItemIssuance">
<set value="Delete ItemIssuance" field="operationName"/>
<call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="component://product/minilang/shipment/shipment/ShipmentServices.xml"/>
<check-errors/>

<entity-one entity-name="ItemIssuance" value-field="lookedUpValue"/>
<remove-value value-field="lookedUpValue"/>
</simple-method>

<!-- ItemIssuanceRole services -->
<simple-method method-name="createItemIssuanceRole" short-description="Create ItemIssuanceRole">
<set value="Create ItemIssuanceRole" field="operationName"/>
<call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="component://product/minilang/shipment/shipment/ShipmentServices.xml"/>
<check-errors/>
<make-value entity-name="ItemIssuanceRole" value-field="newEntity"/>
<set-pk-fields map="parameters" value-field="newEntity"/>
<set-nonpk-fields map="parameters" value-field="newEntity"/>
<create-value value-field="newEntity"/>
</simple-method>

<simple-method method-name="deleteItemIssuanceRole" short-description="Delete ItemIssuanceRole">
<set value="Delete ItemIssuanceRole" field="operationName"/>
<call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="component://product/minilang/shipment/shipment/ShipmentServices.xml"/>
<check-errors/>
<entity-one entity-name="ItemIssuanceRole" value-field="lookedUpValue"/>
<remove-value value-field="lookedUpValue"/>
</simple-method>

<!-- the actual issuance services -->
<simple-method method-name="issueOrderItemToShipment" short-description="Issue OrderItem to Shipment">
<set value="Issue OrderItem to Shipment" field="operationName"/>
<call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="component://product/minilang/shipment/shipment/ShipmentServices.xml"/>
<check-errors/>

<!-- get orderHeader -->
<entity-one entity-name="OrderHeader" value-field="orderHeader" auto-field-map="true"/>
@@ -132,9 +89,6 @@ under the License.
</simple-method>

<simple-method method-name="issueOrderItemShipGrpInvResToShipment" short-description="Issue OrderItemShipGrpInvRes to Shipment">
<set value="Issue OrderItemShipGrpInvRes to Shipment" field="operationName"/>
<call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="component://product/minilang/shipment/shipment/ShipmentServices.xml"/>
<check-errors/>

<!-- get orderItemShipGrpInvRes -->
<make-value entity-name="OrderItemShipGrpInvRes" value-field="OrderItemShipGrpInvResLookupPk"/>
@@ -464,7 +418,7 @@ under the License.
<field-to-result field="itemIssuanceId"/>
</simple-method>
<simple-method method-name="associateIssueRoles" short-description="Associate Roles for ItemIssuance - meant to be called in-line">
<!-- make sure the party is in the PACKER role -->
<!-- make sure the party is in the PACKER role TODO need to replace by ensurePartyRole-->
<make-value entity-name="PartyRole" value-field="partyRole"/>
<set field="partyRole.partyId" from-field="userLogin.partyId"/>
<set field="partyRole.roleTypeId" value="PACKER"/>
@@ -565,8 +519,9 @@ under the License.
<!-- issuance can be canceled only if the sales shipment is not packed -->

<if-compare field="shipment.statusId" operator="not-equals" value="SHIPMENT_CANCELLED">
<set from-field="itemIssuance.shipmentId" field="shipmentId"/>
<call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="component://product/minilang/shipment/shipment/ShipmentServices.xml"/>
<set from-field="itemIssuance.shipmentId" field="checkCanChangeShipmentStatusPackedMap.shipmentId"/>
<set value="UPDATE" field="checkCanChangeShipmentStatusPackedMap.mainAction"/>
<call-service service-name="checkCanChangeShipmentStatusPacked" in-map-name="checkCanChangeShipmentStatusPackedMap" />
<check-errors/>
</if-compare>

@@ -361,9 +361,6 @@ under the License.
</simple-method>

<simple-method method-name="issueOrderItemToShipmentAndReceiveAgainstPO" short-description="Issues order item quantity specified to the shipment, then receives inventory for that item and quantity">
<set value="Issue OrderItem to Shipment and Receive against PO" field="operationName"/>
<call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="component://product/minilang/shipment/shipment/ShipmentServices.xml"/>
<check-errors/>

<!-- get orderItem -->
<entity-one entity-name="OrderItem" value-field="orderItem" auto-field-map="true"/>

0 comments on commit 609ade4

Please sign in to comment.
You can’t perform that action at this time.