use of com.google.gerrit.extensions.api.projects.CommentLinkInfo in project gerrit by GerritCodeReview.
the class CommentLinkProvider method parseConfig.
private List<CommentLinkInfo> parseConfig(Config cfg) {
Set<String> subsections = cfg.getSubsections(ProjectConfig.COMMENTLINK);
ImmutableList.Builder<CommentLinkInfo> cls = ImmutableList.builderWithExpectedSize(subsections.size());
for (String name : subsections) {
try {
StoredCommentLinkInfo cl = ProjectConfig.buildCommentLink(cfg, name, true);
if (cl.getOverrideOnly()) {
logger.atWarning().log("commentlink %s empty except for \"enabled\"", name);
continue;
}
cls.add(cl.toInfo());
} catch (IllegalArgumentException e) {
logger.atWarning().log("invalid commentlink: %s", e.getMessage());
}
}
return cls.build();
}
use of com.google.gerrit.extensions.api.projects.CommentLinkInfo in project gerrit by GerritCodeReview.
the class StoredCommentLinkInfo method toInfo.
/**
* Returns an {@link CommentLinkInfo} instance with the same values.
*/
public CommentLinkInfo toInfo() {
CommentLinkInfo info = new CommentLinkInfo();
info.name = getName();
info.match = getMatch();
info.link = getLink();
info.html = getHtml();
info.enabled = getEnabled();
return info;
}
use of com.google.gerrit.extensions.api.projects.CommentLinkInfo in project gerrit by GerritCodeReview.
the class GerritGlobalModule method configure.
@Override
protected void configure() {
bind(EmailExpander.class).toProvider(EmailExpanderProvider.class).in(SINGLETON);
bind(IdGenerator.class);
bind(RulesCache.class);
bind(BlameCache.class).to(BlameCacheImpl.class);
install(AccountCacheImpl.module());
install(BatchUpdate.module());
install(ChangeKindCacheImpl.module());
install(ChangeFinder.module());
install(ConflictsCacheImpl.module());
install(DefaultPreferencesCacheImpl.module());
install(GroupCacheImpl.module());
install(GroupIncludeCacheImpl.module());
install(MergeabilityCacheImpl.module());
install(ServiceUserClassifierImpl.module());
install(PatchListCacheImpl.module());
install(ProjectCacheImpl.module());
install(DiffOperationsImpl.module());
install(SectionSortCache.module());
install(SubmitStrategy.module());
install(TagCache.module());
install(PureRevertCache.module());
install(CommentContextCacheImpl.module());
install(SubmitRequirementsEvaluatorImpl.module());
install(new AccessControlModule());
install(new AccountModule());
install(new CmdLineParserModule());
install(new EmailModule());
install(new ExternalIdCacheModule());
install(new ExternalIdModule());
install(new GitModule());
install(new GroupDbModule());
install(new GroupModule());
install(new NoteDbModule());
install(new PrologModule());
install(new DefaultSubmitRuleModule());
install(new IgnoreSelfApprovalRuleModule());
install(new ReceiveCommitsModule());
install(new SshAddressesModule());
install(new FileInfoJsonModule());
install(ThreadLocalRequestContext.module());
install(new ApprovalModule());
install(new MailSoySauceModule());
factory(CapabilityCollection.Factory.class);
factory(ChangeData.AssistedFactory.class);
factory(ChangeJson.AssistedFactory.class);
factory(ChangeIsVisibleToPredicate.Factory.class);
factory(DistinctVotersPredicate.Factory.class);
factory(DeadlineChecker.Factory.class);
factory(MergeUtil.Factory.class);
factory(MultiProgressMonitor.Factory.class);
factory(PatchScriptFactory.Factory.class);
factory(PatchScriptFactoryForAutoFix.Factory.class);
factory(ProjectState.Factory.class);
factory(RevisionJson.Factory.class);
factory(InboundEmailRejectionSender.Factory.class);
factory(ExternalUser.Factory.class);
bind(PermissionCollection.Factory.class);
bind(AccountVisibility.class).toProvider(AccountVisibilityProvider.class).in(SINGLETON);
AccountDefaultDisplayName accountDefaultDisplayName = cfg.getEnum("accounts", null, "defaultDisplayName", AccountDefaultDisplayName.FULL_NAME);
bind(AccountDefaultDisplayName.class).toInstance(accountDefaultDisplayName);
factory(ProjectOwnerGroupsProvider.Factory.class);
factory(SubmitRuleEvaluator.Factory.class);
bind(AuthBackend.class).to(UniversalAuthBackend.class).in(SINGLETON);
DynamicSet.setOf(binder(), AuthBackend.class);
bind(GroupControl.Factory.class).in(SINGLETON);
bind(GroupControl.GenericFactory.class).in(SINGLETON);
bind(FileTypeRegistry.class).to(MimeUtilFileTypeRegistry.class);
bind(ToolsCatalog.class);
bind(EventFactory.class);
bind(TransferConfig.class);
bind(GcConfig.class);
DynamicSet.setOf(binder(), GerritConfigListener.class);
bind(ChangeCleanupConfig.class);
bind(AccountDeactivator.class);
bind(ApprovalsUtil.class);
bind(FromAddressGenerator.class).toProvider(FromAddressGeneratorProvider.class).in(SINGLETON);
bind(Boolean.class).annotatedWith(EnablePeerIPInReflogRecord.class).toProvider(EnablePeerIPInReflogRecordProvider.class).in(SINGLETON);
bind(PatchSetInfoFactory.class);
bind(IdentifiedUser.GenericFactory.class).in(SINGLETON);
bind(AccountControl.Factory.class);
OptionalBinder.newOptionalBinder(binder(), Ticker.class).setDefault().toInstance(Ticker.systemTicker());
bind(UiActions.class);
bind(GitReferenceUpdated.class);
DynamicMap.mapOf(binder(), new TypeLiteral<Cache<?, ?>>() {
});
DynamicSet.setOf(binder(), CacheRemovalListener.class);
DynamicMap.mapOf(binder(), CapabilityDefinition.class);
DynamicMap.mapOf(binder(), PluginProjectPermissionDefinition.class);
DynamicSet.setOf(binder(), GitReferenceUpdatedListener.class);
DynamicSet.setOf(binder(), AssigneeChangedListener.class);
DynamicSet.setOf(binder(), ChangeAbandonedListener.class);
DynamicSet.setOf(binder(), ChangeDeletedListener.class);
DynamicSet.setOf(binder(), CommentAddedListener.class);
DynamicSet.setOf(binder(), HashtagsEditedListener.class);
DynamicSet.setOf(binder(), ChangeMergedListener.class);
bind(ChangeMergedListener.class).annotatedWith(Exports.named("CreateGroupPermissionSyncer")).to(CreateGroupPermissionSyncer.class);
DynamicSet.setOf(binder(), ChangeRestoredListener.class);
DynamicSet.setOf(binder(), ChangeRevertedListener.class);
DynamicSet.setOf(binder(), PrivateStateChangedListener.class);
DynamicSet.setOf(binder(), ReviewerAddedListener.class);
DynamicSet.setOf(binder(), ReviewerDeletedListener.class);
DynamicSet.setOf(binder(), VoteDeletedListener.class);
DynamicSet.setOf(binder(), WorkInProgressStateChangedListener.class);
DynamicSet.setOf(binder(), RevisionCreatedListener.class);
DynamicSet.setOf(binder(), TopicEditedListener.class);
DynamicSet.setOf(binder(), AgreementSignupListener.class);
DynamicSet.setOf(binder(), PluginEventListener.class);
DynamicSet.setOf(binder(), ReceivePackInitializer.class);
DynamicSet.setOf(binder(), PostReceiveHook.class);
DynamicSet.setOf(binder(), PreUploadHook.class);
DynamicSet.setOf(binder(), PostUploadHook.class);
DynamicSet.setOf(binder(), AccountActivationListener.class);
DynamicSet.setOf(binder(), AccountIndexedListener.class);
DynamicSet.setOf(binder(), ChangeIndexedListener.class);
DynamicSet.setOf(binder(), GroupIndexedListener.class);
DynamicSet.setOf(binder(), ProjectIndexedListener.class);
DynamicSet.setOf(binder(), NewProjectCreatedListener.class);
DynamicSet.setOf(binder(), ProjectDeletedListener.class);
DynamicSet.setOf(binder(), GarbageCollectorListener.class);
DynamicSet.setOf(binder(), HeadUpdatedListener.class);
DynamicSet.setOf(binder(), UsageDataPublishedListener.class);
DynamicSet.bind(binder(), GitReferenceUpdatedListener.class).to(ReindexAfterRefUpdate.class);
DynamicSet.bind(binder(), GitReferenceUpdatedListener.class).to(ProjectConfigEntry.UpdateChecker.class);
DynamicSet.setOf(binder(), EventListener.class);
DynamicSet.bind(binder(), EventListener.class).to(EventsMetrics.class);
DynamicSet.setOf(binder(), UserScopedEventListener.class);
DynamicSet.setOf(binder(), CommitValidationListener.class);
DynamicSet.bind(binder(), CommitValidationListener.class).to(SubmitRequirementExpressionsValidator.class);
DynamicSet.setOf(binder(), CommentValidator.class);
DynamicSet.setOf(binder(), ChangeMessageModifier.class);
DynamicSet.setOf(binder(), RefOperationValidationListener.class);
DynamicSet.setOf(binder(), OnSubmitValidationListener.class);
DynamicSet.setOf(binder(), MergeValidationListener.class);
DynamicSet.setOf(binder(), ProjectCreationValidationListener.class);
DynamicSet.setOf(binder(), GroupCreationValidationListener.class);
DynamicSet.setOf(binder(), HashtagValidationListener.class);
DynamicSet.setOf(binder(), OutgoingEmailValidationListener.class);
DynamicSet.setOf(binder(), AccountActivationValidationListener.class);
DynamicItem.itemOf(binder(), AvatarProvider.class);
DynamicSet.setOf(binder(), LifecycleListener.class);
DynamicSet.setOf(binder(), TopMenu.class);
DynamicMap.mapOf(binder(), DownloadScheme.class);
DynamicMap.mapOf(binder(), DownloadCommand.class);
DynamicMap.mapOf(binder(), CloneCommand.class);
DynamicMap.mapOf(binder(), ReviewerSuggestion.class);
DynamicSet.bind(binder(), GerritConfigListener.class).toInstance(SuggestReviewers.configListener());
DynamicSet.setOf(binder(), ExternalIncludedIn.class);
DynamicMap.mapOf(binder(), ProjectConfigEntry.class);
DynamicSet.setOf(binder(), PluginPushOption.class);
DynamicSet.setOf(binder(), PatchSetWebLink.class);
DynamicSet.setOf(binder(), ResolveConflictsWebLink.class);
DynamicSet.setOf(binder(), ParentWebLink.class);
DynamicSet.setOf(binder(), FileWebLink.class);
DynamicSet.setOf(binder(), FileHistoryWebLink.class);
DynamicSet.setOf(binder(), DiffWebLink.class);
DynamicSet.setOf(binder(), EditWebLink.class);
DynamicSet.setOf(binder(), ProjectWebLink.class);
DynamicSet.setOf(binder(), BranchWebLink.class);
DynamicSet.setOf(binder(), TagWebLink.class);
DynamicMap.mapOf(binder(), OAuthLoginProvider.class);
DynamicItem.itemOf(binder(), OAuthTokenEncrypter.class);
DynamicSet.setOf(binder(), AccountExternalIdCreator.class);
DynamicSet.setOf(binder(), WebUiPlugin.class);
DynamicItem.itemOf(binder(), AccountPatchReviewStore.class);
DynamicSet.setOf(binder(), AssigneeValidationListener.class);
DynamicSet.setOf(binder(), ActionVisitor.class);
DynamicItem.itemOf(binder(), MergeSuperSetComputation.class);
DynamicItem.itemOf(binder(), ProjectNameLockManager.class);
DynamicSet.setOf(binder(), SubmitRule.class);
DynamicSet.setOf(binder(), SubmitRequirement.class);
DynamicSet.setOf(binder(), QuotaEnforcer.class);
DynamicSet.setOf(binder(), PerformanceLogger.class);
if (cfg.getBoolean("tracing", "exportPerformanceMetrics", false)) {
DynamicSet.bind(binder(), PerformanceLogger.class).to(PerformanceMetrics.class);
}
DynamicSet.setOf(binder(), RequestListener.class);
DynamicSet.bind(binder(), RequestListener.class).to(TraceRequestListener.class);
DynamicSet.setOf(binder(), ChangeETagComputation.class);
DynamicSet.setOf(binder(), ExceptionHook.class);
DynamicSet.bind(binder(), ExceptionHook.class).to(ExceptionHookImpl.class);
DynamicSet.setOf(binder(), MailSoyTemplateProvider.class);
DynamicSet.setOf(binder(), OnPostReview.class);
DynamicMap.mapOf(binder(), AccountTagProvider.class);
DynamicMap.mapOf(binder(), MailFilter.class);
bind(MailFilter.class).annotatedWith(Exports.named("ListMailFilter")).to(ListMailFilter.class);
bind(AutoReplyMailFilter.class).annotatedWith(Exports.named("AutoReplyMailFilter")).to(AutoReplyMailFilter.class);
factory(UploadValidators.Factory.class);
DynamicSet.setOf(binder(), UploadValidationListener.class);
bind(CommentValidator.class).annotatedWith(Exports.named(CommentCountValidator.class.getSimpleName())).to(CommentCountValidator.class);
bind(CommentValidator.class).annotatedWith(Exports.named(CommentSizeValidator.class.getSimpleName())).to(CommentSizeValidator.class);
bind(CommentValidator.class).annotatedWith(Exports.named(CommentCumulativeSizeValidator.class.getSimpleName())).to(CommentCumulativeSizeValidator.class);
DynamicMap.mapOf(binder(), DynamicOptions.DynamicBean.class);
DynamicMap.mapOf(binder(), ChangeQueryBuilder.ChangeOperatorFactory.class);
DynamicMap.mapOf(binder(), ChangeQueryBuilder.ChangeHasOperandFactory.class);
DynamicMap.mapOf(binder(), ChangeQueryBuilder.ChangeIsOperandFactory.class);
DynamicSet.setOf(binder(), ChangePluginDefinedInfoFactory.class);
install(new GitwebConfig.LegacyModule(cfg));
bind(AnonymousUser.class);
factory(AbandonOp.Factory.class);
factory(AccountMergeValidator.Factory.class);
factory(GroupMergeValidator.Factory.class);
factory(RefOperationValidators.Factory.class);
factory(OnSubmitValidators.Factory.class);
factory(MergeValidators.Factory.class);
factory(ProjectConfigValidator.Factory.class);
factory(NotesBranchUtil.Factory.class);
factory(MergedByPushOp.Factory.class);
factory(GitModules.Factory.class);
factory(VersionedAuthorizedKeys.Factory.class);
factory(StoreSubmitRequirementsOp.Factory.class);
factory(FileEditsPredicate.Factory.class);
bind(AccountManager.class);
bind(SubscriptionGraph.Factory.class).to(ConfiguredSubscriptionGraphFactory.class);
bind(new TypeLiteral<List<CommentLinkInfo>>() {
}).toProvider(CommentLinkProvider.class);
DynamicSet.bind(binder(), GerritConfigListener.class).to(CommentLinkProvider.class);
bind(ReloadPluginListener.class).annotatedWith(UniqueAnnotations.create()).to(PluginConfigFactory.class);
DynamicMap.mapOf(binder(), ExternalIdUpsertPreprocessor.class);
}
use of com.google.gerrit.extensions.api.projects.CommentLinkInfo in project gerrit by GerritCodeReview.
the class ConfigInfoCreator method constructInfo.
@SuppressWarnings("deprecation")
public static ConfigInfo constructInfo(boolean serverEnableSignedPush, ProjectState projectState, CurrentUser user, DynamicMap<ProjectConfigEntry> pluginConfigEntries, PluginConfigFactory cfgFactory, AllProjectsName allProjects, UiActions uiActions, DynamicMap<RestView<ProjectResource>> views) {
ConfigInfo configInfo = new ConfigInfo();
Project p = projectState.getProject();
configInfo.description = Strings.emptyToNull(p.getDescription());
ProjectState parentState = Iterables.getFirst(projectState.parents(), null);
for (BooleanProjectConfig cfg : BooleanProjectConfig.values()) {
InheritedBooleanInfo info = new InheritedBooleanInfo();
info.configuredValue = p.getBooleanConfig(cfg);
if (parentState != null) {
info.inheritedValue = parentState.is(cfg);
}
BooleanProjectConfigTransformations.set(cfg, configInfo, info);
}
if (!serverEnableSignedPush) {
configInfo.enableSignedPush = null;
configInfo.requireSignedPush = null;
}
configInfo.maxObjectSizeLimit = getMaxObjectSizeLimit(projectState, p);
configInfo.defaultSubmitType = new SubmitTypeInfo();
configInfo.defaultSubmitType.value = projectState.getSubmitType();
configInfo.defaultSubmitType.configuredValue = MoreObjects.firstNonNull(projectState.getConfig().getProject().getSubmitType(), Project.DEFAULT_SUBMIT_TYPE);
ProjectState parent = projectState.isAllProjects() ? projectState : projectState.parents().get(0);
configInfo.defaultSubmitType.inheritedValue = parent.getSubmitType();
configInfo.submitType = configInfo.defaultSubmitType.value;
configInfo.state = p.getState() != com.google.gerrit.extensions.client.ProjectState.ACTIVE ? p.getState() : null;
configInfo.commentlinks = new LinkedHashMap<>();
for (CommentLinkInfo cl : projectState.getCommentLinks()) {
configInfo.commentlinks.put(cl.name, cl);
}
configInfo.pluginConfig = getPluginConfig(projectState, pluginConfigEntries, cfgFactory, allProjects);
configInfo.actions = new TreeMap<>();
for (UiAction.Description d : uiActions.from(views, new ProjectResource(projectState, user))) {
configInfo.actions.put(d.getId(), new ActionInfo(d));
}
configInfo.extensionPanelNames = projectState.getConfig().getExtensionPanelSections();
return configInfo;
}
use of com.google.gerrit.extensions.api.projects.CommentLinkInfo in project gerrit by GerritCodeReview.
the class ProjectIT method localCommentLinksAreInheritedFromParent.
@Test
public void localCommentLinksAreInheritedFromParent() throws Exception {
ConfigInput input = new ConfigInput();
addCommentLink(input, BUGZILLA, BUGZILLA_MATCH, BUGZILLA_LINK);
addCommentLink(input, JIRA, JIRA_MATCH, JIRA_LINK);
ConfigInfo info = setConfig(project, input);
Map<String, CommentLinkInfo> expected = new HashMap<>();
expected.put(BUGZILLA, commentLinkInfo(BUGZILLA, BUGZILLA_MATCH, BUGZILLA_LINK));
expected.put(JIRA, commentLinkInfo(JIRA, JIRA_MATCH, JIRA_LINK));
assertCommentLinks(info, expected);
Project.NameKey child = projectOperations.newProject().parent(project).create();
assertCommentLinks(getConfig(child), expected);
}
Aggregations