Example #1
0
  @Transactional
  @Auditable(actionType = AuditActionType.DELETE)
  public void deleteProject(Integer projectId) throws ParentChildConstraintException {
    Project project;

    project = projectDAO.findById(projectId);

    deleteEmptyAssignments(project);
    LOGGER.debug("Deleting project " + project);
    projectDAO.delete(project);
  }
  private List<Project> fetchProjects(UserCriteria userCriteria) {
    List<Project> projects;
    if (userCriteria.isOnlyActiveProjects()) {
      LOGGER.debug("Fetching only active projects");

      projects = projectDAO.findAllActive();
    } else {
      LOGGER.debug("Fetching all projects");

      projects = projectDAO.findAll();
    }
    return projects;
  }
Example #3
0
  public Project getProject(Integer projectId) throws ObjectNotFoundException {
    Project project = projectDAO.findById(projectId);

    if (project == null) {
      throw new ObjectNotFoundException("Project not found for id " + projectId);
    }

    return project;
  }
Example #4
0
  @Transactional
  @Override
  public Project updateProject(Project project) {
    projectDAO.persist(project);

    validatePMRoles(project);
    assignUsersToDefaultProject(project);

    return project;
  }
  /**
   * Get available projects depended on the userCriteria
   *
   * @param userCriteria
   * @return
   */
  private List<Project> getAvailableProjects(UserCriteria userCriteria) {
    List<Project> projects;

    if (userCriteria.isEmptyCustomers()) {
      projects = fetchProjects(userCriteria);
    } else {
      projects =
          projectDAO.findProjectForCustomers(
              userCriteria.getCustomers(), userCriteria.isOnlyActiveProjects());
    }

    projects = checkForOnlyBillableProjects(userCriteria, projects);

    return projects;
  }
Example #6
0
 @Override
 public List<Project> getActiveProjects() {
   return projectDAO.findAllActive();
 }
Example #7
0
 @Override
 public List<Project> getProjects() {
   return projectDAO.findAll();
 }
Example #8
0
 public List<Project> getProjectManagerProjects(User user) {
   return projectDAO.findActiveProjectsWhereUserIsPM(user);
 }