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

knowledgepixels / nanodash / 34870785928

14 Sep 2026 04:47PM UTC coverage: 48.177% (+7.0%) from 41.212%
34870785928

Pull #669

github

web-flow
Merge 9f5073871 into f2c7a323f
Pull Request #669: feat(publish): check whether a minted ID has already been used

4769 of 10647 branches covered (44.79%)

Branch coverage included in aggregate %.

8512 of 16920 relevant lines covered (50.31%)

8.05 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/QueryResultListBuilder.java
1
package com.knowledgepixels.nanodash.component;
2

3
import com.knowledgepixels.nanodash.*;
4
import com.knowledgepixels.nanodash.domain.AbstractResourceWithProfile;
5
import org.apache.wicket.Component;
6
import org.apache.wicket.behavior.AttributeAppender;
7
import org.nanopub.extra.services.ApiResponse;
8
import org.nanopub.extra.services.QueryRef;
9

10
import java.io.Serializable;
11

12
/**
13
 * Builder class for creating QueryResultList components.
14
 */
15
public class QueryResultListBuilder implements Serializable {
16

17
    private String markupId;
18
    private ViewDisplay viewDisplay;
19
    private String contextId = null;
×
20
    private QueryRef queryRef;
21
    private AbstractResourceWithProfile resourceWithProfile = null;
×
22
    private String id = null;
×
23
    private AbstractResourceWithProfile pageResource = null;
×
24
    private String postPublishTab = null;
×
25
    private String refRoot = null;
×
26

27
    private QueryResultListBuilder(String markupId, QueryRef queryRef, ViewDisplay viewDisplay) {
×
28
        this.markupId = markupId;
×
29
        // Bind session-derived "magic" query parameters here on the request thread
30
        // (ApiCache fetches on background threads where the session is absent).
31
        this.queryRef = com.knowledgepixels.nanodash.MagicQueryParams.augment(queryRef);
×
32
        this.viewDisplay = viewDisplay;
×
33
    }
×
34

35
    /**
36
     * Creates a new QueryResultListBuilder instance.
37
     *
38
     * @param markupId    the markup ID for the component
39
     * @param queryRef    the query reference
40
     * @param viewDisplay the view display
41
     * @return a new QueryResultListBuilder instance
42
     */
43
    public static QueryResultListBuilder create(String markupId, QueryRef queryRef, ViewDisplay viewDisplay) {
44
        return new QueryResultListBuilder(markupId, queryRef, viewDisplay);
×
45
    }
46

47
    public QueryResultListBuilder resourceWithProfile(AbstractResourceWithProfile resourceWithProfile) {
48
        this.resourceWithProfile = resourceWithProfile;
×
49
        return this;
×
50
    }
51

52
    /**
53
     * Sets the context ID for the QueryResultList.
54
     *
55
     * @param contextId the context ID
56
     * @return the current QueryResultListBuilder instance
57
     */
58
    public QueryResultListBuilder contextId(String contextId) {
59
        this.contextId = contextId;
×
60
        return this;
×
61
    }
62

63
    public QueryResultListBuilder id(String id) {
64
        this.id = id;
×
65
        return this;
×
66
    }
67

68
    public QueryResultListBuilder pageResource(AbstractResourceWithProfile pageResource) {
69
        this.pageResource = pageResource;
×
70
        return this;
×
71
    }
72

73
    /**
74
     * Sets the tab to return to after publishing one of this view's action
75
     * buttons (e.g. {@code "about"}). Null leaves the post-publish redirect on
76
     * its default tab.
77
     *
78
     * @param postPublishTab the tab name, or null for the default
79
     * @return the current QueryResultListBuilder instance
80
     */
81
    public QueryResultListBuilder postPublishTab(String postPublishTab) {
82
        this.postPublishTab = postPublishTab;
×
83
        return this;
×
84
    }
85

86
    /**
87
     * Pins this list to a specific ref (root definition), so action visibility is gated
88
     * against that claimant's authority rather than the resource's representative ref. Used
89
     * on {@code ?root=}-pinned pages. Null leaves it on the representative ref.
90
     *
91
     * @param refRoot the ref's root nanopub, or null
92
     * @return the current QueryResultListBuilder instance
93
     */
94
    public QueryResultListBuilder refRoot(String refRoot) {
95
        this.refRoot = refRoot;
×
96
        return this;
×
97
    }
98

99
    /**
100
     * Builds the QueryResultList component.
101
     *
102
     * @return the QueryResultList component
103
     */
104
    public Component build() {
105
        ApiResponse response = ApiCache.retrieveResponseAsync(queryRef);
×
106
        Component comp = ApiResultComponent.create(markupId, queryRef, response, viewDisplay.getTitle(), this::buildList);
×
107
        comp.add(new AttributeAppender("class", " col-" + viewDisplay.getDisplayWidth()));
×
108
        return comp;
×
109
    }
110

111
    private QueryResultList buildList(String markupId, ApiResponse response) {
112
        QueryResultList resultList = new QueryResultList(markupId, queryRef, response, viewDisplay);
×
113
        resultList.setResourceWithProfile(resourceWithProfile);
×
114
        resultList.setPageResource(pageResource);
×
115
        resultList.setContextId(contextId);
×
116
        resultList.setPostPublishTab(postPublishTab);
×
117
        resultList.setRefRoot(refRoot);
×
118
        ViewActionMappings.addResultActions(resultList, viewDisplay, queryRef, id, contextId, resourceWithProfile, refRoot);
×
119
        return resultList;
×
120
    }
121

122
}
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