Skip to content

Commit

Permalink
#4690 Fix meta data source fields
Browse files Browse the repository at this point in the history
  • Loading branch information
stroomdev66 committed Jan 28, 2025
1 parent 4f30608 commit 6d68682
Show file tree
Hide file tree
Showing 37 changed files with 273 additions and 330 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,8 @@ public int getFieldCount(final DocRef docRef) {
}

@Override
public Optional<String> fetchDocumentation(final DocRef docRef) {
return Optional.empty();
}

@Override
public DocRef fetchDefaultExtractionPipeline(final DocRef dataSourceRef) {
return null;
}

@Override
public QueryField getTimeField(final DocRef docRef) {
return AnalyticFields.TIME_FIELD;
public Optional<QueryField> getTimeField(final DocRef docRef) {
return Optional.of(AnalyticFields.TIME_FIELD);
}

public ResultStore createResultStore(final SearchRequest searchRequest) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import stroom.annotation.api.AnnotationCreator;
import stroom.annotation.shared.AnnotationDetail;
import stroom.datasource.api.v2.DataSourceProvider;
import stroom.event.logging.api.ObjectInfoProviderBinder;
import stroom.search.extraction.AnnotationsDecoratorFactory;
import stroom.searchable.api.Searchable;
Expand All @@ -42,6 +43,8 @@ protected void configure() {
ObjectInfoProviderBinder.create(binder())
.bind(AnnotationDetail.class, AnnotationEventInfoProvider.class);

GuiceUtil.buildMultiBinder(binder(), DataSourceProvider.class)
.addBinding(AnnotationService.class);
GuiceUtil.buildMultiBinder(binder(), Searchable.class)
.addBinding(AnnotationService.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

import jakarta.inject.Inject;

import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
Expand All @@ -65,13 +66,21 @@ public class AnnotationService implements Searchable, AnnotationCreator, HasUser
}

@Override
public DocRef getDocRef() {
try {
checkPermission();
return ANNOTATIONS_PSEUDO_DOC_REF;
} catch (final PermissionException e) {
return null;
public String getDataSourceType() {
return ANNOTATIONS_PSEUDO_DOC_REF.getType();
}

@Override
public List<DocRef> getDataSourceDocRefs() {
if (securityContext.hasAppPermission(AppPermission.ANNOTATIONS)) {
return Collections.singletonList(ANNOTATIONS_PSEUDO_DOC_REF);
}
return Collections.emptyList();
}

@Override
public Optional<QueryField> getTimeField(final DocRef docRef) {
return Optional.of(AnnotationFields.UPDATED_ON_FIELD);
}

@Override
Expand All @@ -87,16 +96,6 @@ public int getFieldCount(final DocRef docRef) {
return NullSafe.size(AnnotationFields.FIELDS);
}

@Override
public Optional<String> fetchDocumentation(final DocRef docRef) {
return Optional.empty();
}

@Override
public QueryField getTimeField() {
return AnnotationFields.UPDATED_ON_FIELD;
}

@Override
public void search(final ExpressionCriteria criteria,
final FieldIndex fieldIndex,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ private String buildXML(final String[] include, final String[] exclude) {
<query>
<dataSource>
<type>StreamStore</type>
<uuid>0</uuid>
<name>StreamStore</name>
<uuid>StreamStore</uuid>
<name>Stream Store</name>
</dataSource>
<expression>
<children>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package stroom.index.impl;

import stroom.datasource.api.v2.DataSourceProvider;
import stroom.docstore.api.ContentIndexable;
import stroom.docstore.api.DocumentActionHandlerBinder;
import stroom.explorer.api.ExplorerActionHandler;
Expand Down Expand Up @@ -76,6 +77,8 @@ protected void configure() {
GuiceUtil.buildMultiBinder(binder(), ContentIndexable.class)
.addBinding(IndexStoreImpl.class);

GuiceUtil.buildMultiBinder(binder(), DataSourceProvider.class)
.addBinding(IndexShardServiceImpl.class);
GuiceUtil.buildMultiBinder(binder(), Searchable.class)
.addBinding(IndexShardServiceImpl.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
import jakarta.inject.Inject;
import jakarta.inject.Singleton;

import java.util.Collections;
import java.util.List;
import java.util.Optional;

@Singleton
public class IndexShardServiceImpl implements IndexShardService, Searchable {
Expand All @@ -58,8 +58,13 @@ public ResultPage<IndexShard> find(final FindIndexShardCriteria criteria) {
}

@Override
public DocRef getDocRef() {
return IndexShardFields.INDEX_SHARDS_PSEUDO_DOC_REF;
public String getDataSourceType() {
return IndexShardFields.INDEX_SHARDS_PSEUDO_DOC_REF.getType();
}

@Override
public List<DocRef> getDataSourceDocRefs() {
return Collections.singletonList(IndexShardFields.INDEX_SHARDS_PSEUDO_DOC_REF);
}

@Override
Expand All @@ -79,16 +84,6 @@ public int getFieldCount(final DocRef docRef) {
return NullSafe.size(getFields());
}

@Override
public Optional<String> fetchDocumentation(final DocRef docRef) {
return Optional.empty();
}

@Override
public QueryField getTimeField() {
return null;
}

@Override
public void search(final ExpressionCriteria criteria,
final FieldIndex fieldIndex,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package stroom.meta.impl;

import stroom.datasource.api.v2.DataSourceProvider;
import stroom.event.logging.api.ObjectInfoProviderBinder;
import stroom.job.api.ScheduledJobsBinder;
import stroom.meta.api.MetaSecurityFilter;
Expand Down Expand Up @@ -28,6 +29,8 @@ protected void configure() {
ObjectInfoProviderBinder.create(binder())
.bind(Meta.class, MetaObjectInfoProvider.class);

GuiceUtil.buildMultiBinder(binder(), DataSourceProvider.class)
.addBinding(MetaServiceImpl.class);
GuiceUtil.buildMultiBinder(binder(), Searchable.class)
.addBinding(MetaServiceImpl.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ public Meta getMeta(final long id, final boolean anyStatus) {
final FindMetaCriteria findMetaCriteria = new FindMetaCriteria(secureExpression);
findMetaCriteria.setPageRequest(PageRequest.oneRow());
final List<Meta> list = find(findMetaCriteria).getValues();
if (list == null || list.size() == 0) {
if (list == null || list.isEmpty()) {
return null;
}
return list.get(0);
return list.getFirst();
}

@Override
Expand Down Expand Up @@ -299,8 +299,18 @@ private int doLogicalDelete(final long id, final boolean lockCheck) {
}

@Override
public DocRef getDocRef() {
return MetaFields.STREAM_STORE_DOC_REF;
public String getDataSourceType() {
return MetaFields.STREAM_STORE_DOC_REF.getType();
}

@Override
public List<DocRef> getDataSourceDocRefs() {
return Collections.singletonList(MetaFields.STREAM_STORE_DOC_REF);
}

@Override
public Optional<QueryField> getTimeField(final DocRef docRef) {
return Optional.of(MetaFields.CREATE_TIME);
}

@Override
Expand All @@ -316,16 +326,6 @@ public int getFieldCount(final DocRef docRef) {
return NullSafe.size(MetaFields.getAllFields());
}

@Override
public Optional<String> fetchDocumentation(final DocRef docRef) {
return Optional.empty();
}

@Override
public QueryField getTimeField() {
return MetaFields.CREATE_TIME;
}

@Override
public void search(final ExpressionCriteria criteria,
final FieldIndex fieldIndex,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package stroom.pipeline.refdata;

import stroom.datasource.api.v2.DataSourceProvider;
import stroom.pipeline.factory.PipelineElementModule;
import stroom.pipeline.refdata.store.RefDataStoreModule;
import stroom.searchable.api.Searchable;
Expand All @@ -42,6 +43,8 @@ protected void configure() {
RestResourcesBinder.create(binder())
.bind(ReferenceDataResourceImpl.class);

GuiceUtil.buildMultiBinder(binder(), DataSourceProvider.class)
.addBinding(ReferenceDataServiceImpl.class);
GuiceUtil.buildMultiBinder(binder(), Searchable.class)
.addBinding(ReferenceDataServiceImpl.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ public void purge(final StroomDuration purgeAge, final String nodeName) {
? "node " + nodeName
: "all nodes";
final String taskName = "Reference Data Purge on "
+ nodeNameStr
+ " (purge age: " + purgeAge.toString() + ")";
+ nodeNameStr
+ " (purge age: " + purgeAge.toString() + ")";

taskContextFactory.context(
taskName,
Expand Down Expand Up @@ -309,7 +309,7 @@ public void purge(final StroomDuration purgeAge, final String nodeName) {
exception.set(throwable);
LOGGER.error(
"Error purging reference data store on node [{}]: {}. " +
"Enable DEBUG for stacktrace",
"Enable DEBUG for stacktrace",
nodeName2,
throwable.getMessage());
LOGGER.debug("Error purging ref data store on node [{}]",
Expand Down Expand Up @@ -346,8 +346,8 @@ public void purge(final String feedName,
? "node " + nodeName
: "all nodes";
final String taskName = "Reference Data Purge on "
+ nodeNameStr
+ " (feed: " + feedName + ", purge age: " + purgeAge.toString() + ")";
+ nodeNameStr
+ " (feed: " + feedName + ", purge age: " + purgeAge.toString() + ")";

taskContextFactory.context(
taskName,
Expand Down Expand Up @@ -378,7 +378,7 @@ public void purge(final String feedName,
exception.set(throwable);
LOGGER.error(
"Error purging reference data store on node [{}]: {}. " +
"Enable DEBUG for stacktrace",
"Enable DEBUG for stacktrace",
nodeName2,
throwable.getMessage());
LOGGER.debug("Error purging ref data store on node [{}]",
Expand Down Expand Up @@ -432,8 +432,8 @@ public void purge(final long refStreamId, final String nodeName) {
? "node " + nodeName
: "all nodes";
final String taskName = "Reference Data Purge on "
+ nodeNameStr
+ " (Stream: " + refStreamId + ")";
+ nodeNameStr
+ " (Stream: " + refStreamId + ")";

taskContextFactory.context(
taskName,
Expand Down Expand Up @@ -467,7 +467,7 @@ public void purge(final long refStreamId, final String nodeName) {
exception.set(throwable);
LOGGER.error(
"Error purging reference data store on node [{}]: {}. " +
"Enable DEBUG for stacktrace",
"Enable DEBUG for stacktrace",
nodeName2,
throwable.getMessage());
LOGGER.debug("Error purging ref data store on node [{}]",
Expand Down Expand Up @@ -509,7 +509,7 @@ public void clearBufferPool(final String nodeName) {
? "node " + nodeName
: "all nodes";
final String taskName = "Clearing Byte Buffer Pool on "
+ nodeNameStr;
+ nodeNameStr;

taskContextFactory.context(
nodeNameStr,
Expand Down Expand Up @@ -540,7 +540,7 @@ public void clearBufferPool(final String nodeName) {
exception.set(throwable);
LOGGER.error(
"Error clearing byte buffer pool on node [{}]: {}. " +
"Enable DEBUG for stacktrace",
"Enable DEBUG for stacktrace",
nodeName2,
throwable.getMessage());
LOGGER.debug("Error clearing byte buffer pool on node [{}]",
Expand Down Expand Up @@ -650,7 +650,7 @@ private DocRef getFeedDocRef(final ReferenceLoader referenceLoader) {
throw RestUtil.badRequest("Null referenceLoader");
} else {
if (referenceLoader.getReferenceFeed().getUuid() != null
&& referenceLoader.getReferenceFeed().getName() != null) {
&& referenceLoader.getReferenceFeed().getName() != null) {

return referenceLoader.getReferenceFeed();
} else if (referenceLoader.getReferenceFeed().getName() != null) {
Expand Down Expand Up @@ -690,8 +690,13 @@ private void withPermissionCheck(final Runnable runnable) {
}

@Override
public DocRef getDocRef() {
return ReferenceDataFields.REF_STORE_PSEUDO_DOC_REF;
public String getDataSourceType() {
return ReferenceDataFields.REF_STORE_PSEUDO_DOC_REF.getType();
}

@Override
public List<DocRef> getDataSourceDocRefs() {
return Collections.singletonList(ReferenceDataFields.REF_STORE_PSEUDO_DOC_REF);
}

@Override
Expand All @@ -713,16 +718,6 @@ public int getFieldCount(final DocRef docRef) {
return NullSafe.size(getFields());
}

@Override
public Optional<String> fetchDocumentation(final DocRef docRef) {
return Optional.empty();
}

@Override
public QueryField getTimeField() {
return null;
}

@Override
public void search(final ExpressionCriteria criteria, final FieldIndex fieldIndex, final ValuesConsumer consumer) {
withPermissionCheck(() -> LOGGER.logDurationIfInfoEnabled(
Expand Down Expand Up @@ -808,7 +803,7 @@ private Predicate<RefStoreEntry> buildEntryPredicate(final ExpressionCriteria ex
final Predicate<RefStoreEntry> predicate = convertExpressionItem(expressionCriteria.getExpression());
if (predicate == null) {
if (expressionCriteria.getExpression() != null
&& Op.NOT.equals(expressionCriteria.getExpression().op())) {
&& Op.NOT.equals(expressionCriteria.getExpression().op())) {
return refStoreEntry -> false;
} else {
return refStoreEntry -> true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package stroom.processor.impl;

import stroom.datasource.api.v2.DataSourceProvider;
import stroom.docstore.api.DocumentActionHandlerBinder;
import stroom.importexport.api.ImportExportActionHandler;
import stroom.job.api.DistributedTaskFactory;
Expand Down Expand Up @@ -64,6 +65,8 @@ protected void configure() {
.addBinding(ProcessorFilterCache.class)
.addBinding(PrioritisedFilters.class);

GuiceUtil.buildMultiBinder(binder(), DataSourceProvider.class)
.addBinding(ProcessorTaskServiceImpl.class);
GuiceUtil.buildMultiBinder(binder(), Searchable.class)
.addBinding(ProcessorTaskServiceImpl.class);

Expand Down
Loading

0 comments on commit 6d68682

Please sign in to comment.