ItEr40S16CUImportacionOrganizacionsTraballoItEr39S17: Updated the attributes of an OrderElement.

This commit is contained in:
Manuel Rego Casasnovas 2009-12-24 18:22:38 +01:00 committed by Javier Moran Rua
parent c5c60ad1cb
commit 8e7a0ce7cb

View file

@ -275,6 +275,27 @@ public final class OrderElementConverter {
throw new IncompatibleTypeException(orderElement.getCode(),
Order.class, orderElement.getClass());
}
Boolean dependenciesConstraintsHavePriority = ((OrderDTO) orderElementDTO).dependenciesConstraintsHavePriority;
if (dependenciesConstraintsHavePriority != null) {
((Order) orderElement)
.setDependenciesConstraintsHavePriority(dependenciesConstraintsHavePriority);
}
String calendarName = ((OrderDTO) orderElementDTO).calendarName;
if (calendarName != null) {
if (!((Order) orderElement).getCalendar().getName().equals(
calendarName)) {
List<BaseCalendar> calendars = Registry
.getBaseCalendarDAO()
.findByName(
((OrderDTO) orderElementDTO).calendarName);
if (calendars.size() == 1) {
((Order) orderElement)
.setCalendar(calendars.get(0));
}
}
}
} else { // orderElementDTO instanceof OrderLineGroupDTO
if (!(orderElement instanceof OrderLineGroup)) {
throw new IncompatibleTypeException(orderElement.getCode(),
@ -311,6 +332,23 @@ public final class OrderElementConverter {
.addMaterialAssignment(toEntity(materialAssignmentDTO));
}
}
if (orderElementDTO.name != null) {
orderElement.setName(orderElementDTO.name);
}
if (orderElementDTO.initDate != null) {
orderElement.setInitDate(orderElementDTO.initDate);
}
if (orderElementDTO.deadline != null) {
orderElement.setDeadline(orderElementDTO.deadline);
}
if (orderElementDTO.description != null) {
orderElement.setDescription(orderElementDTO.description);
}
}
public final static void update(HoursGroup hoursGroup,