public EnvironmentRest getSpecific(Integer environmentId) { Environment environment = environmentRepository.queryById(environmentId); if (environment != null) { return toRestModel().apply(environment); } return null; }
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()); }
public void delete(Integer environmentId) { Preconditions.checkArgument( environmentRepository.queryById(environmentId) != null, "Couldn't find environment with id " + environmentId); environmentRepository.delete(environmentId); }