cancel
Showing results for 
Search instead for 
Did you mean: 

Extract image and Features from the Catalog via JAVA API

Former Member
0 Kudos

Hello,

I would like to Extract image from the Catalog via JAVA API, Can anybody help on that? I also tried to extract the Features field form the Catalog but results in the error "Features field not found" Any ideas what could have wrong?

Many thanks,

Dharmi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Dharmi,

To get features:

A2iIntArray textBlockIDs = rs.GetLookupIDAt(i,"Features field name");

String txtBlockVal[] = null;

if (textBlockIDs !=null){

int txtBlocksLength = textBlockIDs.GetSize();

int txtBlockIds [] = new int[txtBlocksLength];

txtBlockVal = new String[txtBlocksLength];

if (textBlockIDs != null) {

for (int t = 0; t < txtBlocksLength; t++){

int textBlockID = textBlockIDs.GetAt(t);

txtBlockIds[t] = textBlockID;

txtBlockVal[t] = catalogdataobject.GetTextBlock("Text Blocks", textBlockID);

}

}

}

For Image:

You need to use CatalogCache class GetImagePath method

Former Member
0 Kudos

Hello Subbu,

Thank you for your code, it solved my problem. I am now going to try to get the image, I would like to get back if I have problems.

Best regards,

Dharmi

p.s. Sorry, I cannot some how allot points, I would check every hour to see if I could give points cos I dont see any options to allot the same next to anybody's reply.

Message was edited by: Dharmi Tanna

Former Member
0 Kudos

Hello Subbu,

When I try to use the CatalogCache.Init I get the following error:

Error:The method Init(String, int, String, String, String, String) in the type CatalogCache is not applicable for the arguments (String, int, String, String, String, int)

Which is quite strange cos the JAVA API reference guide also has the last parameter has int and not string.

Can you please help?

Regards,

Dharmi

Former Member
0 Kudos

Hi Dharmi,

According to javadoc for the latest version(SP2 Patch1), the last parameter is a string.

java.lang.String host,

int port,

java.lang.String user,

java.lang.String password,

java.lang.String path,

java.lang.String regionTag

where...

host - the server name or IP address.

port - the catalog port number.

user - the catalog user name.

password - the catalog user password.

path - the directory path where the blobs will be cached.

regionTag - the region to use for a catalog

Hope this helps,

Richard

Former Member
0 Kudos

Hello Richard,

The JavaAPI that I was refering was for MDM 4.0. Thank you for pointing out the difference I would try with the regionTag. One more question how does one find out the name of the ImageTable where the images are stored?

Regards,

Dharmi

p.s. Sorry cannot allot points somehow.

Former Member
0 Kudos

Hello,

Can anybody tell me where i can find the latest JAVAAPI reference guide? I found the one for MDM 5.5 SP 1 but that also refers to the last parameter of the CatalogCache.Init as int and not string.

I looked up in service.sap.com/instguides -> SAP Netweaver -> Release 4 -> Installation and there only following 3 files are there for MDM 5.5 SP2

MDM 5.5 SP02 - Configuration Guide SAP MDM

MDM 5.5 SP02 - Installation Guide SAP MDM

MDM 5.5 SP02 – ERP-MDM Field Mapping and Check Tables

Regards,

Dharmi

Message was edited by: Dharmi Tanna

Message was edited by: Dharmi Tanna

Former Member
0 Kudos

Hi Dharmi,

The javadoc that i'm referring is included in the MDM Java API installation. Since you have the code (MDM4J.jar) you should also have this. Regardless, you can download it from http://service.sap.com/swdc -> Download -> Support Packages and Patches -> Entry by Application Group -> SAP NetWeaver -> SAP MDM -> SAP MDM 5.5 -> MDM Java API 5.5.

Try "English [US]" for the region tag.

Hope this helps,

Richard

Former Member
0 Kudos

Hello Richard,

Thanks once again. I did try "English [US]" for the region tag / repository language. Now I am busy finding out How can I get the image from the catalog! Do you know what is the name of the Image Table in the Catalog?

Many thanks,

Dharmi

Former Member
0 Kudos

Hi Dharmi,

In the InQuera catalog, the name of the image table is called "Images".

Hope this helps,

Richard

Former Member
0 Kudos

Hello Richard,

Sorry for the delayed reply. I was unable to find the Reference guide at the location specified by you.

Thank you for finding the name of the images table for me. I am now able to extract the image from MDM; but was wondering how to get the exactnames of the image any ideas on that???

Regards,

Dharmi

Former Member
0 Kudos

Hi Dharmi,

I wasn't referring to the reference guide, i was referring to the javadoc(html based api documentation). The Reference Guide for SP02 isn't available yet.

For the image issue, the CatalogData.GetImageInfo() methods return an ImageInfo class which contains methods to get all kinds of information about the image, including the name.

Hope this helps,

Richard

Former Member
0 Kudos

Hello Richard,

Thanks once again. I would try that and when the point system is ready I would allot the points. I did try last time, and succeded to give some points but then not all that you really deserve.

Best regards,

Dharmi

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Dharmi,

Can you give me the following info so that i can determine what the problem is? Thanks!!

Does your catalog have a table that contains a field called Features?

What classes and methods did you use to search the Features field?

Richard

Former Member
0 Kudos

Hello Richard,

The catalog that I am using is the Demo_Inquera - I believe that it is the default catalog of MDM having the products catalog.

The following code was used to extract the data of the Features field:

A2iValueArray ftures= rs.GetValueAt(i, "Features").GetValueArray();

for(int j=0;j<ftures.GetCount();j++){

System.out.println("Features["j"] : "+

cd.GetTextInfo("Text

Blocks",ftures.GetValueAt(j).GetIntValue()).GetString());

}

Regards,

Dharmi