use of com.searchcode.app.model.ValidatorResult in project searchcode-server by boyter.
the class AdminRouteService method postBulk.
public List<ValidatorResult> postBulk(Request request, Response response) {
var repos = request.queryParams("repos");
var repolines = repos.split("\\r?\\n");
var validatorResults = new ArrayList<ValidatorResult>();
for (String line : repolines) {
var repoparams = line.split(",", -1);
if (repoparams.length == 7) {
var branch = repoparams[6].trim();
if (branch.equals(Values.EMPTYSTRING)) {
branch = "master";
}
var scm = repoparams[1].trim().toLowerCase();
if (scm.equals(Values.EMPTYSTRING)) {
scm = "git";
}
RepoResult repoResult = new RepoResult().setRowId(-1).setName(repoparams[0]).setScm(scm).setUrl(repoparams[2]).setUsername(repoparams[3]).setPassword(repoparams[4]).setSource(repoparams[5]).setBranch(branch).setData("{}");
var validate = this.validatorService.validate(repoResult, false);
if (validate.isValid) {
this.repo.saveRepo(repoResult);
this.jobService.forceEnqueue(repoResult);
} else {
validate.setLine(line);
validatorResults.add(validate);
}
} else {
ValidatorResult validate = new ValidatorResult(false, "Incorrect number of elements: " + line);
validate.setLine(line);
validatorResults.add(validate);
}
}
return validatorResults;
}
Aggregations