Package realcix20.classes.plugins

Examples of realcix20.classes.plugins.CixFile


           
                boolean result = false;
               
                Iterator correspondenceItemRowsIter = correspondenceRow.getRowSet().getRows().iterator();
                while (correspondenceItemRowsIter.hasNext()) {
                    Row correspondenceItemRow = (Row)correspondenceItemRowsIter.next();
                    int newR = -1;
                    if ( (ObjectUtil.findNewCell(correspondenceItemRow, "TI", "R").getColumnValue() != null) &&
                            (ObjectUtil.findNewCell(correspondenceItemRow, "TI", "R").getColumnValue().toString().trim().length() > 0) ) {
                        newR = Integer.parseInt(ObjectUtil.findNewCell(correspondenceItemRow, "TI", "R").getColumnValue().toString());
                    }
View Full Code Here


                boolean result = true;
       
                Vector rAndRis = new Vector();
                Iterator rowsIter = correspondenceRow.getRowSet().getRows().iterator();
                while (rowsIter.hasNext()) {
                    Row row = (Row)rowsIter.next();
                    int newR = -1;
                    int newRI = -1;
                    if ( (ObjectUtil.findNewCell(row, "TI", "R").getColumnValue() != null) && (ObjectUtil.findNewCell(row, "TI", "R").getColumnValue().toString().trim().length() > 0) ) {
                        newR = Integer.parseInt(ObjectUtil.findNewCell(row, "TI", "R").getColumnValue().toString());                  
                    }
View Full Code Here

           
                //Test if can regs
                boolean allTamtEqualsZero = true;
                Iterator rowsIter = correspondenceRow.getRowSet().getRows().iterator();
                while (rowsIter.hasNext()) {
                    Row row = (Row)rowsIter.next();
                    if (correspondenceRow.isAdd()) {
                        if (row != correspondenceRow) {
                            Double tempTAmt = Double.parseDouble(ObjectUtil.findNewCell(row, "TI", "TAMT").getColumnValue().toString());
                            if (tempTAmt != 0.0) {
                                allTamtEqualsZero = false;
                                break;
                            }
                        }
                    } else {
                        Double tempTAmt = Double.parseDouble(ObjectUtil.findNewCell(row, "TI", "TAMT").getColumnValue().toString());
                        if (tempTAmt != 0.0) {
                            allTamtEqualsZero = false;
                            break;
                        }
                    }
                }
                if (allTamtEqualsZero) {
                    return -1;
                }
           
                //delete oldR
                Vector newRAndOldRs = new Vector();//data struct: new_R-newR
                rowsIter = correspondenceRow.getRowSet().getRows().iterator();
                while (rowsIter.hasNext()) {
                    Row row = (Row)rowsIter.next();
                    int oldR = -1;
                    int newR = -1;
                    if ( (ObjectUtil.findOldCell(row, "TI", "R").getColumnValue() != null) && (ObjectUtil.findOldCell(row, "TI", "R").getColumnValue().toString().trim().length() > 0) ) {
                        oldR = Integer.parseInt(ObjectUtil.findOldCell(row, "TI", "R").getColumnValue().toString());                  
                    }
                    if ( (ObjectUtil.findNewCell(row, "TI", "R").getColumnValue() != null) && (ObjectUtil.findNewCell(row, "TI", "R").getColumnValue().toString().trim().length() > 0) ) {
                        newR = Integer.parseInt(ObjectUtil.findNewCell(row, "TI", "R").getColumnValue().toString());                  
                    }
                    if (!row.isDelete()) {
                        if (oldR != -1) {
                            TaxClass.deleteR(oldR);//USE TaxClass
                            TaxClass.deleteRI(oldR);//USE TaxClass
                        }
                        if (newR != -1) {
                            TaxClass.deleteR(newR);//USE TaxClass
                            TaxClass.deleteRI(newR);//USE TaxClass
                        }
                    } else {
                        if (!row.isAdd()) {
                            if (oldR != -1) {
                                TaxClass.deleteR(oldR);//USE TaxClass
                                TaxClass.deleteRI(oldR);//USE TaxClass
                            }
                        }
                    }                   
                }               
                rowsIter = correspondenceRow.getRowSet().getRows().iterator();
                int new_R = TaxClass.getMAXR() + 1;
                while (rowsIter.hasNext()) {
                    Row row = (Row)rowsIter.next();
                    int newR = -1;
                    if ( (ObjectUtil.findNewCell(row, "TI", "R").getColumnValue() != null) && (ObjectUtil.findNewCell(row, "TI", "R").getColumnValue().toString().trim().length() > 0) ) {
                        newR = Integer.parseInt(ObjectUtil.findNewCell(row, "TI", "R").getColumnValue().toString());                  
                    }
                    String str = new_R + "-" + newR;
                    newRAndOldRs.add(str);               
                }
               
                //add new R
                rowsIter = correspondenceRow.getRowSet().getRows().iterator();
                Iterator newRAndOldRsIter = newRAndOldRs.iterator();
                while (rowsIter.hasNext()) {
                    Row row = (Row)rowsIter.next();
                    String str = (String)newRAndOldRsIter.next();
                    StringTokenizer st = new StringTokenizer(str, "-");    
                    String tDate = ObjectUtil.findNewCell(correspondenceRow, "T", "DUE").getColumnValue().toString();
                    String txt512 = "";
                    if (ObjectUtil.findNewCell(correspondenceRow, "T", "TXT256").getColumnValue() != null)
                        txt512 = ObjectUtil.findNewCell(correspondenceRow, "T", "TXT256").getColumnValue().toString();
                    new_R = Integer.parseInt(st.nextElement().toString());
                    TaxClass.insertr(new_R, tDate, txt512);//USE TaxClass                             
                }
               
                //add newri
                correspondenceRow.setModify(true);
                rowsIter = correspondenceRow.getRowSet().getRows().iterator();
                newRAndOldRsIter = newRAndOldRs.iterator();
                int currentRI = 1;
                while (rowsIter.hasNext()) {
                    Row row = (Row)rowsIter.next();
                    String str = (String)newRAndOldRsIter.next();
                    StringTokenizer st = new StringTokenizer(str, "-");
                    String tDate = ObjectUtil.findNewCell(correspondenceRow, "T", "DUE").getColumnValue().toString();
                    String txt512 = "";
                    String ld = CorrespondenceClass.getLD(correspondenceRow);
View Full Code Here

                Vector data = new Vector();
           
                Cell urtCell = ObjectUtil.findNewCell(mainRow, "T", "URT");
                String urt = (String)urtCell.getColumnValue();
                if ( (urt == null) || (urt.trim().equals("")) ) {                   
                    CixFile file = generateCixFile_Stat4(mainRow);
                    String fileName = generateCixFileName(mainRow, 4);
                    data.add(file);
                    data.add(fileName);
                } else {
                    CixFile file = generateCixFile_Stat5(mainRow);
                    String fileName = generateCixFileName(mainRow, 5);
                    data.add(file);
                    data.add(fileName);
                    registerTransfer(mainRow, null);
                }         
View Full Code Here

           
        }
       
        private CixFile generateCixFile_Stat4(Row mainRow) {
           
                CixFile file = null;
               
                int cixFileStat = 4;
                Vector noEncryData = new Vector();
                byte[] wrappedKey = null;
                Vector encryData = new Vector();
                SealedObject sealedEncryData = null;
               
                Cell nsCell = ObjectUtil.findNewCell(mainRow, "T", "NS");
                String ns = (String)nsCell.getColumnValue();
                Cell pCell = ObjectUtil.findNewCell(mainRow, "T", "P");
                String p = (String)pCell.getColumnValue();
                Cell paCell = ObjectUtil.findNewCell(mainRow, "T", "PA");
                String pa = (String)paCell.getColumnValue();
               
                String urns = null;
                String urp = null;
                DAO dao = DAO.getInstance();
                dao.query(Resources.SELECT_URNS_URP_FORM_P_SQL);
                dao.setObject(1, ns);
                dao.setObject(2, p);
                ResultSet rs = dao.executeQuery();
                try {
                    if (rs.next()) {
                        urns = rs.getString("URNS");
                        urp = rs.getString("URP");
                    }
                    rs.close();
                } catch (Exception e) {
                    e.printStackTrace();
                }
               
                String urpa = null;
                dao.query(Resources.SELECT_URPA_FROM_PA_SQL);
                dao.setObject(1, ns);
                dao.setObject(2, p);
                dao.setObject(3, pa);
                rs = dao.executeQuery();
                try {
                    if (rs.next()) {
                        urpa = rs.getString("URPA");
                    }
                    rs.close();
                } catch (Exception e) {
                    e.printStackTrace();
                }
               
                noEncryData.add(urns);
                noEncryData.add(urp);
                noEncryData.add(urpa);
               
                encryData.add(mainRow);
               
                PrivateKey priKey = getPriKey(ns, p, pa);
                try {
                    KeyGenerator keyGen = KeyGenerator.getInstance("DES");
                    SecureRandom random = new SecureRandom();
                    keyGen.init(random);
                    SecretKey key = keyGen.generateKey();
                    Cipher cipher = Cipher.getInstance("DES");
                    cipher.init(Cipher.ENCRYPT_MODE,key);
                    sealedEncryData = new SealedObject(encryData, cipher);                      
                    cipher = Cipher.getInstance("RSA");
                    cipher.init(Cipher.WRAP_MODE, priKey);
                    wrappedKey = cipher.wrap(key);
                } catch (Exception e) {
                    e.printStackTrace();
                }
               
                file = new CixFile(cixFileStat, noEncryData, null, wrappedKey, sealedEncryData);
               
                return file;
           
        }
View Full Code Here

           
        }
       
        private CixFile generateCixFile_Stat5(Row mainRow) {
               
                CixFile file = null;
               
               
               
                return file;
           
View Full Code Here

       
        private Vector dealWithPacc(Row mainRow) {
               
                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'
View Full Code Here

           
        }
       
        private CixFile dealWithPacc_stat_1(Row mainRow) {
           
                CixFile file = null;
               
                int cixFileStat = 1;
                Vector noEncryData = new Vector();
                PublicKey pubKey = null;
                byte[] wrappedKey = null;
                PrivateKey priKey = null;
                Vector encryData = new Vector();
                SealedObject sealedEncryData = null;
                //use the first account's keypair to encry the data;
                Iterator childRowsIter = mainRow.getRowSet().getRows().iterator();
                int currentRow = 0;
                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();
                            }
                        }                                               
                    }                       
                }
                encryData.add(mainRow);
                Vector pairData = new Vector();
                pairData.add(pubKeys);
                pairData.add(pas);                       
                encryData.add(pairData);
                try {
                    KeyGenerator keyGen = KeyGenerator.getInstance("DES");
                    SecureRandom random = new SecureRandom();
                    keyGen.init(random);
                    SecretKey key = keyGen.generateKey();
                    Cipher cipher = Cipher.getInstance("DES");
                    cipher.init(Cipher.ENCRYPT_MODE,key);
                    sealedEncryData = new SealedObject(encryData, cipher);                      
                    cipher = Cipher.getInstance("RSA");
                    cipher.init(Cipher.WRAP_MODE, priKey);
                    wrappedKey = cipher.wrap(key);
                } catch (Exception e) {
                    e.printStackTrace();
                }

                file = new CixFile(cixFileStat, noEncryData, pubKey, wrappedKey, sealedEncryData);
               
                return file;
           
        }
