コード例 #1
0
  public static ProjectDTO updateProject(ProjectDTO inputDTO) {
    validateProject(inputDTO);

    // Generate a TmpProject from the input
    TmpProject tmpProject = ProjectManager.generateTmpProject(inputDTO);
    tmpProject.setProjectId(Integer.parseInt(inputDTO.getProjectId()));
    tmpProject.setDateUpdated(new Date());

    // Update the client
    tmpProjectDAO.update(tmpProject);

    // Return the resulting VO
    return ProjectManager.generateProjectDTO(tmpProject);
  }
コード例 #2
0
  public static List<ProjectDTO> getProjectsByUpdateDate(Date updateDate) {
    List<ProjectDTO> projectDTOs = new ArrayList<ProjectDTO>();

    // Collect the projects
    List<TmpProject> tmpProjects = tmpProjectDAO.getTmpProjectsByUpdateDate(updateDate);

    // For each project, collect and map the data
    // TODO: this should be done in a single query
    for (Iterator<TmpProject> iterator = tmpProjects.iterator(); iterator.hasNext(); ) {
      TmpProject tmpProject = iterator.next();
      ProjectDTO projectDTO = ProjectManager.generateProjectDTO(tmpProject);
      projectDTOs.add(projectDTO);
    }
    return projectDTOs;
  }
コード例 #3
0
  public static ProjectDTO addProject(ProjectDTO inputDTO) {
    validateProject(inputDTO);

    // Generate a PathClient from the input
    TmpProject tmpProject = ProjectManager.generateTmpProject(inputDTO);

    // Set Export fields
    tmpProject.setDateCreated(new Date());
    tmpProject.setDateUpdated(new Date());

    // Save the client to allow secondary object generation
    tmpProjectDAO.save(tmpProject);
    inputDTO.setProjectId(tmpProject.getProjectId().toString());

    // Return the resulting VO
    return ProjectManager.generateProjectDTO(tmpProject);
  }
コード例 #4
0
  public static boolean deleteProject(String projectId) {
    TmpProject tmpProject = tmpProjectDAO.getTmpProjectById(Integer.parseInt(projectId));
    tmpProjectDAO.delete(tmpProject);

    return true;
  }
コード例 #5
0
 public static ProjectDTO getProjectById(String projectId) {
   ProjectDTO projectDTO =
       ProjectManager.generateProjectDTO(
           tmpProjectDAO.getTmpProjectById(Integer.parseInt(projectId)));
   return projectDTO;
 }