Examples of SmsInteractionExecutionForm


Examples of evolaris.platform.smssvc.web.form.SmsInteractionExecutionForm

  private static final Logger LOGGER = Logger.getLogger(SmsServiceExecutionAction.class);
 
  @Override
  public ActionForward cancel(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
   
    SmsInteractionExecutionForm executionForm = (SmsInteractionExecutionForm)form;
   
    if(executionForm.getIsDetailView() != null && executionForm.getIsDetailView().equals("true")){
      req.setAttribute("id", executionForm.getId());
      return mapping.findForward("backToServiceInteractionsList");
    } else {
      return mapping.findForward("cancelled");
    }
  }
View Full Code Here

Examples of evolaris.platform.smssvc.web.form.SmsInteractionExecutionForm

   
    return map;
  }
 
  protected ActionForward enter(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    SmsInteractionExecutionForm executionForm = (SmsInteractionExecutionForm)form;
   
    Long invocationId = executionForm.getId();
    SmsDbManager smsDbManager = new SmsDbManager(locale,session);
   
    Invocation invocation = smsDbManager.getInvocation(invocationId);
   
    if (invocation == null){
      throw new InputException(getResources(req).getMessage(locale, "sys.entryNotAvailable"),"id = " + executionForm.getId(),null,null);
    }
   
    req.getSession().setAttribute("invocation", invocation);
   
    Long msisdn = webUser.getMsisdn();
View Full Code Here

Examples of evolaris.platform.smssvc.web.form.SmsInteractionExecutionForm

   
    return mapping.findForward("enter");
  }
 
  public ActionForward send(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    SmsInteractionExecutionForm executionForm = (SmsInteractionExecutionForm)form;
   
    Long invocationId = executionForm.getId();
    SmsDbManager smsDbManager = new SmsDbManager(locale,session);
   
    Invocation invocation = smsDbManager.getInvocation(invocationId);
   
    if (invocation == null){
      throw new InputException(getResources(req).getMessage(locale, "sys.entryNotAvailable"),"id = " + executionForm.getId(),null,null);
    }

    LOGGER.info("processing sms service event #" + executionForm.getId() + " (Keyword: " + invocation.getKeywords() + "; group: " + invocation.getGroup().getGroupname() + ")");
   
    String msisdn = "";
    if(executionForm.getCountryCode() != null && executionForm.getCountryCode().trim().length() >= 1){
      msisdn = executionForm.getCountryCode();
    }

    if(executionForm.getMobileNumber() != null && executionForm.getMobileNumber().trim().length() >= 1){
      msisdn +=  Long.parseLong(executionForm.getMobileNumber()); //the convertion is used to cut the leading zero
    }
     
    // execute the commands 
    Set<CommandEntry> commandEntries = invocation.getCommandEntries();
    // table-driven action evaluation
    UserManager userManager = new UserManager(locale,session);
    User user = userManager.registerUserByMsisdn(Long.parseLong(msisdn), null, invocation.getGroup());
   
    InteractionLogManager interactionLogManager = new InteractionLogManager(locale, session);   
    EventParameters eventParameters = null;
   
    ReceivedSms receivedSms = new ReceivedSms();
    receivedSms.setSender(msisdn);
    receivedSms.setReceiver(invocation.getMsisdn() != null ? Long.toString(invocation.getMsisdn()) : "");
    receivedSms.setOperator("SIMULATOR");
    receivedSms.setContent(executionForm.getMessage());
    receivedSms.setSubject(executionForm.getMmsSubject());
    if (executionForm.getFile() != null && executionForm.getFile().getFileSize() > 0) {
      try {
        receivedSms.setAttachment(new SerialBlob(executionForm.getFile().getFileData()));
        receivedSms.setAttachmentContentType(executionForm.getFile().getContentType());
        receivedSms.setAttachmentName(executionForm.getFile().getFileName());
      } catch (Exception e) {
        LOGGER.error("Creating blob from uploaded file faild.", e);
        throw new BugException("Creating blob from uploaded file faild.", e);
      }
    }
   
    receivedSms.setInvocation(invocation);
    SmsDbManager smsMgr = new SmsDbManager(locale, session);
    smsMgr.writeIncomingMessageLog(receivedSms);
    eventParameters = new SmsEventParameters(locale, session, user, invocation, receivedSms);
    InteractionLog log = new InteractionLog();
    eventParameters.updateInteractionLog(log);
    log.setOperation(InteractionLogManager.EVENT_SMS_SIMULATED);
    log.setParameter(executionForm.getMessage());
    interactionLogManager.writeInteractionLog(log);   
   
    interactionLogManager.writeInteractionLog(log);   
   
    EventVariables eventVariables = new EventVariables(eventParameters);
    MacroCommand macroCommand = new MacroCommand(eventParameters,eventVariables, commandEntries);
    Result result = macroCommand.execute();
   
    LOGGER.debug("command interpretation finished with result: " + result);
   
    if(result.getValue() != null){
      req.setAttribute("result", result.getValue());
    }
   
    // a different redirection will be done depending on the service type
    req.setAttribute("serviceType", InteractionLogManager.EVENT_SMS_SIMULATED);
    if(executionForm.getIsDetailView() != null && executionForm.getIsDetailView().equals("true")){
      req.setAttribute("serviceId", executionForm.getId());
    }
   
    return mapping.findForward("executed");
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.