@Override public ProjectInfoDAO convertObjectToDAO(ProjectInfo projectInfo) throws PhrescoException { ProjectInfoDAO projectInfoDAO = new ProjectInfoDAO(); projectInfoDAO.setId(projectInfo.getId()); projectInfoDAO.setProjectCode(projectInfo.getProjectCode()); projectInfoDAO.setApplicationInfoIds(createAppInfoIds(projectInfo)); return projectInfoDAO; }
@Override public ProjectInfo convertDAOToObject(ProjectInfoDAO dao, MongoOperations mongoOperation) throws PhrescoException { ProjectInfo projectInfo = new ProjectInfo(); projectInfo.setId(dao.getId()); projectInfo.setProjectCode(dao.getProjectCode()); List<ApplicationInfo> applicationInfos = getApplicationInfos(dao.getApplicationInfoIds(), mongoOperation); if (CollectionUtils.isNotEmpty(applicationInfos)) { projectInfo.setAppInfos(applicationInfos); } return projectInfo; }
private List<String> createAppInfoIds(ProjectInfo projectInfo) { List<ApplicationInfo> appInfos = projectInfo.getAppInfos(); List<String> appInfoIds = new ArrayList<String>(); for (ApplicationInfo applicationInfo : appInfos) { appInfoIds.add(applicationInfo.getId()); } return appInfoIds; }
/* Sharepoint pilotProject json data creation */ public void publishMetaData() throws PhrescoException { ProjectInfo info = new ProjectInfo(); info.setName("PilotSharePoint"); info.setCode("PHR_PilotSharePoint"); info.setDescription(""); info.setApplication("apptype-webapp"); Technology tech = new Technology(); tech.setId("tech-sharepoint"); tech.setName("Sharepoint"); tech.setFrameworks(null); info.setTechnology(tech); info.setPilotProjectUrls(new String[] {"/pilots/tech-sharepoint/0.1/tech-sharepoint-0.1.zip"}); Gson gson = new Gson(); String json = gson.toJson(info); try { FileWriter write = new FileWriter("sharepointJson.pilots"); write.write(json); write.close(); ArtifactInfo aInfo = new ArtifactInfo( PilotProjectManager.PILOT_GROUP, TechnologyTypes.SHAREPOINT, "", "pilots", "0.1"); File artifact = new File("sharepointJson.pilots"); repManager.addArtifact(aInfo, artifact); } catch (IOException e) { throw new PhrescoException(e); } }