Package evolaris.framework.smsservices.business

Examples of evolaris.framework.smsservices.business.CommandEntryManager


  }

  // checks the label of a modified command entry, then forwards to list
  @Override
  protected ActionForward adaptModified(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    CommandEntry commandEntry = commandEntryFromRequest(req, commandEntryManager);
    checkSortLabel(req, commandEntry,interactionListFromSession(req).getCommandEntries());
    return list(mapping,form,req,resp);
  }
View Full Code Here


   * @param sendForm
   * @param group group for template searching
   */
  @SuppressWarnings("unchecked")
  protected void prepareTemplate(HttpServletRequest req, F sendForm,Group group, E exampleEntry) {
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    Set<E> commandEntries = commandEntryManager.getTemplateCommandEntries(group, exampleEntry);
    req.getSession().setAttribute("templates",commandEntries);

    Long selectedTemplateId = sendForm.getTemplateId();
    sendForm.setTemplateId(-1L)// none selected
    if (selectedTemplateId != null && selectedTemplateId != -1){
View Full Code Here

   */
  public ActionForward modify(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp)  {
    FragmentInteractionEnterOrEditForm f = (FragmentInteractionEnterOrEditForm)form;
    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);
    LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": Command Entry with id: " + commandEntryId + " has been modified");
    setCommandEntryInRequest(req, fragmentCommandEntry);
    return mapping.findForward("modified");
  }
View Full Code Here

      throw new InputException(resources.getMessage(locale, "smssvc.labelMustBeProvided"));
    }


    long commandEntryId = breakInteractionEnterOrEditForm.getCommandEntryId();
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    CommandEntry commandEntry = commandEntryManager.getCommandEntry(commandEntryId);
    if (commandEntry == null || !(commandEntry instanceof BreakCommandEntry)){
      throw new InputException(getResources(req).getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"))// may have been deleted
    }

    BreakCommandEntry breakCommandEntry = (BreakCommandEntry)commandEntry;
    checkAccessRights(req, breakCommandEntry.getGroup());
    commandEntryManager.evict(breakCommandEntry)// do not modify in this session yet (might be erroneous)

    breakCommandEntry.setSortLabel(breakInteractionEnterOrEditForm.getSortLabel());
    breakCommandEntry.setResultString(breakInteractionEnterOrEditForm.getResultString().length() == 0?null:breakInteractionEnterOrEditForm.getResultString());
    breakCommandEntry.setTypeOfBreak(breakInteractionEnterOrEditForm.getTypeOfBreak());
    LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": Break  entry #" + commandEntryId + " has been modified to result value: " + breakCommandEntry.getResultString());
View Full Code Here

    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)
   
    upcallCommandEntry.setSortLabel(upcallForm.getSortLabel());
    upcallCommandEntry.setJndiName(upcallForm.getJndiName());
    upcallCommandEntry.setParameter1(upcallForm.getParameter1());
    upcallCommandEntry.setParameter2(upcallForm.getParameter2());
View Full Code Here

  }
 
  private TreeSet<CommandEntry> getSortedCommandEntries(HttpServletRequest req){
    // template selector: first set content from the template, if selected; content will be changed later if not allowed (except destination group, which  has to be checked explicitly)

    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    Set<UpcallCommandEntry> commandEntries = commandEntryManager.getTemplateCommandEntries(groupFromSession(req), new UpcallCommandEntry());
    TreeSet<CommandEntry> sortedCommandEntries = new TreeSet<CommandEntry>(new Comparator<CommandEntry>(){
      public int compare(CommandEntry o1, CommandEntry o2) {
        String leftName = o1.getSortLabel();
        String rightName = o2.getSortLabel();
        if (leftName.startsWith("(") && !rightName.startsWith("(")) {  // "(no template)" first in list
View Full Code Here

    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)
    transferFormValuesIntoCommandEntry(f, contentCommandEntry);
    LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": modified content parser request entry #"+contentCommandEntry.getId());
    setCommandEntryInRequest(req, contentCommandEntry);
    return mapping.findForward("modified");
  }
View Full Code Here

   *      org.apache.struts.action.ActionForm,
   *      javax.servlet.http.HttpServletRequest,
   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    String commandEntryIdParam = req.getParameter("commandEntryId");
    if (commandEntryIdParam == null){
      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);
View Full Code Here

   
    // group assignment is not editable => perform source to destination automatically
    mappingSet.add(new Entry(oldInvocation.getGroup()), new Entry(newInvocation.getGroup()));
   
    // Create duplicated command entries according to the original execution order
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    SortedSet<CommandEntry> newCommandEntries = new TreeSet<CommandEntry>(new CommandEntryManager.CommandEntryComparator());
    Set<CommandEntry> oldCommandEntries = oldInvocation.getCommandEntries();
    SortedSet<CommandEntry> sortedOldCommandEntries = new TreeSet<CommandEntry>(new CommandEntryManager.CommandEntryComparator());
    sortedOldCommandEntries.addAll(oldCommandEntries);
    for (CommandEntry oldCommandEntry : sortedOldCommandEntries) {
      CommandEntryExtender extender = commandEntryManager.createCommandEntryExtender(oldCommandEntry);
      CommandEntry duplicatedCommandEntry = extender.duplicateCommandEntry(newInvocation.getGroup(),mappingSet);
      Set<InteractionList> invocations = new TreeSet<InteractionList>();
      invocations.add(newInvocation);
      duplicatedCommandEntry.setInteractionLists(invocations);
      commandEntryManager.create(duplicatedCommandEntry)// also sets the ID for sorting
      newCommandEntries.add(duplicatedCommandEntry);
    }
    newInvocation.setCommandEntries(newCommandEntries);
    SmsDbManager smsDbManager = new SmsDbManager(locale,session);
    smsDbManager.createInvocation(newInvocation);
View Full Code Here

    SortedSet<CommandEntry> sortedCommandEntries = sortedCommandEntries(event);
    CommandEntry insertCommandEntry = null;
    Long insertId = f.getInsertCommandEntryId();
    int insertionType = f.getInsertionType();
    if (insertId != null && insertId >= 1 && insertionType >= 1){
      CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
      insertCommandEntry = commandEntryManager.getCommandEntry(insertId);
    }
    req.getSession().setAttribute("sortLabel", proposedSortLabel(req, sortedCommandEntries,insertCommandEntry,insertionType));
  }
View Full Code Here

TOP

Related Classes of evolaris.framework.smsservices.business.CommandEntryManager

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.