Openbravo Issue Tracking System - Retail Modules
View Issue Details
0034287Retail ModulesWeb POSpublic2016-10-24 18:482020-04-14 15:10
eduardo_Argal 
eduardo_Argal 
normalmajoralways
newopen 
5
 
 
mtaal
No
0034287: Entity vs Import Qualifier
Havning a process with a service defined as Transaction (so it does use queues, import entries)
As you know for this processes we define:
- An entity:
@DataSynchronization(entity = "XXX")
- An import qualifier:
  protected String getImportQualifier() {
    return "YYY";
  }
We were always assuming that this XXX = YYY, but this is not correct. For example in the case of Cancel Layaway the entity behind is a Layaway (Order) but the import qualifier should be the process: OBPOS_CancelLayaway (for example). We noticed this due to an error that now is thrown due to the validation you added for synchronized mode (afterReturnFromCentral). This validation is querying to retrieve the record in the other server (check DS). As we were using process name as entity, process was failing when trying to get object behind 'id' for non existing entity (OBPOS_CancelLayaway).
This took me to change entity = Order, importQaulifier = OBPOS_CancelLayaway. and this worked fine. But as well a new problem raised.
Let me explain, when preference for synchronized is not there (equals 'N') and an error occurs, an import error is raised and there the API is using entity for the importdatatype. That's a problem because I think it should map to the importQualifier (so that process can be run again when fixing error)
Create a Layaway in an env with synchronized preference equals Y.
Cancel it using cancel Layaway process.
System fails due to wrong entity (OBPOS_CancelLayaway).
Find patches attached
No tags attached.
diff posterminal.diff (4,258) 2016-10-24 18:48
https://issues.openbravo.com/file_download.php?file_id=9950&type=bug
diff mobile.core (1).diff (2,282) 2016-10-24 18:49
https://issues.openbravo.com/file_download.php?file_id=9951&type=bug
Issue History
2016-10-24 18:48eduardo_ArgalNew Issue
2016-10-24 18:48eduardo_ArgalAssigned To => adrianromero
2016-10-24 18:48eduardo_ArgalFile Added: posterminal.diff
2016-10-24 18:49eduardo_ArgalFile Added: mobile.core (1).diff
2016-10-24 18:49eduardo_ArgalAssigned Toadrianromero => eduardo_Argal
2016-10-26 17:48hgbotCheckin
2016-10-26 17:48hgbotNote Added: 0090930
2016-10-26 17:48hgbotStatusnew => resolved
2016-10-26 17:48hgbotResolutionopen => fixed
2016-10-26 17:48hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/85e0af60e83bb6b3ec99ac157aa778d3dfb0218a [^]
2016-10-26 17:49hgbotCheckin
2016-10-26 17:49hgbotNote Added: 0090931
2016-11-04 10:27hgbotCheckin
2016-11-04 10:27hgbotNote Added: 0091164
2016-11-07 11:49mtaalReview Assigned To => mtaal
2016-11-15 10:25mtaalNote Added: 0091538
2016-11-15 10:25mtaalStatusresolved => new
2016-11-15 10:25mtaalResolutionfixed => open
2016-12-30 13:37hgbotCheckin
2016-12-30 13:37hgbotNote Added: 0093074
2016-12-30 13:37hgbotCheckin
2016-12-30 13:37hgbotNote Added: 0093076
2016-12-30 13:37hgbotCheckin
2016-12-30 13:37hgbotNote Added: 0093078
2020-04-14 15:10marvintmProjectJava Client POS => Retail Modules
2020-04-14 15:10marvintmTriggers an Emergency Pack => No
2020-04-14 15:10marvintmCategory01 - General => Web POS

Notes
(0090930)
hgbot   
2016-10-26 17:48   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 85e0af60e83bb6b3ec99ac157aa778d3dfb0218a
Author: Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
Date: Wed Oct 26 17:48:35 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/85e0af60e83bb6b3ec99ac157aa778d3dfb0218a [^]

Fixes issue 34287. API change in handle error (importQualifier vs entity)

---
M src/org/openbravo/mobile/core/process/DataSynchronizationErrorHandler.java
M src/org/openbravo/mobile/core/process/DataSynchronizationProcess.java
---
(0090931)
hgbot   
2016-10-26 17:49   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: a960316c234272a2c3dcb42fda40b8886e146c61
Author: Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
Date: Wed Oct 26 17:49:22 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/a960316c234272a2c3dcb42fda40b8886e146c61 [^]

Related to issue 34287. API change in handle error (importQualifier vs entity)

