001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * https://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 * 019 */ 020package org.apache.directory.api.ldap.aci.protectedItem; 021 022 023import org.apache.directory.api.ldap.aci.ProtectedItem; 024 025 026/** 027 * Restricts the maximum number of immediate subordinates of the superior 028 * entry to an entry being added or imported. It is examined if the 029 * protected item is an entry, the permission sought is add or import, and 030 * the immediate superior entry is in the same DSA as the entry being added 031 * or imported. Immediate subordinates of the superior entry are counted 032 * without regard to context or access control as though the entry addition 033 * or importing were successful. If the number of subordinates exceeds 034 * maxImmSub, the ACI item is treated as not granting add or import access. 035 * 036 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 037 */ 038public class MaxImmSubItem extends ProtectedItem 039{ 040 /** The maximum number of allowed subordinates */ 041 private final int value; 042 043 /** 044 * Creates a new instance. 045 * 046 * @param value The maximum number of immediate subordinates 047 */ 048 public MaxImmSubItem( int value ) 049 { 050 this.value = value; 051 } 052 053 054 /** 055 * Gets the maximum number of immediate subordinates. 056 * 057 * @return the maximum number of immediate subordinates 058 */ 059 public int getValue() 060 { 061 return value; 062 } 063 064 065 /** 066 * {@inheritDoc} 067 */ 068 @Override 069 public int hashCode() 070 { 071 int hash = 37; 072 hash = hash * 17 + value; 073 074 return hash; 075 } 076 077 078 /** 079 * {@inheritDoc} 080 */ 081 @Override 082 public boolean equals( Object o ) 083 { 084 if ( this == o ) 085 { 086 return true; 087 } 088 089 if ( o instanceof MaxImmSubItem ) 090 { 091 MaxImmSubItem that = ( MaxImmSubItem ) o; 092 093 return this.value == that.value; 094 } 095 096 return false; 097 } 098 099 100 /** 101 * {@inheritDoc} 102 */ 103 @Override 104 public String toString() 105 { 106 return "maxImmSub " + value; 107 } 108}