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())); } }
protected void processSelectModel( String actionCode, String actionObject, HttpServletRequest request) throws SQLException { WorkCenterMgr workCenterMgr = (WorkCenterMgr) this.getManagerFromSession(request); String serial = actionCode.split("-")[2]; if (actionObject.equals("Employee")) { Employee employee = (Employee) Utility.getObject( workCenterMgr.getFindMeta(workCenterMgr.getFoundMode()).getFindList(), serial); if (workCenterMgr.getEntryMode().equals(Constant.WORKER_GROUP)) { workCenterMgr.getCurrentWorkerGroup().setLeader(employee); } else if (workCenterMgr.getEntryMode().equals(Constant.CREATE_WORKER)) { workCenterMgr.getCurrentWorker().setEmployee(employee); workCenterMgr.getCurrentWorkerGroupMeta().refreshDepartment(employee.getEmployeeId()); } } else if (actionObject.equals("WorkerGroup")) { WorkerGroup workerGroup = (WorkerGroup) Utility.getObject( workCenterMgr.getFindMeta(workCenterMgr.getFoundMode()).getFindList(), serial); workCenterMgr.getCurrentWorker().setWorkerGroup(workerGroup); } else if (actionObject.equals("Worker")) { Worker worker = (Worker) Utility.getObject( workCenterMgr.getFindMeta(workCenterMgr.getFoundMode()).getFindList(), serial); workCenterMgr.getCurrentWorking().setWorker(worker); workCenterMgr.getCurrentWorking().getWorkingDetailList().clear(); } else if (actionObject.equals("Assignment")) { WorkingAssignment workingAssignment = (WorkingAssignment) Utility.getObject( workCenterMgr.getFindMeta(workCenterMgr.getFoundMode()).getFindList(), serial); if (workingAssignment != null && !workCenterMgr.getCurrentWorking().isSelected(serial)) { WorkingDetail workingDetail = new WorkingDetail(); workingDetail.setWorkingAssignment(workingAssignment); workingDetail.setSheetQty(workingAssignment.getAssignmentQty()); workCenterMgr.getCurrentWorking().getWorkingDetailList().add(workingDetail); workCenterMgr.getCurrentWorking().setDetailListRowNo(); } } else if (actionObject.equals("Working")) { Working working = (Working) Utility.getObject( workCenterMgr.getFindMeta(workCenterMgr.getFoundMode()).getFindList(), serial); workCenterMgr.setCurrentWorking(working); workCenterMgr.getCurrentWorking().populateWorkingDetailList(); WorkingDetail workingDetail = (WorkingDetail) ((LinkedList) workCenterMgr.getCurrentWorking().getWorkingDetailList()).getFirst(); workCenterMgr .getCurrentWorking() .populateWorker(workCenterMgr, workingDetail.getWorkingAssignment().getWorkerId()); } }
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)); } } }
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 setHttpParameterWorker(HttpServletRequest request, WorkCenterMgr workCenterMgr) { Worker worker = workCenterMgr.getCurrentWorker(); worker.setWorkerNo(request.getParameter("workerNo")); if (request.getParameter("isDisable") != null && request.getParameter("isDisable").equals("Y")) { worker.setDisable(true); } else { worker.setDisable(false); } worker.setDepartment( (SelectionOption) Utility.getObject( workCenterMgr.getCurrentWorkerGroupMeta().getDepartmentList(), request.getParameter("departmentList"))); }