Examples of CommandEntryManager


Examples of evolaris.framework.smsservices.business.CommandEntryManager

   * checks label and lists
   * @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

Examples of evolaris.framework.smsservices.business.CommandEntryManager

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


    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;
    checkAccessRights(req, interactionLogCommandEntry.getGroup());
    commandEntryManager.evict(interactionLogCommandEntry)// do not modify in this session yet (might be erroneous)

    evaluateForm(req, interactionLogForm, interactionLogCommandEntry);
    LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": Interaction Log  entry #" + commandEntryId + " has been modified to operation: " + interactionLogCommandEntry.getOperation() + "; parameter: " + interactionLogCommandEntry.getParameter());
    setCommandEntryInRequest(req, interactionLogCommandEntry);
    return mapping.findForward("modified");
View Full Code Here

Examples of evolaris.framework.smsservices.business.CommandEntryManager

      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 ImageRecognitionCommandEntry)){
      throw new InputException(getResources(req).getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"))// may have been deleted
    }

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

    commentCommandEntry.setSortLabel(f.getSortLabel());
    commentCommandEntry.setFolderSuffix(Integer.parseInt(f.getFolderSuffix()));
    LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": comment entry #" + commandEntryId + " has been modified;");
    setCommandEntryInRequest(req, commentCommandEntry);
View Full Code Here

