Skip to content

Instantly share code, notes, and snippets.

@lonelydimple
Created April 15, 2011 13:38
Show Gist options
  • Save lonelydimple/921703 to your computer and use it in GitHub Desktop.
Save lonelydimple/921703 to your computer and use it in GitHub Desktop.
public void update(RequestUtility inRU) {
FieldChange fc = null;
TypeConversion tc = new TypeConversion();
String t1 = "", t2 = "";
int i1 = 0, i2 = 0;
java.text.DecimalFormat dc = new java.text.DecimalFormat("00000");
if ("M".equals(getTransactionType())) { //effectiveDate - major
if (getEffectiveDate() != null)
t1 = getEffectiveDate().getDateAsString();
else
t1 = "";
t2 = inRU.getParamValue("effectiveDate");
if ((t2 != null) && (!(t1.trim().equals(t2.trim())))) {
fc = new FieldChange("Effective Date", t2, t1);
getMinorChanges().addElement(fc);
setEffectiveDate(t2);
}
}
//endDate - minor
if (getExpirationDate() != null)
t1 = getExpirationDate().getDateAsString();
else
t1 = "";
t2 = inRU.getParamValue("expirationDate");
if ((t2 != null) && (!(t1.trim().equals(t2.trim())))) {
fc = new FieldChange("Expiration Date", t2, t1);
getMinorChanges().addElement(fc);
setExpirationDate(t2);
}
if (getInstructionCodes() != null)
t1 = getInstructionCodes();
else
t1 = "";
t2 = inRU.getParamValue("BIIC");
if ((t2 != null) && (!(t1.trim().equals(t2.trim())))) {
fc =
new FieldChange(
"Instruction Code",
calcInstructionCode(t2),
calcInstructionCode(t1));
Vector v = new Vector();
v.add(fc);
if (!("E".equals(getTransactionType()))) {
LogRecord clr =
new LogRecord(
"Minor Updates",
"New",
getBondNumber(),
dc.format(new Integer(getAAgency().getAgentCode()).intValue()),
getAPrincipal().getName(),
v);
clr.writeLogRecord();
}
setInstructionCodes(t2);
}
setUserName(inRU.getParamValue("BIUSER"));
setUserNameLong(inRU.getParamValue("txtUserName"));
setTexasIdentifier(inRU.getParamValue("BITXID"));
setAttorneyInFact(inRU.getParamValue("attorneyInFact"));
getAContract().setContractDate(
inRU.getParamValue("ContractDate") == null
? ""
: inRU.getParamValue("ContractDate"));
setEffectiveAsOfDate(inRU.getParamValue("effectiveAsOfDateEnter"));
setIsAgent(tc.string2Boolean(inRU.getParamValue("isAgent")));
setState(inRU.getParamValue("State"));
setNumberOfRenewals(new Integer(inRU.getParamValue("BDRREN")).intValue());
EasyMoney em = new EasyMoney();
//BDTERM - minor
t1 = new Integer(getTermLength()).toString();
t2 = inRU.getParamValue("BDTERM");
if ((t2 != null) && (!(t1.trim().equals(t2.trim())))) {
fc = new FieldChange("Bond Term", t2, t1);
getMinorChanges().addElement(fc);
setTermLength(new Integer(t2).intValue());
}
if (getAPrincipal() != null) { //BDPRIN - minor
t1 = getAPrincipal().getName();
t2 = inRU.getParamValue("BDPRIN");
if ((t2 != null) && (!(t1.trim().equals(t2.trim())))) {
fc = new FieldChange("Principal Name", t2, t1);
getMinorChanges().addElement(fc);
getAPrincipal().setPrincipalName(t2);
} //BDDBA - minor
t1 = getAPrincipal().getDBA();
t2 = inRU.getParamValue("BDDBA");
if ((t2 != null) && (!(t1.trim().equals(t2.trim())))) {
fc = new FieldChange("Principal DBA", t2, t1);
getMinorChanges().addElement(fc);
getAPrincipal().setDBA(t2);
} //BDADR1 - minor
t1 = getAPrincipal().getAddress1();
t2 = inRU.getParamValue("BDADR1");
if ((t2 != null) && (!(t1.trim().equals(t2.trim())))) {
fc = new FieldChange("Principal Address 1", t2, t1);
getMinorChanges().addElement(fc);
getAPrincipal().setAddress1(t2);
} //BDADR2 - minor
t1 = getAPrincipal().getAddress2();
t2 = inRU.getParamValue("BDADR2");
if ((t2 != null) && (!(t1.trim().equals(t2.trim())))) {
fc = new FieldChange("Principal Address 2", t2, t1);
getMinorChanges().addElement(fc);
getAPrincipal().setAddress2(t2);
} //BDCITY - minor
t1 = getAPrincipal().getCity();
t2 = inRU.getParamValue("BDCITY");
if ((t2 != null) && (!(t1.trim().equals(t2.trim())))) {
fc = new FieldChange("Principal City", t2, t1);
getMinorChanges().addElement(fc);
getAPrincipal().setCity(t2);
} //BDSTATE - minor
t1 = getAPrincipal().getState();
t2 = inRU.getParamValue("BDST");
if ((t2 != null) && (!(t1.trim().equals(t2.trim())))) {
fc = new FieldChange("Principal State", t2, t1);
getMinorChanges().addElement(fc);
getAPrincipal().setState(t2);
//setState(t2);
} //BDZIP - minor
t1 = getAPrincipal().getZipcode();
t2 = inRU.getParamValue("BDZIP");
if ((t2 != null) && (!(t1.trim().equals(t2.trim())))) {
fc = new FieldChange("Principal Zip", t2, t1);
getMinorChanges().addElement(fc);
getAPrincipal().setZipcode(t2);
}
} //BDOBLG - minor
t1 = getObligee();
t2 = inRU.getParamValue("BDOBLG");
if ((t2 != null) && (!(t1.trim().equals(t2.trim())))) {
fc = new FieldChange("Obligee", t2, t1);
getMinorChanges().addElement(fc);
setObligee(t2);
}
if (inRU.getParamValue("ReturnBond") != null) {
boolean b1 = tc.string2Boolean(inRU.getParamValue("ReturnBond"));
if (b1 != getReturnBond())
setReturnBond(b1);
} //CHANGE IN BOND AMOUNT, PREM AMOUNT and COMMISH IS MAJOR
//BDBAMT - major
// I'll probably need to look at this again,
// there is something wrong with BondAmount and BIBAMT
// 2/20/02 - r
double d1 = em.currency2Double(inRU.getParamValue("BIBAMT").trim());
double dold = 0;
if (d1 > 0) {
if ("A".equals(getTransactionType()))
dold = getBondAmount() + d1;
else
if ("D".equals(getTransactionType()))
dold = getBondAmount() - d1;
else
dold = d1;
fc =
new FieldChange(
"Bond Amount",
em.double2CurrencyRounded(dold),
em.double2CurrencyRounded(getBondAmount()));
if (em.double2CurrencyRounded(dold)
!= em.double2CurrencyRounded(getBondAmount())) {
getMajorChanges().addElement(fc);
}
}
//BDAGC - minor
i1 = getAgentID().length() > 0 ? new Integer(getAgentID()).intValue() : 0;
i2 = new Integer(inRU.getParamValue("BDAGC")).intValue();
if (i1 != i2) {
fc =
new FieldChange(
"Agent Code",
dc.format(new Integer(i1).intValue()),
dc.format(new Integer(i2).intValue()));
getMinorChanges().addElement(fc);
if (getAAgency() != null)
getAAgency().setAgentCode(i2);
setAgentID(inRU.getParamValue("BDAGC"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment