Working with 7.5.1.1 RAM java api. RAMLibrary is returning null.
Accepted answer
But about NPE on ai? You wouldn't be getting an NPE on ai itself, but getLibrary(ai) will return null if the asset being requested IS NOT a library or if the asset doesn't exist. So you would be getting the NPE on the null.getVersion() instead in that case.
Comments
Looking for the following information when I submit a RAMAsset: Name, Version, Community, Type, Short Description. These are mandatory attributes when submitting an asset that were dictated by the RAM application (7.5.1.1).
When I use the RAM java api to pull in the AssetAttriubtues I get the following information but not the mandatory information, how do I get the aforementioned information using the RAM java api.:
RamJava Client Started capaturing RAM attribute Data
Environment Deployment Topology =
Deloyment Description = Nov. Major Release of Premier Connect
FEATURE BUNDLE = 1
List of Stories/Tasks = RA12345, RA23456, RA4567
Deploy DAsset to NON PROD ENV = PERFORMANCE
Database Updates Required = true
Describe Deployment Order = Perform database updates first
SCHEDULE DEPLOYMENT DATE = 2012-11-10
SCHEDULE DEPLOYMENT TIME = 12:01am
etc......
k, lets clarify your question a bit,
You are getting a RAMAsset, from a RAMSession, and user the getAssetAttributes() to list all the custom attributes that are SET on that asset (e.g., if you created an asset without that custom attribute, you will not get it here).
Note that short/description, version, community ... are not custom attributes. These properties have explicit API directly on the RAMAsset (e.g., getShortDescription()).
What is it that you are missing from that RAMAsset?
Great! Clarification.
Yes I would like to access the properties of the RAMAsset via the RAM JAVA API.
How do I get these properties "short/description, version, community" via the java api?
I think you are saying that I can access these properties by using the RAMAsset class directly? is this correct. RAMAsset ramasset = new RAMAsset();
ramasset.getShortDescription(); for example.
Kind regards,
I tested this out, its actually RAMAsset ramAsset= rtsession.getAsset(new com.ibm.ram.common.data.AssetIdentification(sessionID, Version));
And now I can get the RAM Asset properties that I seek: ramAsset.getShortDescription(); getCommunityName(); etc...
Thanks Gili, I'm all set.
Comments
Gerald Gordon
Dec 11 '12, 9:08 a.m.String st = rtsession.getLibrary(ai).getDescription();
I guess getting version does not make much sense since I'm passing it in... but getDescription from the RAMLIbrary is more pratical.