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)); } } }
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); } }