Package com.scooterframework.orm.sqldataexpress.object

Examples of com.scooterframework.orm.sqldataexpress.object.RowInfo


    try {
      Map<String, Object> inputs = new HashMap<String, Object>();
      StringBuilder strBuffer = new StringBuilder();
      ColumnInfo ci = null;
      RowInfo ri = home.getRowInfo();
      for (Map.Entry<String, Object> entry : fieldData.entrySet()) {
        String field = entry.getKey();
        if (field == null) continue;

        ci = ri.getColumnInfo(field);
        if (!ri.isValidColumnName(field) || ci.isReadOnly()
            || !ci.isWritable() || ci.isPrimaryKey())
          continue;

        String token = getUniqueToken(field, conditionsSQLData, true);
        strBuffer.append(field).append(" = ?").append(token).append(", ");
View Full Code Here


  @Override
  protected Map<String, Object> getTemplateProperties() {
    Map<String, Object> templateProps = new HashMap<String, Object>();

    List<Map<String, Object>> columns = new ArrayList<Map<String, Object>>();
    RowInfo ri = O.rowInfoOf(recordHome);
    Iterator<ColumnInfo> it = O.columns(recordHome);
    while(it.hasNext()) {
      ColumnInfo ci = it.next();
      String columnName = ci.getColumnName();
        boolean isAuditedColumn = ri.isAuditedForCreateOrUpdate(columnName);
        if (isAuditedColumn) continue;

        if (ci.isAutoIncrement()) continue;

      String columnNameLower = columnName.toLowerCase();
      boolean isRequired = ri.isRequiredColumn(columnName);
        boolean isLongText = ri.isLongTextColumn(columnName, 255);
        boolean isDateColumn = ri.isDateColumn(columnName);
        boolean isTimestampColumn = ri.isTimestampColumn(columnName);
        int size = 80;
        if (isDateColumn || isTimestampColumn) {
          size = 30;
        }
        else if (isLongText) {
View Full Code Here

  @Override
  protected Map<String, Object> getTemplateProperties() {
    Map<String, Object> templateProps = new HashMap<String, Object>();

    List<Map<String, Object>> columns = new ArrayList<Map<String, Object>>();
    RowInfo ri = O.rowInfoOf(recordHome);
    Iterator<ColumnInfo> it = O.columns(recordHome);
    while(it.hasNext()) {
      ColumnInfo ci = (ColumnInfo)it.next();
      String columnName = ci.getColumnName();
        boolean isAuditedColumn = ri.isAuditedForCreateOrUpdate(columnName);
        if (isAuditedColumn) continue;

        if (ci.isAutoIncrement()) continue;

      String columnNameLower = columnName.toLowerCase();
        boolean isPKColumn = ri.isPrimaryKeyColumn(columnName);
        if (!isPKColumn && ci.isAutoIncrement()) continue;
      boolean isRequired = ri.isRequiredColumn(columnName);
        boolean isLongText = ri.isLongTextColumn(columnName, 255);
        boolean isDateColumn = ri.isDateColumn(columnName);
        boolean isTimestampColumn = ri.isTimestampColumn(columnName);
        int size = 80;
        if (isDateColumn || isTimestampColumn) {
          size = 30;
        }
        else if (isLongText) {
View Full Code Here

      if (tableName != null && columnName != null) {
        // find more properties of this column
        TableInfo ti = SqlExpressUtil.lookupTableInfo(udc, tableName);

        // add more properties for this column
        RowInfo header = ti.getHeader();
        int columnIndex = header.getColumnPositionIndex(columnName);

        sqlDataType = header.getColumnSqlDataType(columnIndex);
        sqlDataTypeName = header.getColmnDataTypeName(columnIndex);
        javaClassName = header.getColumnJavaClassName(columnIndex);

        jdbcParam.setSqlDataType(sqlDataType);
        jdbcParam.setSqlDataTypeName(sqlDataTypeName);
        jdbcParam.setJavaClassName(javaClassName);
      } else {
View Full Code Here

     * prepareInsertSQL
     */
  private int prepareInsertSQL(RowData rd, Map<String, Object> outs,
      StringBuilder strBuffer, boolean autoPopulatePrimaryKey,
      boolean changedOnly) {
    RowInfo ri = rd.getRowInfo();
        if (ri == null)
            throw new IllegalArgumentException("Error in prepareInsertSQL: no RowInfo.");

        StringBuilder names = new StringBuilder();
        StringBuilder values = new StringBuilder();
        int maxSize = rd.getSize();
        int positionIndex = 0;
        ColumnInfo ci = null;
        int i = 0;
    for (i = 0; i < maxSize - 1; i++) {
            ci = ri.getColumnInfo(i);
            if (ci.isPrimaryKey() && autoPopulatePrimaryKey) continue;
            if (ci.isReadOnly() || !ci.isWritable()) continue;
            if (changedOnly && !modifiedColumns.contains(ci.getColumnName())) continue;

            names.append(ci.getColumnName()).append(", ");
            values.append("?, ");
            positionIndex = positionIndex + 1;
            outs.put(positionIndex+"", rd.getField(i));
        }

        //the last column: i=maxSize-1
        ci = ri.getColumnInfo(i);
    if (!ci.isReadOnly()
        && ci.isWritable()
        && (!changedOnly || changedOnly
            && modifiedColumns.contains(ci.getColumnName()))) {
            names.append(ci.getColumnName()).append("");
View Full Code Here

     * prepareSetSQL
     */
  private int prepareSetSQL(int startPosition, RowData rd,
      Map<String, Object> outs, StringBuilder strBuffer,
      boolean changedOnly) {
    RowInfo ri = rd.getRowInfo();
        if (ri == null)
            throw new IllegalArgumentException("Error in prepareSetSQL: no RowInfo.");

        int maxSize = rd.getSize();

        int i = 0;
        ColumnInfo ci = null;
    for (i = 0; i < maxSize; i++) {
            ci = ri.getColumnInfo(i);
            if (ci.isReadOnly() || !ci.isWritable() || ci.isPrimaryKey()) continue;
            if (changedOnly && !modifiedColumns.contains(ci.getColumnName())) continue;

            strBuffer.append(ci.getColumnName()).append(" = ?, ");
            outs.put(startPosition + "", rd.getField(i));
View Full Code Here

                    Cursor cursor = sp.getCursor(p.getName(), rs);
                    int cursorWidth = cursor.getDimension();
                   
                    Set<String> allowedColumns = getAllowedColumns(outputFilter, cursor);
                    TableData rt = new TableData();
                    RowInfo newHeader = getFilteredHeaderInfo(allowedColumns, cursor);
                    rt.setHeader(newHeader);
                    returnTO.addTableData(p.getName(), rt);
                   
                    while(rs.next()) {
                        ArrayList<Object> cellValues = new ArrayList<Object>();
View Full Code Here

        return part;
    }

    private String getColumnSqlDataTypeName(String parentKeyName, RowData parent) {
        String sqlDataTypeName = "";
        RowInfo ri = parent.getRowInfo();
        if (ri != null) {
            sqlDataTypeName = ri.getColmnDataTypeName(ri.getColumnPositionIndex(parentKeyName));
        }

        if (sqlDataTypeName != null && !sqlDataTypeName.equals(""))
            sqlDataTypeName = ":" + sqlDataTypeName;
View Full Code Here

    public static List<RowData> getRows(String connName, String table) {
        return getRows(connName, table, null);
    }
   
    public static List<RowData> getRows(String connName, String table, String whereClause) {
    RowInfo ri = getRowInfo(connName, table);

    // prepare inputs map
    Map<String, Object> inputs = new HashMap<String, Object>();
    String processorType = DataProcessorTypes.DIRECT_SQL_STATEMENT_PROCESSOR;
    String processorName = getFinderSql(connName, table);
View Full Code Here

    }
    return (td != null) ? td.getAllRows() : null;
  }
   
    public static RowData getRow(String connName, String table, String restfulId) {
        RowInfo ri = getRowInfo(connName, table);
       
        //prepare inputs map
        Map<String, Object> inputs = new HashMap<String, Object>();
        inputs.put(DataProcessor.input_key_database_connection_name, connName);
        inputs.put("id", restfulId);
View Full Code Here

TOP

Related Classes of com.scooterframework.orm.sqldataexpress.object.RowInfo

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.