1 31 32 package org.opencms.workflow; 33 34 import org.opencms.db.CmsSecurityManager; 35 import org.opencms.file.CmsGroup; 36 import org.opencms.file.CmsProject; 37 import org.opencms.file.CmsRequestContext; 38 import org.opencms.file.CmsUser; 39 import org.opencms.main.CmsException; 40 41 import java.util.List ; 42 43 53 public class CmsTaskService { 54 55 56 public static final String TASK_FILTER = "task.filter."; 57 58 59 public static final String TASK_MESSAGES = "TaskMessages"; 60 61 62 public static final int TASK_MESSAGES_ACCEPTED = 1; 63 64 65 public static final int TASK_MESSAGES_COMPLETED = 4; 66 67 68 public static final int TASK_MESSAGES_FORWARDED = 2; 69 70 71 public static final int TASK_MESSAGES_MEMBERS = 8; 72 73 74 public static final int TASK_PRIORITY_HIGH = 1; 75 76 77 public static final int TASK_PRIORITY_LOW = 3; 78 79 82 public static final int TASK_PRIORITY_NORMAL = 2; 83 84 85 public static final int TASK_STATE_ENDED = 4; 86 87 88 public static final int TASK_STATE_HALTED = 5; 89 90 91 public static final int TASK_STATE_NOTENDED = 3; 92 93 94 public static final int TASK_STATE_PREPARE = 0; 95 96 97 public static final int TASK_STATE_START = 1; 98 99 100 public static final int TASK_STATE_STARTED = 2; 101 102 103 public static final int TASKLOG_SYSTEM = 0; 104 105 106 public static final int TASKLOG_USER = 1; 107 108 109 public static final int TASKS_ACTIVE = 4; 110 111 112 public static final int TASKS_ALL = 1; 113 114 115 public static final int TASKS_DONE = 5; 116 117 118 public static final int TASKS_NEW = 2; 119 120 121 public static final int TASKS_OPEN = 3; 122 123 124 protected CmsRequestContext m_context; 125 126 127 protected CmsSecurityManager m_securityManager; 128 129 135 public CmsTaskService(CmsRequestContext context, CmsSecurityManager securityManager) { 136 137 m_context = context; 138 m_securityManager = securityManager; 139 } 140 141 148 public void acceptTask(int taskId) throws CmsException { 149 150 m_securityManager.acceptTask(m_context, taskId); 151 } 152 153 169 public CmsTask createTask( 170 int projectid, 171 String agentName, 172 String roleName, 173 String taskname, 174 String taskcomment, 175 int tasktype, 176 long timeout, 177 int priority) throws CmsException { 178 179 return m_securityManager.createTask( 180 m_context, 181 m_context.currentUser(), 182 projectid, 183 agentName, 184 roleName, 185 taskname, 186 taskcomment, 187 tasktype, 188 timeout, 189 priority); 190 } 191 192 214 public CmsTask createTask(String agentName, String roleName, String taskname, long timeout, int priority) 215 throws CmsException { 216 217 return (m_securityManager.createTask(m_context, agentName, roleName, taskname, timeout, priority)); 218 } 219 220 227 public void endTask(int taskid) throws CmsException { 228 229 m_securityManager.endTask(m_context, taskid); 230 } 231 232 241 public void forwardTask(int taskid, String newRoleName, String newUserName) throws CmsException { 242 243 m_securityManager.forwardTask(m_context, taskid, newRoleName, newUserName); 244 } 245 246 256 public String getTaskPar(int taskid, String parname) throws CmsException { 257 258 return m_securityManager.getTaskPar(m_context, taskid, parname); 259 } 260 261 270 public int getTaskType(String taskname) throws CmsException { 271 272 return m_securityManager.getTaskType(m_context, taskname); 273 } 274 275 285 public void reactivateTask(int taskId) throws CmsException { 286 287 m_securityManager.reactivateTask(m_context, taskId); 288 } 289 290 299 public CmsUser readAgent(CmsTask task) throws CmsException { 300 301 return m_securityManager.readAgent(m_context, task); 302 } 303 304 326 public List readGivenTasks(int projectId, String ownerName, int taskType, String orderBy, String sort) 327 throws CmsException { 328 329 return m_securityManager.readGivenTasks(m_context, projectId, ownerName, taskType, orderBy, sort); 330 } 331 332 341 public CmsGroup readGroup(CmsTask task) throws CmsException { 342 343 return m_securityManager.readGroup(m_context, task); 344 } 345 346 355 public CmsUser readOriginalAgent(CmsTask task) throws CmsException { 356 357 return m_securityManager.readOriginalAgent(m_context, task); 358 } 359 360 369 public CmsUser readOwner(CmsTask task) throws CmsException { 370 371 return m_securityManager.readOwner(m_context, task); 372 } 373 374 383 public CmsUser readOwner(CmsTaskLog log) throws CmsException { 384 385 return m_securityManager.readOwner(m_context, log); 386 } 387 388 397 public CmsProject readProject(CmsTask task) throws CmsException { 398 399 return m_securityManager.readProject(m_context, task); 400 } 401 402 411 public List readProjectLogs(int projectId) throws CmsException { 412 413 return m_securityManager.readProjectLogs(m_context, projectId); 414 } 415 416 425 public CmsTask readTask(int id) throws CmsException { 426 427 return m_securityManager.readTask(m_context, id); 428 } 429 430 439 public List readTaskLogs(int taskid) throws CmsException { 440 441 return m_securityManager.readTaskLogs(m_context, taskid); 442 } 443 444 465 public List readTasksForProject(int projectId, int tasktype, String orderBy, String sort) throws CmsException { 466 467 return (m_securityManager.readTasksForProject(m_context, projectId, tasktype, orderBy, sort)); 468 } 469 470 492 public List readTasksForRole(int projectId, String roleName, int tasktype, String orderBy, String sort) 493 throws CmsException { 494 495 return m_securityManager.readTasksForRole(m_context, projectId, roleName, tasktype, orderBy, sort); 496 } 497 498 520 public List readTasksForUser(int projectId, String userName, int tasktype, String orderBy, String sort) 521 throws CmsException { 522 523 return m_securityManager.readTasksForUser(m_context, projectId, userName, tasktype, orderBy, sort); 524 } 525 526 534 public void setName(int taskId, String name) throws CmsException { 535 536 m_securityManager.setName(m_context, taskId, name); 537 } 538 539 547 public void setPriority(int taskId, int priority) throws CmsException { 548 549 m_securityManager.setPriority(m_context, taskId, priority); 550 } 551 552 561 public void setTaskPar(int taskid, String parname, String parvalue) throws CmsException { 562 563 m_securityManager.setTaskPar(m_context, taskid, parname, parvalue); 564 } 565 566 574 public void setTimeout(int taskId, long timeout) throws CmsException { 575 576 m_securityManager.setTimeout(m_context, taskId, timeout); 577 } 578 579 587 public void writeTaskLog(int taskid, String comment) throws CmsException { 588 589 m_securityManager.writeTaskLog(m_context, taskid, comment); 590 } 591 592 601 public void writeTaskLog(int taskId, String comment, int taskType) throws CmsException { 602 603 m_securityManager.writeTaskLog(m_context, taskId, comment, taskType); 604 } 605 } | Popular Tags |