Changeset 202 for trunk/grails-app/services
- Timestamp:
- Nov 30, 2009, 1:26:18 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/TaskService.groovy
r201 r202 1 /* 2 * Provides a service for the Task domain class.1 /** 2 * Provides a service class for the Task domain class. 3 3 * 4 4 */ … … 10 10 def personService 11 11 12 /* 12 /** 13 13 * Determines and returns a possible parent list 14 * @ taskInstance The task to use when determining the possible parent list.14 * @param taskInstance The task to use when determining the possible parent list. 15 15 * @returns A list of the possible parents. 16 16 */ … … 26 26 } 27 27 28 /* 28 /** 29 29 * Creates a new task with the given params. 30 * @param s The params to use when creating the new task.30 * @param params The params to use when creating the new task. 31 31 * @returns A map containing result.error=true (if any error) and result.taskInstance. 32 32 */ … … 69 69 } // end create() 70 70 71 /* 71 /** 72 72 * Creates a subTask copying attributes from the parentTask unless otherwise specified. 73 * The taskProcedure is only assigned to the sub task if given in params. 73 74 * @param parentTask The parent task to get attributes from, also set as the parent. 74 75 * @param params Overrides the parent task values if specified. … … 94 95 p.targetStartDate = params.targetStartDate ?: parentTask.targetStartDate 95 96 p.targetCompletionDate = params.targetCompletionDate ?: parentTask.targetCompletionDate 97 98 if(params.taskProcedure) p.taskProcedure = params.taskProcedure 96 99 97 100 //Set the assignedPersons … … 108 111 } // end createSubTask() 109 112 110 /* 113 /** 111 114 * Creates a new task entry. 112 * @param s The params to use when creating the new entry.115 * @param params The params to use when creating the new entry. 113 116 * @returns A map containing result.error=true (if any error), result.entryInstance and result.taskId. 114 117 */ … … 180 183 } // end create() 181 184 185 /** 186 * Updates an existing task. 187 * @param params The params to update for task with id of params.id. 188 * @returns A map containing result.error=true (if any error) and result.taskInstance. 189 */ 182 190 def update(params) { 183 191 Task.withTransaction { status -> … … 223 231 } // end update() 224 232 233 /** 234 * Completes an existing task. 235 * @param params The params for task with id of params.id. 236 * @returns A map containing result.error=true (if any error) and result.taskInstance. 237 */ 225 238 def complete(params) { 226 239 Task.withTransaction { status -> … … 241 254 242 255 result.taskInstance.taskStatus = TaskStatus.get(3) 243 244 if(result.taskInstance.save()) { 245 246 result.taskInstance.taskRecurringSchedule?.enabled = false 247 256 result.taskInstance.taskRecurringSchedule?.enabled = false 257 258 if(result.taskInstance.save()) { 248 259 def taskModification = new TaskModification(person:personService.currentUser(), 249 260 taskModificationType: TaskModificationType.get(4), … … 270 281 } // end complete() 271 282 283 /** 284 * Reopens an existing task. 285 * @param params The params for task with id of params.id. 286 * @returns A map containing result.error=true (if any error) and result.taskInstance. 287 */ 272 288 def reopen(params) { 273 289 Task.withTransaction { status -> … … 313 329 } // end reopen() 314 330 331 /** 332 * Move a task to the trash. 333 * @param params The params for task with id of params.id. 334 * @returns A map containing result.error=true (if any error) and result.taskInstance. 335 */ 315 336 def trash(params) { 316 337 Task.withTransaction { status -> … … 331 352 332 353 result.taskInstance.trash = true 333 334 if(result.taskInstance.save()) { 335 336 result.taskInstance.taskRecurringSchedule?.enabled = false 337 354 result.taskInstance.taskRecurringSchedule?.enabled = false 355 356 if(result.taskInstance.save()) { 338 357 def taskModification = new TaskModification(person:personService.currentUser(), 339 358 taskModificationType: TaskModificationType.get(6), … … 359 378 } // end trash() 360 379 380 /** 381 * Restore a task from the trash. 382 * @param params The params for task with id of params.id. 383 * @returns A map containing result.error=true (if any error) and result.taskInstance. 384 */ 361 385 def restore(params) { 362 386 Task.withTransaction { status -> … … 402 426 } // end restore() 403 427 428 /** 429 * Approve a task. 430 * @param params The params for task with id of params.id. 431 * @returns A map containing result.error=true (if any error) and result.taskInstance. 432 */ 404 433 def approve(params) { 405 434 Task.withTransaction { status -> … … 445 474 } // end approve() 446 475 476 /** 477 * Remove a previously given approval from a task. 478 * @param params The params for task with id of params.id. 479 * @returns A map containing result.error=true (if any error) and result.taskInstance. 480 */ 447 481 def renegeApproval(params) { 448 482 Task.withTransaction { status ->
Note: See TracChangeset
for help on using the changeset viewer.