@Override @Secured({"ROLE_USER"}) @Transactional(readOnly = true) public boolean exist(long id) { LOGGER.debug("Exist computer with id : {}", id); return computerDAO.exists(id); }
@Override @Secured({"ROLE_ADMIN"}) public void create(Computer c) { LOGGER.debug("Create computer : {}", c); if (computerDAO.exists(c.getId())) { throw new IllegalArgumentException("The computer already exists"); } computerDAO.save(c); }
@Override @Secured({"ROLE_ADMIN"}) public void update(Computer c) { LOGGER.debug("Update computer : {}", c); if (c == null) { throw new IllegalArgumentException("You must specify a computer"); } // Check the Computer already exists if (!computerDAO.exists(c.getId())) { throw new IllegalArgumentException("Computer with id " + c.getId() + " not found !"); } computerDAO.save(c); }