Package org.openbravo.model.ad.datamodel

Examples of org.openbravo.model.ad.datamodel.Column


  }

  private String generateEntityPage(Table table, Entity entity) {
    final StringBuilder sb = new StringBuilder();
    for (Property property : entity.getProperties()) {
      final Column column;
      if (property.getColumnName() != null) {
        column = getColumn(table, property.getColumnName());
      } else {
        column = null;
      }

      if (sb.length() > 0) {
        sb.append("\n\n");
      }
      sb.append("|-");
      sb.append("\n|");
      // property name
      sb.append(property.getName() + (property.isId() ? "<sup>*</sup>" : "")
          + (property.isIdentifier() ? "<sup>#</sup>" : ""));
      if (property.isInactive()) {
        sb.append(" '''(inactive)'''");
      }

      sb.append(" || ");

      // table name
      if (column != null) {
        sb.append(getLink("ERP/2.50/Developers_Guide/Database_Model/" + entity.getPackageName()
            + "/" + entity.getTableName() + "#" + column.getName(), column.getDBColumnName()));
      } else {
        sb.append("");
      }

      sb.append(" || ");

      // mandatory
      {
        final StringBuilder constraints = new StringBuilder();
        if (property.isMandatory()) {
          if (constraints.length() > 0) {
            constraints.append("<br/>");
          }
          constraints.append("Mandatory");
        }
        if (property.getMinValue() != null) {
          if (constraints.length() > 0) {
            constraints.append("<br/>");
          }
          constraints.append("Min: " + property.getMinValue());
        }
        if (property.getMaxValue() != null) {
          if (constraints.length() > 0) {
            constraints.append("<br/>");
          }
          System.err.println("Property " + property);
          constraints.append("Max: " + property.getMaxValue());
        }
        if (property.getFieldLength() > 0 && property.getPrimitiveType() == String.class) {
          if (constraints.length() > 0) {
            constraints.append("<br/>");
          }
          constraints.append("Max Length: " + property.getFieldLength());
        }
        sb.append(constraints.toString());
      }
      sb.append(" || ");

      // the type
      if (property.isPrimitive()) {
        sb.append(property.getTypeName());
      } else {
        if (property.isOneToMany()) {
          sb.append("List of ");
        }
        sb.append(getLink("ERP/2.50/Developers_Guide/Reference/Entity_Model/"
            + property.getTargetEntity().getName(), property.getTargetEntity().getName()));
      }

      sb.append(" || ");

      if (column != null && column.getHelpComment() != null) {
        sb.append(column.getHelpComment());
      }
    }
    return sb.toString();
  }
View Full Code Here

TOP

Related Classes of org.openbravo.model.ad.datamodel.Column

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.