use of com.google.gerrit.server.events.RefEvent in project gerrit by GerritCodeReview.
the class EventBroker method isVisibleTo.
protected boolean isVisibleTo(Event event, CurrentUser user) throws OrmException {
if (event instanceof RefEvent) {
RefEvent refEvent = (RefEvent) event;
String ref = refEvent.getRefName();
if (PatchSet.isChangeRef(ref)) {
Change.Id cid = PatchSet.Id.fromRef(ref).getParentKey();
try {
Change change = notesFactory.createChecked(dbProvider.get(), refEvent.getProjectNameKey(), cid).getChange();
return isVisibleTo(change, user);
} catch (NoSuchChangeException e) {
log.debug("Change {} cannot be found, falling back on ref visibility check", cid.id);
}
}
return isVisibleTo(refEvent.getBranchNameKey(), user);
} else if (event instanceof ProjectEvent) {
return isVisibleTo(((ProjectEvent) event).getProjectNameKey(), user);
}
return true;
}
Aggregations