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