org.apache.fulcrum.security.util.SecuritySet Maven / Gradle / Ivy
package org.apache.fulcrum.security.util;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.io.Serializable;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import org.apache.commons.lang.StringUtils;
import org.apache.fulcrum.security.entity.SecurityEntity;
/**
* This class represents a set of Security Entities. It makes it easy to build a
* UI. It wraps a TreeSet object to enforce that only relevant methods are
* available. TreeSet's contain only unique Objects (no duplicates) based on the
* ID. They may or may not have a name, that depends on the implementation. Want
* to get away from requiring an ID and a name... Nothing should force Name to be
* unique in the basic architecture of Fulcrum Security.
*
* @author Eric Pugh
* @author John D. McNally
* @author Brett McLaughlin
* @author Marco Knüttel
* @author Henning P. Schmiedehausen
* @version $Id: SecuritySet.java 1754545 2016-07-29 16:08:15Z tv $
*/
public abstract class SecuritySet implements Serializable, Set, Iterable
{
/** Serial version */
private static final long serialVersionUID = 2251987059226422569L;
/** Map for "name" -> "security object" */
protected Map nameMap = null;
/** Map for "id" -> "security object" */
protected Map