1 /** 2 * Copyright 2005-2015 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.kew.impl.document; 17 18 import org.kuali.rice.kew.api.WorkflowDocument; 19 import org.kuali.rice.kew.api.document.DocumentContentUpdate; 20 import org.kuali.rice.kew.api.document.DocumentUpdate; 21 22 /** 23 * Service provider interface for creation and loading of {@link WorkflowDocument}s. 24 * NOTE: WorkflowDocumentFactory constructs a single global instance, so implementations of this interface 25 * must be thread-safe. 26 * 27 * @author Kuali Rice Team (rice.collab@kuali.org) 28 */ 29 public interface WorkflowDocumentProvider { 30 /** 31 * Creates a new workflow document of the given type with the given initiator. 32 * 33 * @param principalId the document initiator 34 * @param documentTypeName the document type 35 * @param documentUpdate pre-constructed state with which to initialize the document 36 * @param documentContentUpdate pre-constructed document content with which to initialize the document 37 * 38 * @return a WorkflowDocument object through which to interact with the new workflow document 39 * 40 * @throws IllegalArgumentException if principalId is null or blank 41 * @throws IllegalArgumentException if documentTypeName is null or blank 42 * @throws org.kuali.rice.kew.api.doctype.IllegalDocumentTypeException if documentTypeName does not represent a valid document type 43 */ 44 WorkflowDocument createDocument(String principalId, String documentTypeName, DocumentUpdate documentUpdate, DocumentContentUpdate documentContentUpdate); 45 46 /** 47 * Loads an existing workflow document. 48 * @param principalId the principal id under which to perform document actions 49 * @param documentId the id of the document to load 50 * 51 * @return a WorkflowDocument object through which to interact with the loaded workflow document 52 * 53 * @throws IllegalArgumentException if principalId is null or blank 54 * @throws IllegalArgumentException if documentTypeName is null or blank 55 * @throws org.kuali.rice.kew.api.doctype.IllegalDocumentTypeException if the specified document type is not active 56 * @throws org.kuali.rice.kew.api.doctype.IllegalDocumentTypeException if the specified document type does not support document 57 * creation (in other words, it's a document type that is only used as a parent) 58 * @throws org.kuali.rice.kew.api.action.InvalidActionTakenException if the supplied principal is not allowed to execute this 59 * action 60 * @see org.kuali.rice.kew.impl.document.WorkflowDocumentProvider#loadDocument(String, String) 61 */ 62 WorkflowDocument loadDocument(String principalId, String documentId); 63 }