本文整理汇总了Java中com.google.gerrit.reviewdb.server.ReviewDb类的典型用法代码示例。如果您正苦于以下问题:Java ReviewDb类的具体用法?Java ReviewDb怎么用?Java ReviewDb使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ReviewDb类属于com.google.gerrit.reviewdb.server包,在下文中一共展示了ReviewDb类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CreateBatchUser
import com.google.gerrit.reviewdb.server.ReviewDb; //导入依赖的package包/类
@Inject
public CreateBatchUser(@PluginName String pluginName, SchemaFactory<ReviewDb> schema,
PluginConfigFactory configFactory, SshKeyCache sshKeyCache, VersionedAuthorizedKeys.Accessor authorizedKeys,
AccountCache accountCache, AccountByEmailCache byEmailCache, AccountLoader.Factory infoLoader,
GroupsCollection groupsCollection, WorkQueue queue, ThreadLocalRequestContext context,
IdentifiedUser.GenericFactory userFactory) {
this.schema = schema;
this.sshKeyCache = sshKeyCache;
this.authorizedKeys = authorizedKeys;
this.accountCache = accountCache;
this.byEmailCache = byEmailCache;
this.infoLoader = infoLoader;
this.groupsCollection = groupsCollection;
this.context = context;
this.userFactory = userFactory;
pluginConfig = configFactory.getFromGerritConfig(pluginName);
username = pluginConfig.getString("username", "jenkins");
sshKey = pluginConfig.getString("sshKey");
name = pluginConfig.getString("name", "Batch user");
executor = queue.getDefaultQueue();
createBatchUserIfNotExistsYet();
}
示例2: migrateData
import com.google.gerrit.reviewdb.server.ReviewDb; //导入依赖的package包/类
@Override
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException {
SortedSet<Project.NameKey> repoList = repoManager.list();
SortedSet<Project.NameKey> repoUpgraded = new TreeSet<>();
ui.message("\tMigrating " + repoList.size() + " repositories ...");
for (Project.NameKey projectName : repoList) {
try (Repository git = repoManager.openRepository(projectName);
MetaDataUpdate md = new MetaDataUpdate(GitReferenceUpdated.DISABLED, projectName, git)) {
ProjectConfigSchemaUpdate cfg = ProjectConfigSchemaUpdate.read(md);
cfg.removeForceFromPermission("pushTag");
if (cfg.isUpdated()) {
repoUpgraded.add(projectName);
}
cfg.save(serverUser, COMMIT_MSG);
} catch (ConfigInvalidException | IOException ex) {
throw new OrmException("Cannot migrate project " + projectName, ex);
}
}
ui.message("\tMigration completed: " + repoUpgraded.size() + " repositories updated:");
ui.message("\t" + repoUpgraded.stream().map(n -> n.get()).collect(joining(" ")));
}
示例3: EmailMerge
import com.google.gerrit.reviewdb.server.ReviewDb; //导入依赖的package包/类
@Inject
EmailMerge(
@SendEmailExecutor ExecutorService executor,
MergedSender.Factory mergedSenderFactory,
SchemaFactory<ReviewDb> schemaFactory,
ThreadLocalRequestContext requestContext,
IdentifiedUser.GenericFactory identifiedUserFactory,
@Assisted Project.NameKey project,
@Assisted Change.Id changeId,
@Assisted @Nullable Account.Id submitter,
@Assisted NotifyHandling notifyHandling,
@Assisted ListMultimap<RecipientType, Account.Id> accountsToNotify) {
this.sendEmailsExecutor = executor;
this.mergedSenderFactory = mergedSenderFactory;
this.schemaFactory = schemaFactory;
this.requestContext = requestContext;
this.identifiedUserFactory = identifiedUserFactory;
this.project = project;
this.changeId = changeId;
this.submitter = submitter;
this.notifyHandling = notifyHandling;
this.accountsToNotify = accountsToNotify;
}
示例4: ListFiles
import com.google.gerrit.reviewdb.server.ReviewDb; //导入依赖的package包/类
@Inject
ListFiles(
Provider<ReviewDb> db,
Provider<CurrentUser> self,
FileInfoJson fileInfoJson,
Revisions revisions,
GitRepositoryManager gitManager,
PatchListCache patchListCache,
PatchSetUtil psUtil,
DynamicItem<AccountPatchReviewStore> accountPatchReviewStore) {
this.db = db;
this.self = self;
this.fileInfoJson = fileInfoJson;
this.revisions = revisions;
this.gitManager = gitManager;
this.patchListCache = patchListCache;
this.psUtil = psUtil;
this.accountPatchReviewStore = accountPatchReviewStore;
}
示例5: DeleteVote
import com.google.gerrit.reviewdb.server.ReviewDb; //导入依赖的package包/类
@Inject
DeleteVote(
Provider<ReviewDb> db,
RetryHelper retryHelper,
ApprovalsUtil approvalsUtil,
PatchSetUtil psUtil,
ChangeMessagesUtil cmUtil,
IdentifiedUser.GenericFactory userFactory,
VoteDeleted voteDeleted,
DeleteVoteSender.Factory deleteVoteSenderFactory,
NotifyUtil notifyUtil,
RemoveReviewerControl removeReviewerControl,
ProjectCache projectCache) {
super(retryHelper);
this.db = db;
this.approvalsUtil = approvalsUtil;
this.psUtil = psUtil;
this.cmUtil = cmUtil;
this.userFactory = userFactory;
this.voteDeleted = voteDeleted;
this.deleteVoteSenderFactory = deleteVoteSenderFactory;
this.notifyUtil = notifyUtil;
this.removeReviewerControl = removeReviewerControl;
this.projectCache = projectCache;
}
示例6: OutputStreamQuery
import com.google.gerrit.reviewdb.server.ReviewDb; //导入依赖的package包/类
@Inject
OutputStreamQuery(
ReviewDb db,
GitRepositoryManager repoManager,
ChangeQueryBuilder queryBuilder,
ChangeQueryProcessor queryProcessor,
EventFactory eventFactory,
TrackingFooters trackingFooters,
CurrentUser user,
SubmitRuleEvaluator.Factory submitRuleEvaluatorFactory) {
this.db = db;
this.repoManager = repoManager;
this.queryBuilder = queryBuilder;
this.queryProcessor = queryProcessor;
this.eventFactory = eventFactory;
this.trackingFooters = trackingFooters;
this.user = user;
this.submitRuleEvaluatorFactory = submitRuleEvaluatorFactory;
}
示例7: Context
import com.google.gerrit.reviewdb.server.ReviewDb; //导入依赖的package包/类
Context(
SchemaFactory<ReviewDb> schemaFactory,
IdentifiedUser.GenericFactory userFactory,
Account.Id accountId,
Project.NameKey project) {
this.schemaFactory = schemaFactory;
this.userFactory = userFactory;
this.accountId = accountId;
this.project = project;
map = new HashMap<>();
cleanup = new RequestCleanup();
map.put(DB_KEY, new RequestScopedReviewDbProvider(schemaFactory, Providers.of(cleanup)));
map.put(RC_KEY, cleanup);
IdentifiedUser user = userFactory.create(accountId);
user.setAccessPath(AccessPath.GIT);
map.put(USER_KEY, user);
}
示例8: filterOnChangeVisibility
import com.google.gerrit.reviewdb.server.ReviewDb; //导入依赖的package包/类
private Set<Account.Id> filterOnChangeVisibility(
final ReviewDb db, ChangeNotes notes, Set<Account.Id> accounts) {
return accounts
.stream()
.filter(
accountId -> {
try {
IdentifiedUser user = userFactory.create(accountId);
return permissionBackend
.user(user)
.change(notes)
.database(db)
.test(ChangePermission.READ);
} catch (PermissionBackendException e) {
log.warn(
String.format(
"Failed to check if account %d can see change %d",
accountId.get(), notes.getChangeId().get()),
e);
return false;
}
})
.collect(toSet());
}
示例9: Args
import com.google.gerrit.reviewdb.server.ReviewDb; //导入依赖的package包/类
protected Args(
ProjectCache projectCache,
PermissionBackend permissionBackend,
IdentifiedUser.GenericFactory userFactory,
Provider<ReviewDb> dbProvider,
String value,
Set<Account.Id> accounts,
AccountGroup.UUID group) {
this.projectCache = projectCache;
this.permissionBackend = permissionBackend;
this.userFactory = userFactory;
this.dbProvider = dbProvider;
this.value = value;
this.accounts = accounts;
this.group = group;
}
示例10: PushOneCommit
import com.google.gerrit.reviewdb.server.ReviewDb; //导入依赖的package包/类
@AssistedInject
PushOneCommit(
ChangeNotes.Factory notesFactory,
ApprovalsUtil approvalsUtil,
Provider<InternalChangeQuery> queryProvider,
NotesMigration notesMigration,
@Assisted ReviewDb db,
@Assisted PersonIdent i,
@Assisted TestRepository<?> testRepo,
@Assisted String subject,
@Assisted Map<String, String> files)
throws Exception {
this(
notesFactory,
approvalsUtil,
queryProvider,
notesMigration,
db,
i,
testRepo,
subject,
files,
null);
}
示例11: migrateData
import com.google.gerrit.reviewdb.server.ReviewDb; //导入依赖的package包/类
@Override
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException, SQLException {
conn = ((JdbcSchema) db).getConnection();
dialect = ((JdbcSchema) db).getDialect();
Map<String, PrimaryKey> corrections = findPKUpdates();
if (corrections.isEmpty()) {
return;
}
ui.message("Wrong Primary Key Column Order Detected");
ui.message("The following tables are affected:");
ui.message(Joiner.on(", ").join(corrections.keySet()));
ui.message("fixing primary keys...");
try (JdbcExecutor executor = new JdbcExecutor(conn)) {
for (Map.Entry<String, PrimaryKey> c : corrections.entrySet()) {
ui.message(String.format(" table: %s ... ", c.getKey()));
recreatePK(executor, c.getKey(), c.getValue(), ui);
ui.message("done");
}
ui.message("done");
}
}
示例12: apply
import com.google.gerrit.reviewdb.server.ReviewDb; //导入依赖的package包/类
@Override
public List<ReviewerInfo> apply(ChangeResource rsrc)
throws OrmException, PermissionBackendException {
Map<String, ReviewerResource> reviewers = new LinkedHashMap<>();
ReviewDb db = dbProvider.get();
for (Account.Id accountId : approvalsUtil.getReviewers(db, rsrc.getNotes()).all()) {
if (!reviewers.containsKey(accountId.toString())) {
reviewers.put(accountId.toString(), resourceFactory.create(rsrc, accountId));
}
}
for (Address adr : rsrc.getNotes().getReviewersByEmail().all()) {
if (!reviewers.containsKey(adr.toString())) {
reviewers.put(adr.toString(), new ReviewerResource(rsrc, adr));
}
}
return json.format(reviewers.values());
}
示例13: MergeUtil
import com.google.gerrit.reviewdb.server.ReviewDb; //导入依赖的package包/类
@AssistedInject
MergeUtil(
@GerritServerConfig Config serverConfig,
Provider<ReviewDb> db,
IdentifiedUser.GenericFactory identifiedUserFactory,
@CanonicalWebUrl @Nullable Provider<String> urlProvider,
ApprovalsUtil approvalsUtil,
@Assisted ProjectState project,
PluggableCommitMessageGenerator commitMessageGenerator,
@Assisted boolean useContentMerge) {
this.db = db;
this.identifiedUserFactory = identifiedUserFactory;
this.urlProvider = urlProvider;
this.approvalsUtil = approvalsUtil;
this.project = project;
this.useContentMerge = useContentMerge;
this.useRecursiveMerge = useRecursiveMerge(serverConfig);
this.commitMessageGenerator = commitMessageGenerator;
}
示例14: PrimaryStorageMigrator
import com.google.gerrit.reviewdb.server.ReviewDb; //导入依赖的package包/类
@Inject
PrimaryStorageMigrator(
@GerritServerConfig Config cfg,
Provider<ReviewDb> db,
GitRepositoryManager repoManager,
AllUsersName allUsers,
ChangeRebuilder rebuilder,
ChangeNotes.Factory changeNotesFactory,
Provider<InternalChangeQuery> queryProvider,
ChangeUpdate.Factory updateFactory,
InternalUser.Factory internalUserFactory,
RetryHelper retryHelper) {
this(
cfg,
db,
repoManager,
allUsers,
rebuilder,
null,
changeNotesFactory,
queryProvider,
updateFactory,
internalUserFactory,
retryHelper);
}
示例15: createWithAutoRebuildingDisabled
import com.google.gerrit.reviewdb.server.ReviewDb; //导入依赖的package包/类
@Test
public void createWithAutoRebuildingDisabled() throws Exception {
ReviewDb oldDb = db;
setNotesMigration(true, true);
PushOneCommit.Result r = createChange();
Change.Id id = r.getPatchSetId().getParentKey();
ChangeNotes oldNotes = notesFactory.create(db, project, id);
// Make a ReviewDb change behind NoteDb's back.
Change c = oldDb.changes().get(id);
assertThat(c.getTopic()).isNull();
String topic = name("a-topic");
c.setTopic(topic);
oldDb.changes().update(Collections.singleton(c));
c = oldDb.changes().get(c.getId());
ChangeNotes newNotes = notesFactory.createWithAutoRebuildingDisabled(c, null);
assertThat(newNotes.getChange().getTopic()).isNotEqualTo(topic);
assertThat(newNotes.getChange().getTopic()).isEqualTo(oldNotes.getChange().getTopic());
}