Package evolaris.framework.sys.business.exception

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


  public ActionForward modify(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp)  {
    UpcallInteractionEnterOrEditForm upcallForm = (UpcallInteractionEnterOrEditForm)form;
   
    MessageResources resources = getResources(req);
    if (upcallForm.getSortLabel() == null ||  upcallForm.getSortLabel().equals("")){
      throw new InputException(resources.getMessage(locale, "smssvc.labelMustBeProvided"));
    }
   
    long commandEntryId = upcallForm.getCommandEntryId();
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    CommandEntry commandEntry = commandEntryManager.getCommandEntry(commandEntryId);
    if (commandEntry == null || !(commandEntry instanceof UpcallCommandEntry)){
      throw new InputException(getResources(req).getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"))// may have been deleted
    }
   
    UpcallCommandEntry upcallCommandEntry = (UpcallCommandEntry)commandEntry;
    checkAccessRights(req, upcallCommandEntry.getGroup());
    commandEntryManager.evict(upcallCommandEntry)// do not modify in this session yet (might be erroneous)
View Full Code Here


   * @return  sender object
   */
  protected Sender validSenderFromForm(HttpServletRequest req, SmsSendForm f,Group group) {
    Long senderId = f.getSenderId();
    if (senderId == null || senderId <= 0) {
      throw new InputException(getResources(req).getMessage(locale,"smssvc.noSenderNumberSelected"));
    }
    SmsSenderManager smsSenderManager = new SmsSenderManager(locale,session);
    Sender sender = smsSenderManager.getSmsSenderById(senderId);
    if (!smsSenderManager.isValidForGroup(sender,group)){
      throw new InputException(getResources(req).getMessage(locale,"smssvc.invalidSender"));
    }
    return sender;
  }
View Full Code Here

   
    ContentParserInteractionEnterOrEditForm f = (ContentParserInteractionEnterOrEditForm)form;
   
    MessageResources resources = getResources(req);
    if (f.getSortLabel() == null ||  f.getSortLabel().equals("")){
      throw new InputException(resources.getMessage(locale, "smssvc.labelMustBeProvided"));
    }
   
    ContentParseCommandEntry commandEntry = new ContentParseCommandEntry();
    Group group = groupFromSession(req);
    checkAccessRights(req, group);
View Full Code Here

   
    ContentParserInteractionEnterOrEditForm f = (ContentParserInteractionEnterOrEditForm)form;
   
    MessageResources resources = getResources(req);
    if (f.getSortLabel() == null ||  f.getSortLabel().equals("")){
      throw new InputException(resources.getMessage(locale, "smssvc.labelMustBeProvided"));
    }
       
    long commandEntryId = f.getCommandEntryId();
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    CommandEntry commandEntry = commandEntryManager.getCommandEntry(commandEntryId);
    if (commandEntry == null || !(commandEntry instanceof ContentParseCommandEntry)){
      throw new InputException(getResources(req).getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"))// may have been deleted
    }

    ContentParseCommandEntry contentCommandEntry = (ContentParseCommandEntry)commandEntry;
    checkAccessRights(req, contentCommandEntry.getGroup());
    commandEntryManager.evict(contentCommandEntry)// do not modify in this session yet (might be erroneous)
View Full Code Here

    ContentParserInteractionEnterOrEditForm f = (ContentParserInteractionEnterOrEditForm)form;
   
    ContentParseCommandEntry commandEntry = (ContentParseCommandEntry)commandEntryFromRequest(req);
    if(commandEntry == null){
      MessageResources resources = getResources(req);
      throw new InputException(resources.getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"));
    }
    checkAccessRights(req, commandEntry.getGroup());
   
    f.setCommandEntryId(commandEntry.getId());
    f.setSortLabel(commandEntry.getSortLabel());
View Full Code Here

      throw new BugException("missing command entry id parameter");
    }
    long commandEntryId = Long.parseLong(commandEntryIdParam);
    CommandEntry commandEntry = commandEntryManager.getCommandEntry(commandEntryId);
    if (commandEntry == null){  // command may have been deleted
      throw new InputException(getResources(req).getMessage(locale,"smssvc.commandEntryNotAvailable"));
    }
    LOGGER.info("distributing edit action according to command entry type: " + commandEntry.getClass().getSimpleName());
    req.setAttribute("commandEntryId",commandEntryId);
   
    if (commandEntry instanceof SmsCommandEntry){
View Full Code Here

    SmsInteractionEnterOrEditForm msgForm = (SmsInteractionEnterOrEditForm) form;
    long commandEntryId = msgForm.getCommandEntryId();
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    CommandEntry commandEntry = commandEntryManager.getCommandEntry(commandEntryId);
    if (commandEntry == null || !(commandEntry instanceof SmsCommandEntry)){
      throw new InputException(getResources(req).getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"))// may have been deleted
    }
    SmsCommandEntry smsCommandEntry = (SmsCommandEntry)commandEntry;
    Group group = smsCommandEntry.getGroup();
    checkAccessRights(req, group);
    commandEntryManager.evict(smsCommandEntry)// do not modify in this session yet (might be erroneous)

    String messageText = msgForm.getMessage();
    if (grossSmsMessageLength(messageText) > MAX_MESSAGE_TEXT_LENGTH){
      throw new InputException(getResources(req).getMessage(locale,"smssvc.messageLongerThan450characters"));
    }
    Sender sender = senderFromMsisdn(req, msgForm.getSendingMsisdn(), group);
    SmsTextValidator.checkForValidLatin1AndSmsAllowingPlaceholders(msgForm.getMessage(), locale);
    smsCommandEntry.setSender(sender);
    smsCommandEntry.setTextContent(messageText);
    smsCommandEntry.setDelayInSeconds(msgForm.getDelayInSeconds());
   
    String sortLabel = msgForm.getSortLabel();
    smsCommandEntry.setSortLabel(sortLabel);

    switch (msgForm.getDestinationSelection().intValue()){
      case 1: // message return to sender
        smsCommandEntry.setDestinationContact(0);
        smsCommandEntry.setDestinationUserSet(null);
        smsCommandEntry.setDestinationUser(null);
        smsCommandEntry.setDestinationMsisdn(null);
        break;
      case 2: // contact
        smsCommandEntry.setDestinationContact(1);
        smsCommandEntry.setDestinationUserSet(null);
        smsCommandEntry.setDestinationUser(null);
        smsCommandEntry.setDestinationMsisdn(null);
        break;
      case 4: // message to user set
        smsCommandEntry.setDestinationContact(0);
        Long userSetId = msgForm.getUserSetId();
        if(userSetId.longValue() == -1){
          throw new BugException("illegal user set id: " + userSetId);
        }
        UserSetManager userSetManager = new UserSetManager(locale,session);
        UserSet userSet =  userSetManager.getUserSet(userSetId);
        if (userSet == null && userSetId != -2) {
          throw new ConfigurationException("illegal user set id: " + userSetId);
        }
        smsCommandEntry.setDestinationUserSet(userSet);
        smsCommandEntry.setCurrentUserSetAsDestination(userSetId == -2 ? 1 : 0);       
        smsCommandEntry.setDestinationUser(null);
        smsCommandEntry.setDestinationMsisdn(null);
        break;
      case 5: // message to user
        Long userId = msgForm.getUserId();
        if (userId.longValue() == -1){
          String noUserSelectedString = getResources(req).getMessage(locale,"smssvc.MessageNotSentBecauseNoUserSelected");
          throw new InputException(noUserSelectedString);
        }
        UserManager userManager = new UserManager(locale,session);
        User user = userManager.getUserDetails(userId);
        if (user == null){
          throw new ConfigurationException("illegal user id: " + user);
View Full Code Here

   * @param sendingMsisdnSelection  selected msisdn
   * @param group  group of the command
   */
  private Sender senderFromMsisdn(HttpServletRequest req, String sendingMsisdnSelection, Group group) {
    if (sendingMsisdnSelection == null || sendingMsisdnSelection.startsWith("(")){
      throw new InputException(getResources(req).getMessage(locale,"smssvc.noSenderNumberSelected"));
    }
    long sendingMsisdn = Long.parseLong(sendingMsisdnSelection);
    SmsSenderManager smsSenderManager = new SmsSenderManager(locale,session);
    Sender sender = smsSenderManager.getSmsSenderByMsisdn(sendingMsisdn);
    if (!smsSenderManager.isValidForGroup(sender,group)){
      throw new InputException(getResources(req).getMessage(locale,"smssvc.invalidSender"));
    }
    return sender;
  }
View Full Code Here

    SmsInteractionEnterOrEditForm msgForm = (SmsInteractionEnterOrEditForm) form;

    String messageText = msgForm.getMessage();
    if (grossSmsMessageLength(messageText) > MAX_MESSAGE_TEXT_LENGTH){
      throw new InputException(getResources(req).getMessage(locale,"smssvc.messageLongerThan450characters"));
    }
    SmsCommandEntry smsCommandEntry = new SmsCommandEntry();
    Group group = groupFromSession(req);
    checkAccessRights(req, group);
    Sender sender = senderFromMsisdn(req, msgForm.getSendingMsisdn(), group);
    SmsTextValidator.checkForValidLatin1AndSmsAllowingPlaceholders(msgForm.getMessage(), locale);
    smsCommandEntry.setSender(sender);
    smsCommandEntry.setTextContent(messageText);
    smsCommandEntry.setDelayInSeconds(msgForm.getDelayInSeconds());   

    String sortLabel = msgForm.getSortLabel();
    smsCommandEntry.setSortLabel(sortLabel);
    smsCommandEntry.setGroup(group);

    switch (msgForm.getDestinationSelection().intValue()){
      case 1: // message return to sender
        smsCommandEntry.setDestinationContact(0);
        smsCommandEntry.setDestinationUserSet(null);
        smsCommandEntry.setDestinationMsisdn(null);
        smsCommandEntry.setDestinationUser(null);
        break;
      case 2: // contact
        smsCommandEntry.setDestinationContact(1);
        smsCommandEntry.setDestinationUserSet(null);
        smsCommandEntry.setDestinationMsisdn(null);
        smsCommandEntry.setDestinationUser(null);
        break;
      case 4: // message to user set
        smsCommandEntry.setDestinationContact(0);
        Long userSetId = msgForm.getUserSetId();
        if(userSetId.longValue() == -1){
          throw new BugException("illegal user set id: " + userSetId);
        }
        UserSetManager userSetManager = new UserSetManager(locale,session);
        UserSet userSet =  userSetManager.getUserSet(userSetId);
        if (userSet == null&& userSetId != -2) {
          throw new ConfigurationException("illegal user set id: " + userSetId);
        }
        smsCommandEntry.setDestinationUserSet(userSet);
        smsCommandEntry.setCurrentUserSetAsDestination(userSetId == -2 ? 1 : 0);
        smsCommandEntry.setDestinationMsisdn(null);
        smsCommandEntry.setDestinationUser(null);
        break;
      case 5: // message to user
        smsCommandEntry.setDestinationContact(0);
        Long userId = msgForm.getUserId();
        if (userId.longValue() == -1){
          String noUserSelectedString = getResources(req).getMessage(locale,"smssvc.MessageNotSentBecauseNoUserSelected");
          throw new InputException(noUserSelectedString);
        }
        UserManager userManager = new UserManager(locale,session);
        User user = userManager.getUserDetails(userId);
        if (user == null){
          throw new ConfigurationException("illegal user id: " + user);
View Full Code Here

   */
  public ActionForward createIncludingInteractions(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp)  {
    InvocationEnterOrEditForm f = (InvocationEnterOrEditForm)form;
    Invocation oldInvocation = entryFromDatabase(f.getId());
    if (oldInvocation == null){
      throw new InputException(getResources(req).getMessage(locale, "admin.entryNotAvailable"));
    }
    checkAccessRights(req,oldInvocation.getGroup(),null);
    req.getSession().setAttribute("oldInteractionListId", oldInvocation.getId());
    Set<CommandEntry> commandEntries = oldInvocation.getCommandEntries();
    Invocation editedInvocation = f.toEntry(new Invocation(), locale, session, getResources(req));
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.