001/**
002 * Copyright 2005-2016 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.kns.datadictionary;
017
018import org.kuali.rice.kns.document.authorization.DocumentAuthorizer;
019import org.kuali.rice.kns.document.authorization.DocumentPresentationController;
020import org.kuali.rice.kns.document.authorization.TransactionalDocumentAuthorizerBase;
021import org.kuali.rice.kns.document.authorization.TransactionalDocumentPresentationControllerBase;
022import org.kuali.rice.kns.rule.PromptBeforeValidation;
023import org.kuali.rice.kns.web.derivedvaluesetter.DerivedValuesSetter;
024import org.kuali.rice.krad.datadictionary.ReferenceDefinition;
025
026import java.util.ArrayList;
027import java.util.List;
028
029/**
030 * @author Kuali Rice Team (rice.collab@kuali.org)
031 *
032 * @deprecated Use {@link org.kuali.rice.krad.datadictionary.TransactionalDocumentEntry}.
033 */
034@Deprecated
035public class TransactionalDocumentEntry extends org.kuali.rice.krad.datadictionary.TransactionalDocumentEntry implements KNSDocumentEntry {
036
037    protected Class<? extends PromptBeforeValidation> promptBeforeValidationClass;
038    protected Class<? extends DerivedValuesSetter> derivedValuesSetterClass;
039    protected List<String> webScriptFiles = new ArrayList<String>(3);
040    protected List<HeaderNavigation> headerNavigationList = new ArrayList<HeaderNavigation>();
041
042    protected boolean sessionDocument = false;
043
044    public TransactionalDocumentEntry() {
045        super();
046
047    documentAuthorizerClass = TransactionalDocumentAuthorizerBase.class;
048    documentPresentationControllerClass = TransactionalDocumentPresentationControllerBase.class;
049    }
050
051    @Override
052    public List<HeaderNavigation> getHeaderNavigationList() {
053        return headerNavigationList;
054    }
055
056    @Override
057    public List<String> getWebScriptFiles() {
058        return webScriptFiles;
059    }
060
061    /**
062     * @return Returns the preRulesCheckClass.
063     */
064    @Override
065    public Class<? extends PromptBeforeValidation> getPromptBeforeValidationClass() {
066        return promptBeforeValidationClass;
067    }
068
069    /**
070     * The promptBeforeValidationClass element is the full class name of the java
071     * class which determines whether the user should be asked any questions prior to running validation.
072     *
073     * @see KualiDocumentActionBase#promptBeforeValidation(org.apache.struts.action.ActionMapping,
074     *      org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest,
075     *      javax.servlet.http.HttpServletResponse, String)
076     */
077    @Override
078    public void setPromptBeforeValidationClass(Class<? extends PromptBeforeValidation> preRulesCheckClass) {
079        this.promptBeforeValidationClass = preRulesCheckClass;
080    }
081
082    /**
083     * The webScriptFile element defines the name of javascript files
084     * that are necessary for processing the document.  The specified
085     * javascript files will be included in the generated html.
086     */
087    @Override
088    public void setWebScriptFiles(List<String> webScriptFiles) {
089        this.webScriptFiles = webScriptFiles;
090    }
091
092    /**
093     * The headerNavigation element defines a set of additional
094     * tabs which will appear on the document.
095     */
096    @Override
097    public void setHeaderNavigationList(List<HeaderNavigation> headerNavigationList) {
098        this.headerNavigationList = headerNavigationList;
099    }
100
101    @Override
102    public boolean isSessionDocument() {
103        return this.sessionDocument;
104    }
105
106    @Override
107    public void setSessionDocument(boolean sessionDocument) {
108        this.sessionDocument = sessionDocument;
109    }
110
111    /**
112     * @return the derivedValuesSetter
113     */
114    @Override
115    public Class<? extends DerivedValuesSetter> getDerivedValuesSetterClass() {
116        return this.derivedValuesSetterClass;
117    }
118
119    /**
120     * @param derivedValuesSetter the derivedValuesSetter to set
121     */
122    @Override
123    public void setDerivedValuesSetterClass(Class<? extends DerivedValuesSetter> derivedValuesSetter) {
124        this.derivedValuesSetterClass = derivedValuesSetter;
125    }
126
127    /**
128     * Returns the document authorizer class for the document.  Only framework code should be calling this method.
129     * Client devs should use {@link DocumentTypeService#getDocumentAuthorizer(org.kuali.rice.krad.document.Document)}
130     * or
131     * {@link DocumentTypeService#getDocumentAuthorizer(String)}
132     *
133     * @return a document authorizer class
134     */
135    @Override
136    public Class<? extends DocumentAuthorizer> getDocumentAuthorizerClass() {
137        return (Class<? extends DocumentAuthorizer>) super.getDocumentAuthorizerClass();
138    }
139
140    /**
141     * Returns the document presentation controller class for the document.  Only framework code should be calling
142     * this
143     * method.
144     * Client devs should use {@link DocumentTypeService#getDocumentPresentationController(org.kuali.rice.krad.document.Document)}
145     * or
146     * {@link DocumentTypeService#getDocumentPresentationController(String)}
147     *
148     * @return the documentPresentationControllerClass
149     */
150    @Override
151    public Class<? extends DocumentPresentationController> getDocumentPresentationControllerClass() {
152        return (Class<? extends DocumentPresentationController>) super.getDocumentPresentationControllerClass();
153    }
154
155    /**
156     * @see org.kuali.rice.krad.datadictionary.DocumentEntry#completeValidation()
157     */
158    @Override
159    public void completeValidation() {
160        super.completeValidation();
161        for (ReferenceDefinition reference : defaultExistenceChecks) {
162            reference.completeValidation(documentClass, null);
163        }
164    }
165
166    @Override
167    public String toString() {
168        return "TransactionalDocumentEntry for documentType " + getDocumentTypeName();
169    }
170}