View Javadoc

1   /**
2    * Copyright 2005-2013 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
33  public class TransactionalDocumentEntry extends org.kuali.rice.krad.datadictionary.TransactionalDocumentEntry implements KNSDocumentEntry {
34  
35      protected Class<? extends PromptBeforeValidation> promptBeforeValidationClass;
36      protected Class<? extends DerivedValuesSetter> derivedValuesSetterClass;
37      protected List<String> webScriptFiles = new ArrayList<String>(3);
38      protected List<HeaderNavigation> headerNavigationList = new ArrayList<HeaderNavigation>();
39  
40      protected boolean sessionDocument = false;
41  
42      public TransactionalDocumentEntry() {
43          super();
44  
45      documentAuthorizerClass = TransactionalDocumentAuthorizerBase.class;
46      documentPresentationControllerClass = TransactionalDocumentPresentationControllerBase.class;
47      }
48  
49      @Override
50      public List<HeaderNavigation> getHeaderNavigationList() {
51          return headerNavigationList;
52      }
53  
54      @Override
55      public List<String> getWebScriptFiles() {
56          return webScriptFiles;
57      }
58  
59      /**
60       * @return Returns the preRulesCheckClass.
61       */
62      @Override
63      public Class<? extends PromptBeforeValidation> getPromptBeforeValidationClass() {
64          return promptBeforeValidationClass;
65      }
66  
67      /**
68       * The promptBeforeValidationClass element is the full class name of the java
69       * class which determines whether the user should be asked any questions prior to running validation.
70       *
71       * @see KualiDocumentActionBase#promptBeforeValidation(org.apache.struts.action.ActionMapping,
72       *      org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest,
73       *      javax.servlet.http.HttpServletResponse, String)
74       */
75      @Override
76      public void setPromptBeforeValidationClass(Class<? extends PromptBeforeValidation> preRulesCheckClass) {
77          this.promptBeforeValidationClass = preRulesCheckClass;
78      }
79  
80      /**
81       * The webScriptFile element defines the name of javascript files
82       * that are necessary for processing the document.  The specified
83       * javascript files will be included in the generated html.
84       */
85      @Override
86      public void setWebScriptFiles(List<String> webScriptFiles) {
87          this.webScriptFiles = webScriptFiles;
88      }
89  
90      /**
91       * The headerNavigation element defines a set of additional
92       * tabs which will appear on the document.
93       */
94      @Override
95      public void setHeaderNavigationList(List<HeaderNavigation> headerNavigationList) {
96          this.headerNavigationList = headerNavigationList;
97      }
98  
99      @Override
100     public boolean isSessionDocument() {
101         return this.sessionDocument;
102     }
103 
104     @Override
105     public void setSessionDocument(boolean sessionDocument) {
106         this.sessionDocument = sessionDocument;
107     }
108 
109     /**
110      * @return the derivedValuesSetter
111      */
112     @Override
113     public Class<? extends DerivedValuesSetter> getDerivedValuesSetterClass() {
114         return this.derivedValuesSetterClass;
115     }
116 
117     /**
118      * @param derivedValuesSetter the derivedValuesSetter to set
119      */
120     @Override
121     public void setDerivedValuesSetterClass(Class<? extends DerivedValuesSetter> derivedValuesSetter) {
122         this.derivedValuesSetterClass = derivedValuesSetter;
123     }
124 
125     /**
126      * Returns the document authorizer class for the document.  Only framework code should be calling this method.
127      * Client devs should use {@link DocumentTypeService#getDocumentAuthorizer(org.kuali.rice.krad.document.Document)}
128      * or
129      * {@link DocumentTypeService#getDocumentAuthorizer(String)}
130      *
131      * @return a document authorizer class
132      */
133     @Override
134     public Class<? extends DocumentAuthorizer> getDocumentAuthorizerClass() {
135         return (Class<? extends DocumentAuthorizer>) super.getDocumentAuthorizerClass();
136     }
137 
138     /**
139      * Returns the document presentation controller class for the document.  Only framework code should be calling
140      * this
141      * method.
142      * Client devs should use {@link DocumentTypeService#getDocumentPresentationController(org.kuali.rice.krad.document.Document)}
143      * or
144      * {@link DocumentTypeService#getDocumentPresentationController(String)}
145      *
146      * @return the documentPresentationControllerClass
147      */
148     @Override
149     public Class<? extends DocumentPresentationController> getDocumentPresentationControllerClass() {
150         return (Class<? extends DocumentPresentationController>) super.getDocumentPresentationControllerClass();
151     }
152 
153     /**
154      * @see org.kuali.rice.krad.datadictionary.DocumentEntry#completeValidation()
155      */
156     @Override
157     public void completeValidation() {
158         super.completeValidation();
159         for (ReferenceDefinition reference : defaultExistenceChecks) {
160             reference.completeValidation(documentClass, null);
161         }
162     }
163 
164     @Override
165     public String toString() {
166         return "TransactionalDocumentEntry for documentType " + getDocumentTypeName();
167     }
168 }