Examples of RowInfo


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

  @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

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

      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

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

     * 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

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

     * 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

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

                    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

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

        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

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

    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

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

    }
    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

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

        }
        return (td != null)?td.getFirstRow():null;
    }
   
    public static RowData createRecord(Map<String, Object> inputs, String connName, String table) {
        RowInfo ri = getRowInfo(connName, table);
        inputs = StringUtil.convertKeyToUpperCase(inputs);
       
        StringBuilder insertSQL = new StringBuilder();
        insertSQL.append("INSERT INTO ").append(SqlExpressUtil.getExpandedTableName(connName, table));
        insertSQL.append(" ").append(prepareInsertSQL(ri, inputs));
View Full Code Here

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

       
        return record;
    }
   
    public static int updateRecord(Map<String, Object> inputs, String connName, String table, String restfulId) {
        RowInfo ri = getRowInfo(connName, table);
        inputs = StringUtil.convertKeyToUpperCase(inputs);
       
        StringBuilder updateSQL = new StringBuilder();
        updateSQL.append("UPDATE ").append(SqlExpressUtil.getExpandedTableName(connName, table));
        updateSQL.append(" SET ").append(prepareSetSQL(ri, inputs));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.