@PostConstruct public void init() { receivedStartedProjects = new ArrayList<>(projectSessionBean.getUncompletedStartedProjects()); if (projectSessionBean.getUncompletedStartedProjects() != null) { for (Project p : projectSessionBean.getUncompletedProjects()) { ongoingProjectNos.put(p.getProjectNo(), p.getProjectNo()); } } }
public void onEditRow(RowEditEvent event) { WeldJob w = (WeldJob) event.getObject(); // gives me unedited value // w.setQuantityWelded(quantityWelded); projectSessionBean.conductWeldJobMerge(w); Project p = projectSessionBean.getProjectByProjectNo(w.getProjectNo()).get(0); double partialWeldJob = 0, totalWeldJob = 0; for (int i = 0; i < p.getWeldJobs().size(); i++) { partialWeldJob += w.getSurfaceArea() * w.getQuantityWelded(); totalWeldJob += w.getSurfaceArea() * w.getTotalQuantity(); } int percent = (int) ((partialWeldJob / totalWeldJob) * 100); p.setProjectProgress(percent); projectSessionBean.conductProjectMerge(p); }
public void filterByProjectNo() { receivedProjectByProjectNo = new ArrayList<>(projectSessionBean.getProjectByProjectNo(selectedProjectNo)); if (!receivedProjectByProjectNo.isEmpty()) { selectedProject = receivedProjectByProjectNo.get(0); } }