Paul Sandoz <[EMAIL PROTECTED]> writes:
>
> Attached is a revamped set of nsIAbDirectoryQuery*
> interfaces. Decided the nsIProperties interface was
> not suitable.
> Considered using arrays but used nsISupportsArray
> for corresponding attributes instead.
Just out of curiousity, why? The nsISupportsArray interface is only
not very scriptable, after all.
> My UML knowledge is very limited, but i presume its
> correct (I have used a really cool java based
> UML editor called Argo,http://www.ArgoUML.org/,
> plug plug)
Got me; I've got no UML experience at all, so I have to confess to not
entirely understanding what relationships between the interfaces are
supposed to be represented by that diagram.
> We plan to use this interface and do a MAPI outlook
> implementation (in addition to implemeting the card and
> directory interfaces) such that an Open Office SDBC driver
> can be written to perform queries on address directories
> from SQL statements and create result sets from these.
> Open Office currently lacks address support so cannot
> perform mail merges :-(
>
> This should also give a significant boost to getting
> organisational LDAP address book functionality working
> and integrated into the address book framework so that
> equivalent 4.x functionality can be acheived.
Great; sounds like very worthwhile work.
> FYI, here is an interesting submission which proposes
> the representatint of vCard objects in RDF:
> http://www.w3.org/Submission/2001/04/
That is interesting; thanks for the pointer.
> #include "nsISupports.idl"
> #include "nsISupportsArray.idl"
>
> [scriptable, uuid(0E846276-1DD2-11B2-95AD-96B1397240AC)]
> interface nsIAbDirectoryQueryProperty : nsISupports
> {
> /**
> * The property which should be matched
> *
> * For example 'primaryEmail' or 'homePhone'
> * for card properties.
> *
> * Two further properties are defined that
> * do not exist as properties on a card.
> * 'card:URI' which represents the URI property
> * of the card as an RDF resource
> * 'card:nsIAbCard' which represents the interface
> * of a card component
> *
> */
> attribute string name;
> };
>
> [scriptable, uuid(3A6E0C0C-1DD2-11B2-B23D-EA3A8CCB333C)]
> interface nsIAbDirectoryQueryPropertyValue : nsIAbDirectoryQueryProperty
> {
> /**
> * The value of the property
> *
> */
> attribute wstring value;
> };
Does these actually need to be interfaces, or could they just be
passed around as wstrings? And how come one of them is a string
rather than a wstring?
> [scriptable, uuid(418EEDA8-1DD2-11B2-8FB5-905EF30BC9F6)]
> interface nsIAbDirectoryQueryMatchItem : nsIAbDirectoryQueryProperty
> {
> /**
> * List of defined match types
> *
> */
> const long matchContains = 0;
> const long matchDoesNotContain = 1;
> const long matchIs = 2;
> const long matchIsNot = 3;
> const long matchBeginsWith = 4;
> const long matchEndsWith = 6;
> const long matchSoundsLike = 7;
> const long matchRegExp = 8;
>
> /**
> * The type of match, like 4.x search parameters
> * contains, does not contain
> * is, is not
> * begins with, ends with
> * sounds like (?)
> *
> */
> attribute long matchType;
>
> /**
> * The match value
> *
> */
> attribute wstring matchValue;
> };
>
> [scriptable, uuid(41EC291E-1DD2-11B2-B583-C44757081F64)]
> interface nsIAbDirectoryQueryArguments : nsISupports
> {
> /**
> * The list of match items which will
> * be matched against instances of
> * cards
> *
> * nsISupportsArray<nsIAbDirectoryQueryMatchItem>
> *
> */
> attribute nsISupportsArray matchItems;
>
> /**
> * List of defined match items types
> *
> */
> const long matchItemsOneOrMore = 0;
> const long matchItemsAll = 1;
>
>
> /**
> * Defines how multiple match items should
> * be treated for a query result
> * Match one or more (or)
> * Match all (and)
> *
> */
> attribute long matchItemsType
>
> /**
> * Defines if sub directories should be
> * queried
> *
> */
> attribute boolean querySubDirectories;
>
> /**
> * The list of properties which should
> * be returned if a match occurs on a card
> *
> * nsISupportsArray<nsIAbDirectoryQueryProperty>
> *
> */
> attribute nsISupportsArray returnProperties;
> };
Would it be worthwhile to design the interfaces to support boolean
logic (and, or, not, precedence), to allow for future expansion?
> [scriptable, uuid(4241C46E-1DD2-11B2-978D-A2FBD0A72AC2)]
> interface nsIAbDirectoryQuery : nsISupports
> {
> /**
> * Initiates a query on a directory and
> * sub-directories for properties on cards
> *
> * @param arguments
> * The properties and values to match
> * Value could of type nsIAbDirectoryQueryMatchItem
> * for matches other than ?contains?
> * @param listener
> * The listener which will obtain individual
> * query results
> * @param resultLimit
> * Limits the results returned to a specifed
> * maximum value
> * @return
> * Unique number representing the context ID of
> * the query
> *
> */
> long doQuery (in nsIAbDirectoryQueryArguments arguments,
> in nsIAbDirectoryQueryResultListener listener,
> in long resultLimit);
>
> /**
> * Stops an existing query operation if
> * operation is asynchronous
> *
> * @param contextID
> * The unique number returned from
> * the doQuery methods
> *
> */
> void stopQuery (in long contextID);
> };
>
> [scriptable, uuid(4290E508-1DD2-11B2-AC3E-9597BBCB25D7)]
> interface nsIAbDirectoryQueryResultListener : nsISupports
> {
> /**
> * Called when a match is found. May be
> * called from a different thread to the
> * one that initiates the query
> *
> * @param result
> * A individual result associated returned
> * from a query
> */
> void onQueryItem (in nsIAbDirectoryQueryResult result);
> };
>
> [scriptable, uuid(42E600BA-1DD2-11B2-BC39-C363AC0C93E3)]
> interface nsIAbDirectoryQueryResult : nsISupports
> {
> /**
> * The context ID of the query
> *
> */
> readonly attribute long contextID;
>
> /**
> * The context of the query which
> * corresponds to the arguments that
> * define the query
> *
> */
> readonly attribute nsIAbDirectoryQueryArguments context
>
> /**
> * List of defined query results
> *
> */
> const long queryResultMatch = 0;
> const long queryResultComplete = 1;
> const long queryResultStopped = 2;
> const long queryResultError = 3;
>
> /**
> * The type of result
> *
> * Identifies a query entry, the query has finished
> * or that an error has occured
> */
> readonly attribute long type;
>
> /**
> * The result of a singular match for a card
> *
> * Only valid when the attribute type is
> * of 'query match'
> *
> * nsISupportsArray<nsIAbDirectoryQueryPropertyValue>
> * Multiple entries corresponding to card
> * properties
> * nsISupportsArray<nsIAbCard>
> * Only one entry makese sense
> *
> */
> readonly attribute nsISupportsArray result;
> };
Dan
--