001    /**
002     * Copyright 2005-2012 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.document;
017    
018    import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
019    
020    import javax.persistence.MappedSuperclass;
021    
022    /**
023     * Controller that handles requests coming from a <code>TransactionalDocumentView</code>
024     *
025     * @author Kuali Rice Team (rice.collab@kuali.org)
026     */
027    @MappedSuperclass
028    public abstract class TransactionalDocumentBase extends DocumentBase implements TransactionalDocument, SessionDocument {
029        private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(TransactionalDocumentBase.class);
030    
031        /**
032         * Default constructor.
033         */
034        public TransactionalDocumentBase() {
035            super();
036        }
037    
038        /**
039         * @see org.kuali.rice.krad.document.TransactionalDocument#getAllowsCopy()
040         *      Checks if copy is set to true in data dictionary and the document instance implements
041         *      Copyable.
042         */
043        public boolean getAllowsCopy() {
044            return KRADServiceLocatorWeb.getDocumentDictionaryService().getAllowsCopy(this).booleanValue() &&
045                    this instanceof Copyable;
046        }
047    
048        /**
049         * This method to check whether the document class implements SessionDocument
050         *
051         * @return
052         */
053        public boolean isSessionDocument() {
054            return SessionDocument.class.isAssignableFrom(this.getClass());
055        }
056    }