Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » COSMOS » How to avoid the empty templates loading all the items?
How to avoid the empty templates loading all the items? [message #12470] Wed, 21 January 2009 08:04 Go to next message
arunachalam is currently offline arunachalamFriend
Messages: 15
Registered: July 2009
Junior Member
Hi ,

I successfully used the cosmos API and get the output , But for my
project the requirement is that I should not load all the items from the
db because the db may have the miilions of records. But on the query there
can be a empty template [ please see the example query below ] and that
empty template can be as a source or target into the relaitonship template.

But when I have a empty template as per the cosmos API it loads all
the items logically , But If I don't have the ItemTemplateHandler and
having the empty item template in the query I am getting the exception as
"Unsupported Constraint Type" exception.

I don't want to load the all the items from the db , but want to load
only the items that is having the relationship with the source or target.
In my example I am having the empty template as a source , So I can pass
the source as null to the DB and get the items having a RUNSON
relaitonship with the target template items and want to add these items
into the query response.
I added the empty item on my ItemTemplateHandler and again create the item
handler in my relationshiprecordtypehanlder to add the source items which
I got after I apply the relationship record type , But I am not getting
the source items in my query response and still getting the empty item
element on the query response.


Is there a way in the cosmos API for doing this or I need to write my
own code to do this ? If I need to write my own code which part of the
code needs to be changed or Can I extend any of the class and write my
code to do this?

Regards

Arunachalam
Re: How to avoid the empty templates loading all the items? -- Query Example [message #12494 is a reply to message #12470] Wed, 21 January 2009 08:11 Go to previous messageGo to next message
arunachalam is currently offline arunachalamFriend
Messages: 15
Registered: July 2009
Junior Member
<?xml version="1.0" encoding="UTF-8"?>

<!-- This query selects all attributes for the item "PLAS56" -->

<s:query xmlns:s="http://cmdbf.org/schema/1-0-0/datamodel">
<s:itemTemplate id="template1">
<s:instanceIdConstraint>
<s:instanceId>
<s:mdrId>CCMDBMDR</s:mdrId>
<s:localId>PLAS56</s:localId>
</s:instanceId>
</s:instanceIdConstraint>
</s:itemTemplate>

<s:itemTemplate id="template2">
</s:itemTemplate>

<s:relationshipTemplate id="RUNSON">

<s:recordConstraint>
<s:recordType namespace="" localName="RUNSON"/>
</s:recordConstraint>

<s:sourceTemplate ref="template2"/>
<s:targetTemplate ref="template1"/>
</s:relationshipTemplate>

</s:query>
Re: How to avoid the empty templates loading all the items? [message #12513 is a reply to message #12470] Wed, 11 February 2009 17:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: david_whiteman.us.ibm.com

arunachalam wrote:
> Hi ,
> I successfully used the cosmos API and get the output , But for my
> project the requirement is that I should not load all the items from the
> db because the db may have the miilions of records. But on the query
> there can be a empty template [ please see the example query below ] and
> that empty template can be as a source or target into the relaitonship
> template.
>
> But when I have a empty template as per the cosmos API it loads all
> the items logically , But If I don't have the ItemTemplateHandler and
> having the empty item template in the query I am getting the exception
> as "Unsupported Constraint Type" exception.
>
> I don't want to load the all the items from the db , but want to
> load only the items that is having the relationship with the source or
> target. In my example I am having the empty template as a source , So I
> can pass the source as null to the DB and get the items having a RUNSON
> relaitonship with the target template items and want to add these items
> into the query response.
> I added the empty item on my ItemTemplateHandler and again create the
> item handler in my relationshiprecordtypehanlder to add the source items
> which I got after I apply the relationship record type , But I am not
> getting the source items in my query response and still getting the
> empty item element on the query response.
>
>
> Is there a way in the cosmos API for doing this or I need to write
> my own code to do this ? If I need to write my own code which part of
> the code needs to be changed or Can I extend any of the class and write
> my code to do this?
>
> Regards
>
> Arunachalam

Hi Arunachalam,

My apologies for the long delay in responding. Thank you for your
detailed post.

You can look at the Aperi MDR example as an example of overriding the
handler processing to gain more control in the process.

For the exception, I have created a defect in our system:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=264556 . Please add
yourself to the cc: list to be notified of its progress, and provide any
additional info there as necessary.

Also, for the case you describe immediately after that, does it also
seem to be working improperly? If so, please create a defect for that
as well. And if you have any specific API requests, feel free to create
an enhancement request in Bugzilla so we can prioritize the effort.

Regards,
David
Re: How to avoid the empty templates loading all the items? [message #12533 is a reply to message #12513] Thu, 19 February 2009 13:45 Go to previous messageGo to next message
arunachalam is currently offline arunachalamFriend
Messages: 15
Registered: July 2009
Junior Member
Hi David ,

Thank you for your reply. I find the solution for this and it seems to be
working. But I am not sure this is the right way of doing.

I extend the
org.eclipse.cosmos.dc.provisional.cmdbf.services.query.servi ce.impl.CMDBfQueryOperation
class and overwrite the "private IQueryResult execute(Object input) throws
CMDBfServiceException".

I have added one method as "processEmptyTemplates(IQueryResult result)
and calling this method after the
"processRelationshipTemplates(cmdbfQuery, queryResult);" method call in
this method.

In the itemtemplatehandler I am adding the empty item and adding the
template id into map with empty item [ Nodes ] , So that we will get the
template id with the empty item and in relationship record type handler, I
am getting actual item [ because I am getting the item only when I am
executing the relationship ] and update this map.So this map will be
filled once the method "processRelationshipTemplates(cmdbfQuery,
queryResult);" is called. I am calling the method which is by me after
this method and this method take care in appending the nodes [ which is
filled during the relaitonship process ] to the empty template [ during
the item template handler processing ].

And this is working fine for me, But I don't think this will be an
temporary solution.

Regards

Arunachalam.
Re: How to avoid the empty templates loading all the items? [message #12553 is a reply to message #12513] Thu, 19 February 2009 13:48 Go to previous message
arunachalam is currently offline arunachalamFriend
Messages: 15
Registered: July 2009
Junior Member
Hi David ,

Thank you for your reply. I find the solution for this and it seems to be
working. But I am not sure this is the right way of doing.

I extend the
org.eclipse.cosmos.dc.provisional.cmdbf.services.query.servi ce.impl.CMDBfQueryOperation
class and overwrite the "private IQueryResult execute(Object input) throws
CMDBfServiceException".

I have added one method as "processEmptyTemplates(IQueryResult result)
and calling this method after the
"processRelationshipTemplates(cmdbfQuery, queryResult);" method call in
this method.

In the itemtemplatehandler I am adding the empty item and adding the
template id into map with empty item [ Nodes ] , So that we will get the
template id with the empty item and in relationship record type handler, I
am getting actual item [ because I am getting the item only when I am
executing the relationship ] and update this map.So this map will be
filled once the method "processRelationshipTemplates(cmdbfQuery,
queryResult);" is called. I am calling the method which is by me after
this method and this method take care in appending the nodes [ which is
filled during the relaitonship process ] to the empty template [ during
the item template handler processing ].

And this is working fine for me, But I don't think this will be an
temporary solution.

Regards

Arunachalam.
Re: How to avoid the empty templates loading all the items? -- Query Example [message #572340 is a reply to message #12470] Wed, 21 January 2009 08:11 Go to previous message
arunachalam is currently offline arunachalamFriend
Messages: 15
Registered: July 2009
Junior Member
<?xml version="1.0" encoding="UTF-8"?>

<!-- This query selects all attributes for the item "PLAS56" -->

<s:query xmlns:s="http://cmdbf.org/schema/1-0-0/datamodel">
<s:itemTemplate id="template1">
<s:instanceIdConstraint>
<s:instanceId>
<s:mdrId>CCMDBMDR</s:mdrId>
<s:localId>PLAS56</s:localId>
</s:instanceId>
</s:instanceIdConstraint>
</s:itemTemplate>

<s:itemTemplate id="template2">
</s:itemTemplate>

<s:relationshipTemplate id="RUNSON">

<s:recordConstraint>
<s:recordType namespace="" localName="RUNSON"/>
</s:recordConstraint>

<s:sourceTemplate ref="template2"/>
<s:targetTemplate ref="template1"/>
</s:relationshipTemplate>

</s:query>
Re: How to avoid the empty templates loading all the items? [message #572400 is a reply to message #12470] Wed, 11 February 2009 17:33 Go to previous message
David Whiteman is currently offline David WhitemanFriend
Messages: 166
Registered: July 2009
Senior Member
arunachalam wrote:
> Hi ,
> I successfully used the cosmos API and get the output , But for my
> project the requirement is that I should not load all the items from the
> db because the db may have the miilions of records. But on the query
> there can be a empty template [ please see the example query below ] and
> that empty template can be as a source or target into the relaitonship
> template.
>
> But when I have a empty template as per the cosmos API it loads all
> the items logically , But If I don't have the ItemTemplateHandler and
> having the empty item template in the query I am getting the exception
> as "Unsupported Constraint Type" exception.
>
> I don't want to load the all the items from the db , but want to
> load only the items that is having the relationship with the source or
> target. In my example I am having the empty template as a source , So I
> can pass the source as null to the DB and get the items having a RUNSON
> relaitonship with the target template items and want to add these items
> into the query response.
> I added the empty item on my ItemTemplateHandler and again create the
> item handler in my relationshiprecordtypehanlder to add the source items
> which I got after I apply the relationship record type , But I am not
> getting the source items in my query response and still getting the
> empty item element on the query response.
>
>
> Is there a way in the cosmos API for doing this or I need to write
> my own code to do this ? If I need to write my own code which part of
> the code needs to be changed or Can I extend any of the class and write
> my code to do this?
>
> Regards
>
> Arunachalam

Hi Arunachalam,

My apologies for the long delay in responding. Thank you for your
detailed post.

You can look at the Aperi MDR example as an example of overriding the
handler processing to gain more control in the process.

For the exception, I have created a defect in our system:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=264556 . Please add
yourself to the cc: list to be notified of its progress, and provide any
additional info there as necessary.

Also, for the case you describe immediately after that, does it also
seem to be working improperly? If so, please create a defect for that
as well. And if you have any specific API requests, feel free to create
an enhancement request in Bugzilla so we can prioritize the effort.

Regards,
David
Re: How to avoid the empty templates loading all the items? [message #572426 is a reply to message #12513] Thu, 19 February 2009 13:45 Go to previous message
arunachalam is currently offline arunachalamFriend
Messages: 15
Registered: July 2009
Junior Member
Hi David ,

Thank you for your reply. I find the solution for this and it seems to be
working. But I am not sure this is the right way of doing.

I extend the
org.eclipse.cosmos.dc.provisional.cmdbf.services.query.servi ce.impl.CMDBfQueryOperation
class and overwrite the "private IQueryResult execute(Object input) throws
CMDBfServiceException".

I have added one method as "processEmptyTemplates(IQueryResult result)
and calling this method after the
"processRelationshipTemplates(cmdbfQuery, queryResult);" method call in
this method.

In the itemtemplatehandler I am adding the empty item and adding the
template id into map with empty item [ Nodes ] , So that we will get the
template id with the empty item and in relationship record type handler, I
am getting actual item [ because I am getting the item only when I am
executing the relationship ] and update this map.So this map will be
filled once the method "processRelationshipTemplates(cmdbfQuery,
queryResult);" is called. I am calling the method which is by me after
this method and this method take care in appending the nodes [ which is
filled during the relaitonship process ] to the empty template [ during
the item template handler processing ].

And this is working fine for me, But I don't think this will be an
temporary solution.

Regards

Arunachalam.
Re: How to avoid the empty templates loading all the items? [message #572447 is a reply to message #12513] Thu, 19 February 2009 13:48 Go to previous message
arunachalam is currently offline arunachalamFriend
Messages: 15
Registered: July 2009
Junior Member
Hi David ,

Thank you for your reply. I find the solution for this and it seems to be
working. But I am not sure this is the right way of doing.

I extend the
org.eclipse.cosmos.dc.provisional.cmdbf.services.query.servi ce.impl.CMDBfQueryOperation
class and overwrite the "private IQueryResult execute(Object input) throws
CMDBfServiceException".

I have added one method as "processEmptyTemplates(IQueryResult result)
and calling this method after the
"processRelationshipTemplates(cmdbfQuery, queryResult);" method call in
this method.

In the itemtemplatehandler I am adding the empty item and adding the
template id into map with empty item [ Nodes ] , So that we will get the
template id with the empty item and in relationship record type handler, I
am getting actual item [ because I am getting the item only when I am
executing the relationship ] and update this map.So this map will be
filled once the method "processRelationshipTemplates(cmdbfQuery,
queryResult);" is called. I am calling the method which is by me after
this method and this method take care in appending the nodes [ which is
filled during the relaitonship process ] to the empty template [ during
the item template handler processing ].

And this is working fine for me, But I don't think this will be an
temporary solution.

Regards

Arunachalam.
Previous Topic:How to avoid the empty templates loading all the items?
Next Topic:Instance Id Constraint and record type constraint in same template,not possible?
Goto Forum:
  


Current Time: Fri Mar 29 01:45:51 GMT 2024

Powered by FUDForum. Page generated in 0.17090 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top