From 59b976acb8b0982616212688c99b808504ef08d6 Mon Sep 17 00:00:00 2001 From: stroomdev66 Date: Thu, 23 Jan 2025 16:42:49 +0000 Subject: [PATCH 1/2] #4687 Fix dependencies NPE --- .../impl/ScheduledQueryAnalyticExecutor.java | 24 +++--- .../presenter/AbstractMetaListPresenter.java | 5 +- .../data/client/presenter/DocRefCell.java | 74 ++++++++++--------- .../client/DocumentPluginEventManager.java | 58 ++++++++------- .../UserDependenciesListPresenter.java | 6 -- .../client/presenter/UserTabPresenter.java | 4 - .../impl/DictionaryResourceImpl.java | 1 - .../stroom/explorer/impl/DocRefInfoCache.java | 7 +- .../stroom/meta/impl/MetaServiceImpl.java | 9 ++- .../impl/ProcessorFilterServiceImpl.java | 24 +++--- .../stroom/security/impl/UserServiceImpl.java | 16 ++-- .../20250123_164212_666__4687.md | 24 ++++++ 12 files changed, 152 insertions(+), 100 deletions(-) create mode 100644 unreleased_changes/20250123_164212_666__4687.md diff --git a/stroom-analytics/stroom-analytics-impl/src/main/java/stroom/analytics/impl/ScheduledQueryAnalyticExecutor.java b/stroom-analytics/stroom-analytics-impl/src/main/java/stroom/analytics/impl/ScheduledQueryAnalyticExecutor.java index c2d3c68ce26..06d0126d336 100644 --- a/stroom-analytics/stroom-analytics-impl/src/main/java/stroom/analytics/impl/ScheduledQueryAnalyticExecutor.java +++ b/stroom-analytics/stroom-analytics-impl/src/main/java/stroom/analytics/impl/ScheduledQueryAnalyticExecutor.java @@ -590,16 +590,22 @@ public List getUserDependencies(final UserRef userRef) { final DocRefInfoService docRefInfoService = docRefInfoServiceProvider.get(); return NullSafe.stream(executionScheduleDao.fetchSchedulesByRunAsUser(userRef.getUuid())) .map(executionSchedule -> { - DocRef owningDocRef = executionSchedule.getOwningDoc(); - owningDocRef = docRefInfoService.decorate(owningDocRef); - final String details = LogUtil.message( - "{} '{}' has as a scheduled executor named '{}' " + - "with a run-as dependency.", - owningDocRef.getType(), - owningDocRef.getName(), - executionSchedule.getName()); - return new UserDependency(userRef, details, executionSchedule.getOwningDoc()); + try { + DocRef owningDocRef = executionSchedule.getOwningDoc(); + owningDocRef = docRefInfoService.decorate(owningDocRef); + final String details = LogUtil.message( + "{} '{}' has as a scheduled executor named '{}' " + + "with a run-as dependency.", + owningDocRef.getType(), + owningDocRef.getName(), + executionSchedule.getName()); + return new UserDependency(userRef, details, executionSchedule.getOwningDoc()); + } catch (final RuntimeException e) { + LOGGER.debug(e::getMessage, e); + return null; + } }) + .filter(Objects::nonNull) // .filter(userDependency -> // NullSafe.getOrElse( // userDependency.getDocRef(), diff --git a/stroom-core-client/src/main/java/stroom/data/client/presenter/AbstractMetaListPresenter.java b/stroom-core-client/src/main/java/stroom/data/client/presenter/AbstractMetaListPresenter.java index f32f6d4f03b..71adc901826 100644 --- a/stroom-core-client/src/main/java/stroom/data/client/presenter/AbstractMetaListPresenter.java +++ b/stroom-core-client/src/main/java/stroom/data/client/presenter/AbstractMetaListPresenter.java @@ -365,11 +365,12 @@ void addFeedColumn() { void addStreamTypeColumn() { dataGrid.addResizableColumn( - DataGridUtil.textColumnBuilder((MetaRow metaRow) -> + DataGridUtil.copyTextColumnBuilder((MetaRow metaRow) -> Optional.ofNullable(metaRow) .map(MetaRow::getMeta) .map(Meta::getTypeName) - .orElse("")) + .orElse(""), + getEventBus()) .withSorting(MetaFields.TYPE) .build(), "Type", diff --git a/stroom-core-client/src/main/java/stroom/data/client/presenter/DocRefCell.java b/stroom-core-client/src/main/java/stroom/data/client/presenter/DocRefCell.java index 4c2387a6dd6..c466d1366d6 100644 --- a/stroom-core-client/src/main/java/stroom/data/client/presenter/DocRefCell.java +++ b/stroom-core-client/src/main/java/stroom/data/client/presenter/DocRefCell.java @@ -168,46 +168,49 @@ public void render(final Context context, final DocRefProvider value, fin sb.append(SafeHtmlUtils.EMPTY_SAFE_HTML); } else { final DocRef docRef = GwtNullSafe.get(value, DocRefProvider::getDocRef); - final SafeHtml cellHtmlText; - if (cellTextFunction != null) { - cellHtmlText = cellTextFunction.apply(value); + if (docRef == null || GwtNullSafe.isBlankString(docRef.getName())) { + sb.append(SafeHtmlUtils.EMPTY_SAFE_HTML); + } else { - cellHtmlText = getTextFromDocRef(value); - } + final SafeHtml cellHtmlText; + if (cellTextFunction != null) { + cellHtmlText = cellTextFunction.apply(value); + } else { + cellHtmlText = getTextFromDocRef(value); + } - String cssClasses = "docRefLinkText"; - if (cssClassFunction != null) { - final String additionalClasses = cssClassFunction.apply(value.getRow()); - if (additionalClasses != null) { - cssClasses += " " + additionalClasses; + String cssClasses = "docRefLinkText"; + if (cssClassFunction != null) { + final String additionalClasses = cssClassFunction.apply(value.getRow()); + if (additionalClasses != null) { + cssClasses += " " + additionalClasses; + } } - } - final SafeHtml textDiv = template.div(cssClasses, cellHtmlText); - - final String containerClasses = String.join( - " ", - HOVER_ICON_CONTAINER_CLASS_NAME, - "docRefLinkContainer"); - - sb.appendHtmlConstant("
"); - if (showIcon && docRef != null) { - final DocumentType documentType = DocumentTypeRegistry.get(docRef.getType()); - if (documentType != null) { - final SvgImage svgImage = documentType.getIcon(); - final SafeHtml iconDiv = SvgImageUtil.toSafeHtml( - documentType.getDisplayType(), - svgImage, - ICON_CLASS_NAME, - "docRefLinkIcon"); - sb.append(iconDiv); + final SafeHtml textDiv = template.div(cssClasses, cellHtmlText); + + final String containerClasses = String.join( + " ", + HOVER_ICON_CONTAINER_CLASS_NAME, + "docRefLinkContainer"); + + sb.appendHtmlConstant("
"); + if (showIcon) { + final DocumentType documentType = DocumentTypeRegistry.get(docRef.getType()); + if (documentType != null) { + final SvgImage svgImage = documentType.getIcon(); + final SafeHtml iconDiv = SvgImageUtil.toSafeHtml( + documentType.getDisplayType(), + svgImage, + ICON_CLASS_NAME, + "docRefLinkIcon"); + sb.append(iconDiv); + } } - } - sb.append(textDiv); + sb.append(textDiv); - // This DocRefCell gets used for pipeline props which sometimes are a docRef - // and other times just a simple string - if (docRef != null) { + // This DocRefCell gets used for pipeline props which sometimes are a docRef + // and other times just a simple string final SafeHtml copy = SvgImageUtil.toSafeHtml( SvgImage.COPY, ICON_CLASS_NAME, @@ -227,9 +230,8 @@ public void render(final Context context, final DocRefProvider value, fin "Open " + docRef.getType() + " " + docRef.getName() + " in new tab", open)); } + sb.appendHtmlConstant("
"); } - - sb.appendHtmlConstant("
"); } } diff --git a/stroom-core-client/src/main/java/stroom/document/client/DocumentPluginEventManager.java b/stroom-core-client/src/main/java/stroom/document/client/DocumentPluginEventManager.java index 668a395f8b0..bec9a39f924 100644 --- a/stroom-core-client/src/main/java/stroom/document/client/DocumentPluginEventManager.java +++ b/stroom-core-client/src/main/java/stroom/document/client/DocumentPluginEventManager.java @@ -742,31 +742,39 @@ public void open(final DocRef docRef, final boolean fullScreen, final CommonDocLinkTab selectedLinkTab, final TaskMonitorFactory taskMonitorFactory) { - final DocumentPlugin documentPlugin = documentPluginRegistry.get(docRef.getType()); - if (documentPlugin != null) { - // Decorate the DocRef with its name from the info service (required by the doc presenter) - restFactory - .create(EXPLORER_RESOURCE) - .method(res -> - res.decorate(DecorateRequest.create(docRef))) - .onSuccess(decoratedDocRef -> { - documentPlugin.open( - decoratedDocRef, - forceOpen, - fullScreen, - selectedLinkTab, - new DefaultTaskMonitorFactory(this)); - highlight(decoratedDocRef, explorerListener); - }) - .onFailure(error -> { - AlertEvent.fireError(DocumentPluginEventManager.this, - buildNotFoundMessage(docRef), - null); - }) - .taskMonitorFactory(taskMonitorFactory) - .exec(); - } else { - throw new IllegalArgumentException("Document type '" + docRef.getType() + "' not registered"); + if (docRef != null && docRef.getType() != null) { + final DocumentPlugin documentPlugin = documentPluginRegistry.get(docRef.getType()); + if (documentPlugin != null) { + // Decorate the DocRef with its name from the info service (required by the doc presenter) + restFactory + .create(EXPLORER_RESOURCE) + .method(res -> + res.decorate(DecorateRequest.create(docRef))) + .onSuccess(decoratedDocRef -> { + if (decoratedDocRef == null) { + AlertEvent.fireError(DocumentPluginEventManager.this, + buildNotFoundMessage(docRef), + null); + } else { + documentPlugin.open( + decoratedDocRef, + forceOpen, + fullScreen, + selectedLinkTab, + new DefaultTaskMonitorFactory(this)); + highlight(decoratedDocRef, explorerListener); + } + }) + .onFailure(error -> { + AlertEvent.fireError(DocumentPluginEventManager.this, + buildNotFoundMessage(docRef), + null); + }) + .taskMonitorFactory(taskMonitorFactory) + .exec(); + } else { + throw new IllegalArgumentException("Document type '" + docRef.getType() + "' not registered"); + } } } diff --git a/stroom-core-client/src/main/java/stroom/security/client/presenter/UserDependenciesListPresenter.java b/stroom-core-client/src/main/java/stroom/security/client/presenter/UserDependenciesListPresenter.java index 36964b2cfa5..0fb969cd686 100644 --- a/stroom-core-client/src/main/java/stroom/security/client/presenter/UserDependenciesListPresenter.java +++ b/stroom-core-client/src/main/java/stroom/security/client/presenter/UserDependenciesListPresenter.java @@ -48,8 +48,6 @@ public class UserDependenciesListPresenter private UserRef userRef; private RestDataProvider> dataProvider; - private ResultPage currentData = null; - private Consumer> resultPageConsumer; private String filter; @Inject @@ -137,11 +135,7 @@ protected void exec(final Range range, @Override protected void changeData(final ResultPage data) { - currentData = data; super.changeData(data); - if (resultPageConsumer != null) { - resultPageConsumer.accept(data); - } if (!data.isEmpty()) { selectionModel.setSelected(data.getFirst()); } else { diff --git a/stroom-core-client/src/main/java/stroom/security/client/presenter/UserTabPresenter.java b/stroom-core-client/src/main/java/stroom/security/client/presenter/UserTabPresenter.java index 6f5e11cf8e6..ec43b859b11 100644 --- a/stroom-core-client/src/main/java/stroom/security/client/presenter/UserTabPresenter.java +++ b/stroom-core-client/src/main/java/stroom/security/client/presenter/UserTabPresenter.java @@ -59,7 +59,6 @@ public class UserTabPresenter .build(); private final UserInfoPresenter userInfoPresenter; - private final ClientSecurityContext clientSecurityContext; private final LazyValue userPermsReportPresenterLazyValue; private final LazyValue userDependenciesListPresenterLazyValue; private final LazyValue apiKeysListPresenterLazyValue; @@ -70,7 +69,6 @@ public class UserTabPresenter private UserRef userRef; private String label; private PresenterWidget currentContent; - private TabData selectedTab; @Inject public UserTabPresenter(final EventBus eventBus, @@ -84,7 +82,6 @@ public UserTabPresenter(final EventBus eventBus, final Provider userAndGroupsPresenterProvider) { super(eventBus, view); this.userInfoPresenter = userInfoPresenter; - this.clientSecurityContext = clientSecurityContext; this.userPermsReportPresenterLazyValue = new LazyValue<>( userPermsReportPresenterProvider, userPermissionReportPresenter -> { @@ -151,7 +148,6 @@ public void selectTab(final TabData tab) { getView().getLayerContainer().show((Layer) currentContent); // Update the selected tab. getView().getTabBar().selectTab(tab); - selectedTab = tab; afterSelectTab(content); } }); diff --git a/stroom-dictionary/stroom-dictionary-impl/src/main/java/stroom/dictionary/impl/DictionaryResourceImpl.java b/stroom-dictionary/stroom-dictionary-impl/src/main/java/stroom/dictionary/impl/DictionaryResourceImpl.java index 7e96fc0f479..67e1d11f58d 100644 --- a/stroom-dictionary/stroom-dictionary-impl/src/main/java/stroom/dictionary/impl/DictionaryResourceImpl.java +++ b/stroom-dictionary/stroom-dictionary-impl/src/main/java/stroom/dictionary/impl/DictionaryResourceImpl.java @@ -69,7 +69,6 @@ public DictionaryDoc fetch(final String uuid) { final DictionaryDoc dictionaryDoc = documentResourceHelperProvider.get() .read(dictionaryStoreProvider.get(), getDocRef(uuid)); - // if (NullSafe.hasItems(dictionaryDoc.getImports())) { final DocRefInfoService docRefInfoService = docRefInfoServiceProvider.get(); final List decoratedImports = dictionaryDoc.getImports() diff --git a/stroom-explorer/stroom-explorer-impl/src/main/java/stroom/explorer/impl/DocRefInfoCache.java b/stroom-explorer/stroom-explorer-impl/src/main/java/stroom/explorer/impl/DocRefInfoCache.java index b2588cc5b1e..98cfa7947c2 100644 --- a/stroom-explorer/stroom-explorer-impl/src/main/java/stroom/explorer/impl/DocRefInfoCache.java +++ b/stroom-explorer/stroom-explorer-impl/src/main/java/stroom/explorer/impl/DocRefInfoCache.java @@ -27,6 +27,8 @@ import stroom.util.entityevent.EntityAction; import stroom.util.entityevent.EntityEvent; import stroom.util.entityevent.EntityEventHandler; +import stroom.util.logging.LambdaLogger; +import stroom.util.logging.LambdaLoggerFactory; import stroom.util.shared.Clearable; import jakarta.inject.Inject; @@ -48,7 +50,7 @@ EntityAction.UPDATE_EXPLORER_NODE}) class DocRefInfoCache implements EntityEvent.Handler, Clearable { - private static final Logger LOGGER = LoggerFactory.getLogger(DocRefInfoCache.class); + private static final LambdaLogger LOGGER = LambdaLoggerFactory.getLogger(DocRefInfoCache.class); private static final String CACHE_NAME = "Doc Ref Info Cache"; // Effectively docUuid => optDocRefInfo @@ -87,7 +89,7 @@ private Optional loadDocRefInfo(final DocRef docRef) { } }); } catch (final RuntimeException e) { - LOGGER.debug(e.getMessage(), e); + LOGGER.debug(e::getMessage, e); } return Optional.ofNullable(docRefInfo); } @@ -103,6 +105,7 @@ private DocRefInfo getDocRefInfoWithoutType(final DocRef docRef) { try { return handler.info(docRef); } catch (DocumentNotFoundException e) { + LOGGER.debug(e::getMessage, e); return null; } }) diff --git a/stroom-meta/stroom-meta-impl/src/main/java/stroom/meta/impl/MetaServiceImpl.java b/stroom-meta/stroom-meta-impl/src/main/java/stroom/meta/impl/MetaServiceImpl.java index 1b04f0a8113..25c2acfd4e2 100644 --- a/stroom-meta/stroom-meta-impl/src/main/java/stroom/meta/impl/MetaServiceImpl.java +++ b/stroom-meta/stroom-meta-impl/src/main/java/stroom/meta/impl/MetaServiceImpl.java @@ -40,6 +40,7 @@ import stroom.meta.shared.SelectionSummary; import stroom.meta.shared.SimpleMeta; import stroom.meta.shared.Status; +import stroom.pipeline.shared.PipelineDoc; import stroom.query.api.v2.ExpressionOperator; import stroom.query.api.v2.ExpressionOperator.Builder; import stroom.query.api.v2.ExpressionTerm; @@ -604,7 +605,13 @@ public SelectionSummary getReprocessSelectionSummary(final FindMetaCriteria crit private DocRef getPipeline(final Meta meta) { if (meta.getPipelineUuid() != null) { final Optional optionalDocRefInfo = docRefInfoService.info(meta.getPipelineUuid()); - return optionalDocRefInfo.map(DocRefInfo::getDocRef).orElse(null); + return optionalDocRefInfo + .map(DocRefInfo::getDocRef) + .orElse(DocRef + .builder() + .type(PipelineDoc.TYPE) + .uuid(meta.getPipelineUuid()) + .build()); } return null; } diff --git a/stroom-processor/stroom-processor-impl/src/main/java/stroom/processor/impl/ProcessorFilterServiceImpl.java b/stroom-processor/stroom-processor-impl/src/main/java/stroom/processor/impl/ProcessorFilterServiceImpl.java index e24dd114104..9962b3ca41e 100644 --- a/stroom-processor/stroom-processor-impl/src/main/java/stroom/processor/impl/ProcessorFilterServiceImpl.java +++ b/stroom-processor/stroom-processor-impl/src/main/java/stroom/processor/impl/ProcessorFilterServiceImpl.java @@ -624,18 +624,24 @@ public List getUserDependencies(final UserRef userRef) { return NullSafe.stream(processorFilterDao.fetchByRunAsUser(userRef.getUuid())) .map(processorFilter -> { - final String pipeUuid = Objects.requireNonNull(processorFilter.getPipelineUuid()); + try { + final String pipeUuid = Objects.requireNonNull(processorFilter.getPipelineUuid()); - DocRef pipelineDocRef = PipelineDoc.getDocRef(pipeUuid); - pipelineDocRef = docRefInfoService.decorate(pipelineDocRef); + DocRef pipelineDocRef = PipelineDoc.getDocRef(pipeUuid); + pipelineDocRef = docRefInfoService.decorate(pipelineDocRef); - final String details = LogUtil.message( - "Pipeline '{}' has a filter with a run-as dependency.", pipelineDocRef.getName()); - return new UserDependency( - userRef, - details, - processorFilter.getPipeline()); + final String details = LogUtil.message( + "Pipeline '{}' has a filter with a run-as dependency.", pipelineDocRef.getName()); + return new UserDependency( + userRef, + details, + processorFilter.getPipeline()); + } catch (final RuntimeException e) { + LOGGER.debug(e::getMessage, e); + return null; + } }) + .filter(Objects::nonNull) // .filter(userDependency -> // NullSafe.getOrElse( // userDependency.getDocRef(), diff --git a/stroom-security/stroom-security-impl/src/main/java/stroom/security/impl/UserServiceImpl.java b/stroom-security/stroom-security-impl/src/main/java/stroom/security/impl/UserServiceImpl.java index 959823fb307..b5bcfa2f719 100644 --- a/stroom-security/stroom-security-impl/src/main/java/stroom/security/impl/UserServiceImpl.java +++ b/stroom-security/stroom-security-impl/src/main/java/stroom/security/impl/UserServiceImpl.java @@ -384,12 +384,18 @@ public ResultPage fetchUserDependencies(final FindUserDependenci .flatMap(hasUserDependencies -> hasUserDependencies.getUserDependencies(UserRef.forUserUuid(userUuid)).stream()) .map(userDependency -> { - final DocRef docRef = NullSafe.get(userDependency.getDocRef(), docRefInfoService::decorate); - return new UserDependency( - userDependency.getUserRef(), - userDependency.getDetails(), - docRef); + try { + final DocRef docRef = NullSafe.get(userDependency.getDocRef(), docRefInfoService::decorate); + return new UserDependency( + userDependency.getUserRef(), + userDependency.getDetails(), + docRef); + } catch (final RuntimeException e) { + LOGGER.debug(e::getMessage, e); + return null; + } }) + .filter(Objects::nonNull) .toList(); LOGGER.debug(() -> LogUtil.message("Found {} userDependencies", allUserDependencies.size())); diff --git a/unreleased_changes/20250123_164212_666__4687.md b/unreleased_changes/20250123_164212_666__4687.md new file mode 100644 index 00000000000..532f257fc96 --- /dev/null +++ b/unreleased_changes/20250123_164212_666__4687.md @@ -0,0 +1,24 @@ +* Issue **#4687** : Fix dependencies NPE. + + +```sh +# ******************************************************************************** +# Issue title: User Profile-> Dependencies Alert Popup +# Issue link: https://github.com/gchq/stroom/issues/4687 +# ******************************************************************************** + +# ONLY the top line will be included as a change entry in the CHANGELOG. +# The entry should be in GitHub flavour markdown and should be written on a SINGLE +# line with no hard breaks. You can have multiple change files for a single GitHub issue. +# The entry should be written in the imperative mood, i.e. 'Fix nasty bug' rather than +# 'Fixed nasty bug'. +# +# Examples of acceptable entries are: +# +# +# * Issue **123** : Fix bug with an associated GitHub issue in this repository +# +# * Issue **namespace/other-repo#456** : Fix bug with an associated GitHub issue in another repository +# +# * Fix bug with no associated GitHub issue. +``` From 65b9970bded32c0b93f24795048008a941aa7280 Mon Sep 17 00:00:00 2001 From: stroomdev66 Date: Thu, 23 Jan 2025 17:18:29 +0000 Subject: [PATCH 2/2] #4717 Fix processor filter expression fields --- .../rule/impl/AnalyticRuleProcessors.java | 2 +- .../client/presenter/ProcessorPresenter.java | 8 ++++++- .../processor/shared/ProcessorFields.java | 6 ++--- .../shared/ProcessorFilterFields.java | 2 -- .../impl/db/ProcessorFilterDaoImpl.java | 3 +-- .../impl/ProcessorFilterServiceImpl.java | 4 ++-- .../20250123_171536_030__4717.md | 24 +++++++++++++++++++ 7 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 unreleased_changes/20250123_171536_030__4717.md diff --git a/stroom-analytics/stroom-analytics-rule-impl/src/main/java/stroom/analytics/rule/impl/AnalyticRuleProcessors.java b/stroom-analytics/stroom-analytics-rule-impl/src/main/java/stroom/analytics/rule/impl/AnalyticRuleProcessors.java index a5d7d0469be..e477163673e 100644 --- a/stroom-analytics/stroom-analytics-rule-impl/src/main/java/stroom/analytics/rule/impl/AnalyticRuleProcessors.java +++ b/stroom-analytics/stroom-analytics-rule-impl/src/main/java/stroom/analytics/rule/impl/AnalyticRuleProcessors.java @@ -94,7 +94,7 @@ private List getProcessor(final AnalyticRuleDoc analyticRuleDoc) { private ResultPage getProcessorFilters(final Processor processor) { final ExpressionOperator filterExpression = ExpressionOperator.builder() .addIdTerm( - ProcessorFilterFields.PROCESSOR_ID, + ProcessorFields.ID, ExpressionTerm.Condition.EQUALS, processor.getId()) .addBooleanTerm( diff --git a/stroom-core-client/src/main/java/stroom/processor/client/presenter/ProcessorPresenter.java b/stroom-core-client/src/main/java/stroom/processor/client/presenter/ProcessorPresenter.java index 8903427b2de..240458ac587 100644 --- a/stroom-core-client/src/main/java/stroom/processor/client/presenter/ProcessorPresenter.java +++ b/stroom-core-client/src/main/java/stroom/processor/client/presenter/ProcessorPresenter.java @@ -21,11 +21,13 @@ import stroom.alert.client.event.ConfirmEvent; import stroom.analytics.shared.AnalyticRuleDoc; import stroom.data.client.presenter.ExpressionPresenter; +import stroom.datasource.api.v2.QueryField; import stroom.dispatch.client.DefaultErrorHandler; import stroom.dispatch.client.RestFactory; import stroom.docref.DocRef; import stroom.entity.client.presenter.HasDocumentRead; import stroom.pipeline.shared.PipelineDoc; +import stroom.processor.shared.ProcessorFields; import stroom.processor.shared.ProcessorFilter; import stroom.processor.shared.ProcessorFilterFields; import stroom.processor.shared.ProcessorFilterResource; @@ -59,6 +61,7 @@ import com.gwtplatform.mvp.client.MyPresenterWidget; import com.gwtplatform.mvp.client.View; +import java.util.ArrayList; import java.util.List; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -242,9 +245,12 @@ private void onFilter() { e.hide(); }; + final List fields = new ArrayList<>(); + fields.addAll(ProcessorFields.getFields()); + fields.addAll(ProcessorFilterFields.getFields()); presenter.read(processorListPresenter.getExpression(), ProcessorFilterFields.PROCESSOR_FILTERS_DOC_REF, - ProcessorFilterFields.getFields()); + fields); presenter.getWidget().getElement().addClassName("default-min-sizes"); final PopupSize popupSize = PopupSize.resizable(800, 600); diff --git a/stroom-core-shared/src/main/java/stroom/processor/shared/ProcessorFields.java b/stroom-core-shared/src/main/java/stroom/processor/shared/ProcessorFields.java index df92d84a51c..f3dd0cf1fd4 100644 --- a/stroom-core-shared/src/main/java/stroom/processor/shared/ProcessorFields.java +++ b/stroom-core-shared/src/main/java/stroom/processor/shared/ProcessorFields.java @@ -28,20 +28,20 @@ public class ProcessorFields { public static final QueryField PROCESSOR_TYPE = QueryField.createText("Processor Type"); public static final QueryField PIPELINE = QueryField.createDocRefByUuid( PipelineDoc.TYPE, "Processor Pipeline"); - public static final QueryField ANALYTIC_RULE = QueryField.createDocRefByUuid( - AnalyticRuleDoc.TYPE, "Analytic Rule"); public static final QueryField ENABLED = QueryField.createBoolean("Processor Enabled"); public static final QueryField DELETED = QueryField.createBoolean("Processor Deleted"); public static final QueryField UUID = QueryField.createText("Processor UUID"); + public static final QueryField ANALYTIC_RULE = QueryField.createDocRefByUuid( + AnalyticRuleDoc.TYPE, "Analytic Rule"); static { FIELDS.add(ID); FIELDS.add(PROCESSOR_TYPE); FIELDS.add(PIPELINE); - FIELDS.add(ANALYTIC_RULE); FIELDS.add(ENABLED); FIELDS.add(DELETED); FIELDS.add(UUID); + FIELDS.add(ANALYTIC_RULE); ALL_FIELD_MAP = FIELDS.stream().collect(Collectors.toMap(QueryField::getFldName, Function.identity())); } diff --git a/stroom-core-shared/src/main/java/stroom/processor/shared/ProcessorFilterFields.java b/stroom-core-shared/src/main/java/stroom/processor/shared/ProcessorFilterFields.java index 0a4bf234519..d8f72d64996 100644 --- a/stroom-core-shared/src/main/java/stroom/processor/shared/ProcessorFilterFields.java +++ b/stroom-core-shared/src/main/java/stroom/processor/shared/ProcessorFilterFields.java @@ -31,7 +31,6 @@ public class ProcessorFilterFields { public static final QueryField PRIORITY = QueryField.createInteger("Processor Filter Priority"); public static final QueryField ENABLED = QueryField.createBoolean("Processor Filter Enabled"); public static final QueryField DELETED = QueryField.createBoolean("Processor Filter Deleted"); - public static final QueryField PROCESSOR_ID = QueryField.createId("Processor Id"); public static final QueryField UUID = QueryField.createText("Processor Filter UUID"); public static final QueryField RUN_AS_USER = QueryField .builder() @@ -47,7 +46,6 @@ public class ProcessorFilterFields { FIELDS.add(PRIORITY); FIELDS.add(ENABLED); FIELDS.add(DELETED); - FIELDS.add(PROCESSOR_ID); FIELDS.add(UUID); FIELDS.add(RUN_AS_USER); diff --git a/stroom-processor/stroom-processor-impl-db/src/main/java/stroom/processor/impl/db/ProcessorFilterDaoImpl.java b/stroom-processor/stroom-processor-impl-db/src/main/java/stroom/processor/impl/db/ProcessorFilterDaoImpl.java index a4c01ecdc2c..56a9e9eeb4e 100644 --- a/stroom-processor/stroom-processor-impl-db/src/main/java/stroom/processor/impl/db/ProcessorFilterDaoImpl.java +++ b/stroom-processor/stroom-processor-impl-db/src/main/java/stroom/processor/impl/db/ProcessorFilterDaoImpl.java @@ -82,11 +82,10 @@ class ProcessorFilterDaoImpl implements ProcessorFilterDao { expressionMapper.map(ProcessorFilterFields.PRIORITY, PROCESSOR_FILTER.PRIORITY, Integer::valueOf); expressionMapper.map(ProcessorFilterFields.ENABLED, PROCESSOR_FILTER.ENABLED, Boolean::valueOf); expressionMapper.map(ProcessorFilterFields.DELETED, PROCESSOR_FILTER.DELETED, Boolean::valueOf); - expressionMapper.map(ProcessorFilterFields.PROCESSOR_ID, PROCESSOR_FILTER.FK_PROCESSOR_ID, Integer::valueOf); expressionMapper.map(ProcessorFilterFields.UUID, PROCESSOR_FILTER.UUID, value -> value); expressionMapper.map(ProcessorFilterFields.RUN_AS_USER, PROCESSOR_FILTER.RUN_AS_USER_UUID, value -> value); - expressionMapper.map(ProcessorFields.ID, PROCESSOR.ID, Integer::valueOf); + expressionMapper.map(ProcessorFields.ID, PROCESSOR_FILTER.FK_PROCESSOR_ID, Integer::valueOf); expressionMapper.map(ProcessorFields.PROCESSOR_TYPE, PROCESSOR.TASK_TYPE, String::valueOf); expressionMapper.map(ProcessorFields.ANALYTIC_RULE, PROCESSOR.PIPELINE_UUID, value -> value, false); expressionMapper.map(ProcessorFields.PIPELINE, PROCESSOR.PIPELINE_UUID, value -> value, false); diff --git a/stroom-processor/stroom-processor-impl/src/main/java/stroom/processor/impl/ProcessorFilterServiceImpl.java b/stroom-processor/stroom-processor-impl/src/main/java/stroom/processor/impl/ProcessorFilterServiceImpl.java index e24dd114104..5bf2110e7ae 100644 --- a/stroom-processor/stroom-processor-impl/src/main/java/stroom/processor/impl/ProcessorFilterServiceImpl.java +++ b/stroom-processor/stroom-processor-impl/src/main/java/stroom/processor/impl/ProcessorFilterServiceImpl.java @@ -461,7 +461,7 @@ public ResultPage find(final DocRef pipelineDocRef) { // Now find all the processor filters for (Processor processor : processorResultPage.getValues()) { final ExpressionOperator filterExpression = ExpressionOperator.builder() - .addIdTerm(ProcessorFilterFields.PROCESSOR_ID, + .addIdTerm(ProcessorFields.ID, ExpressionTerm.Condition.EQUALS, processor.getId()).build(); ResultPage filterResultPage = find(new ExpressionCriteria(filterExpression)); @@ -554,7 +554,7 @@ private int getAutoPriority(final Processor processor, int priority = defaultPriority; final ExpressionOperator filterExpression = ExpressionOperator.builder() - .addIdTerm(ProcessorFilterFields.PROCESSOR_ID, ExpressionTerm.Condition.EQUALS, processor.getId()) + .addIdTerm(ProcessorFields.ID, ExpressionTerm.Condition.EQUALS, processor.getId()) .addBooleanTerm(ProcessorFilterFields.DELETED, ExpressionTerm.Condition.EQUALS, false) .build(); final List list = processorFilterDao.find( diff --git a/unreleased_changes/20250123_171536_030__4717.md b/unreleased_changes/20250123_171536_030__4717.md new file mode 100644 index 00000000000..23f0c84b65d --- /dev/null +++ b/unreleased_changes/20250123_171536_030__4717.md @@ -0,0 +1,24 @@ +* Issue **#4717** : Fix processor filter expression fields. + + +```sh +# ******************************************************************************** +# Issue title: Pipeline Processors Filter missing terms +# Issue link: https://github.com/gchq/stroom/issues/4717 +# ******************************************************************************** + +# ONLY the top line will be included as a change entry in the CHANGELOG. +# The entry should be in GitHub flavour markdown and should be written on a SINGLE +# line with no hard breaks. You can have multiple change files for a single GitHub issue. +# The entry should be written in the imperative mood, i.e. 'Fix nasty bug' rather than +# 'Fixed nasty bug'. +# +# Examples of acceptable entries are: +# +# +# * Issue **123** : Fix bug with an associated GitHub issue in this repository +# +# * Issue **namespace/other-repo#456** : Fix bug with an associated GitHub issue in another repository +# +# * Fix bug with no associated GitHub issue. +```