View Full Code Here

           
        }
       
        private CixFile dealWithPacc_stat_2(Row mainRow) {
               
                CixFile file = null;
                int cixFileStat = 2;
                Vector noEncryData = new Vector();
                PublicKey pubKey = null;
                byte[] wrappedKey = null;
                PrivateKey priKey = null;
                Vector encryData = new Vector();
                SealedObject sealedEncryData = null;
               
                //use the first account's keypair to encry the data;
                Iterator childRowsIter = mainRow.getRowSet().getRows().iterator();
                int currentRow = 0;
                Vector pubKeys = new Vector();
                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();
                            }
                        }                                               
                    }                       
                }
                encryData.add(mainRow);
                Vector pairData = new Vector();
                pairData.add(pubKeys);
                pairData.add(pas);
                pairData.add(urpas);
                encryData.add(pairData);
                try {
                    KeyGenerator keyGen = KeyGenerator.getInstance("DES");
                    SecureRandom random = new SecureRandom();
                    keyGen.init(random);
                    SecretKey key = keyGen.generateKey();
                    Cipher cipher = Cipher.getInstance("DES");
                    cipher.init(Cipher.ENCRYPT_MODE,key);
                    sealedEncryData = new SealedObject(encryData, cipher);                      
                    cipher = Cipher.getInstance("RSA");
                    cipher.init(Cipher.WRAP_MODE, priKey);
                    wrappedKey = cipher.wrap(key);
                } catch (Exception e) {
                    e.printStackTrace();
                }

                file = new CixFile(cixFileStat, noEncryData, pubKey, wrappedKey, sealedEncryData);
               
                return file;
           
        }
