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

Java API - How to get Asset Type scoping information?

 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

0 votes

Comments

 Hello,


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

Regards,
Pramod



One answer

Permanent link
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();
		

0 votes

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
× 10,938

Question asked: Jul 18 '14, 8:38 a.m.

Question was seen: 5,866 times

Last updated: Jul 21 '14, 4:21 a.m.

Confirmation Cancel Confirm