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

knowledgepixels / nanodash / 18221996852

03 Oct 2025 12:17PM UTC coverage: 13.699% (-0.02%) from 13.723%
18221996852

push

github

tkuhn
style(Spaces): Hide status info for template/query items in Spaces

446 of 4114 branches covered (10.84%)

Branch coverage included in aggregate %.

1154 of 7566 relevant lines covered (15.25%)

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

3
import com.knowledgepixels.nanodash.GrlcQuery;
4
import com.knowledgepixels.nanodash.User;
5
import com.knowledgepixels.nanodash.Utils;
6
import com.knowledgepixels.nanodash.page.QueryPage;
7

8
import org.apache.wicket.markup.html.WebMarkupContainer;
9
import org.apache.wicket.markup.html.basic.Label;
10
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
11
import org.apache.wicket.markup.html.panel.Panel;
12
import org.apache.wicket.request.mapper.parameter.PageParameters;
13
import org.eclipse.rdf4j.model.IRI;
14
import org.nanopub.SimpleTimestampPattern;
15
import org.nanopub.extra.security.NanopubSignatureElement;
16
import org.nanopub.extra.security.SignatureUtils;
17
import org.slf4j.Logger;
18
import org.slf4j.LoggerFactory;
19

20
import java.text.SimpleDateFormat;
21
import java.util.Calendar;
22

23
/**
24
 * A panel representing a single query item in a list.
25
 * Displays the query label as a link, the user who created it, and the creation timestamp.
26
 */
27
public class QueryItem extends Panel {
28

29
    private static final Logger logger = LoggerFactory.getLogger(QueryItem.class);
×
30

31
    /**
32
     * Constructor.
33
     *
34
     * @param id    the Wicket id for this panel
35
     * @param query the GrlcQuery object containing query details
36
     */
37
    public QueryItem(String id, GrlcQuery query, boolean extended) {
38
        super(id);
×
39

40
        PageParameters params = new PageParameters();
×
41
        params.add("id", query.getQueryId());
×
42
        BookmarkablePageLink<Void> l = new BookmarkablePageLink<Void>("querylink", QueryPage.class, params);
×
43
        l.add(new Label("linktext", query.getLabel()));
×
44
        add(l);
×
45

46
        WebMarkupContainer statusPart = new WebMarkupContainer("status");
×
47
        if (extended) {
×
48
            String userString = "somebody";
×
49
            try {
50
                NanopubSignatureElement se = SignatureUtils.getSignatureElement(query.getNanopub());
×
51
                if (se != null) {
×
52
                    IRI signer = (se.getSigners().isEmpty() ? null : se.getSigners().iterator().next());
×
53
                    String pubkeyhash = Utils.createSha256HexHash(se.getPublicKeyString());
×
54
                    userString = User.getShortDisplayNameForPubkeyhash(signer, pubkeyhash);
×
55
                }
56
            } catch (Exception ex) {
×
57
                logger.error("Error retrieving signature info: {}", ex.getMessage());
×
58
            }
×
59
            statusPart.add(new Label("user", userString));
×
60
            String timeString = "unknown date";
×
61
            Calendar c = SimpleTimestampPattern.getCreationTime(query.getNanopub());
×
62
            if (c != null) {
×
63
                timeString = (new SimpleDateFormat("yyyy-MM-dd")).format(c.getTime());
×
64
            }
65
            statusPart.add(new Label("timestamp", timeString));
×
66
        } else {
×
67
            statusPart.setVisible(false);
×
68
        }
69
        add(statusPart);
×
70
    }
×
71

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