@SuppressWarnings("deprecation")
@Override
public Activity convertFrom(ActivityEntity source, Activity destination) {
Activity result = null;
ActivityEntity tmp = null;
if (source != null) {
tmp = HibernateHelper.initializeAndUnproxy(source);
}
if (tmp instanceof ServiceEntity) {
Service service = new Service();
service.setId(tmp.getId());
service.setDescription(((ServiceEntity) tmp).getDescription());
service.setElapsedTime(tmp.getElapsedTime());
service.setNote(tmp.getNote());
service.setTotal(tmp.getTotal());
result = service;
}
if (tmp instanceof DetailReplacementEntity) {
DetailReplacement detailReplacement = new DetailReplacement();
detailReplacement.setId(tmp.getId());
DetailEntity detailEntity = ((DetailReplacementEntity) tmp)
.getDetail();
Detail detail = DozerHelper.map(detailEntity, Detail.class);
detailReplacement.setDetail(detail);
detailReplacement.setElapsedTime(tmp.getElapsedTime());
detailReplacement.setNote(tmp.getNote());
detailReplacement.setTotal(tmp.getTotal());
result = detailReplacement;
}
return result;