Search in sources :

Example 1 with JavaScriptMethod

use of org.kohsuke.stapler.bind.JavaScriptMethod in project jenkin-qtest-plugin by QASymphony.

the class PipelineStatisticsAction method getTreeResult.

/**
 * use to get result in qTest Plugin page
 *
 * @param page page submitted result
 * @return submitted result data
 */
@JavaScriptMethod
public JSONObject getTreeResult(int page) {
    Map<Integer, SubmittedResult> results = null;
    try {
        Job job = this.getJob();
        results = storeResultService.fetchAll(new ReadSubmitLogRequest().setJob(job).setStart(0).setSize(-1)).getResults();
    } catch (Exception e) {
        LOG.log(Level.WARNING, e.getMessage());
    }
    JSONObject jsonObject = new JSONObject();
    jsonObject.put("data", null == results ? "" : results.values());
    return jsonObject;
}
Also used : SubmittedResult(com.qasymphony.ci.plugin.model.SubmittedResult) JSONObject(net.sf.json.JSONObject) ReadSubmitLogRequest(com.qasymphony.ci.plugin.store.ReadSubmitLogRequest) WorkflowJob(org.jenkinsci.plugins.workflow.job.WorkflowJob) Job(hudson.model.Job) JavaScriptMethod(org.kohsuke.stapler.bind.JavaScriptMethod)

Example 2 with JavaScriptMethod

use of org.kohsuke.stapler.bind.JavaScriptMethod in project jenkin-qtest-plugin by QASymphony.

the class StatisticsAction method getTreeResult.

/**
 * use to get result in qTest Plugin page
 *
 * @param page page submitted result
 * @return submitted result data
 */
@JavaScriptMethod
public JSONObject getTreeResult(int page) {
    Map<Integer, SubmittedResult> results = null;
    try {
        AbstractProject project = this.getProject();
        results = storeResultService.fetchAll(new ReadSubmitLogRequest().setProject(project).setStart(0).setSize(-1)).getResults();
    } catch (Exception e) {
        LOG.log(Level.WARNING, e.getMessage());
    }
    JSONObject jsonObject = new JSONObject();
    jsonObject.put("data", null == results ? "" : results.values());
    return jsonObject;
}
Also used : SubmittedResult(com.qasymphony.ci.plugin.model.SubmittedResult) JSONObject(net.sf.json.JSONObject) ReadSubmitLogRequest(com.qasymphony.ci.plugin.store.ReadSubmitLogRequest) AbstractProject(hudson.model.AbstractProject) JavaScriptMethod(org.kohsuke.stapler.bind.JavaScriptMethod)

Aggregations

SubmittedResult (com.qasymphony.ci.plugin.model.SubmittedResult)2 ReadSubmitLogRequest (com.qasymphony.ci.plugin.store.ReadSubmitLogRequest)2 JSONObject (net.sf.json.JSONObject)2 JavaScriptMethod (org.kohsuke.stapler.bind.JavaScriptMethod)2 AbstractProject (hudson.model.AbstractProject)1 Job (hudson.model.Job)1 WorkflowJob (org.jenkinsci.plugins.workflow.job.WorkflowJob)1