protected void processEditModel( String actionCode, String actionObject, HttpServletRequest request) throws SQLException { WorkCenterMgr workCenterMgr = (WorkCenterMgr) this.getManagerFromSession(request); workCenterMgr.setFunctionMode(Constant.UPDATE); String key = actionCode.split("-")[2]; if (actionObject.equals("WorkCenter")) { WorkCenter workCenter = (WorkCenter) Utility.getObject(workCenterMgr.getCurrentWorkCenterMeta().getWorkCenterList(), key); workCenterMgr.setCurrentWorkCenter(workCenter); } else if (actionObject.equals("WorkerGroup")) { WorkerGroup workerGroup = (WorkerGroup) Utility.getObject( workCenterMgr.getCurrentWorkerGroupMeta().getWorkerGroupList(), key); workCenterMgr.setCurrentWorkerGroup(workerGroup); } else if (actionObject.equals("Worker")) { Worker worker = (Worker) Utility.getObject(workCenterMgr.getCurrentWorkerGroupMeta().getWorkerList(), key); workCenterMgr.setCurrentWorker(worker); workCenterMgr .getCurrentWorkerGroupMeta() .refreshDepartment(worker.getEmployee().getEmployeeId()); worker.setDepartment( (SelectionOption) Utility.getObject( workCenterMgr.getCurrentWorkerGroupMeta().getDepartmentList(), worker.getDepartment().getAttributeId())); } }
private void setHttpRequestWorkCenter(HttpServletRequest request, WorkCenterMgr workCenterMgr) { WorkCenter workCenter = workCenterMgr.getCurrentWorkCenter(); workCenter.setWorkCenterCode(request.getParameter("workCenterCode")); workCenter.setWorkCenterName(request.getParameter("workCenterName")); workCenter.setWorkCenterDescription(request.getParameter("workCenterDescription")); workCenter.setFactoryLocation( (SelectionOption) Utility.getObject( workCenterMgr.getCurrentWorkCenterMeta().getFindFactoryList(), request.getParameter("factoryList"))); }
protected void initModel(String page, HttpServletRequest request) throws SQLException { WorkCenterMgr workCenterMgr = new WorkCenterMgr(); this.putManagerToSession(request, workCenterMgr); workCenterMgr.setFunctionMode(Constant.CREATE); if (page.equals("workCenter")) { workCenterMgr.setEntryMode(Constant.WORKCENTER); workCenterMgr.getCurrentWorkCenterMeta().refreshFactory(); workCenterMgr.getCurrentWorkCenterMeta().populateWorkCenterList(); } else if (page.equals("createWorkerGroup")) { workCenterMgr.setEntryMode(Constant.WORKER_GROUP); workCenterMgr.getCurrentWorkCenterMeta().refreshFactory(); workCenterMgr.getCurrentWorkerGroupMeta().populateWorkerGroupList(workCenterMgr); } else if (page.equals("createWorker")) { workCenterMgr.setEntryMode(Constant.CREATE_WORKER); workCenterMgr.getCurrentWorkCenterMeta().refreshFactory(); workCenterMgr.getCurrentWorkerGroupMeta().refreshDepartment(null); workCenterMgr.getCurrentWorkerGroupMeta().populateWorkerList(workCenterMgr); } else if (page.endsWith("Working")) { if (page.equals("createWorking")) { workCenterMgr.setEntryMode(Constant.CREATE_WORKING); } else if (page.equals("updateWorking")) { workCenterMgr.setEntryMode(Constant.UPDATE_WORKING); } else if (page.equals("deleteWorking")) { workCenterMgr.setEntryMode(Constant.DELETE_WORKING); } else if (page.equals("confirmWorking")) { workCenterMgr.setEntryMode(Constant.CONFIRM_WORKING); } else if (page.equals("reportWorking")) { workCenterMgr.setEntryMode(Constant.REPORT_WORKING); } workCenterMgr.getCurrentWorkCenterMeta().refreshFactory(); workCenterMgr.getCurrentWorkerGroupMeta().refreshDepartment(null); // } else if (page.equals("paymentReport")) { // workCenterMgr.setEntryMode(Constant.PAYMENT_WORKING_REPORT); // workCenterMgr.setCurrentWorkCenterMeta(new WorkCenterMeta()); // workCenterMgr.getCurrentWorkCenterMeta().refreshFactory(); } }
private void setHttpParameterWorkerGroup( HttpServletRequest request, WorkCenterMgr workCenterMgr) { WorkerGroup workerGroup = workCenterMgr.getCurrentWorkerGroup(); workerGroup.setWorkerGroupCode(request.getParameter("workerGroupCode")); workerGroup.setWorkerGroupName(request.getParameter("workerGroupName")); workerGroup.setWorkerGroupDescription(request.getParameter("description")); workerGroup.setFactoryLocation( (SelectionOption) Utility.getObject( workCenterMgr.getCurrentWorkCenterMeta().getFindFactoryList(), request.getParameter("factoryList"))); if (request.getParameter("isDisable") != null && request.getParameter("isDisable").equals("Y")) { workerGroup.setIsDisable(true); } else { workerGroup.setIsDisable(false); } }
protected void processSaveModel( String actionCode, String actionObject, HttpServletRequest request) throws SQLException { WorkCenterMgr workCenterMgr = (WorkCenterMgr) this.getManagerFromSession(request); if (actionObject.equals("WorkCenter")) { setHttpRequestWorkCenter(request, workCenterMgr); workCenterMgr.getCurrentWorkCenter().validate(); if (workCenterMgr.getCurrentWorkCenter().isValid()) { workCenterMgr.getCurrentWorkCenter().save(); if (workCenterMgr.getFunctionMode().equals(Constant.CREATE)) { ((LinkedList) workCenterMgr.getCurrentWorkCenterMeta().getWorkCenterList()) .addFirst(workCenterMgr.getCurrentWorkCenter()); } } } else if (actionObject.equals("WorkerGroup")) { this.setHttpParameterWorkerGroup(request, workCenterMgr); workCenterMgr.getCurrentWorkerGroup().validate(); if (workCenterMgr.getCurrentWorkerGroup().isValid()) { workCenterMgr.getCurrentWorkerGroup().save(this.getLogin(request)); if (workCenterMgr.getFunctionMode().equals(Constant.CREATE)) { ((LinkedList) workCenterMgr.getCurrentWorkerGroupMeta().getWorkerGroupList()) .addFirst(workCenterMgr.getCurrentWorkerGroup()); } } } else if (actionObject.equals("Worker")) { this.setHttpParameterWorker(request, workCenterMgr); workCenterMgr.getCurrentWorker().validate(); if (workCenterMgr.getCurrentWorker().isValid()) { workCenterMgr.getCurrentWorker().save(this.getLogin(request)); if (workCenterMgr.getFunctionMode().equals(Constant.CREATE)) { ((LinkedList) workCenterMgr.getCurrentWorkerGroupMeta().getWorkerList()) .addFirst(workCenterMgr.getCurrentWorker()); } } } else if (actionObject.equals("Working")) { this.setHttpParameterWorking(request, workCenterMgr); workCenterMgr.getCurrentWorking().validate(); if (workCenterMgr.getCurrentWorking().isValid()) { workCenterMgr.getCurrentWorking().save(workCenterMgr, this.getLogin(request)); } } }