Examples of evolaris.framework.smsservices.business.CommandEntryManager

    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);
                commandMap.put(interaction.getIndentation(), lastFragmentCommandEntryExtender);
                if (!contactAvailable && lastFragmentCommandEntryExtender.assignsContact()){
                  contactAssignLabel = sortLabel;
                }
              }
            }
           }
        }
      }
     
      // check for outer loops and current user set access outside of loops
      if (commandEntry instanceof IterateCommandEntry){
        if (!withinLoop){
          loopLabel = sortLabel;
        }
      } else if (!interaction.isError() && !withinLoop && commandEntryExtender.requiresCurrentUserSet()){
        interaction.setError(true);
        interaction.setErrorDescription(messages.getString("smssvc.AccessedCurrentUserSetIsNotAvailable"));
      }
     
      // check for available contact user; no checks and prefix setting if contact already available
      if (!contactAvailable){  // both contact user assigning interactions return "a" in case of success
        if (!interaction.isError() && commandEntryExtender.requiresContactUser()){
          interaction.setError(true);
          interaction.setErrorDescription(messages.getString("smssvc.AccessedContactMayNotBeAvailable"));
        }
         if (commandEntryExtender.assignsContact()){
           contactAssignLabel = sortLabel;
        }
      }
     
      // check if command not usuable in this list by creating a command entry with the dummy event parameters
      if (!interaction.isError() && eventParameters != null && commandEntryExtender.createCommand(eventParameters, new EventVariables(eventParameters), null) == null){
        interaction.setError(true);
        interaction.setErrorDescription(messages.getString("InteractionNotAllowedInThisInteractionList"));
      }
     
      // add condition entries if appropriate           
      if (previousCommandEntry != null) {       
        String condString = commandEntryManager.getCondition(previousCommandEntry, commandEntry);
        String baseStringRepresentation = sortLabel.getBaseStringRepresentation();
        if (condString != null && !labelsUsedForCondition.contains(baseStringRepresentation)) {
          DisplayableInteractionContent condition = new DisplayableInteractionContent();
          condition.setIndentation(interaction.getIndentation() - 1)// indent one less than statement itself
          condition.setCondition(true);
View Full Code Here

Examples of evolaris.framework.smsservices.business.CommandEntryManager

   */
  public CommandEntry insertionPointFromRequest(HttpServletRequest req,CommandEntry defaultInsertionPoint){
    Object insertionPointIdParameter = req.getAttribute("insertionPointId");
    if (insertionPointIdParameter != null && insertionPointIdParameter instanceof Long){
      long insertionPointId = (Long)insertionPointIdParameter;
      CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
      CommandEntry commandEntry = commandEntryManager.getCommandEntry(insertionPointId);
      if (commandEntry != null){
        return commandEntry;
      }
    }
    return defaultInsertionPoint;
View Full Code Here

Examples of evolaris.framework.smsservices.business.CommandEntryManager

   */
  public ActionForward modify(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp)  {
    AccessCheckInteractionEnterOrEditForm accessCheckForm = (AccessCheckInteractionEnterOrEditForm)form;
    MessageResources resources = getResources(req);
    long commandEntryId = accessCheckForm.getCommandEntryId();
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    CommandEntry commandEntry = commandEntryManager.getCommandEntry(commandEntryId);
    if (commandEntry == null || !(commandEntry instanceof AccessCheckCommandEntry)){
      throw new InputException(getResources(req).getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"))// may have been deleted
    }
    AccessCheckCommandEntry accessCheckCommandEntry = (AccessCheckCommandEntry)commandEntry;
    checkAccessRights(req, accessCheckCommandEntry.getGroup());
    commandEntryManager.evict(accessCheckCommandEntry)// do not modify in this session yet (might be erroneous)
    accessCheckForm.toEntry(accessCheckCommandEntry, accessCheckCommandEntry.getGroup(), locale, session, resources);
    LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": Command Entry with id: " + commandEntryId + " has been modified");
    setCommandEntryInRequest(req, accessCheckCommandEntry);
    return mapping.findForward("modified");
  }
View Full Code Here

Examples of evolaris.framework.smsservices.business.CommandEntryManager

    if (simpleInteractionForm.getSortLabel() == null ||  simpleInteractionForm.getSortLabel().equals("")){
      throw new InputException(resources.getMessage(locale, "smssvc.labelMustBeProvided"));
    }
   
    long commandEntryId = simpleInteractionForm.getCommandEntryId();
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    CommandEntry commandEntry = commandEntryManager.getCommandEntry(commandEntryId);
    if (commandEntry == null || !(commandEntry instanceof SimpleCommandEntry)){
      throw new InputException(getResources(req).getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"))// may have been deleted
    }
   
    SimpleCommandEntry simpleCommandEntry = (SimpleCommandEntry)commandEntry;
    checkAccessRights(req, simpleCommandEntry.getGroup());
    commandEntryManager.evict(simpleCommandEntry)// do not modify in this session yet (might be erroneous)

    simpleCommandEntry.setSimpleCommandEntryType(simpleInteractionForm.getCommandTypeSelection());
    simpleCommandEntry.setSortLabel(simpleInteractionForm.getSortLabel());
    LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": simple command entry with id: " + commandEntryId + " has been modified");
    setCommandEntryInRequest(req, simpleCommandEntry);
View Full Code Here

Examples of evolaris.framework.smsservices.business.CommandEntryManager

   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward modify(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp)  {
    UserSetInteractionEnterOrEditForm f = (UserSetInteractionEnterOrEditForm) form;
    long commandEntryId = f.getCommandEntryId();
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    CommandEntry commandEntry = commandEntryManager.getCommandEntry(commandEntryId);
    if (commandEntry == null || !(commandEntry instanceof UserSetCommandEntry)){
      throw new InputException(getResources(req).getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"))// may have been deleted
    }
    UserSetCommandEntry userSetCommandEntry = (UserSetCommandEntry)commandEntry;
    checkAccessRights(req, userSetCommandEntry.getGroup());
    commandEntryManager.evict(userSetCommandEntry)// do not modify in this session yet (might be erroneous)
   
    UserSetManager userSetManager = new UserSetManager(locale,session);
    UserSet userSet = f.getUserSetId() == -2 ? null : userSetManager.getUserSet(f.getUserSetId());
    if (f.getUserSetId() != -2
      && (userSet == null || userSet.getGroup() != userSetCommandEntry.getGroup())) {
View Full Code Here

Examples of evolaris.framework.smsservices.business.CommandEntryManager

    InteractionListEnterEditDuplicateForm f = (InteractionListEnterEditDuplicateForm)form;
    IL interactionList = entryFromDatabase(f.getId());
    if (interactionList == null){
      throw new InputException(getResources(req).getMessage(locale, "admin.entryNotAvailable"));
    }
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    Set<CommandEntry> commandEntries = interactionList.getCommandEntries();
    for (CommandEntry entry : commandEntries) {
      commandEntryManager.delete(entry);
    }
    SmsDbManager smsDbManager = new SmsDbManager(locale,session);
    smsDbManager.modifyInteractionList(interactionList)// update edited-at attribute to allow recognizing the change
    LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": deleted interactions of interaction list #"+ f.getId());
    delete(mapping,form,req,resp);
View Full Code Here

Examples of evolaris.framework.smsservices.business.CommandEntryManager

   
    // group assignment is not editable => perform source to destination automatically
    mappingSet.add(new Entry(oldTimerEvent.getGroup()), new Entry(newTimerEvent.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 = oldTimerEvent.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(newTimerEvent.getGroup(),mappingSet);
      Set<TimerEvent> timerEvents = new TreeSet<TimerEvent>();
      timerEvents.add(newTimerEvent);
      duplicatedCommandEntry.setTimerEvents(timerEvents);
      commandEntryManager.create(duplicatedCommandEntry)// also sets the ID for sorting
      newCommandEntries.add(duplicatedCommandEntry);
    }
    newTimerEvent.setCommandEntries(newCommandEntries);
    new SmsServiceDbManager(locale,session).createTimerEvent(newTimerEvent);
     return mapping.findForward("duplicated");
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.