FileDocCategorySizeDatePackage
XYZPayrollPermissionCollection.javaAPI DocExample2835Sun Oct 25 18:13:34 GMT 1998None

XYZPayrollPermissionCollection

public class XYZPayrollPermissionCollection extends PermissionCollection

Fields Summary
private Hashtable
permissions
private boolean
addedAdmin
private int
adminMask
Constructors Summary
XYZPayrollPermissionCollection()

		permissions = new Hashtable();
		addedAdmin = false;
	
Methods Summary
public voidadd(java.security.Permission p)

		if (!(p instanceof XYZPayrollPermission))
			throw new IllegalArgumentException("Wrong permission type");
		XYZPayrollPermission xyz = (XYZPayrollPermission) p;
		String name = xyz.getName();
		XYZPayrollPermission other = (XYZPayrollPermission) permissions.get(name);
		if (other != null)
			xyz = merge(xyz, other);
		if (name.equals("*")) {
			addedAdmin = true;
			adminMask = xyz.mask;
		}
		permissions.put(name, xyz);
	
public java.util.Enumerationelements()

		return permissions.elements();
	
public booleanimplies(java.security.Permission p)

		if (!(p instanceof XYZPayrollPermission))
			return false;
		XYZPayrollPermission xyz = (XYZPayrollPermission) p;
		if (addedAdmin && (adminMask & xyz.mask) != 0)
			return true;
		Permission inTable = (Permission) permissions.get(xyz.getName());
		if (inTable == null)
			return false;
		return inTable.implies(xyz);
	
private XYZPayrollPermissionmerge(XYZPayrollPermission a, XYZPayrollPermission b)

		String aAction = a.getActions();
		if (aAction.equals(""))
			return b;
		String bAction = b.getActions();
		if (bAction.equals(""))
			return a;
		return new XYZPayrollPermission(a.getName(), aAction + "," + bAction);