result = incomingPaymentEntity;
}
if (source instanceof OutgoingPayment) {
OutgoingPaymentEntity outgoingPaymentEntity = new OutgoingPaymentEntity();
outgoingPaymentEntity.setCompleted(source.isCompleted());
outgoingPaymentEntity.setCreationDate(source.getCreationDate());
outgoingPaymentEntity.setId(source.getId());
outgoingPaymentEntity.setPaymentDate(source.getPaymentDate());
Employee employee = ((OutgoingPayment) source).getRecipient();
EmployeeEntity employeeEntity = null;
if (employee instanceof Mechanic) {
employeeEntity = DozerHelper.map(employee, MechanicEntity.class);
}
if (employee instanceof Employee) {
employeeEntity = DozerHelper.map(employee, EmployeeEntity.class);
}
outgoingPaymentEntity.setRecipient(employeeEntity);
outgoingPaymentEntity.setSubject(source.getSubject());
SubsidiaryEntity subsidiaryEntity = DozerHelper.map(
source.getSubsidiary(), SubsidiaryEntity.class);
outgoingPaymentEntity.setSubsidiary(subsidiaryEntity);
outgoingPaymentEntity.setTotal(source.getTotal());
outgoingPaymentEntity.setType(source.getType());
result = outgoingPaymentEntity;
}
return result;