View Javadoc
1   /*
2    * Copyright 2009 The Kuali Foundation.
3    * 
4    * Licensed under the Educational Community License, Version 1.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/ecl1.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.ole.sec.document.web;
17  
18  import java.util.Iterator;
19  import java.util.List;
20  
21  import javax.servlet.jsp.JspException;
22  import javax.servlet.jsp.PageContext;
23  import javax.servlet.jsp.tagext.Tag;
24  
25  import org.kuali.ole.sys.document.web.renderers.GroupErrorsRenderer;
26  
27  
28  /**
29   * Integrates with access security module to check security on accounting lines before rendering
30   */
31  public class CollectionSecAccountingLineGroupImpl extends SecAccountingLineGroupImpl {
32  
33      /**
34       * Constructs a SecAccountingLineGroupImpl
35       */
36      public CollectionSecAccountingLineGroupImpl() {
37          super();
38      }
39  
40      /**
41       * Adds info message if we have restricted view of any accounting lines and matches only messages for collection
42       * 
43       * @see org.kuali.ole.sys.document.web.DefaultAccountingLineGroupImpl#renderErrors(javax.servlet.jsp.PageContext,
44       *      javax.servlet.jsp.tagext.Tag)
45       */
46      @Override
47      protected void renderErrors(PageContext pageContext, Tag parentTag) throws JspException {
48          renderSecurityMessage(pageContext, parentTag);
49  
50          GroupErrorsRenderer errorRenderer = new GroupErrorsRenderer();
51          List errors = errorRenderer.getErrorPropertyList(pageContext);
52          if (errors != null && !errors.isEmpty()) {
53              for (Iterator itr = errors.iterator(); itr.hasNext();) {
54                  String error = (String) itr.next();
55                  if (error.startsWith(collectionItemPropertyName)) {
56                      renderMessages(pageContext, parentTag, error);
57                  }
58              }
59          }
60      }
61  
62  }