Coverage Report - org.kuali.rice.kew.impl.document.DefaultWorkflowDocumentProvider
 
Classes in this File Line Coverage Branch Coverage Complexity
DefaultWorkflowDocumentProvider
0%
0/10
0%
0/2
1.667
 
 1  
 /*
 2  
  * Copyright 2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 1.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/ecl1.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.KewApiServiceLocator;
 19  
 import org.kuali.rice.kew.api.WorkflowDocument;
 20  
 import org.kuali.rice.kew.api.document.Document;
 21  
 import org.kuali.rice.kew.api.document.DocumentContentUpdate;
 22  
 import org.kuali.rice.kew.api.document.DocumentUpdate;
 23  
 import org.kuali.rice.kew.service.KEWServiceLocator;
 24  
 
 25  
 /**
 26  
  * TODO 
 27  
  * 
 28  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 29  
  *
 30  
  */
 31  0
 public final class DefaultWorkflowDocumentProvider implements WorkflowDocumentProvider {
 32  
 
 33  
         @Override
 34  
         public WorkflowDocument createDocument(String principalId, String documentTypeName, DocumentUpdate documentUpdate, DocumentContentUpdate documentContentUpdate) {
 35  0
                 Document document = KewApiServiceLocator.getWorkflowDocumentActionsService().create(documentTypeName, principalId, documentUpdate, documentContentUpdate);
 36  0
                 return initializePrototype(principalId, document);
 37  
         }
 38  
 
 39  
         @Override
 40  
         public WorkflowDocument loadDocument(String principalId, String documentId) {
 41  0
                 Document document = KewApiServiceLocator.getWorkflowDocumentService().getDocument(documentId);
 42  0
                 if (document == null) {
 43  0
                         throw new IllegalArgumentException("Failed to locate workflow document for given documentId: " + documentId);
 44  
                 }
 45  0
                 return initializePrototype(principalId, document);
 46  
         }
 47  
         
 48  
         private WorkflowDocumentPrototype initializePrototype(String principalId, Document document) {
 49  0
                 WorkflowDocumentPrototype prototype = KEWServiceLocator.getWorkflowDocumentPrototype();
 50  0
                 prototype.init(principalId, document);
 51  0
                 return prototype;
 52  
         }
 53  
 
 54  
 }