@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 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; }