Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[lyo-dev] Challenge Adding Affected By Links to Requirements

I'm trying to create Affected By (change request) links on RRC requirements.  Server is responding with a 412 (Pre-condition failed).  I think the 2 key details to share are:

1. I am authenticating at /jts first

2. I'm getting the requirement by first getting an org.eclipse.lyo.oslc4j.core.model.Link to the requirement from its related test case and then passing the URI of that Link to getResource().getEntity():

        public HashMap<String, Object> getRequirement(Link requirement) {

                HashMap<String, Object> theRequirementAndEtag = new HashMap<String, Object>();
                ClientResponse response = rrcClient.getResource(requirement.getValue().toString(), OslcMediaType.APPLICATION_RDF_XML);
                Requirement theRequirement = response.getEntity(Requirement.class);
                String eTag = response.getHeaders().getFirst(OSLCConstants.ETAG);
                theRequirementAndEtag.put("requirement", theRequirement);
                theRequirementAndEtag.put("etag", eTag);
                response.consumeContent();

                return theRequirementAndEtag;
        }


3.  I am including the eTag in the update request:

HashMap<String, Object> requirementAndEtag = myRrcUtil.getRequirement(requirements[i]);
Requirement requirement = (Requirement) requirementAndEtag.get("requirement");
String eTag = (String) requirementAndEtag.get("etag");
requirement.addAffectedBy(defectLink);
ClientResponse rrcResponse = rrcClient.updateResource(requirement.getAbout().toString(),
                                                        OslcMediaType.APPLICATION_RDF_XML,
                                                        OslcMediaType.APPLICATION_RDF_XML, eTag);



Regards,

Daniel Chirillo
IBM Software Services for Rational
1-720-395-0914  (voice & fax)
chirillo@xxxxxxxxxx

Back to the top