1 /**
2 * Copyright 2005-2016 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.rice.ken.document.kew;
17
18 import org.kuali.rice.ken.util.NotificationConstants;
19 import org.kuali.rice.kew.api.WorkflowDocument;
20 import org.kuali.rice.kew.api.WorkflowDocumentFactory;
21
22 /**
23 * This class extends the KEW WorkflowDocument object and becomes our gateway for get a handle on
24 * KEW documents in workflow.
25 * @author Kuali Rice Team (rice.collab@kuali.org)
26 */
27 public final class NotificationWorkflowDocument {
28
29 private static final long serialVersionUID = 6125662798733898964L;
30
31 /**
32 * Constructs a NotificationWorkflowDocument instance - this essentially creates a new routable
33 * document in KEW for the given user.
34 * @param principalId
35 * @throws org.kuali.rice.kew.api.exception.WorkflowException
36 */
37 public static WorkflowDocument createNotificationDocument(String principalId) {
38 return WorkflowDocumentFactory.createDocument(principalId,
39 NotificationConstants.KEW_CONSTANTS.NOTIFICATION_DOC_TYPE, null);
40 }
41
42 /**
43 * Constructs a NotificationWorkflowDocument instance - this essentially creates a new routable
44 * document in KEW for the given user and document type name.
45 * @param user
46 * @param documentTypeName
47 * @throws org.kuali.rice.kew.api.exception.WorkflowException
48 */
49 public static WorkflowDocument createNotificationDocument(String principalId, String documentTypeName) {
50 return WorkflowDocumentFactory.createDocument(principalId, documentTypeName, null);
51 }
52
53 /**
54 * Constructs a NotificationWorkflowDocument instance - this one is used to get a handle on a
55 * workflow document that was already created in the system.
56 * @param user
57 * @param documentId
58 * @throws org.kuali.rice.kew.api.exception.WorkflowException
59 */
60 public static WorkflowDocument loadNotificationDocument(String principalId, String documentId) {
61 return WorkflowDocumentFactory.loadDocument(principalId, documentId);
62 }
63
64 private NotificationWorkflowDocument() {}
65
66 }