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 * http://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.extras.controls.ad; 021 022/** 023 * The flags used in the AdDirSync response. 024 * 025 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 026 */ 027public enum AdDirSyncFlag 028{ 029 DEFAULT (0x0000), 030 LDAP_DIRSYNC_OBJECT_SECURITY (0x0001), 031 LDAP_DIRSYNC_ANCESTORS_FIRST_ORDER (0x0800), 032 LDAP_DIRSYNC_PUBLIC_DATA_ONLY (0x2000), 033 LDAP_DIRSYNC_INCREMENTAL_VALUES (0x7FFFFFFF); 034 035 /** The interned value */ 036 private int value; 037 038 /** A private constructor that associates a value to each flag */ 039 private AdDirSyncFlag( int value ) 040 { 041 this.value = value; 042 } 043 044 045 /** 046 * @return The associated value of a given flag 047 */ 048 public int getValue() 049 { 050 return value; 051 } 052 053 054 /** 055 * Get back the flag associated with a given value 056 * @param value The integer value 057 * @return The associated flag 058 */ 059 public static AdDirSyncFlag getFlag( int value ) 060 { 061 switch ( value ) 062 { 063 case 0x0000 : return DEFAULT; 064 case 0x0001 : return LDAP_DIRSYNC_OBJECT_SECURITY; 065 case 0x0800 : return LDAP_DIRSYNC_ANCESTORS_FIRST_ORDER; 066 case 0x2000 : return LDAP_DIRSYNC_PUBLIC_DATA_ONLY; 067 case 0x7FFFFFFF : return LDAP_DIRSYNC_INCREMENTAL_VALUES; 068 default : return null; 069 } 070 } 071}