Advertisement
psi_mmobile

Untitled

Sep 30th, 2019
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.67 KB | None | 0 0
  1. --Context bean    
  2.     private int lastSelectedWbsId = 0;    
  3.     private int lastSelectedPoiId = 0;
  4.     private PointOfInterest lastSelectedPoi;
  5.  
  6. public void setLastSelectedPoiId(int lastSelectedPoiId) {
  7.         AppModuleImpl am = (AppModuleImpl)ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");
  8.         if (lastSelectedPoiId == this.lastSelectedPoiId)
  9.             return;
  10.         log.debug("Last selected POI : " + lastSelectedPoiId);
  11.         this.lastSelectedPoiId = lastSelectedPoiId;
  12.         if (this.lastSelectedPoiId != 0) {
  13.             ViewObjectImpl poiVo = am.getEditPoiView1();
  14.             poiVo.setWhereClause("OcPoi.POI_ID = " + lastSelectedPoiId);
  15.             poiVo.executeQuery();
  16.             log.debug("Found selected POI : " + poiVo.getRowCount());
  17.             if (poiVo.getRowCount() > 0) {
  18.                 Row poiRow = poiVo.first();
  19.                 lastSelectedPoi = new PointOfInterest(poiRow);
  20.                 this.setLastSelectedWbsId((Integer)poiRow.getAttribute("WbsId"));
  21.             }
  22.         } else {
  23.             ViewObjectImpl poiListView = am.getUserPoiListView1();
  24.             if (poiListView.getRowCount() > 0) {
  25.                 Row currentRow = poiListView.first();
  26.                 Integer currentRowPoiId = (Integer)currentRow.getAttribute("PoiId");
  27.                 ViewObjectImpl poiVo = am.getEditPoiView1();
  28.                 poiVo.setWhereClause("OcPoi.POI_ID = " + currentRowPoiId);
  29.                 poiVo.executeQuery();
  30.                 if (poiVo.getRowCount() > 0) {
  31.                     Row poiRow = poiVo.first();
  32.                     lastSelectedPoi = new PointOfInterest(poiRow);
  33.                     this.setLastSelectedWbsId((Integer)poiRow.getAttribute("WbsId"));
  34.                 } else {
  35.                     lastSelectedPoi = null;
  36.                 }
  37.             }
  38.         }
  39.     }
  40.  
  41.     public void setLastSelectedPoi(PointOfInterest lastSelectedPoi) {
  42.         this.lastSelectedPoi = lastSelectedPoi;
  43.     }
  44.  
  45.     public PointOfInterest getLastSelectedPoi() {
  46.         return lastSelectedPoi;
  47.     }
  48.  
  49.     public void setLastSelectedWbsId(Integer lastSelectedWbsId) {
  50.         this.lastSelectedWbsId = (lastSelectedWbsId == null) ? 0 : lastSelectedWbsId;
  51.     }
  52.  
  53.     public int getLastSelectedWbsId() {
  54.         return lastSelectedWbsId;
  55.     }
  56.  
  57.     public int getLastSelectedPoiId() {
  58.         return lastSelectedPoiId;
  59.     }
  60. -- POI list manager
  61.  
  62.         ContextBean.getCurrent().setSelectedPoiId((Integer)ADFUtils.findIterator("PoiView1Iterator").getCurrentRow().getAttribute("PoiId"));
  63.         ContextBean.getCurrent().setLastSelectedPoiId((Integer)ADFUtils.findIterator("PoiView1Iterator").getCurrentRow().getAttribute("PoiId"));
  64.         ContextBean.getCurrent().setSelectedWbsId((Integer)ADFUtils.findIterator("PoiView1Iterator").getCurrentRow().getAttribute("WbsId"));
  65.         ContextBean.getCurrent().setLastSelectedWbsId((Integer)ADFUtils.findIterator("PoiView1Iterator").getCurrentRow().getAttribute("WbsId"));
  66.  
  67.  
  68. -- Attach Doc manager
  69.  
  70.     public String viewPoiRegistrationHistory() {
  71.         AppModuleImpl am = (AppModuleImpl)ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");
  72.         ViewObjectImpl docs = am.getAttachDocView3();
  73.         Row row = docs.getCurrentRow();
  74.         if (row != null) {
  75.             Integer currentPoi = (Integer)row.getAttribute("PoiId");
  76.             if (null != currentPoi) {
  77. //                ContextBean.getCurrent().setSelectedPoiId(currentPoi);
  78.                 ContextBean.getCurrent().setSelectedPoiId(ContextBean.getCurrent().getLastSelectedPoiId());
  79.             }
  80.         }
  81.  
  82.         return PoiRegistrationBean.getInstance().viewPoiRegistrationHistory();
  83.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement