View Javadoc
1   /**
2    * Copyright 2005-2016 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.kns.datadictionary;
17  
18  import org.kuali.rice.kns.document.authorization.DocumentAuthorizer;
19  import org.kuali.rice.kns.document.authorization.DocumentPresentationController;
20  import org.kuali.rice.kns.document.authorization.TransactionalDocumentAuthorizerBase;
21  import org.kuali.rice.kns.document.authorization.TransactionalDocumentPresentationControllerBase;
22  import org.kuali.rice.kns.rule.PromptBeforeValidation;
23  import org.kuali.rice.kns.web.derivedvaluesetter.DerivedValuesSetter;
24  import org.kuali.rice.krad.datadictionary.ReferenceDefinition;
25  
26  import java.util.ArrayList;
27  import java.util.List;
28  
29  /**
30   * @author Kuali Rice Team (rice.collab@kuali.org)
31   *
32   * @deprecated Use {@link org.kuali.rice.krad.datadictionary.TransactionalDocumentEntry}.
33   */
34  @Deprecated
35  public class TransactionalDocumentEntry extends org.kuali.rice.krad.datadictionary.TransactionalDocumentEntry implements KNSDocumentEntry {
36  
37      protected Class<? extends PromptBeforeValidation> promptBeforeValidationClass;
38      protected Class<? extends DerivedValuesSetter> derivedValuesSetterClass;
39      protected List<String> webScriptFiles = new ArrayList<String>(3);
40      protected List<HeaderNavigation> headerNavigationList = new ArrayList<HeaderNavigation>();
41  
42      protected boolean sessionDocument = false;
43  
44      public TransactionalDocumentEntry() {
45          super();
46  
47      documentAuthorizerClass = TransactionalDocumentAuthorizerBase.class;
48      documentPresentationControllerClass = TransactionalDocumentPresentationControllerBase.class;
49      }
50  
51      @Override
52      public List<HeaderNavigation> getHeaderNavigationList() {
53          return headerNavigationList;
54      }
55  
56      @Override
57      public List<String> getWebScriptFiles() {
58          return webScriptFiles;
59      }
60  
61      /**
62       * @return Returns the preRulesCheckClass.
63       */
64      @Override
65      public Class<? extends PromptBeforeValidation> getPromptBeforeValidationClass() {
66          return promptBeforeValidationClass;
67      }
68  
69      /**
70       * The promptBeforeValidationClass element is the full class name of the java
71       * class which determines whether the user should be asked any questions prior to running validation.
72       *
73       * @see KualiDocumentActionBase#promptBeforeValidation(org.apache.struts.action.ActionMapping,
74       *      org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest,
75       *      javax.servlet.http.HttpServletResponse, String)
76       */
77      @Override
78      public void setPromptBeforeValidationClass(Class<? extends PromptBeforeValidation> preRulesCheckClass) {
79          this.promptBeforeValidationClass = preRulesCheckClass;
80      }
81  
82      /**
83       * The webScriptFile element defines the name of javascript files
84       * that are necessary for processing the document.  The specified
85       * javascript files will be included in the generated html.
86       */
87      @Override
88      public void setWebScriptFiles(List<String> webScriptFiles) {
89          this.webScriptFiles = webScriptFiles;
90      }
91  
92      /**
93       * The headerNavigation element defines a set of additional
94       * tabs which will appear on the document.
95       */
96      @Override
97      public void setHeaderNavigationList(List<HeaderNavigation> headerNavigationList) {
98          this.headerNavigationList = headerNavigationList;
99      }
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 }