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.krad.maintenance;
17  
18  import org.kuali.rice.krad.document.DocumentPresentationControllerBase;
19  import org.kuali.rice.krad.service.DocumentDictionaryService;
20  import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class MaintenanceDocumentPresentationControllerBase extends DocumentPresentationControllerBase
26          implements MaintenanceDocumentPresentationController {
27      private static final long serialVersionUID = 2849921477944820474L;
28  
29      private transient DocumentDictionaryService documentDictionaryService;
30  
31      public boolean canCreate(Class boClass) {
32          return getDocumentDictionaryService().getAllowsNewOrCopy(
33                  getDocumentDictionaryService().getMaintenanceDocumentTypeName(boClass));
34      }
35  
36      public boolean canMaintain(Object dataObject) {
37          return true;
38      }
39  
40      protected DocumentDictionaryService getDocumentDictionaryService() {
41          if (documentDictionaryService == null) {
42              documentDictionaryService = KRADServiceLocatorWeb.getDocumentDictionaryService();
43          }
44          return documentDictionaryService;
45      }
46  
47      public void setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService) {
48          this.documentDictionaryService = documentDictionaryService;
49      }
50  }