001 /** 002 * Copyright 2005-2013 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.krad.service.impl; 017 018 import org.kuali.rice.kew.api.WorkflowDocument; 019 import org.kuali.rice.krad.bo.DocumentHeader; 020 import org.kuali.rice.krad.data.DataObjectService; 021 import org.kuali.rice.krad.service.DocumentHeaderService; 022 023 /** 024 * 025 * 026 * @author Kuali Rice Team (rice.collab@kuali.org) 027 */ 028 public class DocumentHeaderServiceImpl implements DocumentHeaderService { 029 030 protected DataObjectService dataObjectService; 031 032 /** 033 * {@inheritDoc} 034 */ 035 @Override 036 public DocumentHeader getDocumentHeaderById(String documentHeaderId) { 037 return dataObjectService.find(DocumentHeader.class, documentHeaderId); 038 } 039 040 /** 041 * {@inheritDoc} 042 */ 043 @Override 044 public DocumentHeader saveDocumentHeader(DocumentHeader documentHeader) { 045 WorkflowDocument workflowDocument = documentHeader.getWorkflowDocument(); 046 DocumentHeader savedDocumentHeader = dataObjectService.save(documentHeader); 047 savedDocumentHeader.setWorkflowDocument( workflowDocument ); 048 return savedDocumentHeader; 049 } 050 051 /** 052 * {@inheritDoc} 053 */ 054 @Override 055 public void deleteDocumentHeader(DocumentHeader documentHeader) { 056 dataObjectService.delete(documentHeader); 057 } 058 059 public void setDataObjectService(DataObjectService dataObjectService) { 060 this.dataObjectService = dataObjectService; 061 } 062 063 }