Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
962 views

Query in DAL for attribute on multiple entities

What is the best way to Query multiple entities attributes?

At this moment I Query for multiple entities, and take the result list into a loop of IDVault.get-questions.
This takes quite a while when numbers go past 200 results.

I would like to be able to say: IDVault.get(field, listofDNs, entity,attribute) to pack it into a single Query.

Is this possible, and what way is best to achieve this?
Labels (1)
0 Likes
6 Replies
Anonymous_User Absent Member.
Absent Member.

Re: Query in DAL for attribute on multiple entities

We had a similar situation where wen needed to read a couple of hundreds
objects and a handful of attributes during form.onload() - this huge
number of IDVault.get() requests could take minutes before the form was
displayed.

We were able to resolve this by one of two approaches:

The first approach was to create a start mapping where our query was
executed and IDVault.get() called against the DN result set. This moved
the costly query/get operations to the server.
Results were stored into an object and passed as JSON to a hidden form
field.
Instead of calling IDVault in the form, we could retrieve the data from
the hidden field, which was significantly faster. Of course, you'd need
to know the DNs at load time of the form.

Later we replaced that 1st approach by implementing a custom Ajax
service replacing the original IDVault.get() by custom functions using
LDAP calls and caching. However, developing this involved significantly
more effort.

Wolfgang


On 25.01.2019 11:24, sebastiantidare wrote:
>
> What is the best way to Query multiple entities attributes?
>
> At this moment I Query for multiple entities, and take the result list
> into a loop of IDVault.get-questions.
> This takes quite a while when numbers go past 200 results.
>
> I would like to be able to say: IDVault.get(field, listofDNs,
> entity,attribute) to pack it into a single Query.
>
> Is this possible, and what way is best to achieve this?
>
>

0 Likes
rrawson Honored Contributor.
Honored Contributor.

Re: Query in DAL for attribute on multiple entities

In one of my recent workflows I actually did a direct VDX query which has a lot fewer limitations than the wrapped IDVault object. I wrote it up in a coolsolutions article:

https://www.netiq.com/communities/cool-solutions/making-vdx-queries-workflow-forms/
0 Likes

Re: Query in DAL for attribute on multiple entities

This would in fact be an interesting solution. Though I do not know the DNs in advance, so that would require a full load on server which I cannot allow.
There is also another interesting thing inside the Product (I would like to keep the development within the range of IDMs capabilites, i.e. no custom builds), and that is the built-in fields of the forms.
The built-in fields can be set to a handle a specific entity and also be configured to show a specific attribute. This is fact loads both DNs and the chosen attribute to the field. This method also loads significantly faster than loading the DNs and looping the attributes manually which makes me think they already use this kinds of Queries for multiple attributes in some way.

I will keep looking, thanks for the advice though!

Wolfgang Schreiber;2494380 wrote:
We had a similar situation where wen needed to read a couple of hundreds
objects and a handful of attributes during form.onload() - this huge
number of IDVault.get() requests could take minutes before the form was
displayed.

We were able to resolve this by one of two approaches:

The first approach was to create a start mapping where our query was
executed and IDVault.get() called against the DN result set. This moved
the costly query/get operations to the server.
Results were stored into an object and passed as JSON to a hidden form
field.
Instead of calling IDVault in the form, we could retrieve the data from
the hidden field, which was significantly faster. Of course, you'd need
to know the DNs at load time of the form.

Later we replaced that 1st approach by implementing a custom Ajax
service replacing the original IDVault.get() by custom functions using
LDAP calls and caching. However, developing this involved significantly
more effort.

Wolfgang


On 25.01.2019 11:24, sebastiantidare wrote:
>
> What is the best way to Query multiple entities attributes?
>
> At this moment I Query for multiple entities, and take the result list
> into a loop of IDVault.get-questions.
> This takes quite a while when numbers go past 200 results.
>
> I would like to be able to say: IDVault.get(field, listofDNs,
> entity,attribute) to pack it into a single Query.
>
> Is this possible, and what way is best to achieve this?
>
>
0 Likes

