Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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();

0 votes

Comments

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

 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 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
× 1,221

Question asked: Jan 30 '18, 3:30 a.m.

Question was seen: 1,307 times

Last updated: Jan 30 '18, 11:24 a.m.

Confirmation Cancel Confirm