Is reading all Attributes Data Type in a DNG Project Area possible using OSLC ?
Vaibhav S (106●3●54)
| asked Dec 27 '18, 2:35 a.m.
edited Jan 16 '19, 5:25 a.m. by Ralph Schoon (63.6k●3●36●46) 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
|
One answer
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());
}
}
}
}
}
|
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.