Esempio n. 1
0
  @Override
  protected void init(Form form) {

    StringBuffer buffer = new StringBuffer();

    // Alter table <table_name>
    buffer.append("ALTER TABLE" + SPACE + form.getName() + SPACE);

    // DROP COLUMN <column_name>
    if (status.equals(DROP_STATUS)) {

      buffer.append(status + SPACE + column + SPACE);

    } else {

      // ALTER COULMN <column_name>
      // or ADD <column_name>
      buffer.append(status + SPACE + element.getName() + SPACE);

      // TYPE
      if (status.endsWith(ALTER_STATUS)) buffer.append("type" + SPACE);

      buffer.append(element.getType() + SPACE);

      if (element.getFormLink() != null) {
        buffer.append(
            SPACE
                + ";"
                + SPACE
                + "ALTER"
                + SPACE
                + "TABLE"
                + SPACE
                + form.getName()
                + SPACE
                + "ADD"
                + SPACE
                + "FOREIGN KEY("
                + element.getName()
                + ")"
                + SPACE
                + "REFERENCES"
                + SPACE
                + element.getFormLink().getName()
                + SPACE
                + "(id)");
      }
    } // end else

    // ;
    buffer.append(SEPARATOR_COMMAND);

    statement = buffer.toString();
  }
Esempio n. 2
0
  public String execute() throws Exception {

    form = formService.getForm(formID.intValue());

    egroups = form.getEgroups();

    return SUCCESS;
  }