Package evolaris.framework.smsservices.datamodel

Examples of evolaris.framework.smsservices.datamodel.CommandEntry


  // 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,eventFromSession(req).getCommandEntries());
    return list(mapping,form,req,resp);
  }
View Full Code Here


   */
  public ActionForward modify(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp)  {
    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();
View Full Code Here

      // description shows first command entry; "..." if more are available; empty comments at the beginning are ignored
      String description = noInteractionsString;
      SortedSet<CommandEntry> sortedCommandEntries = CommandEntryManager.sortedCommandEntries(event.getCommandEntries());
      Iterator<CommandEntry> iterator = sortedCommandEntries.iterator();
      while (iterator.hasNext()){
        CommandEntry commandEntry = iterator.next();
        if (commandEntry instanceof CommentCommandEntry){
          String commentDescription = ((CommentCommandEntry)commandEntry).getDescription();
          if (commentDescription != null){
            description = "(" + commentDescription + ")";
            break;
View Full Code Here

    }


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

    CommentCommandEntry commentCommandEntry = (CommentCommandEntry)commandEntry;
View Full Code Here

   * @see evolaris.platform.smssvc.web.action.InteractionListBaseAction#adaptCreated(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
   */
  @Override
  protected ActionForward adaptCreated(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    CommandEntry commandEntry = commandEntryFromRequest(req, commandEntryManager);
    checkSortLabel(req, commandEntry,commandEntryManager.getTemplateCommandEntries(getCurrentGroup(req), null));
    // set template flag
    commandEntry.setUseAsTemplate(1);
    commandEntryManager.modify(commandEntry);
    LOGGER.info("set template flag in command entry #" + commandEntry.getId());
    //return list(mapping,form,req,resp);
    return mapping.findForward("reload")// reload to avoid re-post of form when admin changes group
  }
View Full Code Here

   * @see evolaris.platform.smssvc.web.action.InteractionListBaseAction#adaptCreated(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
   */
  @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,commandEntryManager.getTemplateCommandEntries(getCurrentGroup(req), null));
    //return list(mapping,form,req,resp);
    return mapping.findForward("reload")// reload to avoid re-post of form when admin changes group
  }
View Full Code Here

    }


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

    InteractionLogCommandEntry interactionLogCommandEntry = (InteractionLogCommandEntry)commandEntry;
View Full Code Here

    }


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

    ImageRecognitionCommandEntry commentCommandEntry = (ImageRecognitionCommandEntry)commandEntry;
