Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.wirabumi.gen.oez.event;
- import java.util.List;
- import org.openbravo.base.model.Entity;
- import org.openbravo.base.model.ModelProvider;
- import org.openbravo.base.secureApp.VariablesSecureApp;
- import org.openbravo.base.structure.BaseOBObject;
- import org.openbravo.dal.service.OBDal;
- import org.openbravo.model.ad.ui.Tab;
- public class ProcessedDocumentHandlerAction extends DocumentRoutingHandlerAction {
- private final String processed="processed";
- private final String complete="co";
- private final String reactive="re";
- private final String waitingRelease1="oez_waitingrelease1";
- private final String waitingRelease2="oez_waitingrelease2";
- private final String waitingRelease3="oez_waitingrelease3";
- private final String waitingRelease4="oez_waitingrelease4";
- private final String waitingRelease5="oez_waitingrelease5";
- @Override
- public void doRouting(String adWindowId, String adTabId, String doc_status_to,
- VariablesSecureApp vars, List<String> recordId) {
- //dari tabId dapatkan tableID
- Tab tab = OBDal.getInstance().get(Tab.class, adTabId);
- String tableId = tab.getTable().getId();
- Entity entity = ModelProvider.getInstance().getEntityByTableId(
- tableId);
- // doc status to=CO maka activate
- //if ((doc_status_to.equalsIgnoreCase(complete)) || doc_status_to.equalsIgnoreCase(waitingRelease1)) {
- switch (doc_status_to) {
- case "CO":
- case "oez_waitingrelease1":
- case "oez_waitingrelease2":
- case "oez_waitingrelease3":
- case "oez_waitingrelease4":
- case "oez_waitingrelease5":
- for (int i = 0; i < recordId.size(); i++) {
- BaseOBObject objek = OBDal.getInstance().get(entity.toString(), recordId.get(i));
- objek.set(processed, true);
- OBDal.getInstance().save(objek);
- }
- try {
- OBDal.getInstance().commitAndClose();
- } catch (Exception e) {
- e.printStackTrace();
- }
- break;
- case "re":
- for (int i = 0; i < recordId.size(); i++) {
- BaseOBObject objek = OBDal.getInstance().get(entity.toString(), recordId.get(i));
- objek.set(processed, false);
- OBDal.getInstance().save(objek);
- }
- try {
- OBDal.getInstance().commitAndClose();
- } catch (Exception e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
- @Override
- public Boolean updateDocumentStatus(Entity entity, List<String> RecordId, String document_status_to,
- String column) {
- return super.updateDocumentStatus(entity, RecordId, document_status_to, column);
- }
- @Override
- public String getCoDocumentNo(String record, Tab tab) {
- // do nothing, cuma activate/deactivate pada kolom isactive
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement