/** {@inheritDoc} */ @Override protected boolean beforeSave(User target) { super.beforeSave(target); if (this.getFormType().isNew()) { target.setPassword(MD5SumTool.md5Sum(target.getPassword())); } return true; }
/** {@inheritDoc} */ @Override protected List<ImageCommand> getTableCommands(User entity) { if (entity.getId() == 1L) { // validação simplista para o usuário administrador List<ImageCommand> commands = new ArrayList<ImageCommand>(); commands.add(new ViewCommand(this)); commands.add(new EditCommand(this)); return commands; } return super.getTableCommands(entity); }