use of com.qlangtech.tis.manage.common.HttpUtils.PostParam in project tis by qlangtech.
the class CoreAction method triggerBuild.
/**
* @param context
* @param userpoint
* @return
* @throws Exception
*/
private boolean triggerBuild(final String startPhrase, Context context, final String userpoint) throws Exception {
String ps = null;
String user = null;
if (StringUtils.indexOf(userpoint, "#") > -1) {
ps = StringUtils.substringAfter(userpoint, "#");
user = StringUtils.substringBefore(userpoint, "#");
} else {
ps = userpoint;
}
// TODO 应该索引数据是否存在
final String pps = ps;
final String fuser = user;
boolean success = sendRequest2FullIndexSwapeNode(this, context, new AppendParams() {
@Override
List<PostParam> getParam() {
List<PostParam> params = Lists.newArrayList();
params.add(new PostParam(IParamContext.COMPONENT_START, startPhrase));
params.add(new PostParam(IParamContext.COMPONENT_START, pps));
// "&ps=" + ps);
if (StringUtils.isNotBlank(fuser)) {
// param.append("&user=").append(fuser);
params.add(new PostParam("user", fuser));
}
return params;
}
}).success;
return success;
}
use of com.qlangtech.tis.manage.common.HttpUtils.PostParam in project tis by qlangtech.
the class GitUtils method createMergeRequest.
/**
* 创建一个merge请求
*
* @param projectId 项目id
* @param sourceBranch 要merge的分支名字
* @param targetBranch master
* @param title 跟sourceBranch一样
*/
private JSONObject createMergeRequest(int projectId, String sourceBranch, String targetBranch, String title, String description) {
String urlString = String.format(GIT_HOST + "/api/v4/projects/%d/merge_requests", projectId);
List<PostParam> params = new ArrayList<>();
params.add(new PostParam("source_branch", sourceBranch));
params.add(new PostParam("target_branch", targetBranch));
params.add(new PostParam("title", title));
if (!StringUtils.isBlank(description)) {
params.add(new PostParam("description", description));
}
final String result = HttpUtils.post(urlString, params, gitPostStreamProcess);
// });
return new JSONObject(result);
}
Aggregations