It's all about the answers!

Ask a question

RM_Migrating link from one customised link type to another using oslc


masoom Abdullah (53119) | asked Jan 30 '18, 3:30 a.m.

 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 commented Jan 30 '18, 11:09 a.m.
JAZZ DEVELOPER

Is there any change that you do see with links for those requirements?


masoom Abdullah commented Jan 30 '18, 11:24 a.m.

 Hi Bas,


I have an artifact with two customized links. 
1. Satisfied by
2. Embeds

I I am trying to migrate the embeds link to satisfied by, according to my login I am able to see both the uris are coming as an array in the satisfied by in the map, but after the update operation, even the earlier satisfied by link is getting deleted


Be the first one to answer this question!


Register or 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.