use of com.google.gwtorm.server.OrmException in project gerrit by GerritCodeReview.
the class ChangeDraftUpdate method applyImpl.
@Override
protected CommitBuilder applyImpl(RevWalk rw, ObjectInserter ins, ObjectId curr) throws OrmException, IOException {
CommitBuilder cb = new CommitBuilder();
cb.setMessage("Update draft comments");
try {
return storeCommentsInNotes(rw, ins, curr, cb);
} catch (ConfigInvalidException e) {
throw new OrmException(e);
}
}
use of com.google.gwtorm.server.OrmException in project gerrit by GerritCodeReview.
the class PRED_get_legacy_label_types_1 method exec.
@Override
public Operation exec(Prolog engine) throws PrologException {
engine.setB0();
Term a1 = arg1.dereference();
List<LabelType> list;
try {
list = StoredValues.CHANGE_DATA.get(engine).getLabelTypes().getLabelTypes();
} catch (OrmException err) {
throw new JavaException(this, 1, err);
}
Term head = Prolog.Nil;
for (int idx = list.size() - 1; 0 <= idx; idx--) {
head = new ListTerm(export(list.get(idx)), head);
}
if (!a1.unify(head, engine.trail)) {
return engine.fail();
}
return cont;
}
use of com.google.gwtorm.server.OrmException in project gerrit by GerritCodeReview.
the class PRED_unresolved_comments_count_1 method exec.
@Override
public Operation exec(Prolog engine) throws PrologException {
engine.setB0();
Term a1 = arg1.dereference();
try {
Integer count = StoredValues.CHANGE_DATA.get(engine).unresolvedCommentCount();
if (!a1.unify(new IntegerTerm(count != null ? count : 0), engine.trail)) {
return engine.fail();
}
} catch (OrmException err) {
throw new JavaException(this, 1, err);
}
return cont;
}
use of com.google.gwtorm.server.OrmException in project gerrit by GerritCodeReview.
the class RenameGroupCommand method run.
@Override
protected void run() throws Failure {
try {
GroupResource rsrc = groups.parse(TopLevelResource.INSTANCE, IdString.fromDecoded(groupName));
PutName.Input input = new PutName.Input();
input.name = newGroupName;
putName.apply(rsrc, input);
} catch (RestApiException | OrmException | IOException | NoSuchGroupException e) {
throw die(e);
}
}
use of com.google.gwtorm.server.OrmException in project gerrit by GerritCodeReview.
the class GetRelatedIT method clearGroups.
private void clearGroups(final PatchSet.Id psId) throws Exception {
try (BatchUpdate bu = batchUpdateFactory.create(db, project, user(user), TimeUtil.nowTs())) {
bu.addOp(psId.getParentKey(), new BatchUpdateOp() {
@Override
public boolean updateChange(ChangeContext ctx) throws OrmException {
PatchSet ps = psUtil.get(ctx.getDb(), ctx.getNotes(), psId);
psUtil.setGroups(ctx.getDb(), ctx.getUpdate(psId), ps, ImmutableList.<String>of());
ctx.dontBumpLastUpdatedOn();
return true;
}
});
bu.execute();
}
}
Aggregations