Esempio n. 1
0
 public void update(Integer id, EnvironmentRest environmentRest) {
   Preconditions.checkArgument(id != null, "Id must not be null");
   Preconditions.checkArgument(
       environmentRest.getId() == null || environmentRest.getId().equals(id),
       "Entity id does not match the id to update");
   environmentRest.setId(id);
   Environment license = environmentRepository.queryById(environmentRest.getId());
   Preconditions.checkArgument(
       license != null, "Couldn't find environment with id " + environmentRest.getId());
   environmentRepository.save(environmentRest.toEnvironment());
 }
Esempio n. 2
0
 public EnvironmentRest getSpecific(Integer environmentId) {
   Environment environment = environmentRepository.queryById(environmentId);
   if (environment != null) {
     return toRestModel().apply(environment);
   }
   return null;
 }
Esempio n. 3
0
 public List<EnvironmentRest> getAll(
     int pageIndex, int pageSize, String sortingRsql, String query) {
   Predicate<Environment> rsqlPredicate =
       rsqlPredicateProducer.getPredicate(Environment.class, query);
   PageInfo pageInfo = pageInfoProducer.getPageInfo(pageIndex, pageSize);
   SortInfo sortInfo = sortInfoProducer.getSortInfo(sortingRsql);
   return nullableStreamOf(
           environmentRepository.queryWithPredicates(pageInfo, sortInfo, rsqlPredicate))
       .map(toRestModel())
       .collect(Collectors.toList());
 }
Esempio n. 4
0
 public void delete(Integer environmentId) {
   Preconditions.checkArgument(
       environmentRepository.queryById(environmentId) != null,
       "Couldn't find environment with id " + environmentId);
   environmentRepository.delete(environmentId);
 }
Esempio n. 5
0
 public Integer store(EnvironmentRest environmentRest) {
   Preconditions.checkArgument(environmentRest.getId() == null, "Id must be null");
   return environmentRepository.save(environmentRest.toEnvironment()).getId();
 }