コード例 #1
0
 static String getTypesSQL(@NonNull Container container) {
   StringBuilder builder = new StringBuilder();
   Field[] fields = container.getFields();
   FieldContainer primary = container.getPrimaryField();
   if (primary == null) primary = getPrimaryFieldContainer(container);
   Field primaryField = null;
   if (primary != null) primaryField = primary.getField();
   if (fields != null && fields.length > 0) {
     boolean isFirst = true;
     for (Field f : fields) {
       Ignore ignore = f.getAnnotation(Ignore.class);
       if (ignore != null) {
         LogUtil.d(
             CouSyncDb.TAG,
             CouSyncDb.LOG_HEADER
                 + "ignore field="
                 + f.getName()
                 + " when "
                 + container.getModelName()
                 + "create type column sql");
         continue;
       }
       if (primaryField != null && f.equals(primaryField)) {
         LogUtil.d(
             CouSyncDb.TAG,
             CouSyncDb.LOG_HEADER
                 + "jump primary key field="
                 + f.getName()
                 + " when "
                 + container.getModelName()
                 + "create type column sql");
         continue;
       }
       String typeSql = getTypeString(f);
       if (TextUtils.isEmpty(typeSql)) continue;
       if (isFirst) {
         isFirst = false;
       } else builder.append(Statement.COMMA);
       builder.append(typeSql);
     }
   } else {
     throw new NoFieldException(container.getModelName() + " have no field");
   }
   return builder.toString();
 }
コード例 #2
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();
  }
コード例 #3
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();
  }