Package realcix20.classes

Examples of realcix20.classes.XRClass


        JComponent component = null;
       
        Iterator componentExtIter = componentExts.iterator();
        while (componentExtIter.hasNext()) {
            ComponentExt componentExt = (ComponentExt)componentExtIter.next();
            Column column = componentExt.getColumn();
            if ( (column.getTableName().equals(tableName)) && (column.getColumnName().equals(columnName)) ) {
                component = componentExt.getComponent();
                break;
            }
        }
       
View Full Code Here


        JComponent childComponent = super.findComponent("BUD", "PAMOUNT", componentExts);
        super.contactRelationship1_11(component, childComponent);
       
        //initial BUD.CREATEDBY & BUD.LASTCHANGEDBY relationship
        JComponent component1 = super.findComponent("BUD", "CREATEDBY", componentExts);
        Column column1 = super.findColumn("BUD", "CREATEDBY", componentExts);
        JComponent component2 = super.findComponent("BUD", "LASTCHANGEDBY", componentExts);
        Column column2 = super.findColumn("BUD", "LASTCHANGEDBY", componentExts);
        super.initialComponent7Value(component1, column1.getColumnName(), column1.getInputPar(), null);
        super.initialComponent7Value(component2, column2.getColumnName(), column2.getInputPar(), null);
        super.contactRelationship7_7(component1, component2);
        super.contactRelationship7_7(component2, component1);
                   
    }
