Discussion:
How to implement buildCriteriaScript(entry) api
(too old to reply)
Sufyan Khan
2018-10-04 12:25:49 UTC
Permalink
I have scripted LDAP connector to do a lookup so I have prepared a search criteria (using SearchCriteria class and addCriteria & setType APIs).

Now I have to build a filter which would have mixed '&' and '|' conditions which as per my understanding cannot be achieved using the above way so from javadocs I found buildCriteriaScript API which can help, but I am not able to implement this.

Could anyone help me in this?


Regards,
Sufyan
Eddie Hartman
2018-10-04 17:19:57 UTC
Permalink
Post by Sufyan Khan
I have scripted LDAP connector to do a lookup so I have prepared a search criteria (using SearchCriteria class and addCriteria & setType APIs).
Now I have to build a filter which would have mixed '&' and '|' conditions which as per my understanding cannot be achieved using the above way so from javadocs I found buildCriteriaScript API which can help, but I am not able to implement this.
Could anyone help me in this?
Regards,
Sufyan
You could try setting the ldapSearchFilter parameter instead. Here you can craft your own LDAP search filter as complex as you like.

/Eddie
Eddie Hartman
2018-10-04 17:20:57 UTC
Permalink
Post by Sufyan Khan
I have scripted LDAP connector to do a lookup so I have prepared a search criteria (using SearchCriteria class and addCriteria & setType APIs).
Now I have to build a filter which would have mixed '&' and '|' conditions which as per my understanding cannot be achieved using the above way so from javadocs I found buildCriteriaScript API which can help, but I am not able to implement this.
Could anyone help me in this?
Regards,
Sufyan
Of course, then you will not use findEntry(), but instead selectEntries() to search and getNextEntry() to return entries from the result set.

Complete thought now :)

/Eddie
Sufyan Khan
2018-10-05 18:21:50 UTC
Permalink
Hi Eddie,

Thanks, this would work.

Just for learning, if I want to use buildCriteriaScript API, how to implement it?


Thanks,
Sufyan
Eddie Hartman
2018-10-06 11:53:30 UTC
Permalink
Post by Sufyan Khan
Hi Eddie,
Thanks, this would work.
Just for learning, if I want to use buildCriteriaScript API, how to implement it?
Thanks,
Sufyan
Not sure why you would want to do that, Sufyan. It's a roundabout way of just grabbing values from the attributes you choose and using addCriteria() to set up your searchCriteria; This is instead of using addTemplate() with a LinkCrit value string (for example, '$AttributeName'). This requires you to build out the criteria using an entry, which is an extra step.

And if you understand LDAP v3 search filter syntax, then you have more flexibility setting the ldapSearchFilter and re-selectEntries()'ing than you are afforded by TDI's Link Criteria feature.

/Eddie

Loading...