return result;
}
public static void analyPartnerCIXFile(Vector datas, MainListener listener) {
Row partnerRow = null;
Vector partnerAccountRows = null;
Vector publicKeys = null;
Vector banks = null;
Vector addresses = null;
Row familyRow = null;
Vector mePartnerAccountRows = null;
partnerRow = (Row)datas.get(0);
partnerAccountRows = (Vector)datas.get(1);
publicKeys = (Vector)datas.get(2);
banks = (Vector)datas.get(3);
addresses = (Vector)datas.get(4);
familyRow = (Row)datas.get(5);
mePartnerAccountRows = (Vector)datas.get(6);
Iterator partnerAccountRowsIter = partnerAccountRows.iterator();
Iterator publicKeysIter = publicKeys.iterator();
Iterator mePartnerAccountRowsIter = mePartnerAccountRows.iterator();
//Output
while (partnerAccountRowsIter.hasNext()) {
Row row = (Row)partnerAccountRowsIter.next();
row.print();
}
Vector newPartnerAccountRows = new Vector();
Vector newPublicKeys = new Vector();
Vector newMePartnerAccountRows = new Vector();
Vector oldPartnerAccountRows = new Vector();
Vector oldPublicKeys = new Vector();
Vector oldMePartnerAccountRows = new Vector();
Vector ruserPartnerRow;
boolean useFamilyOrRuser = false;//true:family / false:ruser
int n = 0;
String ruser = null;
Row templatePartnerAccountRow = null;
partnerAccountRowsIter = partnerAccountRows.iterator();
while (partnerAccountRowsIter.hasNext()) {
Row partnerAccountRow = (Row)partnerAccountRowsIter.next();
PublicKey publicKey = (PublicKey)publicKeysIter.next();
Row mePartnerAccountRow = (Row)mePartnerAccountRowsIter.next();
String urns = null;
String urp = null;
String urpa = null;
if ( (ObjectUtil.findNewCell(partnerAccountRow, "PA", "URNS").getColumnValue() != null) &&
(!ObjectUtil.findNewCell(partnerAccountRow, "PA", "URNS").toString().trim().equals("")) )
urns = (String)ObjectUtil.findNewCell(partnerAccountRow, "PA", "URNS").getColumnValue();
if ( (ObjectUtil.findNewCell(partnerAccountRow, "PA", "URP").getColumnValue() != null) &&
(!ObjectUtil.findNewCell(partnerAccountRow, "PA", "URP").toString().trim().equals("")) )
urp = (String)ObjectUtil.findNewCell(partnerAccountRow, "PA", "URP").getColumnValue();
if ( (ObjectUtil.findNewCell(partnerAccountRow, "PA", "URPA").getColumnValue() != null) &&
(!ObjectUtil.findNewCell(partnerAccountRow, "PA", "URPA").toString().trim().equals("")) )
urpa = (String)ObjectUtil.findNewCell(partnerAccountRow, "PA", "URPA").getColumnValue();
// System.err.println("urns = " + urns + " urp = " + urp + " urpa = " + urpa);
// System.err.println("ObjectUtil.findNewCell(partnerAccountRow, 'PA', 'RUSER').getColumnValue() = " +
// ObjectUtil.findNewCell(partnerAccountRow, "PA", "RUSER").getColumnValue());
templatePartnerAccountRow = mePartnerAccountRow;
if ( (urns == null) || (urp == null) || (urns.trim().equals("")) || (urp.trim().equals("")) ) {
//templatePartnerAccountRow = mePartnerAccountRow;
/*if (n == 0) {
ruser = ObjectUtil.findNewCell(partnerAccountRow, "PA", "RUSER").getColumnValue().toString();
} else if (!useFamilyOrRuser) {
if (!ruser.equals(ObjectUtil.findNewCell(partnerAccountRow, "PA", "RUSER").getColumnValue().toString()))
useFamilyOrRuser = true;
}*/
n++;
newPartnerAccountRows.add(partnerAccountRow);
newPublicKeys.add(publicKey);
newMePartnerAccountRows.add(mePartnerAccountRow);
} else {
oldPartnerAccountRows.add(partnerAccountRow);
oldPublicKeys.add(publicKey);
oldMePartnerAccountRows.add(mePartnerAccountRow);
}
}
// System.err.println("newPartnerAccountRows.size() = " + newPartnerAccountRows.size());
// System.err.println("oldMePartnerAccountRows.size() = " + oldMePartnerAccountRows.size());
// System.err.println("banks.size() = " + banks.size());
// System.err.println("addresses.size() = " + addresses.size());
DialogManager.showMessageDialog(listener.getContainer(), TxtManager.getTxt("INFORMATION.IMPORT.IMPORTSUCCESS"));
boolean hasNewPartnerAccount = (newPartnerAccountRows.size() > 0);
boolean hasOldPartnerAccount = (oldPartnerAccountRows.size() > 0);
if (hasOldPartnerAccount) {
GlobalValueManager.setValue("APPLICATION.IMPORT", "import");
DialogManager.showMessageDialog(listener.getContainer(), TxtManager.getTxt("INFORMATION.IMPORT.UPDATEPARTNERPART"));
StringBuffer sb = new StringBuffer("");
Iterator oldPartnerAccountRowsIter = oldPartnerAccountRows.iterator();
Iterator oldPublicKeysIter = oldPublicKeys.iterator();
Iterator oldMePartnerAccountRowsIter = oldMePartnerAccountRows.iterator();
PartnerClass partner = (PartnerClass)ClassManager.createClass(250);
while (oldPartnerAccountRowsIter.hasNext()) {
Row oldPartnerAccountRow = (Row)oldPartnerAccountRowsIter.next();
PublicKey publicKey = (PublicKey)oldPublicKeysIter.next();
Row oldMePartnerAccountRow = (Row)oldMePartnerAccountRowsIter.next();
String urns = null;
String urp = null;
String urpa = null;
if ( (ObjectUtil.findNewCell(oldPartnerAccountRow, "PA", "URNS").getColumnValue() != null) &&
(ObjectUtil.findNewCell(oldPartnerAccountRow, "PA", "URNS").toString().trim().length() > 0) )
urns = ObjectUtil.findNewCell(oldPartnerAccountRow, "PA", "URNS").getColumnValue().toString();
if ( (ObjectUtil.findNewCell(oldPartnerAccountRow, "PA", "URP").getColumnValue() != null) &&
(ObjectUtil.findNewCell(oldPartnerAccountRow, "PA", "URP").toString().trim().length() > 0) )
urp = ObjectUtil.findNewCell(oldPartnerAccountRow, "PA", "URP").getColumnValue().toString();
if ( (ObjectUtil.findNewCell(oldPartnerAccountRow, "PA", "URPA").getColumnValue() != null) &&
(ObjectUtil.findNewCell(oldPartnerAccountRow, "PA", "URPA").toString().trim().length() > 0) )
urpa = ObjectUtil.findNewCell(oldPartnerAccountRow, "PA", "URPA").getColumnValue().toString();
System.err.println("old urns = " + urns + " urp = " + urp + " urpa = " + urpa);
if ( (urpa != null) && (!urpa.trim().equals("")) ) {
Row partnerAccountRow = findPartnerAccountRow(partner, urns, urp, urpa);
if (partnerAccountRow == null) {
sb.append(TxtManager.getTxt("INFORMATION.IMPORT.UPDATEPARTNERFAILPART1"));
sb.append(urns + "/" + urp + "/" + urpa + " " + TxtManager.getTxt("INFORMATION.IMPORT.UPDATEPARTNERFAILPART2") + "\n");
} else {
partnerAccountRow.setModify(true);
ObjectUtil.findNewCell(partnerAccountRow, "P", "CO").setColumnValue(ObjectUtil.findNewCell(templatePartnerAccountRow, "P", "CO").getColumnValue());
ObjectUtil.findNewCell(partnerAccountRow, "P", "FNAME").setColumnValue(ObjectUtil.findNewCell(templatePartnerAccountRow, "P", "FNAME").getColumnValue());
ObjectUtil.findNewCell(partnerAccountRow, "P", "LNAME").setColumnValue(ObjectUtil.findNewCell(templatePartnerAccountRow, "P", "LNAME").getColumnValue());
ObjectUtil.findNewCell(partnerAccountRow, "P", "DOMAIN").setColumnValue(ObjectUtil.findNewCell(templatePartnerAccountRow, "P", "DOMAIN").getColumnValue());
ObjectUtil.findNewCell(partnerAccountRow, "P", "EMAIL").setColumnValue(ObjectUtil.findNewCell(templatePartnerAccountRow, "P", "EMAIL").getColumnValue());
ObjectUtil.findNewCell(partnerAccountRow, "PA", "URNS").setColumnValue(ObjectUtil.findNewCell(oldPartnerAccountRow, "PA", "NS").getColumnValue());
ObjectUtil.findNewCell(partnerAccountRow, "PA", "URP").setColumnValue(ObjectUtil.findNewCell(oldPartnerAccountRow, "PA", "P").getColumnValue());
ObjectUtil.findNewCell(partnerAccountRow, "PA", "URPA").setColumnValue(ObjectUtil.findNewCell(oldPartnerAccountRow, "PA", "PA").getColumnValue());
ObjectUtil.findNewCell(partnerAccountRow, "PA", "PUBKEY").setColumnValue(publicKey);
ObjectUtil.findNewCell(partnerAccountRow, "PA", "BLOCK").setColumnValue(false);
ObjectUtil.findNewCell(partnerAccountRow, "PA", "APPPASS").setColumnValue(null);
partner.classUpdate_WholeObject(partnerAccountRow, false);
/*Iterator addressRowsIter = addresses.iterator();
while (addressRowsIter.hasNext()) {
Row addressRow = (Row)addressRowsIter.next();
updateAddress(addressRow, urns, urp);
}*/
updateAddresses(addresses, urns, urp);
Iterator bankRowsIter = banks.iterator();
while (bankRowsIter.hasNext()) {
Row bankRow = (Row)bankRowsIter.next();
updateBank(bankRow, urns, urp);
}
sb.append(TxtManager.getTxt("INFORMATION.IMPORT.UPDATEPARTNERSUCCESSPART1"));
sb.append(urns + "/" + urp + "/" + urpa + " " + TxtManager.getTxt("INFORMATION.IMPORT.UPDATEPARTNERSUCCESSPART2") + "\n");
}
} else {
Row partnerAccountRow = findPartnerRow(partner, urns, urp);
if (partnerAccountRow == null) {
sb.append(TxtManager.getTxt("INFORMATION.IMPORT.ADDNEWPARTNERACCOUNTFAILPART1"));
sb.append(urns + "/" + urp + " " + TxtManager.getTxt("INFORMATION.IMPORT.ADDNEWPARTNERACCOUNTFAILPART2") + "\n");
} else {
Row newAccountRow = ObjectUtil.cloneRow(partner, partnerAccountRow);
ObjectUtil.findNewCell(partnerAccountRow, "P", "CO").setColumnValue(ObjectUtil.findNewCell(templatePartnerAccountRow, "P", "CO").getColumnValue());
ObjectUtil.findNewCell(partnerAccountRow, "P", "FNAME").setColumnValue(ObjectUtil.findNewCell(templatePartnerAccountRow, "P", "FNAME").getColumnValue());
ObjectUtil.findNewCell(partnerAccountRow, "P", "LNAME").setColumnValue(ObjectUtil.findNewCell(templatePartnerAccountRow, "P", "LNAME").getColumnValue());
ObjectUtil.findNewCell(partnerAccountRow, "P", "DOMAIN").setColumnValue(ObjectUtil.findNewCell(templatePartnerAccountRow, "P", "DOMAIN").getColumnValue());
ObjectUtil.findNewCell(partnerAccountRow, "P", "EMAIL").setColumnValue(ObjectUtil.findNewCell(templatePartnerAccountRow, "P", "EMAIL").getColumnValue());
ObjectUtil.findNewCell(newAccountRow, "PA", "URNS").setColumnValue(ObjectUtil.findNewCell(oldPartnerAccountRow, "PA", "NS").getColumnValue());
ObjectUtil.findNewCell(newAccountRow, "PA", "URP").setColumnValue(ObjectUtil.findNewCell(oldPartnerAccountRow, "PA", "P").getColumnValue());
ObjectUtil.findNewCell(newAccountRow, "PA", "URPA").setColumnValue(ObjectUtil.findNewCell(oldPartnerAccountRow, "PA", "PA").getColumnValue());
ObjectUtil.findNewCell(newAccountRow, "PA", "PUBKEY").setColumnValue(publicKey);
ObjectUtil.findNewCell(newAccountRow, "PA", "PA").setColumnValue(getNewPA(urns, urp));
ObjectUtil.findNewCell(newAccountRow, "PA", "BLOCK").setColumnValue(false);
ObjectUtil.findNewCell(newAccountRow, "PA", "APPPASS").setColumnValue(null);
newAccountRow.setAdd(true);
partnerAccountRow.getRowSet().getRows().add(newAccountRow);
sb.append(TxtManager.getTxt("INFORMATION.IMPORT.ADDNEWPARTNERACCOUNTSUCCESSPART1"));
sb.append(urns + "/" + urp + "/" + getNewPA(urns, urp) + " " + TxtManager.getTxt("INFORMATION.IMPORT.ADDNEWPARTNERACCOUNTSUCCESSPART2") + "\n");
partner.classUpdate_WholeObject(partnerAccountRow, false);
updateAddresses(addresses, urns, urp);
/*Iterator addressRowsIter = addresses.iterator();
while (addressRowsIter.hasNext()) {
Row addressRow = (Row)addressRowsIter.next();
updateAddress(addressRow, urns, urp);
}*/
Iterator bankRowsIter = banks.iterator();
while (bankRowsIter.hasNext()) {
Row bankRow = (Row)bankRowsIter.next();
updateBank(bankRow, urns, urp);
}
}
}
}
DialogManager.showMessageDialog(listener.getContainer(), sb.toString());
GlobalValueManager.setValue("APPLICATION.IMPORT", "noimport");
}
listener.showObjectSettingView(250);
listener.getContainer().updateTable();
if (hasNewPartnerAccount) {
GlobalValueManager.setValue("APPLICATION.IMPORT", "import");
DialogManager.showMessageDialog(listener.getContainer(), TxtManager.getTxt("INFORMATION.IMPORT.CREATEPARTNERPART"));
Row newRow = new Row(listener.getContainer().getCurrentObject().getRowType());
ObjectUtil.findNewCell(newRow, "P", "CO").setColumnValue(ObjectUtil.findNewCell(templatePartnerAccountRow, "P", "CO").getColumnValue());
ObjectUtil.findNewCell(newRow, "P", "FNAME").setColumnValue(ObjectUtil.findNewCell(templatePartnerAccountRow, "P", "FNAME").getColumnValue());
ObjectUtil.findNewCell(newRow, "P", "LNAME").setColumnValue(ObjectUtil.findNewCell(templatePartnerAccountRow, "P", "LNAME").getColumnValue());
ObjectUtil.findNewCell(newRow, "P", "DOMAIN").setColumnValue(ObjectUtil.findNewCell(templatePartnerAccountRow, "P", "DOMAIN").getColumnValue());
ObjectUtil.findNewCell(newRow, "P", "EMAIL").setColumnValue(ObjectUtil.findNewCell(templatePartnerAccountRow, "P", "EMAIL").getColumnValue());
Iterator newPartnerAccountRowsIter = newPartnerAccountRows.iterator();
Iterator newPublicKeysIter = newPublicKeys.iterator();
Iterator newMePartnerAccountRowsIter = newMePartnerAccountRows.iterator();
n = 1;
while (newPartnerAccountRowsIter.hasNext()) {
Row templateRow = (Row)newPartnerAccountRowsIter.next();
PublicKey publicKey = (PublicKey)newPublicKeysIter.next();
Row mePartnerAccountRow = (Row)newMePartnerAccountRowsIter.next();
Row childRow = ObjectUtil.addnewChildRow(listener.getContainer().getCurrentObject(), templateRow);
ObjectUtil.findNewCell(childRow, "PA", "URNS").setColumnValue(ObjectUtil.findNewCell(childRow, "PA", "NS").getColumnValue());
ObjectUtil.findNewCell(childRow, "PA", "NS").setColumnValue(null);
ObjectUtil.findNewCell(childRow, "PA", "URP").setColumnValue(ObjectUtil.findNewCell(childRow, "PA", "P").getColumnValue());
ObjectUtil.findNewCell(childRow, "PA", "P").setColumnValue(null);
ObjectUtil.findNewCell(childRow, "PA", "URPA").setColumnValue(ObjectUtil.findNewCell(childRow, "PA", "PA").getColumnValue());