Java API - How to get Asset Type scoping information?
One answer
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:
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();
Comments
Pramod Chavan
Jul 21 '14, 3:05 a.m.Hello,