AttributeCustomization : Can I use HttpConnectorParameters in Validators and Conditions ?
Hello All,
I am using an OSLC URI to fetch a single value everytime. I dont want to use HTTP value set provider as it returns value sets. I need the value in Conditions or Validators, to perform other calculations.
According to my use case, I need to call the URI in validators or Conditions.
Is it possible to use OSLC URI in Conditions and Validators ?
Am getting the following error :
Please help me on this.
I am using an OSLC URI to fetch a single value everytime. I dont want to use HTTP value set provider as it returns value sets. I need the value in Conditions or Validators, to perform other calculations.
According to my use case, I need to call the URI in validators or Conditions.
Is it possible to use OSLC URI in Conditions and Validators ?
Am getting the following error :
Problems executing validator {0}: com.ibm.team.workitem.api.common.connectors is undefined.
Here is the code :
dojo.provide("com.example.Validator");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("com.ibm.team.workitem.api.common.connectors.HttpConnectorParameters");
dojo.require("com.ibm.team.workitem.api.common.Severity");
dojo.require("com.ibm.team.workitem.api.common.Status");
(function() {
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
var Severity= com.ibm.team.workitem.api.common.Severity;
var Status= com.ibm.team.workitem.api.common.Status;
dojo.declare("com.example.Validator", null, {
validate: function(attribute, workItem, configuration) {
var workItemId = workItem.getValue(WorkItemAttributes.ID);
var params= new com.ibm.team.workitem.api.common.connectors.HttpConnectorParameters();
params.url="https://rb-ubk-clm-04.de.bosch.com:9443/ccm/oslc/workitems/"+workItemId+"/oslc_cm:tracksWorkItem";
params.xpath="//*[name()='oslc_cm:Collection']";
params.columnXpaths=["//Collection/@totalCount"];
params.columnIds=["tracker"];
params.ignoreInvalidCertificates=true;
params.useOAuth=true;
var connector= context.getDataConnector("HttpConnector");
var values= connector.get(params);
var result;
while(values.hasNext()){
var entry= values.next();
result= parseInt(entry.getById("tracker"));
}
if(result ==1)
return Status.OK_STATUS;
else
return new Status(Severity["ERROR"], "Enter tracker Value");
}
});
})();
Please help me on this.