/**
   * Performs the retrieval of the list with projects with the given status from the persistence. If
   * nothing is found, return an empty list. Return only the entities that are not marked as
   * deleted.
   *
   * @param status the given project status to retrieve it's projects. Should not be null.
   * @return the list of Projects for the given project status found in the persistence. If nothing
   *     is found, return an empty list.
   * @throws IllegalArgumentException if status is null.
   * @throws EntityNotFoundException if status is not found in the persistence.
   * @throws DAOConfigurationException if the configured entityManager is invalid (invalid means
   *     null here).
   * @throws DAOException if any error occurs while performing this operation.
   */
  public List<Project> getProjectsWithStatus(ProjectStatus status)
      throws EntityNotFoundException, DAOException {
    Helper.checkNull(status, "status");
    EntityManager entityManager = Helper.checkEntityManager(getEntityManager());

    try {
      retrieveById(status.getId());
      return Helper.getEntities("status", status, entityManager, QUERY);
    } catch (Exception e) {
      throw Helper.wrapWithDAOException(e, "Failed to get get projects with status.");
    }
  }
예제 #2
0
 /**
  * Failure test case for checkNull.The argument is null so <code>IllegalArgumentException</code>
  * should be thrown.
  */
 @Test(expected = IllegalArgumentException.class)
 public void testCheckNullFailure() {
   Helper.checkNull(null, "null-name");
 }
예제 #3
0
 /**
  * Accuracy test case for checkNull.The argument is not null so <code>IllegalArgumentException
  * </code> should not be thrown.
  */
 @Test
 public void testCheckNull() {
   Helper.checkNull("non-null", "non-null name");
 }