54
54
import jakarta .inject .Provider ;
55
55
import jakarta .inject .Singleton ;
56
56
57
- import java .nio .file .Path ;
58
57
import java .util .List ;
59
58
import java .util .Map ;
60
59
import java .util .Objects ;
@@ -189,15 +188,6 @@ public Optional<FeedDoc> tryCreateFeed(final String feedName,
189
188
return optFeedDoc ;
190
189
}
191
190
192
- // private boolean isEligibleForAutoCreation(final UserDesc userDesc,
193
- // final AttributeMap attributeMap) {
194
- // return NullSafe.allNonNull(userDesc, userDesc.getSubjectId(), attributeMap)
195
- // && attributeMap.containsKey(StandardHeaderArguments.ACCOUNT_ID)
196
- // && attributeMap.containsKey(StandardHeaderArguments.COMPONENT)
197
- // && attributeMap.containsKey(StandardHeaderArguments.SCHEMA)
198
- // && attributeMap.containsKey(StandardHeaderArguments.FORMAT);
199
- // }
200
-
201
191
private UserRef getRunAsUser () {
202
192
final AutoContentCreationConfig autoContentCreationConfig = autoContentCreationConfigProvider .get ();
203
193
final String createAsSubjectId = Objects .requireNonNull (autoContentCreationConfig .getCreateAsSubjectId ());
@@ -233,7 +223,7 @@ private Optional<FeedDoc> ensureFeed(final String feedName,
233
223
final List <DocRef > feeds = feedStore .findByName (feedName );
234
224
if (feeds .isEmpty ()) {
235
225
try {
236
- docRef = doCreateFeed (feedName , userDesc , attributeMap );
226
+ docRef = createFeedAndContent (feedName , userDesc , attributeMap );
237
227
} catch (EntityServiceException e ) {
238
228
// It's possible that another thread/node has created the feed
239
229
if (NullSafe .containsIgnoringCase (e .getMessage (), "exists" )) {
@@ -255,9 +245,9 @@ private Optional<FeedDoc> ensureFeed(final String feedName,
255
245
return Optional .of (feedStore .readDocument (feedDocRef ));
256
246
}
257
247
258
- private DocRef doCreateFeed (final String feedName ,
259
- final UserDesc userDesc ,
260
- final AttributeMap attributeMap ) {
248
+ private DocRef createFeedAndContent (final String feedName ,
249
+ final UserDesc userDesc ,
250
+ final AttributeMap attributeMap ) {
261
251
262
252
final String destinationPath = cachedDestinationPathTemplator .getValue ()
263
253
.apply (attributeMap );
@@ -561,62 +551,4 @@ private void createPipelineFromParent(final PipelineDoc parentPipelineDoc,
561
551
// Now create the proc filter for the new pipe
562
552
createProcessorFilter (streamType , newPipelineDoc .asDocRef (), feedDocRef , contentTemplate );
563
553
}
564
- // private Optional<ContentTemplate> getMatchingTemplate(final List<ContentTemplate> activeTemplates,
565
- // final AttributeMap attributeMap) {
566
- // final Map<CIKey, String> caseInSenseAttributes = NullSafe.map(attributeMap)
567
- // .entrySet()
568
- // .stream()
569
- // .collect(Collectors.toMap(
570
- // entry -> CIKey.of(entry.getKey()),
571
- // Entry::getValue));
572
- //
573
- // return activeTemplates.stream()
574
- // .filter(template -> isMatch(template, caseInSenseAttributes))
575
- // .findFirst();
576
- // }
577
- //
578
- // private boolean isMatch(final ContentTemplate contentTemplate,
579
- // final Map<CIKey, String> attributeMap) {
580
- // //T
581
- //// final ExpressionOperator expressionOperator = contentTemplate.getExpression();
582
- ////
583
- //// e
584
- //// if (expressionOperator == n)
585
- //// if (expressionOperator instanceof )
586
- //
587
- //
588
- // }
589
-
590
- // private boolean isMatch(final ExpressionItem expressionItem,
591
- // final Map<CIKey, String> attributeMap) {
592
- // if (expressionItem == null || !expressionItem.enabled()) {
593
- // return false;
594
- // } else if (expressionItem instanceof ExpressionTerm expressionTerm) {
595
- //
596
- // } else if (expressionItem instanceof ExpressionOperator expressionOperator) {
597
- // expressionOperator.op();
598
- //
599
- // } else {
600
- // throw new RuntimeException("Unexpected ExpressionItem " + expressionItem.getClass());
601
- // }
602
- //
603
- // final ExpressionOperator expressionOperator = contentTemplate.getExpression();
604
- // if (expressionOperator instanceof )
605
- //
606
- //
607
- // }
608
- //
609
- // private boolean isMatch(final ExpressionTerm expressionTerm,
610
- // final Map<CIKey, String> attributeMap) {
611
- //
612
- // }
613
-
614
-
615
- // --------------------------------------------------------------------------------
616
-
617
-
618
- private record SourcedContentTemplate (ContentTemplate contentTemplate ,
619
- Path sourceFile ) {
620
-
621
- }
622
554
}
0 commit comments