本文整理汇总了Java中com.google.gerrit.server.project.RefControl类的典型用法代码示例。如果您正苦于以下问题:Java RefControl类的具体用法?Java RefControl怎么用?Java RefControl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RefControl类属于com.google.gerrit.server.project包,在下文中一共展示了RefControl类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createNewChange
import com.google.gerrit.server.project.RefControl; //导入依赖的package包/类
private Change.Id createNewChange(
ReviewDb db,
BatchUpdate bu,
Change.Key changeKey,
Project.NameKey project,
Ref destRef,
Account.Id pullRequestOwner,
RevCommit pullRequestCommit,
RefControl refControl,
String pullRequestMessage,
String topic)
throws OrmException, UpdateException, RestApiException, IOException {
Change change =
new Change(
changeKey,
new Change.Id(db.nextChangeId()),
pullRequestOwner,
new Branch.NameKey(project, destRef.getName()),
TimeUtil.nowTs());
if (topic != null) {
change.setTopic(topic);
}
ChangeInserter ins =
changeInserterFactory.create(change.getId(), pullRequestCommit, refControl.getRefName());
ins.setMessage(pullRequestMessage);
bu.insertChange(ins);
bu.execute();
return ins.getChange().getId();
}
示例2: canView
import com.google.gerrit.server.project.RefControl; //导入依赖的package包/类
@Override
public boolean canView(RepositoryModel repository, String ref) {
try {
ProjectControl control = projectControlFactory.controlFor(new NameKey(StringUtils.stripDotGit(repository.name)), userProvider.get());
if (control != null && control.isVisible()) {
RefControl branchCtrl = control.controlForRef(ref);
return branchCtrl != null && branchCtrl.isVisible();
}
} catch (NoSuchProjectException | IOException e) {
// Silently ignore and return false below.
}
return false;
}