Hi Taher,

It's true :) and it's a beautiful copy paste !

Now my deep think would be that both call are wrong (not wrong but not finalized) because the permission eval call a service. And a service give the information if he will run on new transaction so we need to check on the service definition. More, we can on a specific service, call the permission service on new transaction but not on other service.

So a permission service need to analyse if the service to call require a new transaction and improve permission service model to surcharge this.

Finally, i will open an issue to improve this ^^ .

Cheers,

Nicolas

Le 15/04/2016 08:23, Taher Alkhateeb a écrit :
Hi Nicolas,

I have to note that in ModelPermission the same exact call is also made
with a new transaction. I did not dig deep into it but I advice to at least
check it over there as well. This makes me suspect that either both call
are wrong or both calls are right.

HTH

Taher Alkhateeb

On Fri, Apr 15, 2016 at 9:18 AM, Pranay Pandey <
[email protected]> wrote:

Hi Nicolas,

Calling it as permission service is tricky. I see the comment in
implementation above the simple method in ShipmentServices.xml-

     <!-- Check the Status of a Shipment to see if it can be changed -
meant to be called in-line -->

It was implemented with a purpose to be called inline, may be supporting
the traditional way of doing things. Reviewing at a complete patch with all
the modifications you have done for making shipment CRUD operations can
help here getting the opinion. WDYT?

Best regards,

Pranay Pandey
HotWax Systems
http://www.hotwaxsystems.com/

On Thu, Apr 7, 2016 at 1:30 PM, Nicolas Malin <[email protected]>
wrote:

Hello,

Currently I continue the conversion on shipment  crud service and I
detected that many service use the same mini-lang call to check if the
shipment status is ok for editing "checkCanChangeShipmentStatusPacked"

I convert it on service to call it directly by the permission-service
like that :

     <service name="createShipmentPackageContent"
default-entity-name="ShipmentPackageContent" engine="entity-auto"
invoke="create" auth="true">...
         <permission-service
service-name="checkCanChangeShipmentStatusPacked" main-action="CREATE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>...
     </service>

The problem with this change that when I run the unit tests, I have some
failed to due database lock on shipment.
After some analyse I founded that the permission service wasn't call on
the same service's transaction.
I a realize this change :

Index: framework/service/src/org/ofbiz/service/ModelService.java
===================================================================
--- framework/service/src/org/ofbiz/service/ModelService.java
(révision 1737860)
+++ framework/service/src/org/ofbiz/service/ModelService.java    (copie
de travail)
@@ -985,7 +985,7 @@
                  LocalDispatcher dispatcher = dctx.getDispatcher();
                  Map<String, Object> resp;
                  try {
-                    resp = dispatcher.runSync(permission.name, ctx,
300, true);
+                    resp = dispatcher.runSync(permission.name, ctx);
                  } catch (GenericServiceException e) {
                      Debug.logError(e, module);
                      Map<String, Object> result =
ServiceUtil.returnSuccess();

All unit test pass.
Anyone know the reason to call the permission service on a new
transaction ?
I couldn't spot any valid reason.

Thnaks for help ;)

Nicolas

--
#jeSuisCharlie
[image: logoNrd] <http://nereide.fr/>
Nicolas Malin
Ingénieur d'étude. Dernier sujet : "Les vaches portant un prénom pouvent
trouver la sortie d'un labyrinthe en cas de toxoplasmose
[email protected]
8 rue des Déportés 37000 TOURS, 02 47 50 30 54
Apache OFBiz <http://ofbiz.apache.org/> |  ofbiz-fr
<http://www.ofbiz-fr.org/> |  | réseau LE
<http://www.libre-entreprise.org/>


Reply via email to