View Javadoc
1   /**
2    * Copyright 2005-2014 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.krad.service.impl;
17  
18  import org.kuali.rice.kew.api.WorkflowDocument;
19  import org.kuali.rice.krad.bo.DocumentHeader;
20  import org.kuali.rice.krad.data.DataObjectService;
21  import org.kuali.rice.krad.data.PersistenceOption;
22  import org.kuali.rice.krad.service.DocumentHeaderService;
23  
24  /**
25   *
26   *
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   */
29  public class DocumentHeaderServiceImpl implements DocumentHeaderService {
30  
31      protected DataObjectService dataObjectService;
32  
33      /**
34       * {@inheritDoc}
35       */
36      @Override
37      public DocumentHeader getDocumentHeaderById(String documentHeaderId) {
38          return dataObjectService.find(DocumentHeader.class, documentHeaderId);
39      }
40  
41      /**
42       * {@inheritDoc}
43       */
44      @Override
45      public DocumentHeader saveDocumentHeader(DocumentHeader documentHeader) {
46          WorkflowDocument workflowDocument = documentHeader.getWorkflowDocument();
47          DocumentHeader savedDocumentHeader = dataObjectService.save(documentHeader, PersistenceOption.FLUSH);
48          savedDocumentHeader.setWorkflowDocument( workflowDocument );
49          return savedDocumentHeader;
50      }
51  
52      /**
53       * {@inheritDoc}
54       */
55      @Override
56      public void deleteDocumentHeader(DocumentHeader documentHeader) {
57      	dataObjectService.delete(documentHeader);
58      }
59  
60      public void setDataObjectService(DataObjectService dataObjectService) {
61          this.dataObjectService = dataObjectService;
62      }
63  
64  }