protected Operation exec(Prolog engine, UserIdentity userId) throws PrologException {
    engine.setB0();
    Term a1 = arg1.dereference();
    Term a2 = arg2.dereference();
    Term a3 = arg3.dereference();

    Term idTerm;
    Term nameTerm = Prolog.Nil;
    Term emailTerm = Prolog.Nil;

    Account.Id id = userId.getAccount();
    if (id == null) {
      idTerm = anonymous;
    } else {
      idTerm = new IntegerTerm(id.get());
    }

    String name = userId.getName();
    if (name != null && !name.equals("")) {
      nameTerm = SymbolTerm.create(name);
    }

    String email = userId.getEmail();
    if (email != null && !email.equals("")) {
      emailTerm = SymbolTerm.create(email);
    }

    if (!a1.unify(new StructureTerm(user, idTerm), engine.trail)) {
      return engine.fail();
    }
    if (!a2.unify(nameTerm, engine.trail)) {
      return engine.fail();
    }
    if (!a3.unify(emailTerm, engine.trail)) {
      return engine.fail();
    }
    return cont;
  }
 private AuthResult byAccountId(final HttpServletResponse rsp, final String idStr) {
   final Account.Id id;
   try {
     id = Account.Id.parse(idStr);
   } catch (NumberFormatException nfe) {
     return null;
   }
   try {
     final ReviewDb db = schema.open();
     try {
       return auth(db.accounts().get(id));
     } finally {
       db.close();
     }
   } catch (OrmException e) {
     getServletContext().log("cannot query database", e);
     return null;
   }
 }