Service Desk Practitioners Forum
cancel

Problem with printing organizations names for organizations added to configuration items as CIOrgs

SOLVED
Go to solution
Highlighted
Siekierko Przem
Respected Contributor.

Problem with printing organizations names for organizations added to configuration items as CIOrgs

I’ve got problem with printing organizations names for organizations added to configuration items as CIOrgs.

I’ve got about 500 configuration items and to each CI is added one (in few CI more than one) organization as CIOrgs.

In my code I’m trying to print some information form CI like Serialnumber and names of organizations related to this CI.

This is part of my code:

IConfigurationItem[] cis = org.getOwnerOfCI(); //about 500 configuration items

for(int i=0; i{
System.out.println("Serial Number: "+cis[i].getSerialNumber());

IOrganization[] ciorgs = cis[i].getCiOrgs();

if(ciorgs!=null && ciorgs.length>0) {
System.out.println("CIOrg: " + ciorgs[0].getName1());
}
}

When I’m running this code it takes about 3 minutes to print 500 serial numbers and organizations names.

When I print only 500 serial numbers it takes only one second.

If someone know solution or any idea how improve printing organizations names taken from configurationitem by getCiOrgs() method I would be very thankful.

(Even if you are not sure for 100% that your idea will work, please write it here, I will try it. I’m little desperate, because I fighting with this problem for few weeks and I would be really very thankful for every idea.)

Thanks for help.
7 REPLIES
George M. Meneg
Acclaimed Contributor.
Solution

Re: Problem with printing organizations names for organizations added to configuration items as CIOrgs

Hello,

We also have performance problems using webapi's functions. At some cases we prefer to direct query the sd database instead of use webapi functions that take too long to execute.

In your case the query should be like this:

select cit.cit_serialnumber, org.org_name1
from itsm_configuration_items cit
inner join itsm_ci_orgs cio on cit.cit_oid=cio.cio_cit_oid
inner join itsm_organizations org on cio.cio_org_oid=org.org_oid

This will lists only CIs that have CIorg. If you want to list all CIs (even if they don't have any CIorg) then you must modify inner join to left outer join and instead of org.org_name1 use isnull(org.org_name1, 'Empty') (if you are using sql) or nvl(org.org_name1, 'Empty') if you are using oracle.
menes fhtagn
Lina.K
Respected Contributor.

Re: Problem with printing organizations names for organizations added to configuration items as CIOrgs


Hi Siekierko, Hi George

I have a side question if you allow me.

I surprised when I saw the Java code in the original post, I want to know whether we have an access to the internal Java source code for SD5.1 or not? Where you wrote the above code? from where I can read about getSerialNumber() methods and all available methods???.

Thanks in advanced..
Lina
Carol Hibbard
Acclaimed Contributor.

Re: Problem with printing organizations names for organizations added to configuration items as CIOrgs

SD API questions might get more responses in the developer forum for SD:
http://devresource.hp.com/forums/forum.jspa?forumID=5
Lina.K
Respected Contributor.

Re: Problem with printing organizations names for organizations added to configuration items as CIOrgs



Thanks Carol
Siekierko Przem
Respected Contributor.

Re: Problem with printing organizations names for organizations added to configuration items as CIOrgs

Hello Gorge M. Menegakis,

Did you have to change your queries after Service Pack updates ??
Siekierko Przem
Respected Contributor.

Re: Problem with printing organizations names for organizations added to configuration items as CIOrgs

Hello Lina. K

Look at API folder on HPSD installation CD.
In every service pack you will find API folder. You can find there new examples and new webapi.jar.

In \doc\web_api_javadoc.zip is webapi documentation but itâ s really poor.
George M. Meneg
Acclaimed Contributor.

Re: Problem with printing organizations names for organizations added to configuration items as CIOrgs

Hello,

I can't recall any time that I had to modify the query after installing an SP. The basic layout of the db doesn't change drastically from service pack to service pack, at least not for the basic entities. Some fields may be added, even some new tables, but the already existing tables usually maintain their layout.
menes fhtagn