⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 securityconstraint.java.svn-base

📁 用于JAVA的Web的权限过滤器
💻 SVN-BASE
字号:
package dev.trade.common.securityfilter.config;

import java.util.*;

/**
 * <p>Title: 权限过滤器</p>
 *
 * <p>Description: 权限配置</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: </p>
 *
 * @author Zheng YanNan
 * @version 1.0
 */
public class SecurityConstraint {
   private List resourceCollections;
   private AuthConstraint authConstraint = null;

   /**
    * Constructor
    */
   public SecurityConstraint() {
      this.resourceCollections = new ArrayList();
   }

   /**
    * Add a WebResourceCollection to this SecurityConstraint.
    *
    * @param resourceCollection the WebResourceCollection to add
    */
   public void addWebResourceCollection(WebResourceCollection resourceCollection) {
      resourceCollections.add(resourceCollection);
   }

   /**
    * Get the WebResourceCollections for this SecurityConstraint. The order of the list is the order in which the
    * WebResourceCollections appeared in the config file.
    *
    * @return a List of WebResourceCollections, an empty list if none were added
    */
   public List getWebResourceCollections() {
      return this.resourceCollections;
   }

   /**
    * Set the AuthConstraint.
    *
    * @param authConstraint the AuthConstraint
    */
   public void setAuthConstraint(AuthConstraint authConstraint) {
      this.authConstraint = authConstraint;
   }

   /**
    * Get the AuthConstraint.
    *
    * @return an AuthConstraint object, or null if none has been set
    */
   public AuthConstraint getAuthConstraint() {
      return authConstraint;
   }

   /**
    * 通过WEB资源名称获取指定配置的角色集合
    * @param name String
    * @return Collection
    */
   public Collection getRolesByResourceName(String name){
     if(name!=null && authConstraint!=null){
       WebResourceCollection res = null;
       for(int i = 0, l = resourceCollections.size(); i < l; i++){
         res = (WebResourceCollection)resourceCollections.get(i);
         if(name.equals(res.getWebResourceName())){
           return authConstraint.getRoles();
         }
       }
     }
     return null;
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -