Package realcix20.cixfiles

Examples of realcix20.cixfiles.CIXFile


    public ObjectPlugin(Window window, File file) {
       
            this.window = window;           
            this.file = file;
           
            CIXFile cixFile = new CIXFile();
            try {
                cixFile.importFile(file);
                this.cixFile = cixFile;
                analyType();
            } catch (Exception e) {
                DialogManager.showMessageDialog(window, TxtManager.getTxt("PARTNER.IMPORT.NOTVAILDFILE"));
                e.printStackTrace();               
View Full Code Here


                        while (rowIter.hasNext()) {
                            Row childRow = (Row)rowIter.next();                           
                            Cell cCell = findCell(childRow, "PA", "PA");
                            if ( (childRow != getRow()) && (cCell.getColumnValue().equals(pCell.getColumnValue())) ) {
                                CIXFileData data = new CIXFileData(type, getPrivateKey(), childRow);
                                CIXFile cixFile = new CIXFile(getPublicKey(), data);   
                                Random random = new Random();
                                String fileName = "confirm_add_account_" + random.nextInt(25000);
                                cixFile.exportFile(fileName);          
                                String str = TxtManager.getTxt("PARTNER.IMPORT.ADDPARTNER");
                                str = str.replaceAll("%", fileName);
                                DialogManager.showMessageDialog(getWindow(), str);
                                break;
                            }
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                   
                } else if ( (cell != null) && (cell.getColumnValue().equals("ME")) ) {
                   
                    try {
                        KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
                        keyGen.initialize(1024);
                        KeyPair key = keyGen.generateKeyPair();
                       
                        Iterator rowIter = getRow().getRowSet().getRows().iterator();
                        while (rowIter.hasNext()) {
                            Row childRow = (Row)rowIter.next();
                            if (childRow != getRow()) {
                                Cell publicKeyCell = findCell(childRow, "PA", "PUBKEY");
                                Cell privateKeyCell = findCell(childRow, "PA", "PRIKEY");
                                publicKeyCell.setColumnValue(key.getPublic());
                                privateKeyCell.setColumnValue(key.getPrivate());   
                            }
                        }                                          
                       
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                   
                }

            } else if (action.equals("Confirm Add Account Request")) {                              
               
                Cell cell = findCell(getRow(), "P", "NS");
                if ( (cell != null) && (!cell.getColumnValue().equals("ME")) ) {
                   
                    try {                       
                        Iterator rowIter = getRow().getRowSet().getRows().iterator();
                        while (rowIter.hasNext()) {
                            Row childRow = (Row)rowIter.next();
                            if (childRow != getRow()) {
                                Cell publicKeyCell = findCell(childRow, "PA", "PUBKEY");
                                publicKeyCell.setColumnValue(getCixFile().getPublicKey());
                            }
                        }
                       
                        String type = "Re Confirm Add Account";
                        rowIter = getRow().getRowSet().getRows().iterator();                                               
                        Cell pCell = findCell(getRow(), "P", "DEFPA");
                        while (rowIter.hasNext()) {
                            Row childRow = (Row)rowIter.next();                           
                            Cell cCell = findCell(childRow, "PA", "PA");
                            if ( (childRow != getRow()) && (cCell.getColumnValue().equals(pCell.getColumnValue())) ) {
                                CIXFileData data = new CIXFileData(type, getPrivateKey(), childRow);
                                CIXFile cixFile = new CIXFile(getPublicKey(), data);   
                                Random random = new Random();
                                String fileName = "re_confirm_add_account_"+ random.nextInt(25000);                               
                                cixFile.exportFile(fileName);
                                String str = TxtManager.getTxt("PARTNER.IMPORT.CONFIRMADDPARTNER");
                                str = str.replaceAll("%", fileName);
                                DialogManager.showMessageDialog(getWindow(), str);
                               
                                this.cixFile.getData().setType("Used");
                                this.cixFile.exportFile("used_" + getFile().getName().substring(0, getFile().getName().length() - 2));
                                file.delete();
                                break;
                            }
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                   
                }
               
            } else if (action.equals("Re Confirm Add Account")) {
               
                MainView container = (MainView)window;
               
                JTree tree = container.getTree();
               
                Row tRow = cixFile.getData().getRow(cixFile.getPublicKey());
                Cell cell1 = findCell(tRow, "P", "NS");
                Cell cell2 = findCell(tRow, "P", "P");
                Cell cell3 = findCell(tRow, "P", "URNS");
                Cell cell4 = findCell(tRow, "P", "URP");
               
                for (int i = 1; i <= tree.getRowCount(); i++) {
                                                        
                    DefaultMutableTreeNode node = (DefaultMutableTreeNode)tree.getPathForRow(i).getLastPathComponent();
                    if (node != null) {
                        ObjectInfo oj = (ObjectInfo)node.getUserObject();
                        //It's partner class
                        if ( (oj.flag.equals("object")) && (oj.clsId == 250) ) {                           
                            tree.setSelectionPath(tree.getPathForRow(i));
                            //This will be updated
                            Iterator rowIter = container.getCurrentObject().getRows().iterator();
                            boolean findRow = false;
                            while (rowIter.hasNext()) {
                               
                                Row cRow = (Row)rowIter.next();        
                                Cell ccell1 = findCell(cRow, "P", "NS");
                                Cell ccell2 = findCell(cRow, "P", "P");   
                               
                                if ( (ccell1.getColumnValue().equals(cell3.getColumnValue())) && (ccell2.getColumnValue().equals(cell4.getColumnValue())) ) {                                   
                                   
                                    findRow = true;
                                    Iterator childRowIter = cRow.getRowSet().getRows().iterator();
                                    while (childRowIter.hasNext()) {
                                        Row childRow = (Row)childRowIter.next();
                                        childRow.setModify(true);
                                        Cell ccell3 = findCell(childRow, "P", "URNS");
                                        Cell ccell4 = findCell(childRow, "P", "URP");
                                        Cell publicKeyCell = findCell(childRow, "PA", "PUBKEY");
                                        ccell3.setColumnValue(cell1.getColumnValue());
                                        ccell4.setColumnValue(cell2.getColumnValue());
                                        publicKeyCell.setColumnValue(cixFile.getPublicKey());                                   
                                    }
                                   
                                    container.getCurrentObject().classUpdate_WholeObject(cRow, false);
                                    break;
                                   
View Full Code Here

            }
           
        }
        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"));
View Full Code Here

        public void setCurrentUser(Row currentUser) {
           
                //will be modified
                DAO dao = DAO.getInstance();
                dao.update(Resources.UPDATE_GLOBALVAR_TABLE_SQL);
                Cell userCell = ObjectUtil.findNewCell(currentUser, "LOGINENTRY", "RUSER");               
                dao.setObject(1, userCell.getColumnValue());
                dao.setObject(2, "loginuser");
                dao.executeUpdate();

                this.currentUser = currentUser;
        }
View Full Code Here

        String mainTableName = object.getMainTableName();
        String childTableName = object.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 = object.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());
                }
            }
        }
        return newRow;
    }
View Full Code Here

        return txt;
    }
   
    //���ָ��tableName,columnName��ָ��row�в���newCell��
    public static Cell findNewCell(Row row, String tableName, String columnName) {
        Cell newCell = null;               
        Iterator cellIter = row.getNewCells().iterator();
        while (cellIter.hasNext()) {
            Cell cell = (Cell)cellIter.next();
            if ( (cell.getColumnName().equals(columnName)) && (cell.getTableName().equals(tableName)) ) {
                newCell = cell;
                break;
            }
        }
        return newCell;
View Full Code Here

        return newCell;
    }
   
    //���ָ��tableName,columnName��ָ��row�в���oldCell��
    public static Cell findOldCell(Row row, String tableName, String columnName) {
        Cell oldCell = null;
        Iterator cellIter = row.getOldCells().iterator();
        while (cellIter.hasNext()) {
            Cell cell = (Cell)cellIter.next();
            if ( (cell.getColumnName().equals(columnName)) && (cell.getTableName().equals(tableName)) ) {
                oldCell = cell;
                break;
            }
        }
        return oldCell;
View Full Code Here

                    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());
                                    } else if (GlobalValueManager.getValue("APPLICATION.ZIC").equals("3")) {
                                       rowDatas.add(newCell.getColumnValue() + " - " + i18nString);
                                    }
                                }                                   
                                else {
                                    if (newCell.getColumnValue() instanceof Double) {
                                        rowDatas.add(CurrencyPlugin.getFormatedDouble((Double)newCell.getColumnValue()));
                                    } else
                                    rowDatas.add(newCell.getColumnValue());
                                }
                            } else {
                                if (newCell.getColumnValue() instanceof Double) {
                                    rowDatas.add(CurrencyPlugin.getFormatedDouble((Double)newCell.getColumnValue()));
                                } else
                                    rowDatas.add(newCell.getColumnValue());
                            }                       
                        }
                    }                                   
                    rowDatas.add(row);                   
                    dataValues.add(rowDatas);     
View Full Code Here

            Vector rowDatas = new Vector();
       
            Iterator cellIter = row.getNewCells().iterator();
            while (cellIter.hasNext()) {
               
                Cell cell = (Cell)cellIter.next();
                rowDatas.add(cell.getColumnValue());
               
            }
           
            addRow(rowDatas);
       
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

TOP

Related Classes of realcix20.cixfiles.CIXFile

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.