protected void execute(PrevalentSystem system) throws BusinessException {
for (Registration registration : system.getRegistrations().values()) {
List<Parcel> parcels = registration.getParcels();
for (Parcel parcel : parcels) {
if(parcel.getPayment() != null){
TypeOfPayment paymentType = parcel.getPayment();
if (paymentType.getType().equals("Dinheiro")) {
parcel.setPaymenType(system.getPaymentMoney());
} else if (paymentType.getType().equals("D�bito autom�tico")) {
parcel.setPaymenType(system.getPaymentAutomaticDebit());
} else if (paymentType.getType().equals("Pagamento eletr�nico")) {
parcel.setPaymenType(system.getPaymentEletronic());
} else if (paymentType.getType().equals("Transfer�ncia eletr�nica")) {
parcel.setPaymenType(system.getPaymentEletronicTransfer());
} else if (paymentType.getType().equals("TED")) {
parcel.setPaymenType(system.getPaymentTED());
} else if (paymentType.getType().equals("DOC")) {
parcel.setPaymenType(system.getPaymentDOC());
} else if (paymentType.getType().equals("Saque cart�o")) {
parcel.setPaymenType(system.getPaymentGetMoney());
}else if(paymentType instanceof PaymentBankAccountPayed){
PaymentBankAccountPayed type = (PaymentBankAccountPayed) paymentType;
boolean paymentTypeBankAccountExists = false;
for (int i = 0; i< system.getPaymentTypeBankAccount().size(); i++) {
if(system.getPaymentTypeBankAccount().get(i).getAccountId().equals(type.getAccountId())){
parcel.setPaymenType(system.getPaymentTypeBankAccount().get(i));
paymentTypeBankAccountExists = true;
break;
}
}
if(!paymentTypeBankAccountExists){
PaymentBankAccountPayed paymentTypeBankAccount = new PaymentBankAccountPayed(type.getAccountId());
system.getPaymentTypeBankAccount().add(paymentTypeBankAccount);
for (int j=0; j < system.getPaymentTypeBankAccount().size(); j++){
if(system.getPaymentTypeBankAccount().get(j).getAccountId().equals(type.getAccountId())){
parcel.setPaymenType(system.getPaymentTypeBankAccount().get(j));
break;
}
}
}
} else if (paymentType.getType().equals("Cheque")) {
parcel.setPaymenType(paymentType);
}
}
}
}