Package evolaris.framework.sys.business.exception

Examples of evolaris.framework.sys.business.exception.InputException


    MessageResources resources = getResources(req);
    long commandEntryId = f.getCommandEntryId();
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    CommandEntry commandEntry = commandEntryManager.getCommandEntry(commandEntryId);
    if (commandEntry == null || !(commandEntry instanceof IterateCommandEntry)){
      throw new InputException(getResources(req).getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"))// may have been deleted
    }
    IterateCommandEntry iterateCommandEntry = (IterateCommandEntry)commandEntry;
    checkAccessRights(req, iterateCommandEntry.getGroup());
    commandEntryManager.evict(iterateCommandEntry)// do not modify in this session yet (might be erroneous)
    f.toEntry(iterateCommandEntry, iterateCommandEntry.getGroup(), locale, session, resources);
View Full Code Here


   * @throws ConfigurationException if invalid group ID
   */
  protected Group groupFromSession(HttpServletRequest req) {
    Object groupIdParameter = req.getSession().getAttribute("groupId");
    if (groupIdParameter == null || !(groupIdParameter instanceof Long)){
      throw new InputException(getResources(req).getMessage(locale, "smssvc.pageNotValidAnymore"),null,"no group ID of type Long found in session.",null);
    }
    long groupId = ((Long)groupIdParameter).longValue();
    GroupManager groupManager = new GroupManager(locale,session);
    Group group = groupManager.getGroup(groupId);
    if (group == null){
View Full Code Here

    InteractionList interactionList = smsDbManager.getInteractionList(interactionListId);
    if(interactionList == null) {
      throw new ConfigurationException("There is no interactionList with id: " + interactionListId + " -> cannot add a new interaction");
    }
    if (!req.isUserInRole(UserManagerBase.ADMINISTRATOR) && (!req.isUserInRole(SmsDbManager.INTERACTION_ADMINISTRATOR) || webUser.getGroup() != interactionList.getGroup())){
      throw new InputException(getResources(req).getMessage(locale, "smssvc.insufficientRights"));
    }   
    LOGGER.debug("interaction list from session: id="+ interactionList.getId() + "; group=`" + interactionList.getGroup().getGroupname() + "`; class=" + interactionList.getClass().getName());
    return interactionList;
  }
View Full Code Here

    long commandEntryId = interactionForm.getCommandEntryId();
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    CommandEntry commandEntry = commandEntryManager.getCommandEntry(commandEntryId);
    if (commandEntry == null){
      throw new InputException(getResources(req).getMessage(locale, "smssvc.InteractionToBeDeletedDoesNotExistAnymore."),"command entry id = " + commandEntryId,null,null)// may have been deleted
    }
    checkAccessRights(req, commandEntry.getGroup());
    commandEntryManager.delete(commandEntry);
    LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": Command Entry #" + commandEntryId + " has been deleted");
View Full Code Here

  protected ActionForward edit(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp) {
    FragmentInteractionEnterOrEditForm fragmentForm = (FragmentInteractionEnterOrEditForm)form;
    MessageResources resources = getResources(req);
    FragmentCommandEntry commandEntry = (FragmentCommandEntry)commandEntryFromRequest(req);
    if(commandEntry == null){
      throw new InputException(resources.getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"));
    }
    checkAccessRights(req, commandEntry.getGroup());
    fragmentForm.initialize(commandEntry, locale, session, getResources(req));
    SmsDbManager smsDbManager = new SmsDbManager(locale,session);
    req.getSession().setAttribute("fragments", smsDbManager.getFragments(groupFromSession(req)));
View Full Code Here

    MessageResources resources = getResources(req);
    long commandEntryId = f.getCommandEntryId();
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    CommandEntry commandEntry = commandEntryManager.getCommandEntry(commandEntryId);
    if (commandEntry == null || !(commandEntry instanceof FragmentCommandEntry)){
      throw new InputException(getResources(req).getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"))// may have been deleted
    }
    FragmentCommandEntry fragmentCommandEntry = (FragmentCommandEntry)commandEntry;
    checkAccessRights(req, fragmentCommandEntry.getGroup());
    commandEntryManager.evict(fragmentCommandEntry)// do not modify in this session yet (might be erroneous)
    f.toEntry(fragmentCommandEntry,fragmentCommandEntry.getGroup(), locale, session, resources);
View Full Code Here

    MessageResources resources = getResources(req);
   
    Long userSetId = userImportForm.getUserSetId();
   
    if(userSetId == null){
      throw new InputException(resources.getMessage(locale, "smssvc.missingUserSetSelection"));
    }
    UserSetManager userSetMgm = new UserSetManager(locale,session);
    UserSet userSet = userSetMgm.getUserSet(userSetId);
   
    if(userSet == null){
      throw new InputException(resources.getMessage(locale, "um.userSetNotFound",userSetId));
    }
   
    checkAccessRights(req, userSet.getGroup());
   
    FormFile csvFile = userImportForm.getCsvFile();
    if (csvFile != null && csvFile.getFileName() != null && csvFile.getFileName().length() != 0){
      try {
        InputStream inputStream = csvFile.getInputStream();
        UserManager userManager = new UserManager(locale,session);
       
        UserImportResult importResult = userManager.importData(inputStream, userImportForm.getCharacterSet(), userImportForm.getDelimiter(),userSet,
            userImportForm.getMergeSelection().equals("userName"),
            userImportForm.getMergeSelection().equals("msisdn"),
            userImportForm.getMergeSelection().equals("personnelNumber"));
        inputStream.close();
       
        req.setAttribute("userImportCounter", importResult.getUsersCreated());
        req.setAttribute("userUpdateCounter", importResult.getUsersUpdated());
        req.setAttribute("userIgnoreCounter", importResult.getUsersIgnored());
        req.setAttribute("userImportErrormessages", importResult.getErrorMessages());
       
      } catch (FileNotFoundException e){
        throw new InputException(resources.getMessage(locale, "um.fileNotFound",csvFile.getFileName()),e);
      } catch (IOException e) {
        throw new InputException(resources.getMessage(locale, "um.couldNotReadFile",csvFile.getFileName()),e);
      }
    } else {
      throw new InputException(resources.getMessage(locale, "um.fileNotFound"));
    }
   

   
    return mapping.findForward("imported");
View Full Code Here

  public ActionForward edit(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp) {
    String msisdnParam = req.getParameter("msisdn");
    SmsSenderManager senderManager = new SmsSenderManager(locale,session);
    Sender sender = senderManager.getSmsSenderByMsisdn(Long.parseLong(msisdnParam));
    if (sender == null) {
      throw new InputException(getResources(req).getMessage(locale, "admin.SenderNotFound",  msisdnParam));
    }
    senderToForm(sender, (SenderEnterOrEditForm)form);
    req.getSession().setAttribute("groupList", new GroupManager(locale,session).getGroups());     
    return mapping.findForward("edit");
  }
View Full Code Here

  public ActionForward modify(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    SenderEnterOrEditForm f = (SenderEnterOrEditForm)form;
    SmsSenderManager senderManager = new SmsSenderManager(locale,session);
    Sender sender = senderManager.getSmsSenderByMsisdn(f.getMsisdn());
    if (sender == null) {
      throw new InputException(getResources(req).getMessage(locale, "admin.SenderNotFound",  f.getMsisdn()));
    }   
    formToSender(f, sender);
    ensureUniqueMSISDN(sender, req);   
    senderManager.modifySmsSender(sender);
    LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": Modified sender `"+ sender.getMsisdn() + "`");
View Full Code Here

      crit.add(Restrictions.ne("id", sender.getId()));
    }
    crit.setProjection(Projections.rowCount());
    Integer count = (Integer)crit.uniqueResult();
    if (count != null && count > 0) {
      throw new InputException(getResources(req).getMessage(locale,"admin.senderMsisdnNotUnique", ""+sender.getMsisdn()));
    }
  }
View Full Code Here

TOP

Related Classes of evolaris.framework.sys.business.exception.InputException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.