this.idRegistration = idRegistration;
}
protected void execute(PrevalentSystem system) throws BusinessException {
if (system.getRegistrations().containsKey(idRegistration)) {
Registration persistentRegistration = system.getRegistrations().get(idRegistration);
// if(parcels != null)
// parcels = getCorrectParcels(parcels, system);
if (isOnlySetParcels) {
persistentRegistration.setParcels(parcels);
} else {
for (String idCourse : this.courseIdList) {
if (system.getCourses().containsKey(idCourse)) {
persistentRegistration.addRegistrationItem(new RegistrationItem(system.getCourses().get(idCourse),system.getCourses().get(idCourse).getValue()));
}
}
persistentRegistration.setParcels(parcels);
persistentRegistration.setRegistrationAdditionValue(addition);
persistentRegistration.setRegistrationDiscountValue(discount);
persistentRegistration.setRegistrationValue(registrationValue);
persistentRegistration.setRegistrationDate(date);
persistentRegistration.setDuration(duration);
persistentRegistration.setPontualityDiscount(pontualityDiscount);
}
} else {
List<RegistrationItem> registrationItens = new ArrayList<RegistrationItem>();
for (String idCourse : this.courseIdList) {
if (system.getCourses().containsKey(idCourse)) {
registrationItens.add(new RegistrationItem(system.getCourses()
.get(idCourse), system.getCourses().get(idCourse)
.getValue()));
}
}
system.getRegistrations().put(idRegistration, new Registration(
idRegistration, system.getPeople().get(idPerson), registrationItens, discount,
addition, registrationValue, date, duration, parcels,
active, system.getPeople().get(employeeId),
pontualityDiscount));
}