Example #1
0
  public void alingMenuChoices(Element element) {
    Node menuNode = getNode(element);

    // empura no input/nomatch para o final da lista

    boolean first = true;
    for (int indexA = 0; indexA < menuNode.getListTarget().size() - 2; indexA++) {
      Node choiceNodeA = menuNode.getListTarget().get(indexA);
      FormEntity formChoiceA = (FormEntity) choiceNodeA.getElement().getData();

      if (formChoiceA.getFormType().getName().equalsIgnoreCase(Constants.FORM_TYPE_NOMATCHINPUT)) {
        int indexB = 0;
        Node choiceNodeB = null;
        if (first) {
          first = false;
          indexB = menuNode.getListTarget().size() - 2;
          choiceNodeB = menuNode.getListTarget().get(indexB);

        } else {
          indexB = menuNode.getListTarget().size() - 1;
          choiceNodeB = menuNode.getListTarget().get(indexB);
        }
        menuNode.getListTarget().set(indexB, choiceNodeA);
        menuNode.getListTarget().set(indexA, choiceNodeB);
        indexA = -1;
      }
    }

    // ordena as choices
    for (int indexA = 0; indexA < menuNode.getListTarget().size(); indexA++) {
      Node choiceNodeA = menuNode.getListTarget().get(indexA);
      FormEntity formChoiceA = (FormEntity) choiceNodeA.getElement().getData();

      if (formChoiceA.getFormType().getName().equalsIgnoreCase(Constants.FORM_TYPE_CHOICE)) {

        for (int indexB = indexA; indexB < menuNode.getListTarget().size(); indexB++) {
          Node choiceNodeB = menuNode.getListTarget().get(indexB);
          FormEntity formChoiceB = (FormEntity) choiceNodeB.getElement().getData();
          if (formChoiceB.getFormType().getName().equalsIgnoreCase(Constants.FORM_TYPE_CHOICE)) {

            if (((ChoiceEntity) formChoiceA.getFormId())
                    .compareTo((ChoiceEntity) formChoiceB.getFormId())
                > 0) {

              menuNode.getListTarget().set(indexB, choiceNodeA);
              menuNode.getListTarget().set(indexA, choiceNodeB);

              indexA = -1;
              break;
            }
          }
        }
      }
    }
  }
Example #2
0
  private boolean validadeFormPromptCollect(FormEntity form) {
    PromptCollectEntity promptCollect = (PromptCollectEntity) form.getFormId();
    boolean error = false;
    String msgErro = "";
    if (promptCollect.getGrammar() == null) {
      error = true;
      msgErro = "Grammar is missing";
    }
    if (promptCollect.getPrompt() == null) {
      if (error) {
        msgErro += " / ";
      }
      error = true;
      msgErro += "Prompt is missing";
    }
    if (promptCollect.getNoInput() == null) {
      if (error) {
        msgErro += " / ";
      }
      error = true;
      msgErro += "NoInput is missing";
    }
    if (promptCollect.getNoMatch() == null) {
      if (error) {
        msgErro += " / ";
      }
      error = true;
      msgErro += "NoMatch is missing";
    }
    form.setFormError(error);
    form.setErrorDescription(msgErro);

    return form.isFormError();
  }
Example #3
0
  private boolean validadeFormMenu(FormEntity form) {
    MenuEntity menu = (MenuEntity) form.getFormId();
    boolean error = false;
    String msgErro = "";
    if (menu.getPrompt() == null) {
      error = true;
      msgErro = "Prompt is missing";
    }
    if (menu.getNoInput() == null) {
      if (error) {
        msgErro += " / ";
      }
      error = true;
      msgErro += "NoInput is missing";
    }
    if (menu.getNoMatch() == null) {
      if (error) {
        msgErro += " / ";
      }
      error = true;
      msgErro += "NoMatch is missing";
    }
    if (menu.getChoices() == null || menu.getChoices().size() == 0) {
      if (error) {
        msgErro += " / ";
      }
      error = true;
      msgErro += "Choices is missing";
    }
    form.setFormError(error);
    form.setErrorDescription(msgErro);

    return form.isFormError();
  }
Example #4
0
 private boolean validadeFormAnnounce(FormEntity form) {
   AnnounceEntity announce = (AnnounceEntity) form.getFormId();
   if (announce.getPrompt() == null) {
     form.setFormError(true);
     form.setErrorDescription("Prompt is missing");
   }
   return form.isFormError();
 }
Example #5
0
 private boolean validadeFormDecision(FormEntity form) {
   DecisionEntity decision = (DecisionEntity) form.getFormId();
   if (decision.getListDecisionChance() == null || decision.getListDecisionChance().size() == 0) {
     form.setFormError(true);
     form.setErrorDescription("Chances is missing");
   }
   return form.isFormError();
 }
Example #6
0
 private boolean validadeFormTransfer(FormEntity form) {
   TransferEntity transfer = (TransferEntity) form.getFormId();
   if (transfer.getTransferRules() == null || transfer.getTransferRules().size() == 0) {
     form.setFormError(true);
     form.setErrorDescription("Transfer Rules is missing");
   }
   return form.isFormError();
 }
Example #7
0
 private boolean validadeFormFlow(FormEntity form) {
   FlowEntity flow = (FlowEntity) form.getFormId();
   if (flow.getFlowName() == null || flow.getFlowName().length() == 0) {
     form.setFormError(true);
     form.setErrorDescription("Flow Name is missing");
   }
   return form.isFormError();
 }
Example #8
0
 private boolean validadeFormOperation(FormEntity form) {
   OperationEntity operation = (OperationEntity) form.getFormId();
   if (operation.getListOperationGroup() == null
       || operation.getListOperationGroup().size() == 0) {
     form.setFormError(true);
     form.setErrorDescription("Operation Group is missing");
   }
   return form.isFormError();
 }