Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to create a subCategory in RAM using Java API

I have a method which is intended to create a subcategory .. but it fails with the following error:-


com.ibm.ram.common.data.exception.RAMRuntimeException
    at com.ibm.ram.client.RAMSession.putCategorySchema(RAMSession.java:3776)
    at com.ibm.ram.client.RAMSession.put(RAMSession.java:5041)
    at com.cof.custom.policy.CustomPolicyUtility.categorizeSubCategoryAssets(CustomPolicyUtility.java:488)
    at com.cof.custom.policy.CustomPolicyUtility.manageAssets(CustomPolicyUtility.java:425)
    at com.cof.custom.policy.CustomPolicyUtility.main(CustomPolicyUtility.java:755)
Caused by: java.lang.NullPointerException
    at com.ibm.ram.client.RAMSession.putCategorySchema(RAMSession.java:3666)
    ... 4 more
Exception in thread "main" com.ibm.ram.common.data.exception.RAMRuntimeException
    at com.ibm.ram.client.RAMSession.putCategorySchema(RAMSession.java:3776)
    at com.ibm.ram.client.RAMSession.put(RAMSession.java:5041)


My code goes like this :-

        CategorySchema categorySchema = session.getCategorySchema(CustomPolicyConstants.BUSINESS_CAPABILITY_CATALOG);
RAMCategory  bcCategory = (RAMCategory)categorySchema.getCategory(CustomPolicyConstants.BUSINESS_CAPABILITIES_ASSET_TYPE);

SubCategory subCategory = bcCategory.createSubCategory("NewSubCategory4");
getRAMSession().put(categorySchema, new RAMStatusMonitor());

Can anyone please shed light on this and let me know what am I doing wrong?

Thanks in advance for all your help.

0 votes

Comments

What is the exact version of the RAM client that you are using? I can't find out which  version that the line numbers shown match up with.



11 answers

Permanent link
I updated my code to the following but still getting the same error:-

matchedCategory= subCategory.createSubCategory(assetObj.getName());
            session.put(categorySchema, new RAMStatusMonitor());
            session.release();
           
            getRAMSession();
            categorySchema.clear();
            categorySchema = (RAMCategorySchema)session.getCategorySchema(CustomPolicyConstants.BUSINESS_CAPABILITY_CATALOG);
            category = (RAMCategory)categorySchema.getCategory(category.getName());
            assetObj.refresh();
            category.getSubCategory(subCategory.getName());
            //assetObj.categorize(category, category.getSubCategory(subCategory.getName())+ "/" + matchedCategory.getName());
            assetObj.categorize(matchedCategory);
            session.put(assetObj, new RAMStatusMonitor());

Can anyone please help me on this one?

0 votes

1–15 items
page 2of 1 pagesof 2 pages

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Feb 07 '13, 11:12 a.m.

Question was seen: 10,117 times

Last updated: Feb 14 '13, 3:53 p.m.

Confirmation Cancel Confirm