01: // license-header java merge-point
02: /**
03: * This is only generated once! It will never be overwritten.
04: * You can (and have to!) safely modify it by hand.
05: */package org.andromda.timetracker.domain;
06:
07: import org.andromda.timetracker.vo.TimeAllocationVO;
08: import org.andromda.timetracker.vo.TimePeriodVO;
09:
10: /**
11: * @see org.andromda.timetracker.domain.TimeAllocation
12: */
13: public class TimeAllocationDaoImpl extends
14: org.andromda.timetracker.domain.TimeAllocationDaoBase {
15: /**
16: * @see @see org.andromda.timetracker.domain.TimeAllocationDao#toTimeAllocationVO(org.andromda.timetracker.domain.TimeAllocation, org.andromda.timetracker.vo.TimeAllocationVO)
17: */
18: public void toTimeAllocationVO(
19: org.andromda.timetracker.domain.TimeAllocation sourceEntity,
20: org.andromda.timetracker.vo.TimeAllocationVO targetVO) {
21: super .toTimeAllocationVO(sourceEntity, targetVO);
22: TimePeriod timePeriod = sourceEntity.getTimePeriod();
23: targetVO.setTimePeriodVO(new TimePeriodVO(timePeriod
24: .getStartTime(), timePeriod.getEndTime()));
25: targetVO.setTaskId(sourceEntity.getTask().getId());
26: }
27:
28: /**
29: * @see org.andromda.timetracker.domain.TimeAllocationDao#toTimeAllocationVO(org.andromda.timetracker.domain.TimeAllocation)
30: */
31: public org.andromda.timetracker.vo.TimeAllocationVO toTimeAllocationVO(
32: final org.andromda.timetracker.domain.TimeAllocation entity) {
33: TimeAllocationVO targetVO = new TimeAllocationVO();
34: toTimeAllocationVO(entity, targetVO);
35: return targetVO;
36: }
37:
38: /**
39: * Retrieves the entity object that is associated with the specified value object
40: * from the object store. If no such entity object exists in the object store,
41: * a new, blank entity is created
42: */
43: private org.andromda.timetracker.domain.TimeAllocation loadTimeAllocationFromTimeAllocationVO(
44: org.andromda.timetracker.vo.TimeAllocationVO timeAllocationVO) {
45: // @todo implement loadTimeAllocationFromTimeAllocationVO
46: throw new java.lang.UnsupportedOperationException(
47: "org.andromda.timetracker.domain.loadTimeAllocationFromTimeAllocationVO(org.andromda.timetracker.vo.TimeAllocationVO) not yet implemented.");
48:
49: /* A typical implementation looks like this:
50: org.andromda.timetracker.domain.TimeAllocation timeAllocation = this.load(timeAllocationVO.getId());
51: if (timeAllocation == null)
52: {
53: timeAllocation = org.andromda.timetracker.domain.TimeAllocation.Factory.newInstance();
54: }
55: return timeAllocation;
56: */
57: }
58:
59: /**
60: * @see org.andromda.timetracker.domain.TimeAllocationDao#timeAllocationVOToEntity(org.andromda.timetracker.vo.TimeAllocationVO)
61: */
62: public org.andromda.timetracker.domain.TimeAllocation timeAllocationVOToEntity(
63: org.andromda.timetracker.vo.TimeAllocationVO timeAllocationVO) {
64: // @todo verify behavior of timeAllocationVOToEntity
65: org.andromda.timetracker.domain.TimeAllocation timeAllocation = this
66: .loadTimeAllocationFromTimeAllocationVO(timeAllocationVO);
67: this .timeAllocationVOToEntity(timeAllocationVO, timeAllocation,
68: true);
69: return timeAllocation;
70: }
71:
72: /**
73: * @see org.andromda.timetracker.domain.TimeAllocationDao#timeAllocationVOToEntity(org.andromda.timetracker.vo.TimeAllocationVO, org.andromda.timetracker.domain.TimeAllocation)
74: */
75: public void timeAllocationVOToEntity(
76: org.andromda.timetracker.vo.TimeAllocationVO sourceVO,
77: org.andromda.timetracker.domain.TimeAllocation targetEntity,
78: boolean copyIfNull) {
79: super .timeAllocationVOToEntity(sourceVO, targetEntity,
80: copyIfNull);
81: TimePeriodVO timePeriodVO = sourceVO.getTimePeriodVO();
82: targetEntity.setTimePeriod(TimePeriod.newInstance(timePeriodVO
83: .getStartTime(), timePeriodVO.getEndTime()));
84: }
85: }
|