View Full Code Here

   
    protected void contactRelationship1_11(final JComponent component, final JComponent childComponent) {               
       
        //set initial value
        if (ComponentManager.getValue(component) != null) {
            CurrencyPlugin cp = CurrencyPlugin.getInstance();
            StringBuffer sb = new StringBuffer("###" + cp.getSepor() + "###");
            int fraction = cp.getFraction(ComponentManager.getValue(component).toString());
            if (fraction > 0) {
                sb.append(cp.getFpoint());
            }
            for (int i = 1; i <= fraction; i++) {
                sb.append("0");
            }
            DecimalFormat df = new DecimalFormat(sb.toString());
            NumberFormatter nf = new NumberFormatter(df);
            DefaultFormatterFactory factory = new DefaultFormatterFactory(nf);
            ((JFormattedTextField)childComponent).setFormatterFactory(factory);
        }
       
        ((JComboBox)component).addActionListener(
                new ActionAdapter() {
           
                    public void actionPerformed(ActionEvent e) {
                       
                        if (ComponentManager.getValue(component) != null) {
                            CurrencyPlugin cp = CurrencyPlugin.getInstance();
                            StringBuffer sb = new StringBuffer("###" + cp.getSepor() + "###");
                            int fraction = cp.getFraction(ComponentManager.getValue(component).toString());
                            if (fraction > 0) {
                                sb.append(cp.getFpoint());
                            }
                            for (int i = 1; i <= fraction; i++) {
                                sb.append("0");
                            }
                            DecimalFormat df = new DecimalFormat(sb.toString());
View Full Code Here

TOP

Related Classes of realcix20.classes.plugins.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.