/** * @param requestVO * @return */ public FindingsResponseVO addBlankFindings(FindingsRequestVO requestVO) { FindingsResponseVO responseVO = new FindingsResponseVO(); FindingsVO findingsVO = new FindingsVO(); findingsVO.setFindingsId(RoadmapConstants.NEW_ID); findingsVO.setFindingsText(RoadmapConstants.EMPTY_STRING); findingsVO.setImportance(RoadmapConstants.EMPTY_STRING); findingsVO.setFindingsCategoryId(RoadmapConstants.EMPTY_STRING); List<FindingsVO> findingsVOList = CollectionUtil.safe(requestVO.getFindingsList()); findingsVOList.add(findingsVO); responseVO.setProjectId(Long.parseLong(requestVO.getProjectId())); responseVO.setFindingsList(addFindingsGridSelection(findingsVOList)); return responseVO; }
/** * @param requestVO * @return */ @Transactional(propagation = Propagation.REQUIRED) public FindingsResponseVO retrieveFindings(FindingsRequestVO requestVO) { FindingsResponseVO responseVO = new FindingsResponseVO(); Project project = getEntityManager().find(Project.class, Long.parseLong(requestVO.getProjectId())); if (project.getFindings() == null || project.getFindings().isEmpty()) { createInitialFindingsFromInterviews(project); } List<FindingsVO> findingsVOList = new ArrayList<FindingsVO>(); for (Finding finding : CollectionUtil.safe(project.getFindings())) { FindingsVO findingsVO = new FindingsVO(); findingsVO.setFindingsId(String.valueOf(finding.getFindingsId())); findingsVO.setFindingsText(finding.getFindingsText()); findingsVO.setImportance(finding.getImportance()); findingsVO.setFindingsCategoryId( String.valueOf(finding.getFindingsCategory().getFindingsCategoryId())); findingsVOList.add(findingsVO); } this.includeInputParams(findingsVOList); List<OpportunityVO> opportunityVOList = new ArrayList<OpportunityVO>(); for (Opportunity opportunity : CollectionUtil.safe(project.getOpportunities())) { OpportunityVO opportunityVO = new OpportunityVO(); opportunityVO.setOpportunityId(String.valueOf(opportunity.getOpportunityId())); opportunityVO.setOpportunityText(opportunity.getOpportunityText()); opportunityVO.setOpportunityCategoryId( String.valueOf(opportunity.getOpportunityCategory().getOpportunityCategoryId())); opportunityVOList.add(opportunityVO); } responseVO.setProjectId(Long.parseLong(requestVO.getProjectId())); responseVO.setFindingsList(addFindingsGridSelection(findingsVOList)); responseVO.setOpportunityList(addOpportunityGridSelection(opportunityVOList)); responseVO.setCompletedSteps( ProjectRoadmapProgressUtil.getCompletedSteps(getEntityManager(), requestVO.getProjectId())); return responseVO; }