Jazz Register Log in
Jazz Forum Welcome to the Jazz Community Forum

Welcome to the Jazz Community Forum

Connect and collaborate with IBM Engineering experts and users

Is reading all Attributes Data Type in a DNG Project Area possible using OSLC ?

 Hi all,


I need to read all Attributes Data Type in a DNG Project Area possible.

Is it possible using OSLC. 

Please let me know.

Thanks
Vaibhav

0 votes



One answer

Permanent link

Hello,


I was able to read the attribute types using the below code 

static void readAttributeType() throws IOException, ParserConfigurationException, SAXException
{
String url = "https://dng server/rm/types?resourceContext=dng_server/rm/process/project-areas/project_area_uuid"; 
//HttpURLConnection conn = (HttpURLConnection)url.openConnection();
HttpGet conn=new HttpGet(url);
HttpPost conn1=new HttpPost();
String inline="";
//conn.setRequestMethod("GET");
//conn.setRequestProperty("Cookie", "name1=value1; name2=value2");
conn.setHeader("Accept", "application/rdf+xml");
conn.setHeader("OSLC-Core-Version", "2.0");
conn.setHeader("vvc.configuration", "");
//conn.connect();
org.apache.http.HttpResponse responsecode = client.getHttpClient().execute(conn);
InputStream input=responsecode.getEntity().getContent();
//System.out.println("success");
BufferedReader br = null;
StringBuilder sb = new StringBuilder();
String line = null;
try {

br = new BufferedReader(new InputStreamReader(input));
while ((line = br.readLine()) != null) {
sb.append(line);
}
}
catch (IOException e) {
e.printStackTrace();
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
System.out.println(line);
//System.out.println(responsecode.getEntity());
DOMParser parser = new DOMParser();
try {
    parser.parse(new InputSource(new java.io.StringReader(sb.toString())));
    Document doc = parser.getDocument();
    NodeList childNodes = doc.getDocumentElement().getChildNodes();
    for(int i = 0 ; i < childNodes.getLength(); i++){
        if("rm:ObjectType".equals(childNodes.item(i).getNodeName())){
        NodeList subchildNodes = childNodes.item(i).getChildNodes();
        for (int j = 0 ; j < subchildNodes.getLength(); j++) {
if("dcterms:title".equals(subchildNodes.item(j).getNodeName())){
System.out.println(subchildNodes.item(j).getTextContent());
}
}
           
        }
    }
}

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,995

Question asked: Dec 27 '18, 2:35 a.m.

Question was seen: 1,949 times

Last updated: Jan 16 '19, 5:25 a.m.

Confirmation Cancel Confirm