1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 * 19 */ 20 package org.apache.directory.api.ldap.extras.controls.ad; 21 22 /** 23 * The flags used in the AdDirSync response. 24 * 25 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 26 */ 27 public enum AdDirSyncFlag 28 { 29 DEFAULT (0x0000), 30 LDAP_DIRSYNC_OBJECT_SECURITY (0x0001), 31 LDAP_DIRSYNC_ANCESTORS_FIRST_ORDER (0x0800), 32 LDAP_DIRSYNC_PUBLIC_DATA_ONLY (0x2000), 33 LDAP_DIRSYNC_INCREMENTAL_VALUES (0x7FFFFFFF); 34 35 /** The interned value */ 36 private int value; 37 38 /** A private constructor that associates a value to each flag */ 39 private AdDirSyncFlag( int value ) 40 { 41 this.value = value; 42 } 43 44 45 /** 46 * @return The associated value of a given flag 47 */ 48 public int getValue() 49 { 50 return value; 51 } 52 53 54 /** 55 * Get back the flag associated with a given value 56 * @param value The integer value 57 * @return The associated flag 58 */ 59 public static AdDirSyncFlag getFlag( int value ) 60 { 61 switch ( value ) 62 { 63 case 0x0000 : return DEFAULT; 64 case 0x0001 : return LDAP_DIRSYNC_OBJECT_SECURITY; 65 case 0x0800 : return LDAP_DIRSYNC_ANCESTORS_FIRST_ORDER; 66 case 0x2000 : return LDAP_DIRSYNC_PUBLIC_DATA_ONLY; 67 case 0x7FFFFFFF : return LDAP_DIRSYNC_INCREMENTAL_VALUES; 68 default : return null; 69 } 70 } 71 }