BrightSide Workbench Full Report + Source Code
org.turro.erp.time.TimeControlUtil Class Reference

Public Member Functions

HumanResource getHumanResource ()
 
void setHumanResource (HumanResource humanResource)
 
Task getTask ()
 
void setTask (Task task)
 
List< TimeControlgetPendingControl ()
 
TimeControl start ()
 
TimeControl start (Date date)
 
TimeControl end (TimeControl tc)
 
TimeControl end (TimeControl tc, Date date)
 
List< TimeControlgetFromDate (Date date)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 36 of file TimeControlUtil.java.

Member Function Documentation

◆ end() [1/2]

TimeControl org.turro.erp.time.TimeControlUtil.end ( TimeControl  tc)

Definition at line 93 of file TimeControlUtil.java.

93  {
94  return end(tc, null);
95  }
TimeControl end(TimeControl tc)
Here is the caller graph for this function:

◆ end() [2/2]

TimeControl org.turro.erp.time.TimeControlUtil.end ( TimeControl  tc,
Date  date 
)

Definition at line 97 of file TimeControlUtil.java.

97  {
98  Dao dao = new ErpPU();
99  tc = dao.find(TimeControl.class, tc.getId());
100  if(date == null) {
101  tc.setEndTime(new Date());
102  } else {
103  tc.setEndTime(date);
104  tc.setEndManual(true);
105  }
106  tc = dao.saveObject(tc);
107  return tc;
108  }
Here is the call graph for this function:

◆ getFromDate()

List<TimeControl> org.turro.erp.time.TimeControlUtil.getFromDate ( Date  date)

Definition at line 110 of file TimeControlUtil.java.

110  {
111  CheckDate d = new CheckDate(date);
112  WhereClause wc = new WhereClause();
113  wc.addClause("select tc from TimeControl as tc");
114  wc.addClause("where (year(tc.startTime) = :year1 and month(tc.startTime) = :month1 and day(tc.startTime) = :day1)");
115  wc.addClause("or (year(tc.endTime) = :year2 and month(tc.endTime) = :month2 and day(tc.endTime) = :day2)");
116  wc.addNamedValue("year1", d.getYear());
117  wc.addNamedValue("month1", d.getMonth());
118  wc.addNamedValue("day1", d.getDay());
119  wc.addNamedValue("year2", d.getYear());
120  wc.addNamedValue("month2", d.getMonth());
121  wc.addNamedValue("day2", d.getDay());
122  Dao dao = new ErpPU();
123  return dao.getResultList(wc);
124  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHumanResource()

HumanResource org.turro.erp.time.TimeControlUtil.getHumanResource ( )

Definition at line 41 of file TimeControlUtil.java.

41  {
42  return humanResource;
43  }

◆ getPendingControl()

List<TimeControl> org.turro.erp.time.TimeControlUtil.getPendingControl ( )

Definition at line 57 of file TimeControlUtil.java.

57  {
58  if(humanResource != null) {
59  WhereClause wc = new WhereClause();
60  wc.addClause("select tc from TimeControl as tc");
61  wc.addClause("where tc.humanResource = :humanResource");
62  wc.addNamedValue("humanResource", humanResource);
63  if(task != null) {
64  wc.addClause("and tc.task = :task");
65  wc.addNamedValue("task", task);
66  }
67  wc.addClause("and tc.endTime is null");
68  Dao dao = new ErpPU();
69  return dao.getResultList(wc);
70  }
71  return new ArrayList<TimeControl>();
72  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTask()

Task org.turro.erp.time.TimeControlUtil.getTask ( )

Definition at line 49 of file TimeControlUtil.java.

49  {
50  return task;
51  }

◆ setHumanResource()

void org.turro.erp.time.TimeControlUtil.setHumanResource ( HumanResource  humanResource)

Definition at line 45 of file TimeControlUtil.java.

45  {
46  this.humanResource = humanResource;
47  }
Here is the caller graph for this function:

◆ setTask()

void org.turro.erp.time.TimeControlUtil.setTask ( Task  task)

Definition at line 53 of file TimeControlUtil.java.

53  {
54  this.task = task;
55  }
Here is the caller graph for this function:

◆ start() [1/2]

TimeControl org.turro.erp.time.TimeControlUtil.start ( )

Definition at line 74 of file TimeControlUtil.java.

74  {
75  return start(null);
76  }
Here is the caller graph for this function:

◆ start() [2/2]

TimeControl org.turro.erp.time.TimeControlUtil.start ( Date  date)

Definition at line 78 of file TimeControlUtil.java.

78  {
79  TimeControl tc = new TimeControl();
80  tc.setHumanResource(humanResource);
81  tc.setTask(task);
82  if(date == null) {
83  tc.setStartTime(new Date());
84  } else {
85  tc.setStartTime(date);
86  tc.setStartManual(true);
87  }
88  Dao dao = new ErpPU();
89  tc = dao.saveObject(tc);
90  return tc;
91  }
Here is the call graph for this function:

The documentation for this class was generated from the following file: