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.document;
17  
18  import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
19  
20  import javax.persistence.MappedSuperclass;
21  
22  /**
23   * Base class for transactional documents
24   *
25   * @author Kuali Rice Team (rice.collab@kuali.org)
26   */
27  @MappedSuperclass
28  public abstract class TransactionalDocumentBase extends DocumentBase implements TransactionalDocument, SessionDocument {
29      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(TransactionalDocumentBase.class);
30  
31      /**
32       * Default constructor.
33       */
34      public TransactionalDocumentBase() {
35          super();
36      }
37  
38      /**
39       * @see org.kuali.rice.krad.document.TransactionalDocument#getAllowsCopy()
40       *      Checks if copy is set to true in data dictionary and the document instance implements
41       *      Copyable.
42       */
43      public boolean getAllowsCopy() {
44          return KRADServiceLocatorWeb.getDocumentDictionaryService().getAllowsCopy(this).booleanValue() &&
45                  this instanceof Copyable;
46      }
47  
48      /**
49       * This method to check whether the document class implements SessionDocument
50       *
51       * @return
52       */
53      public boolean isSessionDocument() {
54          return SessionDocument.class.isAssignableFrom(this.getClass());
55      }
56  }