View Full Code Here

    EventParameters eventParameters = dummyEventParametersForList(req);
    SortLabel breakLabel = null;
    SortLabel loopLabel = null;
    SortLabel contactAssignLabel = null;
    List<DisplayableInteractionContent> interactionList = new ArrayList<DisplayableInteractionContent>();
    CommandEntry previousCommandEntry = null;
    Map<Integer, CommandEntryExtender> commandMap = new HashMap<Integer, CommandEntryExtender>();
    Set<String> labelsUsedForCondition = new HashSet<String>();
    ResourceBundle messages = ResourceBundle.getBundle("SmsServices", locale);
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
   
    for (CommandEntry commandEntry : sortedCommandEntries) {
      List<DisplayableInteractionContent> nestedInteractionList = null;
      CommandEntryExtender<?> commandEntryExtender = commandEntryManager.createCommandEntryExtender(commandEntry);
      String toolTipKey = commandEntryExtender.getTooltipKey();
      DisplayableInteractionContent interaction = new DisplayableInteractionContent();
      interaction.setToolTip(messages.getString(toolTipKey));
      interaction.setComment(commandEntry instanceof CommentCommandEntry);       
      interaction.setCommandEntry(commandEntry);
      SortLabel sortLabel = new SortLabel(commandEntry.getSortLabel());
      interaction.setSortLabel(sortLabel);
      interaction.setSortLabelStack(sortLabelStack);
      interaction.setSortLabelDescription(sortLabelStack.stringRepresentation(sortLabel));
      interaction.setEditable(sortLabelStack.isEmpty());
      interaction.setInteractionDescription(commandEntryExtender.readableCommandDescription(req));
      if (commandEntry instanceof FragmentCommandEntry){
        interaction.setFragment(!expandFragments);
        interaction.setExpandedFragment(expandFragments);
      }
      int indentation = enclosingIndentation + sortLabel.branchLevel();
      interaction.setIndentation(indentation)// statements are indented according to the label depth
      commandMap.put(interaction.getIndentation(), commandEntryExtender);
      boolean withinLoop = listWithinLoop || loopLabel != null && sortLabel.nestedIn(loopLabel,"a");
      boolean contactAvailable = contactAvailableWithinList || contactAssignLabel != null && sortLabel.nestedIn(contactAssignLabel,"a");
              
      // check for illegal sort label continuation
      if (!sortLabel.isAllowedAfter(previousCommandEntry != null ? new SortLabel(previousCommandEntry.getSortLabel()) : null)) {
        // if label is not allowed  here we set an error for the label
        // but add it nevertheless to the list. Conditions and other stuff is ignored,
        // also it is not used as the previous entry but the old previous entry is kept.
        interaction.setError(true);
        interaction.setErrorDescription(messages.getString("smssvc.labelNotAllowedHere"));
        interactionList.add(interaction);
        continue;
      }

      // check for interactions after break
      if (breakLabel != null && !(commandEntry instanceof CommentCommandEntry) && sortLabel.follows(breakLabel)){
        interaction.setError(true);
        interaction.setErrorDescription(messages.getString("smssvc.UnreachableInteraction"));
      } else if (commandEntry instanceof BreakCommandEntry){
        breakLabel = sortLabel;
      }
     
      // add operation prefix to interaction log descriptions and check for empty operation values unless the list is a fragment
      if (commandEntry instanceof InteractionLogCommandEntry){
        InteractionLogCommandEntry interactionLogCommandEntry = (InteractionLogCommandEntry)commandEntry;
        if (!interaction.isError() && !isFragment && operationPrefix == null && interactionLogCommandEntry.getOperation() == null){
          interaction.setError(true);
          interaction.setErrorDescription(messages.getString("smssvc.OperationValueMissing"));
        }
        interaction.setInteractionDescription(((InteractionLogCommandEntryExtender) commandEntryExtender).readableCommandDescription(req,operationPrefix));
      }
     
      // expand and check fragments and include if required
      if (commandEntry instanceof FragmentCommandEntry){
        FragmentCommandEntry fragmentCommandEntry = (FragmentCommandEntry)commandEntry;
        Fragment fragment = fragmentCommandEntry.getFragment();
        if (expandFragments){
          interaction.setInteractionDescription(((FragmentCommandEntryExtender) commandEntryExtender).readableCommandDescription(req,false))// do not show operation prefix, because it will be visible in the embedded entries
        }
        SortedSet<CommandEntry> sortedFragmentCommandEntries = CommandEntryManager.sortedCommandEntries(fragment.getCommandEntries());
        String addedOperationPrefix = fragmentCommandEntry.getOperationPrefix();
        String combinedOperationPrefix = operationPrefix == null ? addedOperationPrefix : (operationPrefix + (addedOperationPrefix == null ? "" : addedOperationPrefix));
        nestedInteractionList = subInteractionList(req, group, sortedFragmentCommandEntries,isFragment, expandFragments, withinLoop, contactAvailable, combinedOperationPrefix,
            indentation, new SortLabelStack(sortLabelStack,sortLabel));
        if (nestedInteractionList == null){
          if (!interaction.isError()){
            interaction.setError(true);
            interaction.setErrorDescription(ResourceBundle.getBundle("SmsServices", locale).getString("TooManyNestingLevels"));
          }
        } else if (!interaction.isError()){
          if (!expandFragments){  // check for nested errors
            for (DisplayableInteractionContent displayableInteractionContent : nestedInteractionList) {
              if (displayableInteractionContent.isError()){
                interaction.setError(true);
                interaction.setErrorDescription(ResourceBundle.getBundle("SmsServices", locale).getString("ExpandFragmentsToSeeWarningMessages"));
                break;
              }
            }
          }
           if (!interaction.isError()){  // check for last command at base level and  assume branch result, tool tip and assign/parse/break labels
            if (nestedInteractionList.size() >= 1){
              DisplayableInteractionContent lastFragmentInteraction = nestedInteractionList.get(nestedInteractionList.size() - 1);
              if (lastFragmentInteraction != null
                  &&  !(lastFragmentInteraction.getCommandEntry() instanceof IterateCommandEntry)
                  && (lastFragmentInteraction.getSortLabel().branchLevel() == 0)){
                CommandEntry lastFragmentCommandEntry = lastFragmentInteraction.getCommandEntry();
                if (lastFragmentCommandEntry instanceof BreakCommandEntry){
                  breakLabel = sortLabel;
                }
                interaction.setToolTip(lastFragmentInteraction.getToolTip())// behave like last fragment interaction concerning tool tip and conditions
                CommandEntryExtender lastFragmentCommandEntryExtender = commandEntryManager.createCommandEntryExtender(lastFragmentCommandEntry);
View Full Code Here

        return positionLabel + (char)(lastBranchLetters.charAt(0) + 1) + "1";
      }
    }
   
    // find previous/next command entry on the same level; null if none exists
    CommandEntry previousCommandEntry = null;
    CommandEntry nextCommandEntry = null;
    for (Iterator<CommandEntry> iterator = commandEntries.iterator(); iterator.hasNext();) {
      CommandEntry commandEntry = iterator.next();
      if (commandEntry == positionCommandEntry){
        while(iterator.hasNext()){
          commandEntry = iterator.next();
          if (CommandEntryManager.sortLabelPrefix(commandEntry.getSortLabel()).equals(positionPrefix)){
            nextCommandEntry = commandEntry;
            break;
          }
        }
        break;
      }
      if (CommandEntryManager.sortLabelPrefix(commandEntry.getSortLabel()).equals(positionPrefix)){
        previousCommandEntry = commandEntry;  // candidate for previous command entry
      }
    }
   
    // insert before position label
View Full Code Here

TOP

Related Classes of evolaris.framework.smsservices.datamodel.CommandEntry

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.