Exemplo n.º 1
0
 public List<Project> getProjectsByNameAndId(final String projectName, final long id) {
   CriteriaQuery<Project> q = criteriaBuilder.createQuery(Project.class);
   Root<Project> p = q.from(Project.class);
   q.where(
       criteriaBuilder.and(
           criteriaBuilder.equal(p.get(Project_.name), projectName),
           criteriaBuilder.notEqual(p.get(Project_.id), id)));
   return crudService.createQuery(q).getResultList();
 }
Exemplo n.º 2
0
 @SuppressWarnings("CPD-START")
 public List<Scenario> getScenariosByName(final long projectId, final String scenarioName) {
   CriteriaQuery<Scenario> q = criteriaBuilder.createQuery(Scenario.class);
   Root<Scenario> s = q.from(Scenario.class);
   q.where(
       criteriaBuilder.and(
           criteriaBuilder.equal(s.get(Scenario_.name), scenarioName),
           criteriaBuilder.equal(s.get(Scenario_.project).get(Project_.id), projectId)));
   return crudService.createQuery(q).getResultList();
 }
Exemplo n.º 3
0
 public List<Project> getProjectsWithName(final String projectName) {
   CriteriaQuery<Project> q = criteriaBuilder.createQuery(Project.class);
   Root<Project> p = q.from(Project.class);
   q.where(criteriaBuilder.equal(p.get(Project_.name), projectName));
   return crudService.createQuery(q).getResultList();
 }
Exemplo n.º 4
0
 public List<Project> getAllSortedAscendingByName() {
   CriteriaQuery<Project> q = criteriaBuilder.createQuery(Project.class);
   Root<Project> p = q.from(Project.class);
   q.orderBy(criteriaBuilder.asc(p.get(Project_.name)));
   return crudService.createQuery(q).getResultList();
 }