コード例 #1
0
  public static Activity multistepActivity() {
    Container.Builder parentContainerBuilder =
        new Container.Builder().children(MULTISTEP_INPUT_CONTAINERS).activeChildIndex(1);

    parentContainerBuilder
        .title("Multistep Form")
        .button(
            new Button.Builder()
                .type(Constants.ButtonTypes.SUBMIT)
                .name("actionButton")
                .label("Submit")
                .value("submit")
                .ordinal(1)
                .build());

    Activity.Builder builder =
        new Activity.Builder()
            .elementType(FlowElementType.START_EVENT)
            .usageType(ActivityUsageType.MULTI_STEP)
            .action(
                ActionType.CREATE,
                new Action(parentContainerBuilder.build(), null, DataInjectionStrategy.NONE))
            .action(
                ActionType.COMPLETE,
                new Action(Start.CONF_CONTAINER, null, DataInjectionStrategy.NONE))
            .action(
                ActionType.VIEW,
                new Action(parentContainerBuilder.build(), null, DataInjectionStrategy.NONE))
            .allowAttachments()
            .allowAny();

    for (Container inputContainer : MULTISTEP_INPUT_CONTAINERS) {
      builder.appendFields(inputContainer.getFields());
    }

    return builder.build();
  }
コード例 #2
0
  public static Activity remoteActivity(Container container, String page) {
    Container.Builder parentContainerBuilder =
        new Container.Builder().children(INPUT_CONTAINERS).activeChildIndex(container.getOrdinal());

    if (container.getOrdinal() == 1) {
      parentContainerBuilder
          .title("FSR")
          .button(
              new Button.Builder()
                  .type(Constants.ButtonTypes.SUBMIT)
                  .name("actionButton")
                  .label("Create")
                  .value("submit")
                  .ordinal(1)
                  .build());
    } else {
      parentContainerBuilder.title("{{BudgetNumber}} for {{ReportPeriod}}");

      if (container.getOrdinal() > 1)
        parentContainerBuilder.button(
            new Button.Builder()
                .type(Constants.ButtonTypes.SUBMIT)
                .name("actionButton")
                .label("Return to Previous Step")
                .value("reject")
                .action(ActionType.REJECT.name())
                .ordinal(1)
                .build());

      parentContainerBuilder
          .button(
              new Button.Builder()
                  .type(Constants.ButtonTypes.SUBMIT)
                  .name("actionButton")
                  .label("Save")
                  .value("save")
                  .action(ActionType.SAVE.name())
                  .ordinal(2)
                  .build())
          .button(
              new Button.Builder()
                  .type(Constants.ButtonTypes.SUBMIT)
                  .name("actionButton")
                  .label("Submit")
                  .value("approve")
                  .action(ActionType.COMPLETE.name())
                  .primary()
                  .ordinal(3)
                  .build());
    }

    Activity.Builder builder =
        new Activity.Builder()
            .elementType(FlowElementType.START_EVENT)
            .usageType(ActivityUsageType.MULTI_PAGE)
            .action(
                ActionType.CREATE,
                new Action(parentContainerBuilder.build(), page, DataInjectionStrategy.REMOTE))
            .action(
                ActionType.COMPLETE,
                new Action(Start.CONF_CONTAINER, page, DataInjectionStrategy.REMOTE))
            .action(
                ActionType.VIEW,
                new Action(parentContainerBuilder.build(), page, DataInjectionStrategy.REMOTE))
            .allowAttachments()
            .allowAny();

    for (int i = 0; i < container.getOrdinal(); i++) {
      Container inputContainer = INPUT_CONTAINERS.get(i);
      builder.appendFields(inputContainer.getFields());
    }

    return builder.build();
  }