-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathTask.kt
More file actions
92 lines (86 loc) · 3.41 KB
/
Task.kt
File metadata and controls
92 lines (86 loc) · 3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/////////////////////////////////////////////////////////////////////////////
//
// Project ProjectForge Community Edition
// www.projectforge.org
//
// Copyright (C) 2001-2026 Micromata GmbH, Germany (www.micromata.com)
//
// ProjectForge is dual-licensed.
//
// This community edition is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as published
// by the Free Software Foundation; version 3 of the License.
//
// This community edition is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
// Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, see http://www.gnu.org/licenses/.
//
/////////////////////////////////////////////////////////////////////////////
package org.projectforge.rest.dto
import org.projectforge.business.gantt.GanttObjectType
import org.projectforge.business.gantt.GanttRelationType
import org.projectforge.business.task.TaskDO
import org.projectforge.business.task.TaskTree
import org.projectforge.common.i18n.Priority
import org.projectforge.common.task.TaskStatus
import org.projectforge.common.task.TimesheetBookingStatus
import org.projectforge.framework.persistence.api.BaseDO
import java.math.BigDecimal
class Task(id: Long? = null,
displayName: String? = null,
var parentTask: Task? = null,
var title: String? = null,
var status: TaskStatus? = null,
var priority: Priority? = null,
var shortDescription: String? = null,
var description: String? = null,
var progress: Int? = null,
var maxHours: Int? = null,
var startDate: java.util.Date? = null,
var endDate: java.util.Date? = null,
var duration: BigDecimal? = null,
var protectTimesheetsUntil: java.util.Date? = null,
var responsibleUser: User? = null,
var reference: String? = null,
var timesheetBookingStatus: TimesheetBookingStatus? = null,
var kost2BlackWhiteList: String? = null,
var kost2IsBlackList: Boolean? = null,
var protectionOfPrivacy: Boolean? = null,
var workpackageCode: String? = null,
var ganttPredecessorOffset: Int? = null,
var ganttRelationType: GanttRelationType? = null,
var ganttObjectType: GanttObjectType? = null,
var ganttPredecessor: Task? = null
) : BaseDTODisplayObject<TaskDO>(id, displayName = displayName) {
/**
* @see copyFromMinimal
*/
constructor(src: TaskDO): this() {
copyFromMinimal(src)
}
override fun copyFromMinimal(src: TaskDO) {
super.copyFromMinimal(src)
title = src.title
if (src.parentTask != null) {
parentTask = Task()
parentTask?.copyFromMinimal(src.parentTask!!)
}
}
companion object {
fun getTask(taskId: Long?, minimal: Boolean = true): Task? {
taskId ?: return null
val taskDO = TaskTree.instance.getTaskById(taskId) ?: return null
val task = Task()
if (minimal) {
task.copyFromMinimal(taskDO)
} else {
task.copyFrom(taskDO)
}
return task
}
}
}