RM_Migrating link from one customised link type to another using oslc
Hi all,
I am trying to migrate a customised link from one link type to another in DNG using oslc.
I am getting the response as 200, but my update operation is not reflecting the links migrated.
Code snippet:
for(String s:urls)
{
resourceUri= (String)s;
System.out.println("Resource uri: "+resourceUri);
response= client.getResource(resourceUri , OslcMediaType.APPLICATION_RDF_XML);
etag= response.getHeaders().getFirst(OSLCConstants.ETAG);
requirement= response.getEntity(Requirement.class);
map= requirement.getExtendedProperties();
Set<Entry<QName, Object>> set= map.entrySet();
Iterator<Entry<QName, Object>> iterator= set.iterator();
Iterator<Entry<QName, Object>> iterator1= set.iterator();
String value=null;
while(iterator.hasNext())
{
Entry<QName, Object> entry = iterator.next();
String keyLocalPart=entry.getKey().getLocalPart().toString();
if(keyLocalPart.equalsIgnoreCase("Satisfaction"))
{
nameForSatisfaction=entry.getKey();
String tempValue=entry.getValue().toString();
value=tempValue.substring(0, tempValue.length()-1);
//System.out.println(value);
}
}
while(iterator1.hasNext())
{
Entry<QName, Object> entry1 = iterator1.next();
String keyLocalPart=entry1.getKey().getLocalPart().toString();
if(keyLocalPart.equalsIgnoreCase("Embedding"))// migrating this type of links to Satisfied By link type
{
value=value+", "+entry1.getValue().toString();
}
}
value= value+"]";
map.remove(nameForSatisfaction);
map.put(nameForSatisfaction,value);
requirement.setExtendedProperties(map);
}
ClientResponse updateResponse= client.updateResource(resourceUri, requirement, OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_RDF_XML, etag);
System.out.println("Status: "+updateResponse.getStatusCode());
updateResponse.consumeContent();
response.consumeContent();
Comments
Bas Bekker
JAZZ DEVELOPER Jan 30 '18, 11:09 a.m.Is there any change that you do see with links for those requirements?
masoom Abdullah
Jan 30 '18, 11:24 a.m.Hi Bas,