View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.jetspeed.layout.impl;
18  
19  import java.util.Map;
20  
21  import org.apache.commons.logging.Log;
22  import org.apache.commons.logging.LogFactory;
23  import org.apache.jetspeed.ajax.AjaxAction;
24  import org.apache.jetspeed.ajax.AjaxBuilder;
25  import org.apache.jetspeed.layout.PortletActionSecurityBehavior;
26  import org.apache.jetspeed.om.common.SecuredResource;
27  import org.apache.jetspeed.page.PageManager;
28  
29  /***
30   * Abstract Get Resource aaction for folders, pages and links
31   *
32   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
33   * @version $Id: $
34   */
35  public abstract class BaseGetResourceAction
36      extends BasePortletAction 
37      implements AjaxAction, AjaxBuilder, Constants 
38  {
39      protected static final Log log = LogFactory.getLog(BaseSiteUpdateAction.class);    
40      
41      public BaseGetResourceAction(String template, 
42              String errorTemplate, 
43              PageManager pageManager)
44      {
45          super(template, errorTemplate, pageManager);
46      }
47      
48      public BaseGetResourceAction(String template, 
49                               String errorTemplate, 
50                               PortletActionSecurityBehavior securityBehavior)
51      {
52          super(template, errorTemplate, securityBehavior);
53      }
54  
55      public BaseGetResourceAction(String template, 
56                               String errorTemplate, 
57                               PageManager pageManager,
58                               PortletActionSecurityBehavior securityBehavior)
59      {
60          super(template, errorTemplate, pageManager, securityBehavior);        
61      }
62  
63      protected void putSecurityInformation(Map resultMap, SecuredResource resource)
64      {
65          if (resource.getSecurityConstraints() != null)
66          {
67              resultMap.put(SECURITY_REFS, resource.getSecurityConstraints().getSecurityConstraintsRefs());
68              resultMap.put(SECURITY_DEFS, resource.getSecurityConstraints().getSecurityConstraints());
69              resultMap.put(SECURITY_OWNER, resource.getSecurityConstraints().getOwner());
70          }
71      }
72  }