Package realcix20.classes.basic

Examples of realcix20.classes.basic.Cell


               
                Vector data = null;
           
                CixFile file = null;
           
                Cell urnsCell = ObjectUtil.findNewCell(mainRow, "P", "URNS");
                Cell urpCell = ObjectUtil.findNewCell(mainRow, "P", "URP");
               
                String stat = "Create New Partner";//other is 'Receive An Invite'
               
                if ( (urnsCell.getColumnValue() == null) || (urpCell.getColumnValue() == null) ||
                        (((String)urnsCell.getColumnValue()).trim().equals("")) ||
                        (((String)urpCell.getColumnValue()).trim().equals("")) ) {
                    stat = "Create New Partner";
                } else {
                    stat = "Receive An Invite";
                }
               
View Full Code Here


                Vector pubKeys = new Vector();
                Vector pas = new Vector();
                while (childRowsIter.hasNext()) {
                    Row childRow = (Row)childRowsIter.next();
                    if (!childRow.isDelete()) {
                        Cell ruserCell = ObjectUtil.findNewCell(childRow, "PA", "RUSER");
                        Cell ruserPaCell = ObjectUtil.findNewCell(childRow, "PA", "RUSERPA");
                       
                        if ( (ruserCell.getColumnValue() != null) && (ruserPaCell.getColumnValue() != null) ) {
                            currentRow++;
                            DAO dao = DAO.getInstance();
                            dao.query(Resources.SELECT_PUBKEY_PRIKEY_FROM_PA_SQL);
                            dao.setObject(1, "ME");
                            dao.setObject(2, ruserCell.getColumnValue());
                            dao.setObject(3, ruserPaCell.getColumnValue());
                            ResultSet rs = dao.executeQuery();
                            try {
                                if (rs.next()) {
                                    if (currentRow == 1) {
                                        pubKey = (PublicKey)rs.getObject("PUBKEY");
                                        priKey = (PrivateKey)rs.getObject("PRIKEY");
                                    }
                                    Cell paCell = ObjectUtil.findNewCell(childRow, "PA", "PA");
                                    pas.add(paCell.getColumnValue());
                                    pubKeys.add(rs.getObject("PUBKEY"));
                                }
                                rs.close();
                            } catch (Exception e) {
                                e.printStackTrace();
View Full Code Here

                Vector urpas = new Vector();
                Vector pas = new Vector();
                while (childRowsIter.hasNext()) {
                    Row childRow = (Row)childRowsIter.next();
                    if (!childRow.isDelete()) {
                        Cell ruserCell = ObjectUtil.findNewCell(childRow, "PA", "RUSER");
                        Cell ruserPaCell = ObjectUtil.findNewCell(childRow, "PA", "RUSERPA");
                       
                        if ( (ruserCell.getColumnValue() != null) && (ruserPaCell.getColumnValue() != null) ) {
                            currentRow++;
                            DAO dao = DAO.getInstance();
                            dao.query(Resources.SELECT_PUBKEY_PRIKEY_FROM_PA_SQL);
                            dao.setObject(1, "ME");
                            dao.setObject(2, ruserCell.getColumnValue());
                            dao.setObject(3, ruserPaCell.getColumnValue());
                            ResultSet rs = dao.executeQuery();
                            try {
                                if (rs.next()) {
                                    if (currentRow == 1) {
                                        pubKey = (PublicKey)rs.getObject("PUBKEY");
                                        priKey = (PrivateKey)rs.getObject("PRIKEY");
                                    }
                                    Cell urpaCell = ObjectUtil.findNewCell(childRow, "PA", "URPA");
                                    Cell paCell = ObjectUtil.findNewCell(childRow, "PA", "PA");
                                    if ( (urpaCell.getColumnValue() != null) && (!((String)urpaCell.getColumnValue()).trim().equals("")) ) {
                                        pubKeys.add(rs.getObject("PUBKEY"));
                                        urpas.add(urpaCell.getColumnValue());
                                        pas.add(paCell.getColumnValue());
                                    }
                                }
                                rs.close();
                            } catch (Exception e) {
                                e.printStackTrace();
View Full Code Here

               
        private String generateCixFileName(Row mainRow, int stat) {
           
                StringBuffer sb = new StringBuffer("");
           
                Cell nsCell = ObjectUtil.findNewCell(mainRow, "P", "NS");
                Cell pCell = ObjectUtil.findNewCell(mainRow, "P", "P");
                java.sql.Date now = new java.sql.Date(System.currentTimeMillis());
                String time = now.toString();
                sb.append(nsCell.getColumnValue() + "_");
                sb.append(pCell.getColumnValue() + "_");
                sb.append(stat + "_");
                sb.append(time);
               
                return sb.toString();
           
View Full Code Here

                Vector values = new Vector();
                for (int i = 1; i < tm.getColumnCount(); i++) {
                    String tableName = tm.getColumn(i).getTableName();
                    String columnName = tm.getColumn(i).getColumnName();
                    Item item = (Item)tm.getValueAt(rowIndex, i);
                    Cell cell = new Cell(tableName, columnName, item.getFactValue());
                    values.add(cell);
                }
                Row selectedRow = new Row(values, container.getCurrentObject().getRowType());
                selectedRows.add(selectedRow);
      }
View Full Code Here

                Vector values = new Vector();
                for (int j = 1; j < tm.getColumnCount(); j++) {
                    String tableName = tm.getColumn(j).getTableName();
                    String columnName = tm.getColumn(j).getColumnName();
                    Item item = (Item)tm.getValueAt(rows[i], j);
                    Cell cell = new Cell(tableName, columnName, item.getFactValue());
                    values.add(cell);
                }
                Row row = new Row(values, container.getCurrentObject().getRowType());             
              int newR = 0;
             
//              make selectedRow 1 as templateRow
                if(i==0){
                  newRow = ObjectUtil.cloneRow(getContainer().getCurrentObject(),row);                 
                    //set child row need added & set new primary key to childRows
                    //get new PrimaryKey R.R , RI.R                   
                    DAO dao = DAO.getInstance();
                    dao.query(Resources.SELECT_MAX_R_FROM_R_SQL);
                    ResultSet rs = dao.executeQuery();
                    try {
                        if (rs.next())
                            newR = rs.getInt(1) + 1;
                        rs.close();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    //remove all
                    newRow.getRowSet().getRows().removeAllElements();                               
                   
                    Cell oldPrimaryKey1Cell = ObjectUtil.findOldCell(newRow, "R", "R");
                    oldPrimaryKey1Cell.setColumnValue(newR);
                    Cell newPrimaryKey1Cell = ObjectUtil.findNewCell(newRow, "R", "R");
                    newPrimaryKey1Cell.setColumnValue(newR);
                    Cell oldPrimaryKey2Cell = ObjectUtil.findOldCell(newRow, "RI", "R");
                    oldPrimaryKey2Cell.setColumnValue(newR);
                    Cell newPrimaryKey2Cell = ObjectUtil.findNewCell(newRow, "RI", "R");
                    newPrimaryKey2Cell.setColumnValue(newR);
                    Cell oldPrimaryKey3Cell = ObjectUtil.findOldCell(newRow, "RI", "RI");
                    oldPrimaryKey3Cell.setColumnValue(1);
                    Cell newPrimaryKey3Cell = ObjectUtil.findNewCell(newRow, "RI", "RI");
                    newPrimaryKey3Cell.setColumnValue(1);

                    //set a new childRow equals to newRow
                    Row newChildRow = ObjectUtil.cloneRow(getContainer().getCurrentObject(), newRow);
                    newRow.getRowSet().getRows().add(newChildRow);                   
                    String ld = (String)ObjectUtil.findNewCell(newChildRow, "RI", "LD").getColumnValue();                   
                    if (ld != null) {
                        String lt = LedgerClass.getLTByLD(ld);
                          if (lt.equals("XVC")) {
                              needRemoveRows.add(newChildRow);
                              isLedgerTypeEqualsXVC = true;
                         } else {
                            Double tamt = (Double)ObjectUtil.findNewCell(newChildRow, "RI", "TAMT").getColumnValue();
                            if (tamt == 0.0) {
                               needRemoveRows.add(newChildRow);
                               isTAmtEqualsZero = true;
                           }
                       }
                     } else {
                        needRemoveRows.add(newChildRow);
                     }
                }else{
                  Row newChildRow = ObjectUtil.cloneRow(getContainer().getCurrentObject(), row);
                    Cell oldPrimaryKey1Cell = ObjectUtil.findOldCell(newChildRow, "R", "R");
                    oldPrimaryKey1Cell.setColumnValue(newR);
                    Cell newPrimaryKey1Cell = ObjectUtil.findNewCell(newChildRow, "R", "R");
                    newPrimaryKey1Cell.setColumnValue(newR);
                    Cell oldPrimaryKey2Cell = ObjectUtil.findOldCell(newChildRow, "RI", "R");
                    oldPrimaryKey2Cell.setColumnValue(newR);
                    Cell newPrimaryKey2Cell = ObjectUtil.findNewCell(newChildRow, "RI", "R");
                    newPrimaryKey2Cell.setColumnValue(newR);
                    Cell oldPrimaryKey3Cell = ObjectUtil.findOldCell(newChildRow, "RI", "RI");
                    oldPrimaryKey3Cell.setColumnValue(i+1);
                    Cell newPrimaryKey3Cell = ObjectUtil.findNewCell(newChildRow, "RI", "RI");
                    newPrimaryKey3Cell.setColumnValue(i+1);                       
                    newRow.getRowSet().getRows().add(newChildRow);
                    needRemoveRows = new Vector();                   
                    String ld = (String)ObjectUtil.findNewCell(newChildRow, "RI", "LD").getColumnValue();                   
                    if (ld != null) {
                        String lt = LedgerClass.getLTByLD(ld);
View Full Code Here

            Vector values = new Vector();
            for (int i = 1; i < tm.getColumnCount(); i++) {
                String tableName = tm.getColumn(i).getTableName();
                String columnName = tm.getColumn(i).getColumnName();
                Item item = (Item)tm.getValueAt(selectedRowNumber, i);
                Cell cell = new Cell(tableName, columnName, item.getFactValue());
                values.add(cell);
            }
            Row selectedRow = new Row(values, container.getCurrentObject().getRowType());
            container.getCurrentObject().loadChilds(selectedRow);           
            Row newRow = ObjectUtil.cloneRow(container.getCurrentObject(), selectedRow);
            //set child row need added & set new primary key to childRows
            //get new PrimaryKey R.R , RI.R
            int newR = 0;
            DAO dao = DAO.getInstance();
            dao.query(Resources.SELECT_MAX_R_FROM_R_SQL);
            ResultSet rs = dao.executeQuery();
            try {
                if (rs.next())
                    newR = rs.getInt(1) + 1;
                rs.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
            Cell oldPrimaryKey1Cell = ObjectUtil.findOldCell(newRow, "R", "R");
            oldPrimaryKey1Cell.setColumnValue(newR);
            Cell newPrimaryKey1Cell = ObjectUtil.findNewCell(newRow, "R", "R");
            newPrimaryKey1Cell.setColumnValue(newR);
            Cell oldPrimaryKey2Cell = ObjectUtil.findOldCell(newRow, "RI", "R");
            oldPrimaryKey2Cell.setColumnValue(newR);
            Cell newPrimaryKey2Cell = ObjectUtil.findNewCell(newRow, "RI", "R");
            newPrimaryKey2Cell.setColumnValue(newR);               
            //set a new childRow equals to newRow
            Row newChildRow = null;
            Iterator rowIter = newRow.getRowSet().getRows().iterator();
            while (rowIter.hasNext()) {
                newChildRow = (Row)rowIter.next();
                if (newChildRow == newRow) {
                    break;                       
                }
                newChildRow = null;
            }

            if (newChildRow != null) {             
                newChildRow = ObjectUtil.cloneRow(getContainer().getCurrentObject(), newRow);
                newRow.getRowSet().getRows().add(newChildRow);
            }           
            newRow.getRowSet().getRows().remove(newRow);
            Vector needRemoveRows = new Vector();
            rowIter = newRow.getRowSet().getRows().iterator();
            boolean isLedgerTypeEqualsXVC = false;
            boolean isTAmtEqualsZero = false;
            while (rowIter.hasNext()) {                   
                Row childRow = (Row)rowIter.next();
                String ld = (String)ObjectUtil.findNewCell(childRow, "RI", "LD").getColumnValue();                   
                if (ld != null) {
                    String lt = LedgerClass.getLTByLD(ld);
                    if (lt.equals("XVC")) {
                        needRemoveRows.add(childRow);
                        isLedgerTypeEqualsXVC = true;
                    } else {
                        Double tamt = (Double)ObjectUtil.findNewCell(childRow, "RI", "TAMT").getColumnValue();
                        if ( (tamt == null) || (tamt == 0.0) ) {
                            needRemoveRows.add(childRow);
                            isTAmtEqualsZero = true;
                        }
                    }
                } else {
                    needRemoveRows.add(childRow);
                }
            }
            Iterator removedRowsIter = needRemoveRows.iterator();
            while (removedRowsIter.hasNext()) {
                Row removedRow = (Row)removedRowsIter.next();
                newRow.getRowSet().getRows().remove(removedRow);
            }
            if (isLedgerTypeEqualsXVC) {
                DialogManager.showMessageDialog(container, TxtManager.getTxt("INFORMATION.LEDGEREQUALSXVC"));
            }
            if (isTAmtEqualsZero) {
                DialogManager.showMessageDialog(container, TxtManager.getTxt("INFORMATION.TAMTEQUALSZERO"));
            }
            int i = 1;
            rowIter = newRow.getRowSet().getRows().iterator();
            while (rowIter.hasNext()) {
                Row childRow = (Row)rowIter.next();
                oldPrimaryKey1Cell = ObjectUtil.findOldCell(childRow, "R", "R");
                oldPrimaryKey1Cell.setColumnValue(newR);
                oldPrimaryKey2Cell = ObjectUtil.findOldCell(childRow, "RI", "R");
                oldPrimaryKey2Cell.setColumnValue(newR);
                Cell oldPrimaryKey3Cell = ObjectUtil.findOldCell(childRow, "RI", "RI");
                oldPrimaryKey3Cell.setColumnValue(i);
                newPrimaryKey1Cell = ObjectUtil.findNewCell(childRow, "R", "R");
                newPrimaryKey1Cell.setColumnValue(newR);
                newPrimaryKey2Cell = ObjectUtil.findNewCell(childRow, "RI", "R");
                newPrimaryKey2Cell.setColumnValue(newR);
                Cell newPrimaryKey3Cell = ObjectUtil.findNewCell(childRow, "RI", "RI");
                newPrimaryKey3Cell.setColumnValue(i);
                i++;
            }
            getContainer().getCurrentObject().getRows().add(newRow);
            new ObjectEdit(getContainer(), getContainer().getCurrentObject(), newRow, "Add");
            getContainer().setEnabled(false);
View Full Code Here

            String childTableName = container.getObject().getChildTableName();
           
            Iterator newCellIter = newRow.getNewCells().iterator();
            Iterator oldCellIter = newRow.getOldCells().iterator();
            try {
                Cell newCell = (Cell)newCellIter.next();
                Cell oldCell = (Cell)oldCellIter.next();
                if (newCell.getTableName().equals(childTableName)) {
                    newCell.setColumnValue(null);
                    oldCell.setColumnValue(null);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
           
            Iterator pkColumnIter = container.getObject().getPkColumns().iterator();
            while (pkColumnIter.hasNext()) {
                Column pkColumn = (Column)pkColumnIter.next();
                if (pkColumn.getTableName().equals(mainTableName)) {
                    Cell childPkOldCell = ObjectUtil.findOldCell(newRow, childTableName, pkColumn.getColumnName());

                    //found
                    if (childPkOldCell != null) {
                        Cell childPkNewCell = ObjectUtil.findNewCell(newRow, childTableName, pkColumn.getColumnName());
                        Cell mainPkNewCell = ObjectUtil.findNewCell(newRow, mainTableName, pkColumn.getColumnName());
                        childPkOldCell.setColumnValue(mainPkNewCell.getColumnValue());
                        childPkNewCell.setColumnValue(mainPkNewCell.getColumnValue());
                    }
                }
            }           
            new ItemEdit(container, container.getObject(), newRow, "Add");
            container.setEnabled(false);
View Full Code Here

                String mainTableName = container.getObject().getMainTableName();
                String childTableName = container.getObject().getChildTableName();
                while (pkColumnIter.hasNext()) {
                    Column pkColumn = (Column)pkColumnIter.next();
                    if (pkColumn.getTableName().equals(mainTableName)) {
                        Cell childPkOldCell = ObjectUtil.findOldCell(selectedRow, childTableName, pkColumn.getColumnName());

                        //found
                        if (childPkOldCell != null) {
                            Cell childPkNewCell = ObjectUtil.findNewCell(selectedRow, childTableName, pkColumn.getColumnName());
                            Cell mainPkNewCell = ObjectUtil.findNewCell(container.getCurrentRow(), mainTableName, pkColumn.getColumnName());
                            childPkOldCell.setColumnValue(mainPkNewCell.getColumnValue());
                            childPkNewCell.setColumnValue(mainPkNewCell.getColumnValue());
                        }
                    }
                }
               
                selectedRow.setModify(true);
View Full Code Here

                Vector rowDatas = (Vector)dataVector.get(selectedRowNumber);
                Row templateRow = (Row)rowDatas.get(rowDatas.size() - 1);
               
                //Create a new row
                Row newRow = ObjectUtil.cloneRow(container.getObject(), templateRow);
                Cell oldPrimaryKeyCell = ObjectUtil.findOldCell(newRow, "RI", "RI");
                Cell newPrimaryKeyCell = ObjectUtil.findNewCell(newRow, "RI", "RI");
                oldPrimaryKeyCell.setColumnValue(null);
                newPrimaryKeyCell.setColumnValue(null);
                container.getCurrentRow().getRowSet().getRows().add(newRow);
                new ItemEdit(container, container.getObject(), newRow, "Edit");
                //container.getCurrentRow().getRowSet().getRows().add(newRow);
                container.setEnabled(false);
               
View Full Code Here

TOP

Related Classes of realcix20.classes.basic.Cell

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.