001 /**
002 * Copyright 2005-2011 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.rice.ken.document.kew;
017
018 import org.kuali.rice.ken.util.NotificationConstants;
019 import org.kuali.rice.kew.api.WorkflowDocument;
020 import org.kuali.rice.kew.api.WorkflowDocumentFactory;
021
022 /**
023 * This class extends the KEW WorkflowDocument object and becomes our gateway for get a handle on
024 * KEW documents in workflow.
025 * @author Kuali Rice Team (rice.collab@kuali.org)
026 */
027 public final class NotificationWorkflowDocument {
028
029 private static final long serialVersionUID = 6125662798733898964L;
030
031 /**
032 * Constructs a NotificationWorkflowDocument instance - this essentially creates a new routable
033 * document in KEW for the given user.
034 * @param principalId
035 * @throws org.kuali.rice.kew.api.exception.WorkflowException
036 */
037 public static WorkflowDocument createNotificationDocument(String principalId) {
038 return WorkflowDocumentFactory.createDocument(principalId,
039 NotificationConstants.KEW_CONSTANTS.NOTIFICATION_DOC_TYPE, null);
040 }
041
042 /**
043 * Constructs a NotificationWorkflowDocument instance - this essentially creates a new routable
044 * document in KEW for the given user and document type name.
045 * @param user
046 * @param documentTypeName
047 * @throws org.kuali.rice.kew.api.exception.WorkflowException
048 */
049 public static WorkflowDocument createNotificationDocument(String principalId, String documentTypeName) {
050 return WorkflowDocumentFactory.createDocument(principalId, documentTypeName, null);
051 }
052
053 /**
054 * Constructs a NotificationWorkflowDocument instance - this one is used to get a handle on a
055 * workflow document that was already created in the system.
056 * @param user
057 * @param documentId
058 * @throws org.kuali.rice.kew.api.exception.WorkflowException
059 */
060 public static WorkflowDocument loadNotificationDocument(String principalId, String documentId) {
061 return WorkflowDocumentFactory.loadDocument(principalId, documentId);
062 }
063
064 private NotificationWorkflowDocument() {}
065
066 }