---
M src/org/openbravo/retail/posterminal/ExternalOrderLoaderErrorHandler.java
M src/org/openbravo/retail/posterminal/POSDataSynchronizationErrorHandler.java
---
(0091164)
hgbot   
2016-11-04 10:27   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 83f96a506db7ce8d3d6dc50c627fc4d9ab29d4e8
Author: Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
Date: Fri Nov 04 10:27:34 2016 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/83f96a506db7ce8d3d6dc50c627fc4d9ab29d4e8 [^]

Related to issue 34287: Change in CancellayawayLoader

---
M src/org/openbravo/retail/posterminal/CancelLayawayLoader.java
---
(0091538)
mtaal   
2016-11-15 10:25   
Subclasses of DataSynchronizationProcess have an annotation to tell which entity is handled by the DataSynchronizationProcess (e.g. [1]). The value in the annotation must be a real entity name becauses the annotation is used by DataSynchronizationProcess [5] to find the entity covered by the DataSynchronizationProcess. If an entity is not found then several parts of the code get into an error [4].

Eduardo's team had some issues with it [2] and set the CancelLayawayLoader entity annotation to Order, after discussing with me. But in hinsight this gives issues as there are now 2 DataSynchronizationProcess with the same annotation ([1] and [3]). This gives problems when processing any errors [6] as there a unique entity name is expected to find the implementing DataSynchronizationProcess.

So my take:
- the @DataSynchronization(entity="...") must be unique and may contain non-entity names
- if the annotation has a non-entity name then the implementing class must override the getEntity method to return the real entity
- when creating the error handler the value of the annotation-entity name should be used.

Very confusing topic... Let me know what you think.

gr. Martin

[1]
@DataSynchronization(entity = "Order")
public class OrderLoader extends POSDataSynchronizationProcess implements
    DataSynchronizationImportProcess {

[2]
https://issues.openbravo.com/view.php?id=34287 [^]

[3]
@DataSynchronization(entity = "Order")
public class CancelLayawayLoader extends POSDataSynchronizationProcess implements
    DataSynchronizationImportProcess {

[4]
https://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/file/0a4ebceba039/src/org/openbravo/mobile/core/process/DataSynchronizationProcess.java#l237 [^]
https://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/file/0a4ebceba039/src/org/openbravo/mobile/core/servercontroller/SynchronizedServerProcessCaller.java#l141 [^]

[5]
https://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/file/0a4ebceba039/src/org/openbravo/mobile/core/process/DataSynchronizationProcess.java#l390 [^]

[6]
https://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/file/505ee341ebe9/src/org/openbravo/retail/posterminal/SaveDataActionHandler.java#l71 [^]
https://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/file/dc57a9fb7c64/src/org/openbravo/retail/storeserver/synchronization/process/ProcessPOSErrors.java#l128 [^]
(0093074)
hgbot   
2016-12-30 13:37   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: c362b688c27f58aa66af054ec233f8e31b921277
Author: Guillermo Alvarez de Eulate <guillermo.alvarez <at> openbravo.com>
Date: Fri Dec 30 10:59:13 2016 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/c362b688c27f58aa66af054ec233f8e31b921277 [^]

Related to issue 34287: Backed out changeset a960316c2342 because the release is going to be closed and this change was not approved

---
M src/org/openbravo/retail/posterminal/ExternalOrderLoaderErrorHandler.java
M src/org/openbravo/retail/posterminal/POSDataSynchronizationErrorHandler.java
---
(0093076)
hgbot   
2016-12-30 13:37   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 6d62564df8bba74d6b33cb1bdb1a5ba88c89b85f
Author: Guillermo Alvarez de Eulate <guillermo.alvarez <at> openbravo.com>
Date: Fri Dec 30 11:00:19 2016 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/6d62564df8bba74d6b33cb1bdb1a5ba88c89b85f [^]

Related to issue 34287: Backed out changeset 83f96a506db7 because the release is going to be closed and this change was not approved

---
M src/org/openbravo/retail/posterminal/CancelLayawayLoader.java
---
(0093078)
hgbot   
2016-12-30 13:37   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 49d79b8bed6d5b2eef11195b193a87963a9cad3e
Author: Guillermo Alvarez de Eulate <guillermo.alvarez <at> openbravo.com>
Date: Fri Dec 30 10:57:55 2016 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/49d79b8bed6d5b2eef11195b193a87963a9cad3e [^]

Related to issue 34287: Backed out changeset 85e0af60e83b because the release is going to be closed and this change was not approved

---
M src/org/openbravo/mobile/core/process/DataSynchronizationErrorHandler.java
M src/org/openbravo/mobile/core/process/DataSynchronizationProcess.java
---