use of com.googlecode.prolog_cafe.exceptions.JavaException in project gerrit by GerritCodeReview.
the class PRED__load_commit_labels_1 method exec.
@Override
public Operation exec(Prolog engine) throws PrologException {
engine.setB0();
Term a1 = arg1.dereference();
Term listHead = Prolog.Nil;
try {
ChangeData cd = StoredValues.CHANGE_DATA.get(engine);
LabelTypes types = cd.getLabelTypes();
for (PatchSetApproval a : cd.currentApprovals()) {
LabelType t = types.byLabel(a.getLabelId());
if (t == null) {
continue;
}
StructureTerm labelTerm = new StructureTerm(sym_label, SymbolTerm.intern(t.getName()), new IntegerTerm(a.getValue()));
StructureTerm userTerm = new StructureTerm(sym_user, new IntegerTerm(a.getAccountId().get()));
listHead = new ListTerm(new StructureTerm(sym_commit_label, labelTerm, userTerm), listHead);
}
} catch (OrmException err) {
throw new JavaException(this, 1, err);
}
if (!a1.unify(listHead, engine.trail)) {
return engine.fail();
}
return cont;
}
Aggregations