@Override
  @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
  public ActionVO findOrAddActionNamedAs(String name) throws CapabilityManagerException {
    ActionVO actionVO = null;
    Action action = null;
    try {
      action = findActionEntityNamed(name);
    } catch (NonExistentEntityException e) {
      LOG.log(Level.WARNING, "Action {0} not found. Creating one", name);
      LOG.log(Level.FINEST, e.getMessage(), e);
      action = new Action();
      action.setName(name);
      try {
        actionDAO.create(action);
        LOG.log(Level.FINE, "Action {0} created.", action);
      } catch (Exception ex) {
        throw new CapabilityManagerException(ex);
      }

    } catch (Exception e) {
      throw new CapabilityManagerException(e);
    }
    try {
      actionVO = SecurityEntityValueObjectConverter.toActionVO(action);
    } catch (Exception ex) {
      throw new CapabilityManagerException(ex);
    }
    return actionVO;
  }
 @Override
 public void removeAction(ActionVO actionToRemove) throws CapabilityManagerException {
   try {
     actionDAO.delete(actionToRemove.getId());
   } catch (Exception e) {
     throw new CapabilityManagerException(e);
   }
 }
 @Override
 public void updateAction(ActionVO actionToUpdate) throws CapabilityManagerException {
   try {
     Action action = SecurityEntityValueObjectConverter.toAction(actionToUpdate);
     actionDAO.update(action);
   } catch (Exception e) {
     throw new CapabilityManagerException(e);
   }
 }
  private Action findActionEntityNamed(String name)
      throws DataAccessException, NonExistentEntityException, MultipleEntityFoundException {
    Action action;
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put(Action.QUERY_PARAM_NAME, name);

    action =
        actionDAO.findUniqueDataUsingNamedQuery(Action.NAMED_QUERY_FIND_ACTION_BY_NAME, parameters);

    return action;
  }
 @Override
 public List<ActionVO> findAllActions() throws CapabilityManagerException {
   List<Action> actions;
   List<ActionVO> actionVOList;
   try {
     actions = actionDAO.findAllData();
     actionVOList = SecurityEntityValueObjectConverter.toActionVOList(actions);
   } catch (Exception e) {
     throw new CapabilityManagerException(e);
   }
   return actionVOList;
 }
 @Override
 public ActionVO createNewAction(ActionVO actionVO) throws CapabilityManagerException {
   ActionVO actionVOToReturn = null;
   try {
     Action action = SecurityEntityValueObjectConverter.toAction(actionVO);
     actionDAO.create(action);
     actionVOToReturn = SecurityEntityValueObjectConverter.toActionVO(action);
     LOG.log(Level.FINE, "action {0} created", actionVOToReturn);
   } catch (Exception e) {
     throw new CapabilityManagerException(e);
   }
   return actionVOToReturn;
 }