use of com.checkmarx.flow.dto.rally.CreateResultAction in project cx-flow by checkmarx-ltd.
the class RallyIssueTracker method createRallyTag.
/**
* Creates or locates existing Rally tag and return it's reference.
*
* @param name The name of the Rally Tag to create or locate
* @return String containing the reference, this should never be null!
*/
private JSONObject createRallyTag(String name) {
log.info("Creating Rally Tag: ".concat(name));
HttpEntity httpEntity = new HttpEntity(getJSONCreateTag(name), createAuthHeaders());
CreateResultAction cra;
ResponseEntity<CreateResultAction> response;
response = restTemplate.exchange(properties.getApiUrl().concat(CREATE_TAG), HttpMethod.POST, httpEntity, CreateResultAction.class);
cra = response.getBody();
Map<String, Object> m = (Map<String, Object>) cra.getAdditionalProperties().get("CreateResult");
m = (Map<String, Object>) m.get("Object");
JSONObject cxFlowTag = new JSONObject();
cxFlowTag.put("_ref", (String) m.get("_ref"));
return cxFlowTag;
}
use of com.checkmarx.flow.dto.rally.CreateResultAction in project cx-flow by checkmarx-ltd.
the class RallyIssueTracker method createIssue.
/**
* Creates new Rally defect.
*
* @param resultIssue
* @param request
* @return
* @throws MachinaException
*/
@Override
public Issue createIssue(ScanResults.XIssue resultIssue, ScanRequest request) throws MachinaException {
log.debug("Executing createIssue Rally API call");
try {
String json = getJSONCreateIssue(resultIssue, request);
HttpEntity httpEntity = new HttpEntity(json, createAuthHeaders());
CreateResultAction cra;
ResponseEntity<CreateResultAction> response;
response = restTemplate.exchange(properties.getApiUrl().concat(CREATE_ISSUE), HttpMethod.POST, httpEntity, CreateResultAction.class);
cra = response.getBody();
Map<String, Object> m = (Map<String, Object>) cra.getAdditionalProperties().get("CreateResult");
m = (Map<String, Object>) m.get("Object");
return mapHashManToIssue(m);
} catch (HttpClientErrorException e) {
log.error("Error occurred while creating Rally Issue");
log.error(ExceptionUtils.getStackTrace(e));
throw new MachinaRuntimeException();
}
}
Aggregations