Re: Query in DAL for attribute on multiple entities

Hi, thanks for reply again!

Can you Point me in the direction of how to best create a custom Ajax service such as your second implementation?
It did not really matter to move the calls to the server side since the form won't open until the job is done which still makes it take forever to load.

At the moment i'm implementing search functions coupled with pagination to limit the search results and load time.
It takes about 0,5 seconds to get a Query result back to my form and about 1 second to load attributes from 20 DNs.


Wolfgang Schreiber;2494380 wrote:
We had a similar situation where wen needed to read a couple of hundreds
objects and a handful of attributes during form.onload() - this huge
number of IDVault.get() requests could take minutes before the form was
displayed.

We were able to resolve this by one of two approaches:

The first approach was to create a start mapping where our query was
executed and IDVault.get() called against the DN result set. This moved
the costly query/get operations to the server.
Results were stored into an object and passed as JSON to a hidden form
field.
Instead of calling IDVault in the form, we could retrieve the data from
the hidden field, which was significantly faster. Of course, you'd need
to know the DNs at load time of the form.

Later we replaced that 1st approach by implementing a custom Ajax
service replacing the original IDVault.get() by custom functions using
LDAP calls and caching. However, developing this involved significantly
more effort.

Wolfgang


On 25.01.2019 11:24, sebastiantidare wrote:
>
> What is the best way to Query multiple entities attributes?
>
> At this moment I Query for multiple entities, and take the result list
> into a loop of IDVault.get-questions.
> This takes quite a while when numbers go past 200 results.
>
> I would like to be able to say: IDVault.get(field, listofDNs,
> entity,attribute) to pack it into a single Query.
>
> Is this possible, and what way is best to achieve this?
>
>
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Query in DAL for attribute on multiple entities

There are two main approaches to use Ajax in form fields:

One relies on external services that can be called in a couple of ways,
e.g., like outlined in
https://www.netiq.com/communities/cool-solutions/howto-use-ajax-jquery-user-application-forms/
You could consider having some LDAP service there, that runs your query,
and returns the data.

The other uses the built-in function IDVault.execService() - see the
short doc in the IDM Admin Guide. Unluckily there seems to be no
documentation on how to write your own Java service.
It would be beyond this news group's scope to go into more detail, but
in short you'd write a Java class (e.g., that does your query with LDAP)
and insert and register it in IDMProv.war

If you need to read multiple attributes from the same DN, you might
profit from a (undocumented and unreliable) built-in function:
The normal API "IDVault.get(fieldname,dn,entity-type,attribute)" allows
to pass an array as attribute, thereby reading a couple of attributes in
one go. Something like
ar = IDVault.get(undefined,dn,entity,["LastName", "GivenName"]);
It's sometimes unreliable with unvalued attributes, so you should
compare the result length and the attribute count.

Wolfgang

On 13.03.2019 16:44, sebastiantidare wrote:
>
> Hi, thanks for reply again!
>
> Can you Point me in the direction of how to best create a custom Ajax
> service such as your second implementation?
> It did not really matter to move the calls to the server side since the
> form won't open until the job is done which still makes it take forever
> to load.
>
> At the moment i'm implementing search functions coupled with pagination
> to limit the search results and load time.
> It takes about 0,5 seconds to get a Query result back to my form and
> about 1 second to load attributes from 20 DNs.
>
>

0 Likes

Re: Query in DAL for attribute on multiple entities

New possibilities?

Since a bit research i've seen the new REST API for the IDM 4.7.2 specifically which has extended with api calls such as entities/list. This to me seems like a way to Query multiple entities, however the part im not sure of is wether i get the attributes or not, the example seems to be providing attributes.

Now if this api call does what I Think it does, it basically means i can create forms that Query any entity to provide information to the form. I could also go as far as changing and creating/deleting objects from the form.

This would even solve the issue of working with objects without closing the form after each operation.

Can anyone provide information about this, am I correct in this assumption?
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.