View Full Code Here

    private void initialItemRelationship() {
       
        //initial BUDM.LCURR & BUD.PLCURR relationship
        JComponent component = super.findComponent("BUD", "PLCURR", componentExts);
        JComponent childComponent = super.findComponent("BUDM", "LCURR", componentExts);
        Column column = super.findColumn("BUDM", "LCURR", componentExts);       
        String sql = column.getInputPar();
        String str = "[BUD.PLCURR]";
        if (sql.indexOf(str) != -1) {
            StringBuffer sb = new StringBuffer(sql);
            sb.replace(sql.indexOf(str), sql.indexOf(str) + str.length(), "?");
            sql = sb.toString();
View Full Code Here

       
        sb.append("SELECT ");
       
        for (int i = 0; i < cdModel.getRowCount(); i++) {
           
            Column column = (Column)cdModel.getValueAt(i, 0);
            if ( (cdModel.getValueAt(i, 1) == null) && (cdModel.getValueAt(i, 2) == null) ) {
                sb.append(column.getTableName() + "." + column.getColumnName() + ",");
            } else if (cdModel.getValueAt(i, 1) != null) {
                Boolean isCount = (Boolean)cdModel.getValueAt(i, 1);
                if (isCount)
                    sb.append("COUNT(" + column.getTableName() + "." + column.getColumnName() + ") AS COUNT_" +
                            column.getTableName() + "_" + column.getColumnName() + ",");
                else {
                    sb.append(column.getTableName() + "." + column.getColumnName() + ",");
                }
            } else if (cdModel.getValueAt(i, 2) != null) {
                Boolean isSum = (Boolean)cdModel.getValueAt(i, 2);
                if (isSum)
                    sb.append("SUM(" + column.getTableName() + "." + column.getColumnName() + ") AS SUM_" +
                            column.getTableName() + "_" + column.getColumnName() + ",");
                else {
                    sb.append(column.getTableName() + "." + column.getColumnName() + ",");
                }
            }
           
        }
        sb.replace(sb.length() - 1, sb.length(), " ");
       
        BaseClass object = container.getObject();
        String basicSQL = object.getBasicSQL();       
        if (basicSQL.indexOf("WHERE") == -1)
            basicSQL = basicSQL.substring(basicSQL.indexOf("FROM"));
        else {
            basicSQL = basicSQL.substring(basicSQL.indexOf("FROM"), basicSQL.indexOf("WHERE"));
        }
        sb.append(basicSQL + " ");
       
        boolean hasWhere = false;
        basicSQL = object.getBasicSQL();
        if (basicSQL.indexOf("WHERE") == -1)
            sb.append("WHERE ");
        else {
            hasWhere = true;
            basicSQL = basicSQL.substring(basicSQL.indexOf("WHERE"));
            sb.append(basicSQL + " AND ");
        }
       
        Vector filters = new Vector();
        Vector andors = new Vector();
        for (int i = 0; i < caModel.getRowCount(); i++) {
           
            if ( (caModel.getValueAt(i, 2) != null) && (!caModel.getValueAt(i, 2).toString().trim().equals("")) ) {
                hasWhere = true;
                String andorString = (String)caModel.getValueAt(i, 0);
                boolean andor = (andorString.equals("AND"));
                andors.add(andor);
                Column column = (Column)caModel.getValueAt(i, 1);
                String filterString = (String)caModel.getValueAt(i, 2);
                filterString = filterString.replaceAll("~", column.getTableName() + "." + column.getColumnName());
                filters.add(filterString);
            }
           
        }
       
        if (hasWhere) {
            //first, add and wheres
            for (int i = 0; i < filters.size(); i++) {
                Boolean andor = (Boolean)andors.get(i);
                if (andor) {
                    String filterString = (String)filters.get(i);
                    sb.append(filterString + " AND ");
                }
            }
            //next, add or wheres
            for (int i = 0; i < filters.size(); i++) {
                Boolean andor = (Boolean)andors.get(i);
                if (!andor) {
                    String filterString = (String)filters.get(i);
                    sb.append(filterString + " OR  ");
                }
            }
        }       
        if (!hasWhere)
            sb.replace(sb.lastIndexOf("WHERE"), sb.lastIndexOf("WHERE") + 5, "");
        else
            sb.replace(sb.length() - 4, sb.length() - 1, "");               
       
        boolean hasGroup = true;
        boolean hasCountOrSum = false;
        for (int i = 0; i < cdModel.getRowCount(); i++) {
           
            if ( (cdModel.getValueAt(i, 1) == null) && (cdModel.getValueAt(i, 2) == null) ) {
            } else if (cdModel.getValueAt(i, 1) != null) {               
                Boolean isCount = (Boolean)cdModel.getValueAt(i, 1);
                if (isCount)
                    hasCountOrSum = true;
            } else if (cdModel.getValueAt(i, 2) != null) {               
                Boolean isSum = (Boolean)cdModel.getValueAt(i, 2);
                if (isSum)
                    hasCountOrSum = true;
            }
           
        }
       
        if (!hasCountOrSum)
            hasGroup = false;
       
        if (hasGroup) {
           
            sb.append("GROUP BY ");
           
            for (int i = 0 ; i < cdModel.getRowCount(); i++) {
               
                Column column = (Column)cdModel.getValueAt(i, 0);
               
                if ( (cdModel.getValueAt(i, 1) == null) && (cdModel.getValueAt(i, 2) == null) ) {
                    sb.append(column.getTableName() + "." + column.getColumnName() + ",");
                } else if (cdModel.getValueAt(i, 1) != null) {
                    Boolean isCount = (Boolean)cdModel.getValueAt(i, 1);
                    if (!isCount)
                        sb.append(column.getTableName() + "." + column.getColumnName() + ",");
                } else if (cdModel.getValueAt(i, 2) != null) {
                    Boolean isSum = (Boolean)cdModel.getValueAt(i, 2);
                    if (!isSum)
                        sb.append(column.getTableName() + "." + column.getColumnName() + ",");
                }
               
            }
           
            sb.replace(sb.length() - 1, sb.length(), " ");
           
        }
       
        boolean hasOrder = false;
        if (coModel.getRowCount() > 0)
            hasOrder = true;
       
        if (hasOrder) {
           
            sb.append("ORDER BY ");
           
            for (int i = 0; i < coModel.getRowCount(); i++) {
               
                Column column = (Column)coModel.getValueAt(i, 0);
                Boolean order = false;
                if (coModel.getValueAt(i, 1) != null)
                    order = (Boolean)coModel.getValueAt(i, 1);
               
                String orderString = "DESC";
                if (order)
                    orderString = "ASC";
               
                int tempRow = findRow(column, container.getColumnDisplayTable());
               
                if ( (cdModel.getValueAt(tempRow, 1) == null) && (cdModel.getValueAt(tempRow, 2) == null) ) {
                    sb.append(column.getTableName() + "." + column.getColumnName() + " " + orderString + ",");
                } else if (cdModel.getValueAt(tempRow, 1) != null) {
                    Boolean isCount = (Boolean)cdModel.getValueAt(tempRow, 1);
                    if (isCount)
                        sb.append("COUNT(" + column.getTableName() + "." + column.getColumnName() + ") " + orderString + ",");
                    else {
                        sb.append(column.getTableName() + "." + column.getColumnName() + " " + orderString + ",");
                        hasGroup = true;
                    }
                } else if (cdModel.getValueAt(tempRow, 2) != null) {
                    Boolean isSum = (Boolean)cdModel.getValueAt(tempRow, 2);
                    if (isSum)
                        sb.append("SUM(" + column.getTableName() + "." + column.getColumnName() + ") " + orderString + ",");
                    else {
                        sb.append(column.getTableName() + "." + column.getColumnName() + " " + orderString + ",");
                        hasGroup = true;
                    }
                }
               
            }
View Full Code Here

            dao.executeUpdate();
           
            //addDisplayColumns
            for (int i = 0; i < cdModel.getRowCount(); i++) {
               
                Column column = (Column)cdModel.getValueAt(i, 0);
               
                dao.update(Resources.INSERT_CLFIELDS_SQL);
                dao.setInt(1, clsId);
                dao.setInt(2, layout);
                dao.setString(3, column.getTableName());
                dao.setString(4, column.getColumnName());
                dao.setInt(5, i + 1);
                dao.setObject(6, cdModel.getValueAt(i, 2));
                dao.setObject(7, cdModel.getValueAt(i, 1));
               
                int tempRow = findRow(column, container.getColumnAllTable());
                String andorString = (String)caModel.getValueAt(tempRow, 0);
                if (andorString.equals("AND"))
                    dao.setObject(8, true);
                else
                    dao.setObject(8,false);
                dao.setObject(9, caModel.getValueAt(tempRow, 2));
               
                tempRow = findRow(column, container.getColumnOrderTable());
                if (tempRow == -1)
                    dao.setObject(10, null);
                else
                    dao.setInt(10, tempRow + 1);
               
                if (tempRow == -1)
                    dao.setObject(11, null);
                else
                    dao.setObject(11, coModel.getValueAt(tempRow, 1));
               
                flag = dao.executeUpdate();
               
                if (!flag) {
                    dao.rollback();
                    dao.setAutoCommit(true);
                    return false;
                }
               
            }
            //addFilterColumns
            for (int i = 0; i < caModel.getRowCount(); i++) {
                Column column = (Column)caModel.getValueAt(i, 1);
                String filterString = (String)caModel.getValueAt(i, 2);
                if ( (filterString != null) && (filterString.trim().length() > 0) ) {                
                    dao.query(Resources.SELECT_CLFIELDS_BY_CLSID_AND_LAYOUT_AND_TABLENAME_AND_COLUMNNAME);
                    dao.setObject(1, clsId);
                    dao.setObject(2, layout);
                    dao.setObject(3, column.getTableName());
                    dao.setObject(4, column.getColumnName());
                    ResultSet rs = dao.executeQuery();
                    boolean displayed = false;
                    try {
                        if (rs.next()) {
                            displayed = true;
                        }
                        rs.close();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    if (!displayed) {
                        dao.update(Resources.INSERT_CLFIELDS_SQL);
                        dao.setInt(1, clsId);
                        dao.setInt(2, layout);
                        dao.setString(3, column.getTableName());
                        dao.setString(4, column.getColumnName());
                        dao.setInt(5, 0);
                        dao.setObject(6, null);
                        dao.setObject(7, null);
                        int tempRow = findRow(column, container.getColumnAllTable());
                        String andorString = (String)caModel.getValueAt(tempRow, 0);
View Full Code Here

            names = new Vector();
            dataValues = new Vector();
           
            Iterator columnIter = object.getColumns().iterator();
            while (columnIter.hasNext()) {
                Column column = (Column)columnIter.next();
                if (column.isItemField())
                    names.add(column);
            }
            names.add("row");
           
            Iterator rowIter = mainRow.getRowSet().getRows().iterator();
            int size = mainRow.getRowSet().getRows().size();

            while (rowIter.hasNext()) {
                Row row = (Row)rowIter.next();
                if ( (isItemRow(row)) && (!row.isDelete()) ) {
                
                    Vector rowDatas = new Vector();
                    columnIter = object.getColumns().iterator();
                    while (columnIter.hasNext()) {
                        Column column = (Column)columnIter.next();
                        if (column.isItemField()) {
                            Cell newCell = ObjectUtil.findNewCell(row, column.getTableName(), column.getColumnName());
                            if (column.isI18N()) {
                                String i18nString = null;
                                if (newCell.getColumnValue() != null)
                                    i18nString = I18NManager.getI18NString(column.getI18nPrefix(), newCell.getColumnValue());
                                if (i18nString != null) {
                                    if (GlobalValueManager.getValue("APPLICATION.ZIC").equals("1")) {
                                        rowDatas.add(i18nString);
                                    } else if (GlobalValueManager.getValue("APPLICATION.ZIC").equals("2")) {
                                        rowDatas.add(newCell.getColumnValue());
View Full Code Here

                DefaultTableModel coModel = (DefaultTableModel)container.getColumnOrderTable().getModel();
                DefaultTableModel caModel = (DefaultTableModel)container.getColumnAllTable().getModel();
               
                if ( (sourceTable == container.getColumnTable()) && (ordinaryTable == container.getColumnDisplayTable()) ) {
                   
                    Column column = (Column)cModel.getValueAt(row, 0);                   
                   
                    Vector rowData = new Vector();
                    rowData.add(column);
                    if (column.isCountble())
                        rowData.add(new Boolean(false));
                    else
                        rowData.add(null);
                    if (column.isSumble())
                        rowData.add(new Boolean(false));
                    else
                        rowData.add(null);
                   
                    cdModel.addRow(rowData);
                   
                    rowData = new Vector();
                    rowData.add(column);
                   
                    cosModel.addRow(rowData);
                   
                    cModel.removeRow(row);
                   
                } else if ( (sourceTable == container.getColumnDisplayTable()) && (ordinaryTable == container.getColumnTable()) ) {
               
                    Column column = (Column)cdModel.getValueAt(row, 0);
                   
                    Vector rowData = new Vector();
                    rowData.add(column);
                   
                    cModel.addRow(rowData);
                   
                    int tempRow = findRow(column, container.getColumnOrderSourceTable());
                    if (tempRow != -1)
                        cosModel.removeRow(tempRow);
                   
                    tempRow = findRow(column, container.getColumnOrderTable());
                    if (tempRow != -1)
                        coModel.removeRow(tempRow);
                   
                    cdModel.removeRow(row);
               
                } else if ( (sourceTable == container.getColumnOrderSourceTable()) && (ordinaryTable == container.getColumnOrderTable()) ) {
                   
                    Column column = (Column)cosModel.getValueAt(row, 0);
                   
                    Vector rowData = new Vector();
                    rowData.add(column);
                    rowData.add(new Boolean(false));
                   
                    coModel.addRow(rowData);
                   
                    cosModel.removeRow(row);
                   
                } else if ( (sourceTable == container.getColumnOrderTable()) && (ordinaryTable == container.getColumnOrderSourceTable()) ) {
                   
                    Column column = (Column)coModel.getValueAt(row, 0);
                   
                    Vector rowData = new Vector();
                    rowData.add(column);
                   
                    cosModel.addRow(rowData);
View Full Code Here

            boolean flag = true;                   
           
            Iterator cellIter = row.getNewCells().iterator();
            while (cellIter.hasNext()) {
                Cell cell = (Cell)cellIter.next();
                Column column = findColumn(object, cell.getTableName(), cell.getColumnName());
                if (column != null) {
                    if ( (column.isPrimaryKey()) && (column.isItemField()) ) {
                        if ( (cell.getColumnValue() == null) ) {
                            flag = false;
                            break;
                        }
                    }
View Full Code Here

       
        DefaultTableModel model = (DefaultTableModel)table.getModel();
       
        for (int i = 0; i < model.getRowCount(); i++) {
           
            Column tempColumn = null;
            if (table.equals(container.getColumnAllTable()))
                tempColumn = (Column)model.getValueAt(i, 1);
            else
                tempColumn = (Column)model.getValueAt(i, 0);
           
View Full Code Here

            return flag;
    }
   
    private Column findColumn(BaseClass object, String tableName, String columnName) {
       
            Column rColumn = null;
       
            Iterator columnIter = object.getColumns().iterator();
            while (columnIter.hasNext()) {
                Column column = (Column)columnIter.next();
                if ( (column.getTableName().equals(tableName)) && (column.getColumnName().equals(columnName)) ) {
                    rColumn = column;
                    break;
                }
            }
           
View Full Code Here

TOP

Related Classes of realcix20.classes.XRClass

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.