public static TimesheetTemplateObject getTimesheetTemplateObject(final UserPrefDO userPrefDO)
{
if (userPrefDO == null) {
return null;
}
final TimesheetTemplateObject template = new TimesheetTemplateObject();
final UserPrefDao userPrefDao = Registry.instance().getDao(UserPrefDao.class);
final TimesheetDO timesheet = new TimesheetDO();
userPrefDao.fillFromUserPrefParameters(userPrefDO, timesheet);
template.setName(userPrefDO.getName());
template.setDescription(timesheet.getDescription());
template.setLocation(timesheet.getLocation());
final UserObject user = PFUserDOConverter.getUserObject(timesheet.getUser());
if (user != null) {
template.setUser(user);
}
final TaskObject task = TaskDOConverter.getTaskObject(timesheet.getTask());
if (task != null) {
template.setTask(task);
}
final Cost2Object cost2 = Kost2DOConverter.getCost2Object(timesheet.getKost2());
if (cost2 != null) {
template.setCost2(cost2);
}
return template;
}