Package realcix20.classes.basic

Examples of realcix20.classes.basic.BaseClass


            }
            names.add("row");
           
            Iterator rowIter = object.getRows().iterator();
            while (rowIter.hasNext()) {
                Row row = (Row)rowIter.next();               
                Vector rowDatas = new Vector();
                columnIter = object.getColumns().iterator();
                while (columnIter.hasNext()) {
                    Column column = (Column)columnIter.next();
                    if (column.isIndexField()) {                       
View Full Code Here


        public static void deleteRelativeRegs(Row correspondenceRow) {
            CorrespondenceClass correspondence = (CorrespondenceClass)ClassManager.createClass(520);
            correspondence.loadChilds(correspondenceRow);
            Iterator cItemRowsIter = correspondenceRow.getRowSet().getRows().iterator();           
            while (cItemRowsIter.hasNext()) {               
                Row cItemRow = (Row)cItemRowsIter.next();
                boolean needDelete = true;
                if ( (ObjectUtil.findNewCell(cItemRow, "TI", "R").getColumnValue() == null) ||
                        (ObjectUtil.findNewCell(cItemRow, "TI", "RI").getColumnValue() == null) ) {
                    needDelete = false;
                }
View Full Code Here

                String ns = (String)notEncryedDatas.get(0);
                String p = (String)notEncryedDatas.get(1);
                String pa = (String)notEncryedDatas.get(2);
                PartnerClass partner = (PartnerClass)ClassManager.createClass(250);
//                System.err.println("ns = " + ns + " p = " + p + " pa = " + pa);
                Row partnerAccountRow = PartnerClass.findPartnerAccountRow(partner, ns, p, pa);
                if (partnerAccountRow == null) {
                    StringBuffer sb = new StringBuffer(TxtManager.getTxt("INFORMATION.IMPORT.NOTFINDPA1"));
                    sb.append(ns + "/" + p + "/" + pa + " !");
                    DialogManager.showMessageDialog(listener.getContainer(), sb.toString());
                } else {
                    boolean result = true;
                    String urns = (String)ObjectUtil.findNewCell(partnerAccountRow, "PA", "URNS").getColumnValue();
                    String urp = (String)ObjectUtil.findNewCell(partnerAccountRow, "PA", "URP").getColumnValue();
                    String urpa = (String)ObjectUtil.findNewCell(partnerAccountRow, "PA", "URPA").getColumnValue();
                    PublicKey publicKey = (PublicKey)ObjectUtil.findNewCell(partnerAccountRow, "PA", "PUBKEY").getColumnValue();
                    if ( ( (urns == null) || (urns.trim().length() <= 0) ) ||
                            ( (urp == null) || (urp.trim().length() <= 0) ) ||
                            ( (urpa == null) || (urpa.trim().length() <= 0) ) ||
                            (publicKey == null) ) {
                        result = false;
                    }
                    if (!result) {
                        StringBuffer sb = new StringBuffer(TxtManager.getTxt("INFORMATION.IMPORT.NOTCREATERELATIVE1"));
                        sb.append(ns + "/" + p + "/" + pa + " , ");
                        sb.append(TxtManager.getTxt("INFORMATION.IMPORT.NOTCREATERELATIVE2"));
                        DialogManager.showMessageDialog(listener.getContainer(), sb.toString());
                    } else {
                        if (publicKey != null) {
                            Vector datas = realCIXFile.getDatas(publicKey);
                            if (datas == null) {
                                StringBuffer sb = new StringBuffer(TxtManager.getTxt("INFORMATION.IMPORT.PUBKEYISWRONG1"));
                                sb.append(ns + "/" + p + "/" + pa + " , ");
                                sb.append(TxtManager.getTxt("INFORMATION.IMPORT.PUBKEYISWRONG2"));
                                DialogManager.showMessageDialog(listener.getContainer(), sb.toString());
                            } else {//import success
//                                System.err.println("urns = " + urns + " urp = " + urp + " urpa = " + urpa);
                                DialogManager.showMessageDialog(listener.getContainer(), TxtManager.getTxt("INFORMATION.IMPORT.IMPORTSUCCESS"));
                                DialogManager.showMessageDialog(listener.getContainer(), TxtManager.getTxt("INFORMATION.IMPORT.CREATECORRESPONDENCE"));
                                Row correspondenceRow = (Row)datas.get(0);
                                listener.showObjectView(520);
                                listener.getContainer().updateTable();
                                Row newRow = new Row(listener.getContainer().getCurrentObject().getRowType());
                                ObjectUtil.findNewCell(newRow, "T", "URT").setColumnValue(ObjectUtil.findNewCell(correspondenceRow, "T", "T").getColumnValue());
                                ObjectUtil.findNewCell(newRow, "T", "TT").setColumnValue(ObjectUtil.findNewCell(correspondenceRow, "T", "TT").getColumnValue());
                                ObjectUtil.findNewCell(newRow, "T", "NS").setColumnValue(ns);
                                ObjectUtil.findNewCell(newRow, "T", "P").setColumnValue(p);
                                ObjectUtil.findNewCell(newRow, "T", "PA").setColumnValue(pa);
                                ObjectUtil.findNewCell(newRow, "T", "RECBNS").setColumnValue(ObjectUtil.findNewCell(correspondenceRow, "T", "RECBNS").getColumnValue());
                                ObjectUtil.findNewCell(newRow, "T", "RECB").setColumnValue(ObjectUtil.findNewCell(correspondenceRow, "T", "RECB").getColumnValue());
                                ObjectUtil.findNewCell(newRow, "T", "RECBA").setColumnValue(ObjectUtil.findNewCell(correspondenceRow, "T", "RECBA").getColumnValue());
                                ObjectUtil.findNewCell(newRow, "T", "REQUEST").setColumnValue(ObjectUtil.findNewCell(correspondenceRow, "T", "REQUEST").getColumnValue());
                                ObjectUtil.findNewCell(newRow, "T", "DUE").setColumnValue(ObjectUtil.findNewCell(correspondenceRow, "T", "DUE").getColumnValue());
                                ObjectUtil.findNewCell(newRow, "T", "TXT256").setColumnValue(ObjectUtil.findNewCell(correspondenceRow, "T", "TXT256").getColumnValue());
                                Iterator correspondenceItemRowsIter = correspondenceRow.getRowSet().getRows().iterator();
                                while (correspondenceItemRowsIter.hasNext()) {
                                    Row correspondenceItemRow = (Row)correspondenceItemRowsIter.next();
                                    boolean stat = false;
                                    if ( ( (correspondenceRow.isAdd()) && (correspondenceItemRow != correspondenceRow) ) ||
                                            (!correspondenceRow.isAdd()) ) {
                                        stat = true;
                                    }
                                    if (stat) {//add childRow
                                        Row childRow = ObjectUtil.addnewChildRow(listener.getContainer().getCurrentObject(), correspondenceItemRow);
                                        double tamt = 0.0;
                                        if ( (ObjectUtil.findNewCell(correspondenceItemRow, "TI", "TAMT").getColumnValue() != null) &&
                                                (ObjectUtil.findNewCell(correspondenceItemRow, "TI", "TAMT").getColumnValue().toString().trim().length() > 0) ) {
                                            tamt = 0 - Double.parseDouble(ObjectUtil.findNewCell(correspondenceItemRow, "TI", "TAMT").getColumnValue().toString());                                           
                                        }
View Full Code Here

                datas.add(correspondenceRow);
                String ns = ObjectUtil.findNewCell(correspondenceRow, "T", "NS").getColumnValue().toString();
                String p = ObjectUtil.findNewCell(correspondenceRow, "T", "P").getColumnValue().toString();
                String pa = ObjectUtil.findNewCell(correspondenceRow, "T", "PA").getColumnValue().toString();
                PartnerClass partner = (PartnerClass)ClassManager.createClass(250);
                Row partnerAccountRow = null;             
                partnerAccountRow = PartnerClass.findPartnerAccountRow(partner, ns, p, pa);
                Row mePartnerAccountRow = null;
                if (partnerAccountRow != null)
                    mePartnerAccountRow = PartnerClass.getMePartnerAccount(partnerAccountRow);
                PrivateKey privateKey = null;
                if (mePartnerAccountRow != null) {
                    privateKey = (PrivateKey)ObjectUtil.findNewCell(mePartnerAccountRow, "PA", "PRIKEY").getColumnValue();
View Full Code Here

               
                int currentRi = 0;
                double amt = 0.0;
                Iterator rowsIter = mainRow.getRowSet().getRows().iterator();
                while (rowsIter.hasNext()) {
                    Row childRow = (Row)rowsIter.next();
                    if ( (childRow != null) && (childRow != mainRow) ) {                      
                        currentRi++;
                        txt256Cell = ObjectUtil.findNewCell(childRow, "TI", "TXT256");
                        txt256 = (String)txt256Cell.getColumnValue();
                       
View Full Code Here

           
                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

TOP

Related Classes of realcix20.classes.basic.BaseClass

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.