Openbravo Issue Tracking System - Retail Modules
View Issue Details
0036044Retail ModulesStoreServerpublic2017-05-18 18:232017-06-16 17:36
AugustoMauch 
mtaal 
normalmajorhave not tried
closedfixed 
5
 
RR17Q3 
mtaal
No
0036044: Logical duplication in the MobileServerTransitionToOnlineHandler and CheckServerOfflineHandler classes
The purpose of the CheckServerOfflineHandler and MobileServerTransitionToOnlineHandler classes is very similar:

- CheckServerOfflineHandler is used by the ServerStateBackground process to know if a server must go offline
- MobileServerTransitionToOnlineHandler is used by the MobileServerController.TransitionToOnline to know if a server can go online

In most cases, maybe in all, if for some reason a server must go offline, for that same reason the server cannot go online.

It would be better if we could remove the duplication in logic that there in these two classes.
-
No tags attached.
Issue History
2017-05-18 18:23AugustoMauchNew Issue
2017-05-18 18:23AugustoMauchAssigned To => StoreServer
2017-05-18 18:23AugustoMauchTriggers an Emergency Pack => No
2017-05-18 18:23AugustoMauchAssigned ToStoreServer => mtaal
2017-05-21 21:24mtaalNote Added: 0096688
2017-05-22 15:46mtaalNote Added: 0096715
2017-06-08 10:15mtaalReview Assigned To => AugustoMauch
2017-06-08 13:44hgbotCheckin
2017-06-08 13:44hgbotNote Added: 0097218
2017-06-08 13:44hgbotStatusnew => resolved
2017-06-08 13:44hgbotResolutionopen => fixed
2017-06-08 13:44hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/746e879cffeed5352f18f39ffeefcd9830f9d209 [^]
2017-06-14 18:31AugustoMauchReview Assigned ToAugustoMauch => mtaal
2017-06-15 09:53AugustoMauchNote Added: 0097407
2017-06-16 17:36mtaalNote Added: 0097454
2017-06-16 17:36mtaalStatusresolved => closed
2017-06-16 17:36mtaalFixed in Version => RR17Q3

Notes
(0096688)
mtaal   
2017-05-21 21:24   
The two mentioned classes have different purposes:
- CheckServerOfflineHandler: is called to determine if transition to online can be done
- MobileServerTransitionToOnlineHandler: are called when transition to online is possible because servers are reachable. Is used to execute integrations/transactions during transition.

So the purpose of these classes is different, one is called to determine if transition to online can be done, the other is called to execute transition to online.

Having said this it makes sense to again check the CheckServerOfflineHandler instances during transition to online to be sure that transition to online is possible/valid.

http://wiki.openbravo.com/wiki/How_to_implement_custom_offline_checking [^]
http://wiki.openbravo.com/wiki/How_to_Write_Online_Transition_Handlers [^]
(0096715)
mtaal   
2017-05-22 15:46   
To test the changes you can add this code somewhere to force offline:


  public static class LocalOfflineChecker extends CheckServerOfflineHandler {

    @Override
    public boolean isServerOffline() {
      return true;
    }

  }

  public static class LocalTransitionToOnlineHandler extends MobileServerTransitionToOnlineHandler {

    @Override
    public void processTransactions() {
      // do it
    }

    @Override
    public boolean isReadyToGoOnline() {
      return false;
    }

    @Override
    public String getOfflineLog() {
      return super.getOfflineLog();
    }

  }
(0097218)
hgbot   
2017-06-08 13:44   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 746e879cffeed5352f18f39ffeefcd9830f9d209
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Thu Jun 08 13:43:54 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/746e879cffeed5352f18f39ffeefcd9830f9d209 [^]

Fixes issue 36044: Logical duplication in the MobileServerTransitionToOnlineHandler and CheckServerOfflineHandler classes
Also use the offline handlers in the transition to online code

---
M src/org/openbravo/mobile/core/servercontroller/MobileServerController.java
---
(0097407)
AugustoMauch   
2017-06-15 09:53   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 5ce6e74e79f7a0fe97dc2c4e1de46ebb9601f92c
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed Jun 14 18:24:47 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/5ce6e74e79f7a0fe97dc2c4e1de46ebb9601f92c [^] [^]

Related with issue 36044: Fixes type and reverts number of retries to 10

---
M src/org/openbravo/mobile/core/servercontroller/MobileServerController.java
---
(0097454)
mtaal   
2017-06-16 17:36   
Reviewed