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());
}