Package edu.uga.galileo.voci.db

Examples of edu.uga.galileo.voci.db.ColumnMetadata


   */
  protected GUIElement createTextGUIElementFromMetadata(String displayName,
      String description, String field, boolean repeatable,
      boolean disabled, boolean isPasswordField) {
    try {
      ColumnMetadata meta = getDBColumnMetadata(variableToColumnName(field));
      GUIElement elem = new GUIElement(displayName, description, field,
          getValueFromVariable(field), (!meta.isNullable()),
          GUIElement.TEXT, meta.getDataSize(), null, repeatable,
          null, disabled, false);
      if (isPasswordField) {
        elem.setPasswordField(true);
      }

      // add min/max values for numeric data types
      if ((meta.getDataType() == ColumnMetadata.INTEGER)
          || (meta.getDataType() == ColumnMetadata.SMALL_INTEGER)) {
        elem.setMaxValue(meta.getNumberMaximum());
        elem.setMinValue(meta.getNumberMinimum());
      } /*
         * else if (meta.getDataType()==ColumnMetadata.TIMESTAMP) {
         * elem.setType(GUIElement.DATE); elem.setMaxLength(30); }
         */

 
View Full Code Here


   */
  protected GUIElement createTextAreaGUIElementFromMetadata(
      String displayName, String description, String field,
      boolean repeatable, boolean disabled, boolean wysiwygable) {
    try {
      ColumnMetadata meta = getDBColumnMetadata(variableToColumnName(field));
      return new GUIElement(displayName, description, field,
          getValueFromVariable(field), (!meta.isNullable()),
          wysiwygable ? GUIElement.WYSIWYG : GUIElement.TEXTAREA,
          getDBColumnMetadata(variableToColumnName(field))
              .getDataSize(), null, repeatable, null, disabled,
          false);
    } catch (NoSuchColumnException e) {
View Full Code Here

      useValue = defaultValue;
    }

    String variableName = variableToColumnName(field);
    try {
      ColumnMetadata meta = getDBColumnMetadata(variableName);
      return new GUIElement(displayName, description, field, useValue,
          (!meta.isNullable()), GUIElement.RADIO, -1, options,
          repeatable, null, disabled, false);
    } catch (NoSuchColumnException e) {
      // this will only happen b/c of a mismatch between variable name
      // and db column name
      Logger.error(e.getMessage(), e);
View Full Code Here

      useValue = defaultValue;
    }

    String variableName = variableToColumnName(field);
    try {
      ColumnMetadata meta = getDBColumnMetadata(variableName);
      return new GUIElement(displayName, description, field, useValue,
          (!meta.isNullable()), GUIElement.SELECT, -1, options,
          repeatable, null, disabled, multiSelect);
    } catch (NoSuchColumnException e) {
      // this will only happen b/c of a mismatch between variable name
      // and db column name
      Logger.error(e.getMessage(), e);
View Full Code Here

      useValue = "on";
    }

    String variableName = variableToColumnName(field);
    try {
      ColumnMetadata meta = getDBColumnMetadata(variableName);
      return new GUIElement(displayName, description, field, useValue,
          (!meta.isNullable()), GUIElement.CHECKBOX, -1, null,
          repeatable, null, disabled, false);
    } catch (NoSuchColumnException e) {
      // this will only happen b/c of a mismatch between variable name
      // and db column name
      Logger.error(e.getMessage(), e);
View Full Code Here

   *             If the variable doesn't validate.
   */
  public void validateString(String variableName, String value)
      throws ValidationException {
    try {
      ColumnMetadata metadata = getDBColumnMetadata(variableToColumnName(variableName));
      if ((value == null) || (value.trim().length() == 0)) {
        if (!metadata.isNullable()) {
          throw new ValidationException("This is a required field.");
        }
      } else {
        // a size of -1 indicates a 'text' datatype for the column, and
        // those types have no practical limit for our purposes
        if ((metadata.getDataSize() != -1)
            && (value.length() > metadata.getDataSize())) {
          throw new ValidationException(
              "Maximum length ("
                  + metadata.getDataSize()
                  + ") exceeded by "
                  + (value.length() - metadata.getDataSize())
                  + " characters.  If that sounds wrong, keep in mind that "
                  + "apostrophes, quotation marks, and ampersands are "
                  + "all converted to an escape sequence of 5-6 characters.");
        }
      }
View Full Code Here

   *             If the variable doesn't validate.
   */
  public void validateTimestamp(String variableName, String value)
      throws ValidationException {
    try {
      ColumnMetadata metadata = getDBColumnMetadata(variableToColumnName(variableName));
      if ((value == null) || (value.trim().length() == 0)) {
        if (!metadata.isNullable()) {
          throw new ValidationException("This is a required field.");
        }
      } else {
        if ((value != null)
            && (!(Pattern
View Full Code Here

   *             If the variable doesn't validate.
   */
  public void validateInteger(String variableName, Integer value)
      throws ValidationException {
    try {
      ColumnMetadata metadata = getDBColumnMetadata(variableToColumnName(variableName));
      if (value == null) {
        if (!metadata.isNullable()) {
          throw new ValidationException("This is a required field.");
        }
      } else {
        if ((value < metadata.getNumberMinimum())
            || (value > metadata.getNumberMaximum())) {
          throw new ValidationException(
              "Values falls outside of acceptable range ("
                  + metadata.getNumberMinimum() + " to "
                  + metadata.getNumberMaximum());
        }
      }
    } catch (NoSuchColumnException e) {
      throw new ValidationException(
          "There's a data problem that must be resolved "
View Full Code Here

TOP

Related Classes of edu.uga.galileo.voci.db.ColumnMetadata

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.