public LdapAttributeType[] GetAttributesForClass(string objectClassName) { List <LdapAttributeType> result = new List <LdapAttributeType>(); string className = objectClassName; while (!string.IsNullOrEmpty(className)) { LdapClassType classType = this.GetSchemaTypeByDisplayName(className) as LdapClassType; if (classType == null) { className = null; break; } if (classType.MandatoryAttributes != null) { foreach (string attr in classType.MandatoryAttributes) { SchemaType attrSchemaType = this.GetSchemaTypeByDisplayName(attr); if (attrSchemaType != null) { attrSchemaType.AttributeType = "Mandatory"; LdapAttributeType attrLdapAttributeType = attrSchemaType as LdapAttributeType; result.Add(attrLdapAttributeType); } } } if (classType.OptionalAttributes != null) { foreach (string attr in classType.OptionalAttributes) { SchemaType attrSchemaType = this.GetSchemaTypeByDisplayName(attr); if (attrSchemaType != null) { attrSchemaType.AttributeType = "Optional"; LdapAttributeType attrLdapAttributeType = attrSchemaType as LdapAttributeType; result.Add(attrLdapAttributeType); } } } className = classType.SuperClassName; } if (result.Count > 0) { return(result.ToArray()); } else { return(null); } }
public void reportSchemaCache(Logger.LogLevel logLevel) { if (logLevel > Logger.currentLogLevel) { return; } foreach (KeyValuePair <string, SchemaType> entry in _attrTypeLookup) { string key = entry.Key as string; LdapAttributeType schemaType = entry.Value as LdapAttributeType; if (schemaType != null) { Logger.Log("Attribute Key = " + key, logLevel); Logger.Log(" SchemaType::CName = " + schemaType.CName, logLevel); Logger.Log(" ::AttrSyntax = " + schemaType.AttributeSyntax, logLevel); Logger.Log(" ::DataTypa = " + schemaType.DataType, logLevel); Logger.Log(" ::AttributeDisplayName = " + schemaType.AttributeDisplayName, logLevel); } } foreach (KeyValuePair <string, SchemaType> entry in _classTypeLookup) { string key = entry.Key as string; LdapClassType schemaType = entry.Value as LdapClassType; if (schemaType != null) { Logger.Log("Class Key = " + key, logLevel); Logger.Log(" SchemaType::CName = " + schemaType.CName, logLevel); Logger.Log(" ::AttrSyntax = " + schemaType.AttributeSyntax, logLevel); Logger.Log(" ::DataTypa = " + schemaType.DataType, logLevel); Logger.Log(" ::AttributeDisplayName = " + schemaType.AttributeDisplayName, logLevel); } } foreach (KeyValuePair <string, SchemaType> entry in _dnTypeLookup) { string key = entry.Key as string; SchemaType schemaType = entry.Value as SchemaType; if (schemaType != null) { Logger.Log("Display Name Key = " + key, logLevel); Logger.Log(" SchemaType::CName = " + schemaType.CName, logLevel); Logger.Log(" ::AttrSyntax = " + schemaType.AttributeSyntax, logLevel); Logger.Log(" ::DataTypa = " + schemaType.DataType, logLevel); Logger.Log(" ::AttributeDisplayName = " + schemaType.AttributeDisplayName, logLevel); } } }
protected bool AddClassSchemaType(AttributeMap attribute_map) { LdapValue[] ldapvalues = getFirstValue(attribute_map, CN_TAG); string cName = null; if (ldapvalues != null && ldapvalues.Length > 0) { cName = ldapvalues[0].stringData; } ldapvalues = getFirstValue(attribute_map, ATTR_SYNTAX_TAG); string attributeSyntax = null; if (ldapvalues != null && ldapvalues.Length > 0) { attributeSyntax = ldapvalues[0].stringData; } ldapvalues = getFirstValue(attribute_map, IS_SINGLE_VALUED_TAG); string isSingleValued = null; if (ldapvalues != null && ldapvalues.Length > 0) { isSingleValued = ldapvalues[0].stringData; } ldapvalues = getFirstValue(attribute_map, ATTR_DISPLAYNAME_TAG); string attributeDisplayName = null; if (ldapvalues != null && ldapvalues.Length > 0) { attributeDisplayName = ldapvalues[0].stringData; } ldapvalues = getFirstValue(attribute_map, SUBCLASS_OF_TAG); string superClassName = null; if (ldapvalues != null && ldapvalues.Length > 0) { superClassName = ldapvalues[0].stringData; } string[] systemMustContain = GetAttrsWithTag(attribute_map, SYSTEM_MUST_CONTAIN_TAG); string[] systemMayContain = GetAttrsWithTag(attribute_map, SYSTEM_MAY_CONTAIN_TAG); //5th Parameter is Mandatory and 6th Parameter is Optional atrributes. LdapClassType schemaType = new LdapClassType( cName, attributeSyntax, attributeDisplayName, superClassName, systemMustContain, systemMayContain ); schemaType.Tag = attribute_map; if (String.Compare(isSingleValued, "TRUE") == 0) { schemaType.IsSingleValued = true; } else { schemaType.IsSingleValued = false; } if (!_classTypeLookup.ContainsKey(cName.ToLower())) { _classTypeLookup.Add(cName.ToLower(), schemaType); } if (!_dnTypeLookup.ContainsKey(attributeDisplayName.ToLower())) { _dnTypeLookup.Add(attributeDisplayName.ToLower(), schemaType); } return(true); }