remove customer reference to bankaccount

This commit is contained in:
Peter Hormanns 2014-07-28 11:57:08 +02:00
parent a027cf8d86
commit 7703bb2821
3 changed files with 64 additions and 64 deletions

View File

@ -93,8 +93,8 @@ public class Customer extends AbstractEntity implements Serializable {
@OneToMany(fetch = EAGER, cascade = ALL, mappedBy = "customer") @OneToMany(fetch = EAGER, cascade = ALL, mappedBy = "customer")
private Set<Contact> contacts; private Set<Contact> contacts;
@OneToOne(fetch = EAGER, cascade = ALL, mappedBy = "customer") // @OneToOne(fetch = EAGER, cascade = ALL, mappedBy = "customer")
private BankAccount bankAccount; // private BankAccount bankAccount;
@OneToMany(fetch = LAZY, cascade = ALL, mappedBy = "customer") @OneToMany(fetch = LAZY, cascade = ALL, mappedBy = "customer")
@OrderBy("name") @OrderBy("name")
@ -233,13 +233,13 @@ public class Customer extends AbstractEntity implements Serializable {
contacts.add(contact); contacts.add(contact);
} }
public BankAccount getBankAccount() { // public BankAccount getBankAccount() {
return bankAccount; // return bankAccount;
} // }
//
public void setBankAccount(BankAccount bankAccount) { // public void setBankAccount(BankAccount bankAccount) {
this.bankAccount = bankAccount; // this.bankAccount = bankAccount;
} // }
public Set<Pac> getPacs() { public Set<Pac> getPacs() {
return pacs; return pacs;

View File

@ -36,12 +36,12 @@ public class CustomerModuleImpl extends AbstractModuleImpl {
if (contact.getFirstName() != null && contact.getFirstName().length() > 0) { if (contact.getFirstName() != null && contact.getFirstName().length() > 0) {
custComment = contact.getFirstName() + " " + contact.getLastName(); custComment = contact.getFirstName() + " " + contact.getLastName();
} }
BankAccount bankAccount = newCustomer.getBankAccount(); // BankAccount bankAccount = newCustomer.getBankAccount();
if (bankAccount == null) { // if (bankAccount == null) {
bankAccount = new BankAccount(); // bankAccount = new BankAccount();
bankAccount.setCustomer(newCustomer); // bankAccount.setCustomer(newCustomer);
newCustomer.setBankAccount(bankAccount); // newCustomer.setBankAccount(bankAccount);
} // }
GenericModuleImpl helperModule = new GenericModuleImpl(getTransaction()); GenericModuleImpl helperModule = new GenericModuleImpl(getTransaction());
UnixUser custAccount = new UnixUser(); UnixUser custAccount = new UnixUser();

View File

@ -47,17 +47,17 @@ public class CustomerRemote extends AbstractRemote {
} }
resultMap.put("sharessigned", Integer.toString(cust.getSharesSigned())); resultMap.put("sharessigned", Integer.toString(cust.getSharesSigned()));
resultMap.put("uidvat", cust.getUidVAT()); resultMap.put("uidvat", cust.getUidVAT());
BankAccount bank = cust.getBankAccount(); // BankAccount bank = cust.getBankAccount();
if (bank != null) { // if (bank != null) {
resultMap.put("autodebit_ga", bank.getAutoDebitGA() != null && bank.getAutoDebitGA() ? "Yes" : "No"); // resultMap.put("autodebit_ga", bank.getAutoDebitGA() != null && bank.getAutoDebitGA() ? "Yes" : "No");
resultMap.put("autodebit_ar", bank.getAutoDebitAR() != null && bank.getAutoDebitAR() ? "Yes" : "No"); // resultMap.put("autodebit_ar", bank.getAutoDebitAR() != null && bank.getAutoDebitAR() ? "Yes" : "No");
resultMap.put("autodebit_op", bank.getAutoDebitOP() != null && bank.getAutoDebitOP() ? "Yes" : "No"); // resultMap.put("autodebit_op", bank.getAutoDebitOP() != null && bank.getAutoDebitOP() ? "Yes" : "No");
resultMap.put("bank_customer", bank.getBankCustomer()); // resultMap.put("bank_customer", bank.getBankCustomer());
resultMap.put("bank_iban", bank.getBankIBAN()); // resultMap.put("bank_iban", bank.getBankIBAN());
resultMap.put("bank_bic", bank.getBankBIC()); // resultMap.put("bank_bic", bank.getBankBIC());
resultMap.put("bank_name", bank.getBankName()); // resultMap.put("bank_name", bank.getBankName());
resultMap.put("mandat_ref", bank.getMandatRef()); // resultMap.put("mandat_ref", bank.getMandatRef());
} // }
Set<Contact> contacts = cust.getContacts(); Set<Contact> contacts = cust.getContacts();
if (contacts != null && !contacts.isEmpty()) { if (contacts != null && !contacts.isEmpty()) {
Contact c = contacts.iterator().next(); Contact c = contacts.iterator().next();
@ -131,44 +131,44 @@ public class CustomerRemote extends AbstractRemote {
if (assertNotNull(uidVat)) { if (assertNotNull(uidVat)) {
cust.setUidVAT(uidVat); cust.setUidVAT(uidVat);
} }
BankAccount bank = cust.getBankAccount(); // BankAccount bank = cust.getBankAccount();
if (bank == null) { // if (bank == null) {
bank = new BankAccount(); // bank = new BankAccount();
bank.setCustomer(cust); // bank.setCustomer(cust);
cust.setBankAccount(bank); // cust.setBankAccount(bank);
bank.setMandatRef(memberNo); // bank.setMandatRef(memberNo);
} // }
String autoDebitGA = (String) setParams.get("autodebit_ga"); // String autoDebitGA = (String) setParams.get("autodebit_ga");
if (assertNotNull(autoDebitGA)) { // if (assertNotNull(autoDebitGA)) {
autoDebitGA = autoDebitGA.toUpperCase(); // autoDebitGA = autoDebitGA.toUpperCase();
bank.setAutoDebitGA(new Boolean(autoDebitGA.startsWith("T") || autoDebitGA.startsWith("Y"))); // bank.setAutoDebitGA(new Boolean(autoDebitGA.startsWith("T") || autoDebitGA.startsWith("Y")));
} // }
String autoDebitAR = (String) setParams.get("autodebit_ar"); // String autoDebitAR = (String) setParams.get("autodebit_ar");
if (assertNotNull(autoDebitAR)) { // if (assertNotNull(autoDebitAR)) {
autoDebitAR = autoDebitAR.toUpperCase(); // autoDebitAR = autoDebitAR.toUpperCase();
bank.setAutoDebitAR(new Boolean(autoDebitAR.startsWith("T") || autoDebitAR.startsWith("Y"))); // bank.setAutoDebitAR(new Boolean(autoDebitAR.startsWith("T") || autoDebitAR.startsWith("Y")));
} // }
String autoDebitOP = (String) setParams.get("autodebit_op"); // String autoDebitOP = (String) setParams.get("autodebit_op");
if (assertNotNull(autoDebitOP)) { // if (assertNotNull(autoDebitOP)) {
autoDebitOP = autoDebitOP.toUpperCase(); // autoDebitOP = autoDebitOP.toUpperCase();
bank.setAutoDebitOP(new Boolean(autoDebitOP.startsWith("T") || autoDebitOP.startsWith("Y"))); // bank.setAutoDebitOP(new Boolean(autoDebitOP.startsWith("T") || autoDebitOP.startsWith("Y")));
} // }
String bankCustomer = (String) setParams.get("bank_customer"); // String bankCustomer = (String) setParams.get("bank_customer");
if (assertNotNull(bankCustomer)) { // if (assertNotNull(bankCustomer)) {
bank.setBankCustomer(bankCustomer); // bank.setBankCustomer(bankCustomer);
} // }
String bankIBAN = (String) setParams.get("bank_iban"); // String bankIBAN = (String) setParams.get("bank_iban");
if (assertNotNull(bankIBAN)) { // if (assertNotNull(bankIBAN)) {
bank.setBankIBAN(bankIBAN); // bank.setBankIBAN(bankIBAN);
} // }
String bankBIC = (String) setParams.get("bank_bic"); // String bankBIC = (String) setParams.get("bank_bic");
if (assertNotNull(bankBIC)) { // if (assertNotNull(bankBIC)) {
bank.setBankBIC(bankBIC); // bank.setBankBIC(bankBIC);
} // }
String bankName = (String) setParams.get("bank_name"); // String bankName = (String) setParams.get("bank_name");
if (assertNotNull(bankName)) { // if (assertNotNull(bankName)) {
bank.setBankName(bankName); // bank.setBankName(bankName);
} // }
Set<Contact> contacts = cust.getContacts(); Set<Contact> contacts = cust.getContacts();
Contact c = null; Contact c = null;
if (contacts == null || contacts.isEmpty()) { if (contacts == null || contacts.isEmpty()) {