It's all about the answers!

Ask a question

How to create a subCategory in RAM using Java API


Sourav Ghosh (1266) | asked Feb 07 '13, 11:12 a.m.
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.

Comments
Rich Kulp commented Feb 07 '13, 1:12 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

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
Sourav Ghosh (1266) | answered Feb 14 '13, 3:53 p.m.
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?

Your answer


Register or 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.