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.
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.
11 answers
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?
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?
page 2of 1 pagesof 2 pages
Comments
Rich Kulp
FORUM MODERATOR / JAZZ DEVELOPER Feb 07 '13, 1:12 p.m.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.