List artifact attributes of a project in Doors Next using OSLC query or Rest API
![]() I need to read all attributes that i have in a project in Doors Next. Then write a new URI for each attribute.
What i have achieved so far is to read all projects that I have in the server and then select a project and return its name. I want then to read the attributes of the selected project.
The code below is working fine until the point of reading attributes where it returns nothing, can you help me figure out how to read the attributes of the selected project.
// Send a new GET request to retrieve all attributes of the selected project
HttpGet projectAreaDoc = new HttpGet(serviceProviderUrl);
projectAreaDoc.addHeader("Accept", "application/xml");
projectAreaDoc.addHeader("OSLC-Core-Version", "2.0");
HttpResponse projectAreaResponse = HttpUtils.sendGetForSecureDocument(
server, projectAreaDoc, login, password, HttpClient, JTS_Server);
InputSource source2 = new InputSource(projectAreaResponse.getEntity().getContent());
// Define the XPath evaluation environment for the project area document
XPath xpath3 = factory.newXPath();
xpath3.setNamespaceContext(new NamespaceContextMap(new String[] {
"oslc_rm", "http://open-services.net/xmlns/rm/1.0/",
"dcterms", "http://purl.org/dc/terms/",
"oslc", "http://open-services.net/ns/core#",
}));
// Parse the response body to retrieve all attributes of the selected project
NodeList propertyNodes = (NodeList) xpath3.evaluate("/oslc_rm:properties/*", source2, XPathConstants.NODESET);
int propertyCount = propertyNodes.getLength();
System.out.println(">> Attributes of the selected project area:");
for (int i = 0; i < propertyCount; i++) {
Node propertyNode = propertyNodes.item(i);
String propertyName = propertyNode.getNodeName();
String propertyValue = propertyNode.getTextContent();
System.out.println(">> \t" + propertyName + ": " + propertyValue);
}
|
2 answers
![]()
Ralph Schoon (63.3k●3●36●46)
| answered Apr 20 '23, 5:41 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Apr 20 '23, 5:41 a.m.
These are the available APIs: https://jazz.net/wiki/bin/view/Deployment/CLMProductAPILanding
As far as I can tell, there is no project administration/type system administration API available. We toyed around with the apis to automate delivering the type system or importing it, which might a feasible approach to distribute a fixed/consolidated type system. See https://rsjazz.wordpress.com/2019/03/07/type-system-manager-part-2/ . You would have to manage the changes using the tool. Obviously this is something that you should experiment with on a test server until you are confident what you try to do is working. Comments ![]() FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I couldn't find any OSLC query cabilitities declared for artifact attributes in DN.
My understanding is, that OSLC only supports querying instances of requirements and other domain objects. You would see the attributes that have values. You can - sort of - find the attributes in the creation factories, but this is no API to e.g. modify the URI or create a new attribute etc. Thank you for your answering. Can you provide more details on how to find the attributes in the creation factory? That would be very appreciated. Consider to get the rootservices document, follow OSLC and discover and GET the creation factory that defines all available attributes. Can you provide more details on how to find the attributes in the creation factory? That would be very appreciated. See https://docs.oasis-open-projects.org/oslc-op/core/v3.0/os/discovery.html#creationFactoryShape
Hello again,
to Is there any other easy way to list the attributes that I have inside a project area?
I need to do that in a automated way or in other words using a script. Is this possible using Javascript ?
Thank you in advance.
p.s. I wasn't able to use Creation Factory to list the attributes. ![]() FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Sorry, I meant the resource shape, not the creation factory https://docs.oasis-open-projects.org/oslc-op/core/v3.0/os/resource-shape.html . For OSLC, that is best I can do. I do not know about the JavaScript API.
showing 5 of 7
show 2 more comments
|
![]()
Ian Barnard (2.0k●6●13)
| answered May 05 '23, 7:08 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You may find it simplest to do the process of adding URIs manually and very carefully to ensure consistency where there needs to be consistency and also differentiation where there needs to be differentiation.
Attributes aren't directly exposed in the OSLC API. What is exposed are the shapes (i.e. artifact types) and using these you can find the OSLC properties of each shape which is basically the attributes.
HOWEVER I don't believe it's possible to modify these - but you could at least report them
Manage the typesystem carefully - the best way to ensure consistency across components is to NEVER edit the types in a project component but to have a single central definition of your typesystem in a single component (which is used only for the typesystem) which you very carefully manage changes to, then import these central definitions into each component.
See https://jazz.ibm.com:9443/rs/reports#build/new/gatherData for recommended practices.
As it says in that article: "Ensure that each type system element (all artifacts, attributes, attribute data types, attribute data type values, and link types) in each type system has an associated URI"
|
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.
Comments
Thank you for your response. I have edited the code.
Hint: In the service catalog, I don't find "oslc_rm:properties"