• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

knowledgepixels / nanodash / 36137115324

25 Sep 2026 12:48PM UTC coverage: 50.947% (+0.1%) from 50.801%
36137115324

push

github

web-flow
Merge pull request #741 from knowledgepixels/feat/696-threaded-discussion-view

feat(views): show a discussion as a threaded conversation

5394 of 11387 branches covered (47.37%)

Branch coverage included in aggregate %.

9583 of 18010 relevant lines covered (53.21%)

8.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
src/main/java/com/knowledgepixels/nanodash/component/QueryResultComponentFactory.java
1
package com.knowledgepixels.nanodash.component;
2

3
import com.knowledgepixels.nanodash.View;
4
import com.knowledgepixels.nanodash.ViewDisplay;
5
import com.knowledgepixels.nanodash.domain.AbstractResourceWithProfile;
6
import com.knowledgepixels.nanodash.vocabulary.KPXL_TERMS;
7
import org.apache.wicket.Component;
8
import org.eclipse.rdf4j.model.IRI;
9
import org.nanopub.extra.services.QueryRef;
10

11
/**
12
 * Maps a view's display type to the matching query-result component. The single
13
 * place where the display-type IRIs are dispatched to their builders, shared by
14
 * {@link ViewList} (views on resource pages) and
15
 * {@link com.knowledgepixels.nanodash.page.ViewResultsPage} (the standalone
16
 * results page a query-form view leads to).
17
 */
18
public class QueryResultComponentFactory {
19

20
    private QueryResultComponentFactory() {
21
    }
22

23
    /**
24
     * Builds the result component for the given view display's display type.
25
     *
26
     * @param markupId            the markup ID for the component
27
     * @param queryRef            the query reference to show the results of
28
     * @param viewDisplay         the view display (determines display type, title, width, page size)
29
     * @param resourceWithProfile the resource whose page the component is on, or null on a
30
     *                            standalone page (view actions needing a resource context are
31
     *                            then omitted by the builders)
32
     * @param id                  the resource or part id the view is shown for, or null
33
     * @param contextId           the context id, or null
34
     * @param refRoot             the pinned ref's root nanopub, or null
35
     * @return the component, or null if the view has no or an unrecognized display type
36
     */
37
    public static Component build(String markupId, QueryRef queryRef, ViewDisplay viewDisplay,
38
            AbstractResourceWithProfile resourceWithProfile, String id, String contextId, String refRoot) {
39
        View view = viewDisplay.getView();
×
40
        IRI viewType = (view == null ? null : view.getViewType());
×
41
        if (viewType == null) return null;
×
42
        if (viewType.equals(KPXL_TERMS.LIST_VIEW)) {
×
43
            return QueryResultListBuilder.create(markupId, queryRef, viewDisplay)
×
44
                    .resourceWithProfile(resourceWithProfile)
×
45
                    .pageResource(resourceWithProfile)
×
46
                    .id(id)
×
47
                    .contextId(contextId)
×
48
                    .refRoot(refRoot)
×
49
                    .build();
×
50
        } else if (viewType.equals(KPXL_TERMS.TABULAR_VIEW)) {
×
51
            return QueryResultTableBuilder.create(markupId, queryRef, viewDisplay)
×
52
                    .resourceWithProfile(resourceWithProfile)
×
53
                    .contextId(contextId)
×
54
                    .id(id)
×
55
                    .refRoot(refRoot)
×
56
                    .build();
×
57
        } else if (viewType.equals(KPXL_TERMS.PLAIN_PARAGRAPH_VIEW)) {
×
58
            return QueryResultPlainParagraphBuilder.create(markupId, queryRef, viewDisplay)
×
59
                    .pageResource(resourceWithProfile)
×
60
                    .contextId(contextId)
×
61
                    .id(id)
×
62
                    .refRoot(refRoot)
×
63
                    .build();
×
64
        } else if (viewType.equals(KPXL_TERMS.NANOPUB_SET_VIEW)) {
×
65
            return QueryResultNanopubSetBuilder.create(markupId, queryRef, viewDisplay)
×
66
                    .resourceWithProfile(resourceWithProfile)
×
67
                    .pageResource(resourceWithProfile)
×
68
                    .id(id)
×
69
                    .contextId(contextId)
×
70
                    .refRoot(refRoot)
×
71
                    .build();
×
72
        } else if (viewType.equals(KPXL_TERMS.SVG_VIEW)) {
×
73
            return QueryResultSvgBuilder.create(markupId, queryRef, viewDisplay)
×
74
                    .pageResource(resourceWithProfile)
×
75
                    .contextId(contextId)
×
76
                    .id(id)
×
77
                    .refRoot(refRoot)
×
78
                    .build();
×
79
        } else if (viewType.equals(KPXL_TERMS.THREAD_VIEW)) {
×
80
            return QueryResultThreadBuilder.create(markupId, queryRef, viewDisplay)
×
81
                    .resourceWithProfile(resourceWithProfile)
×
82
                    .pageResource(resourceWithProfile)
×
83
                    .id(id)
×
84
                    .contextId(contextId)
×
85
                    .refRoot(refRoot)
×
86
                    .build();
×
87
        } else if (viewType.equals(KPXL_TERMS.ITEM_LIST_VIEW)) {
×
88
            return QueryResultItemListBuilder.create(markupId, queryRef, viewDisplay)
×
89
                    .resourceWithProfile(resourceWithProfile)
×
90
                    .pageResource(resourceWithProfile)
×
91
                    .id(id)
×
92
                    .contextId(contextId)
×
93
                    .refRoot(refRoot)
×
94
                    .build();
×
95
        }
96
        return null;
×
97
    }
98

99
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc