Package realcix20.utils

Examples of realcix20.utils.ObjectUtil


           
                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

   
    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

   
    protected void contactRelationship1_12(final JComponent component, final JComponent childComponent) {               
       
        //set initial value
        if (ComponentManager.getValue(component) != null) {
            CurrencyPlugin cp = CurrencyPlugin.getInstance();
            UomPlugin up = UomPlugin.getInstance();
            StringBuffer sb = new StringBuffer("###" + cp.getSepor() + "###");
            int fraction = up.getFraction(ComponentManager.getValue(component).toString());
            if (fraction > 0) {
                sb.append(".");
            }
            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();
                            UomPlugin up = UomPlugin.getInstance();
                            StringBuffer sb = new StringBuffer("###" + cp.getSepor() + "###");
                            int fraction = up.getFraction(ComponentManager.getValue(component).toString());
                            if (fraction > 0) {
                                sb.append(".");
                            }
                            for (int i = 1; i <= fraction; i++) {
View Full Code Here

                JMonthPicker monthPicker = new JMonthPicker();
                component = monthPicker;               
                break;               
            case 11:
            case 12:               
                CurrencyPlugin cp = CurrencyPlugin.getInstance();
                //set default format,Ĭ�ϵ����ָ�ʽ������               
                StringBuffer sb = new StringBuffer("###");                    
                sb.append(cp.getSepor() + "###");
                DecimalFormat  df = new DecimalFormat(sb.toString());
                JFormattedTextField formattedTextField = new JFormattedTextField(df);
                component = formattedTextField;               
                break;               
            case 16:               
                cp = CurrencyPlugin.getInstance();               
                //set format
                sb = new StringBuffer("###");
                sb.append(cp.getSepor() + "###");
                int fraction = Integer.parseInt(GlobalValueManager.getValue("APPLIATION.DEFFRACTION"));
                if (fraction > 0) {
                    sb.append(cp.getFpoint());
                }
                for (int i = 1; i <= fraction; i++) {
                    sb.append("0");
                }
                df = new DecimalFormat(sb.toString());               
View Full Code Here

           
        }
       
        public static RealCIXFile exportCorrespondenceCIXFile(Row correspondenceRow) {
           
                RealCIXFile realCIXFile = null;
                String type = "Correspondence";
                Vector datas = new Vector();
                Vector notEncryedDatas = new Vector();
                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();
                }
                if (privateKey != null) {
                    String urns = ObjectUtil.findNewCell(partnerAccountRow, "PA", "URNS").getColumnValue().toString();
                    String urp = ObjectUtil.findNewCell(partnerAccountRow, "PA", "URP").getColumnValue().toString();
                    String urpa = ObjectUtil.findNewCell(partnerAccountRow, "PA", "URPA").getColumnValue().toString();
                    notEncryedDatas.add(urns);
                    notEncryedDatas.add(urp);
                    notEncryedDatas.add(urpa);
                    realCIXFile = new RealCIXFile(type, privateKey, notEncryedDatas, datas);
                }
                return realCIXFile;
           
        }
View Full Code Here

TOP

Related Classes of realcix20.utils.ObjectUtil

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.