It's all about the answers!

Ask a question

Java API - How to get Asset Type scoping information?


Pramod Chavan (191620) | asked Jul 18 '14, 8:38 a.m.
 Hello,

Is there a way to get scoping information(Communities scoping, categories Scoping) for asset types using java API?
I am aware that we can get attribute constraint data for asset type.

Regards,
Pramod

Comments
Pramod Chavan commented Jul 21 '14, 3:05 a.m.

 Hello,


Can we modify the community scoping for asset types using the RAM Java API?

Regards,
Pramod

One answer



permanent link
Lin Lu (3063) | answered Jul 21 '14, 4:21 a.m.
JAZZ DEVELOPER
Hi,
There is a function RAMAssetType.getConfiguration() could be used to retrieve asset type configuration as String.
However I am afraid that there is not a out-of-box way(functions) to retrieve the constraints object. One may need to serilize/deserilize via emf resourceSet. Here is one example code:

                RAMAssetType type = app.getAssetType("Lin Type");
		String typeConfigStr = type.getConfiguration();
		
		ResourceSet resourceSet = ManifestAccessor.createResourceSet((RAMURIConverter) null);
		
		Resource res = resourceSet.createResource(URI.createURI("testdata.xmi"));
		try {
			res.load(new ByteArrayInputStream(typeConfigStr.getBytes("UTF-8")), null);
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		AssetTypeConfiguration typeConfig = (AssetTypeConfiguration) res.getContents().get(0);
		
		List contraints = typeConfig.getConstraints();
		

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.