Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions
nsIAbLDAPAttributeMap Interface Reference

A mapping between addressbook properties and ldap attributes. More...

import "nsIAbLDAPAttributeMap.idl";

Inheritance diagram for nsIAbLDAPAttributeMap:
Inheritance graph
[legend]
Collaboration diagram for nsIAbLDAPAttributeMap:
Collaboration graph
[legend]

List of all members.

Public Member Functions

ACString getAttributeList (in ACString aProperty)
 Get all the LDAP attributes associated with a given property name, in order of precedence (highest to lowest).
void getAttributes (in ACString aProperty, out unsigned long aCount,[retval, array, size_is(aCount)] out string aAttrs)
 Get all the LDAP attributes associated with a given property name, in order of precedence (highest to lowest).
ACString getFirstAttribute (in ACString aProperty)
 Get the first (canonical) LDAP attribute associated with a given property name.
void setAttributeList (in ACString aProperty, in ACString aAttributeList, in boolean allowInconsistencies)
 Set an existing mapping to the comma-separated list of attributes.
ACString getProperty (in ACString aAttribute)
 Find the Mozilla addressbook property name that this attribute should map to.
ACString getAllCardAttributes ()
 Get all attributes that may be used in an addressbook card via this property map (used for passing to to an LDAP search when you want everything that could be in a card returned).
void checkState ()
 Check that no LDAP attributes are listed in more than one property.
void setFromPrefs (in ACString aPrefBranchName)
 Set any attributes specified in the given prefbranch on this object.
void setCardPropertiesFromLDAPMessage (in nsILDAPMessage aMessage, in nsIAbCard aCard)
 Set the properties on an addressbook card from the given LDAP message using the map in this object.

Detailed Description

A mapping between addressbook properties and ldap attributes.

Each addressbook property can map to one or more attributes. If there is no entry in preferences for a field, the getters generally return null; empty strings are passed through as usual. The intent is that properties with a non-zero number of attributes can be overridden for a specific server by supplying a zero-length string. For this to work, most callers are likely to want to check for both success and a non-empty string.

Note that the one exception to this pattern is getAttributes, which throws NS_ERROR_FAILURE for non-existent property entries, since XPConnect doesn't like returning null arrays.

Note that each LDAP attribute can map to at most one addressbook property. The checkState method is a useful tool in enforcing this. Failure to enforce it may make it impossible to guarantee that getProperty will do something consistent and reasonable.

Maybe someday once we support ldap autoconfig stuff (ie draft-joslin-config-schema-11.txt), we can simplify this and other code and only allow a property to map to a single attribute.

Definition at line 70 of file nsIAbLDAPAttributeMap.idl.


Member Function Documentation

Check that no LDAP attributes are listed in more than one property.

Exceptions:
NS_ERROR_FAILUREone or more LDAP attributes are listed multiple times. The object is now in an inconsistent state, and should be either manually repaired or discarded.

Get all attributes that may be used in an addressbook card via this property map (used for passing to to an LDAP search when you want everything that could be in a card returned).

Returns:
a comma-separated list of attribute names
Exceptions:
NS_ERROR_FAILUREthere are no attributes in this property map
ACString nsIAbLDAPAttributeMap::getAttributeList ( in ACString  aProperty)

Get all the LDAP attributes associated with a given property name, in order of precedence (highest to lowest).

Parameters:
aPropertythe address book property to return attrs for
Returns:
a comma-separated list of attributes, null if no entry is present
void nsIAbLDAPAttributeMap::getAttributes ( in ACString  aProperty,
out unsigned long  aCount,
[retval, array, size_is(aCount)] out string  aAttrs 
)

Get all the LDAP attributes associated with a given property name, in order of precedence (highest to lowest).

Parameters:
aPropertythe address book property to return attrs for
Returns:
an array of attributes
Exceptions:
NS_ERROR_FAILUREif there is no entry for this property
ACString nsIAbLDAPAttributeMap::getFirstAttribute ( in ACString  aProperty)

Get the first (canonical) LDAP attribute associated with a given property name.

Parameters:
aPropertythe address book property to return attrs for
Returns:
the first attribute associated with a given property, null if there is no entry for this property
ACString nsIAbLDAPAttributeMap::getProperty ( in ACString  aAttribute)

Find the Mozilla addressbook property name that this attribute should map to.

Returns:
the addressbook property name, null if it's not used in the map
void nsIAbLDAPAttributeMap::setAttributeList ( in ACString  aProperty,
in ACString  aAttributeList,
in boolean  allowInconsistencies 
)

Set an existing mapping to the comma-separated list of attributes.

Parameters:
aPropertythe mozilla addressbook property name
aAttributeLista comma-separated list of attributes in order of precedence from high to low
aAllowInconsistenciesallow changes that would result in a map with an LDAP attribute associated with more than one property. Useful for doing a bunch of sets at once, and calling checkState at the end.
Exceptions:
NS_ERROR_FAILUREmaking this change would result in a map with an LDAP attribute pointing to more than one property

Set the properties on an addressbook card from the given LDAP message using the map in this object.

Parameters:
aCardis the card object whose values are to be set
aMessageis the LDAP message to get the values from
Exceptions:
NS_ERROR_FAILUREis thrown if no addressbook properties are found in the message
void nsIAbLDAPAttributeMap::setFromPrefs ( in ACString  aPrefBranchName)

Set any attributes specified in the given prefbranch on this object.

Parameters:
aPrefBranchNamethe pref branch containing all the property names
Exceptions:
NS_ERROR_FAILUREone or more LDAP attributes are listed multiple times. The object is now in an inconsistent state, and should be either manually repaired or discarded.

The documentation for this interface was generated from the following file: