Пример #1
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();
  }
Пример #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();
  }
Пример #3
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();
 }
Пример #4
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();
 }
Пример #5
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();
 }
Пример #6
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();
 }
Пример #7
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();
 }
Пример #8
0
  public void validateNodes() {
    for (Node node : listNode) {

      FormEntity form = (FormEntity) node.getElement().getData();
      form.setFormError(false);
      form.setErrorDescription("");

      if (form.getFormType().getName().equalsIgnoreCase(Constants.FORM_TYPE_PROMPT_COLLECT)) {
        boolean foundTarget = false;
        for (Node nodeTarget : node.getListTarget()) {
          if (!(nodeTarget
                  .getForm()
                  .getFormType()
                  .getName()
                  .equalsIgnoreCase(Constants.FORM_TYPE_NOINPUT)
              || nodeTarget
                  .getForm()
                  .getFormType()
                  .getName()
                  .equalsIgnoreCase(Constants.FORM_TYPE_NOMATCH))) {
            foundTarget = true;
          }
        }
        if (!foundTarget) {
          form.setFormError(true);
          form.setErrorDescription("Output is mandatory");
          continue;
        }
      }

      FormEntity aux =
          ServicesFactory.getInstance().getFormService().getByName(form.getName(), true);

      if (aux != null && !aux.getId().equals(form.getId())) {
        form.setFormError(true);
        form.setErrorDescription(
            "Name " + form.getName() + " already assigned to another Element in another Flow");
        continue;
      }

      int startFlow = 0;
      boolean stopFlow = false;
      for (Node nodeAux : listNode) {
        FormEntity formAux = (FormEntity) nodeAux.getElement().getData();
        if (!formAux.getId().equalsIgnoreCase(form.getId())
            && formAux.getName().equalsIgnoreCase(form.getName())
            && !(formAux.getFormType().getName().equalsIgnoreCase(Constants.FORM_TYPE_CHOICE)
                || formAux.getFormType().getName().equalsIgnoreCase(Constants.FORM_TYPE_NOINPUT)
                || formAux.getFormType().getName().equalsIgnoreCase(Constants.FORM_TYPE_NOMATCH))) {
          form.setFormError(true);
          form.setErrorDescription(
              "Name " + form.getName() + " already assigned to another Element.");
          continue;
        }
        if (formAux.getFormType().getName().equalsIgnoreCase(Constants.FORM_TYPE_ANSWER)) {
          startFlow++;
        }
        if (formAux.getFormType().getName().equalsIgnoreCase(Constants.FORM_TYPE_DISCONNECT)
            || formAux.getFormType().getName().equalsIgnoreCase(Constants.FORM_TYPE_TRANSFER)
            || formAux.getFormType().getName().equalsIgnoreCase(Constants.FORM_TYPE_RETURN)) {
          stopFlow = true;
        }
      }

      if (validateFormByType(form)) {
        continue;
      }

      if (form.getFormType().getMandatoryInput() == 1 && node.getListSource().size() == 0) {
        form.setFormError(true);
        form.setErrorDescription("Input is mandatory");
        continue;
      }
      if (form.getFormType().getMandatoryOutput() == 1 && node.getListTarget().size() == 0) {
        form.setFormError(true);
        form.setErrorDescription("Output is mandatory");
        continue;
      }
      if (startFlow == 0) {
        form.setFormError(true);
        form.setErrorDescription("You have to start the flow with the node type 'Answer'");
        continue;
      } else if (startFlow > 1) {
        form.setFormError(true);
        form.setErrorDescription("Node type 'Answer' is allowed only ONE per flow");
        continue;
      }

      if (!stopFlow) {
        form.setFormError(true);
        form.setErrorDescription(
            "You have to finish the flow with the node type 'Disconnect', 'Transfer' or 'Return'");
        continue;
      }
    }
  }