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

knowledgepixels / nanodash / 27622721129

16 Jun 2026 01:55PM UTC coverage: 26.963% (+6.3%) from 20.697%
27622721129

Pull #483

github

web-flow
Merge 73a4d0fe1 into 663f14f46
Pull Request #483: Space/resource About pages, ref-aware spaces, and magic query params

1542 of 6717 branches covered (22.96%)

Branch coverage included in aggregate %.

3407 of 11638 relevant lines covered (29.27%)

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

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

11
import java.io.Serializable;
12

13
/**
14
 * Builder class for creating QueryResultNanopubSet components.
15
 */
16
public class QueryResultNanopubSetBuilder implements Serializable {
17

18
    private final String markupId;
19
    private final ViewDisplay viewDisplay;
20
    private String contextId = null;
×
21
    private final QueryRef queryRef;
22
    private boolean hasTitle = true;
×
23
    private AbstractResourceWithProfile pageResource = null;
×
24
    private Long itemsPerPage = null;
×
25

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

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

46
    /**
47
     * Sets the context ID for the QueryResultNanopubSet.
48
     *
49
     * @param contextId the context ID
50
     * @return the current QueryResultNanopubSetBuilder instance
51
     */
52
    public QueryResultNanopubSetBuilder contextId(String contextId) {
53
        this.contextId = contextId;
×
54
        return this;
×
55
    }
56

57
    public QueryResultNanopubSetBuilder pageResource(AbstractResourceWithProfile pageResource) {
58
        this.pageResource = pageResource;
×
59
        return this;
×
60
    }
61

62
    public QueryResultNanopubSetBuilder setItemsPerPage(long itemsPerPage) {
63
        this.itemsPerPage = itemsPerPage;
×
64
        return this;
×
65
    }
66

67
    /**
68
     * Removes the title from the QueryResultNanopubSet.
69
     *
70
     * @return the current QueryResultNanopubSetBuilder instance
71
     */
72
    public QueryResultNanopubSetBuilder noTitle() {
73
        this.hasTitle = false;
×
74
        return this;
×
75
    }
76

77
    /**
78
     * Builds the QueryResultNanopubSet component.
79
     *
80
     * @return the QueryResultNanopubSet component
81
     */
82
    public Component build() {
83
        ApiResponse response = ApiCache.retrieveResponseAsync(queryRef);
×
84
        String colClass = " col-" + viewDisplay.getDisplayWidth();
×
85
        long resolvedItemsPerPage = itemsPerPage != null ? itemsPerPage : viewDisplay.getPageSize();
×
86
        if (response != null) {
×
87
            QueryResultNanopubSet queryResultNanopubSet = new QueryResultNanopubSet(markupId, queryRef, response, viewDisplay, resolvedItemsPerPage);
×
88
            queryResultNanopubSet.setContextId(contextId);
×
89
            queryResultNanopubSet.setPageResource(pageResource);
×
90
            queryResultNanopubSet.populateComponent();
×
91
            queryResultNanopubSet.setTitleVisible(hasTitle);
×
92
            queryResultNanopubSet.add(new AttributeAppender("class", colClass));
×
93
            return queryResultNanopubSet;
×
94
        } else {
95
            ApiResultComponent comp = new ApiResultComponent(markupId, queryRef) {
×
96
                @Override
97
                public Component getApiResultComponent(String markupId, ApiResponse response) {
98
                    QueryResultNanopubSet queryResultNanopubSet = new QueryResultNanopubSet(markupId, queryRef, response, viewDisplay, resolvedItemsPerPage);
×
99
                    queryResultNanopubSet.setContextId(contextId);
×
100
                    queryResultNanopubSet.setPageResource(pageResource);
×
101
                    queryResultNanopubSet.populateComponent();
×
102
                    queryResultNanopubSet.setTitleVisible(hasTitle);
×
103
                    return queryResultNanopubSet;
×
104
                }
105
            };
106
            comp.add(new AttributeAppender("class", colClass));
×
107
            return comp;
×
108
        }
109
    }
110

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

© 2026 Coveralls, Inc