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

knowledgepixels / nanodash / 17577716955

09 Sep 2025 09:11AM UTC coverage: 13.761% (+0.02%) from 13.745%
17577716955

push

github

web-flow
Merge pull request #247 from knowledgepixels/216-status-display-broken-for-nanopubs-without-date

Fix status display broken for nanopubs without date

408 of 3854 branches covered (10.59%)

Branch coverage included in aggregate %.

1083 of 6981 relevant lines covered (15.51%)

0.69 hits per line

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

7.85
src/main/java/com/knowledgepixels/nanodash/component/NanopubItem.java
1
package com.knowledgepixels.nanodash.component;
2

3
import com.knowledgepixels.nanodash.*;
4
import com.knowledgepixels.nanodash.action.NanopubAction;
5
import com.knowledgepixels.nanodash.page.TypePage;
6
import com.knowledgepixels.nanodash.page.UserPage;
7
import com.knowledgepixels.nanodash.template.*;
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.markup.repeater.Item;
13
import org.apache.wicket.markup.repeater.data.DataView;
14
import org.apache.wicket.markup.repeater.data.ListDataProvider;
15
import org.apache.wicket.model.Model;
16
import org.apache.wicket.request.mapper.parameter.PageParameters;
17
import org.eclipse.rdf4j.model.IRI;
18
import org.eclipse.rdf4j.model.Statement;
19
import org.nanopub.SimpleCreatorPattern;
20
import org.nanopub.extra.security.MalformedCryptoElementException;
21
import org.nanopub.extra.security.SignatureUtils;
22
import org.nanopub.vocabulary.NTEMPLATE;
23
import org.slf4j.Logger;
24
import org.slf4j.LoggerFactory;
25

26
import java.text.SimpleDateFormat;
27
import java.util.*;
28

29
/**
30
 * A panel that displays a nanopublication with its header, footer, assertion, provenance, and pubinfo.
31
 */
32
public class NanopubItem extends Panel {
33

34
    private static final long serialVersionUID = -5109507637942030910L;
35

36
    /**
37
     * Date format for displaying the creation date and time of the nanopub.
38
     */
39
    public static SimpleDateFormat simpleDateTimeFormat = new SimpleDateFormat("d MMM yyyy, HH:mm:ss zzz");
5✔
40
    /**
41
     * Date format for displaying the creation time of the nanopub without time.
42
     */
43
    public static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("d MMM yyyy");
5✔
44

45
    private boolean isInitialized = false;
3✔
46
    private NanopubElement n;
47
    private boolean hideAssertion = false;
3✔
48
    private boolean hideProvenance = false;
3✔
49
    private boolean hidePubinfo = false;
3✔
50
    private boolean hideHeader = false;
3✔
51
    private boolean hideFooter = false;
3✔
52
    private boolean hideActionMenu = false;
3✔
53
    private List<NanopubAction> actions;
54
    private IRI signerId;
55
    private String templateId;
56
    private static final Logger logger = LoggerFactory.getLogger(NanopubItem.class);
4✔
57

58
    /**
59
     * Creates a NanopubItem panel.
60
     *
61
     * @param id         the Wicket component ID
62
     * @param n          the NanopubElement to display
63
     * @param templateId the ID of the template to use for rendering the assertion.
64
     */
65
    public NanopubItem(String id, NanopubElement n, String templateId) {
66
        super(id);
3✔
67
        this.n = n;
3✔
68
        this.templateId = templateId;
3✔
69
    }
1✔
70

71
    /**
72
     * Creates a NanopubItem panel with a default template ID.
73
     *
74
     * @param id the Wicket component ID
75
     * @param n  the NanopubElement to display
76
     */
77
    public NanopubItem(String id, NanopubElement n) {
78
        this(id, n, null);
×
79
    }
×
80

81
    private void initialize() {
82
        if (isInitialized) return;
×
83

84
        String pubkey = n.getPubkey();
×
85
        String pubkeyhash = n.getPubkeyhash();
×
86
        signerId = n.getSignerId();
×
87

88
        if (hideHeader) {
×
89
            add(new Label("header", "").setVisible(false));
×
90
        } else {
91
            WebMarkupContainer header = new WebMarkupContainer("header");
×
92
            String labelString = n.getLabel();
×
93
            if (labelString == null || labelString.isBlank()) labelString = Utils.getShortNanopubId(n.getUri());
×
94
            header.add(NanodashLink.createLink("nanopub-id-link", n.getUri(), labelString));
×
95
            if (!hideActionMenu && (actions == null || !actions.isEmpty())) {
×
96
                NanodashSession session = NanodashSession.get();
×
97
                final boolean isOwnNanopub = (session.getUserIri() != null && session.getUserIri().equals(User.getUserData().getUserIriForPubkeyhash(pubkeyhash, false))) ||
×
98
                                             ((pubkey != null) && pubkey.equals(session.getPubkeyString()));
×
99
                final boolean hasLocalPubkey = session.getUserIri() != null && session.getPubkeyString() != null && session.getPubkeyString().equals(pubkey);
×
100
                final List<NanopubAction> actionList = new ArrayList<>();
×
101
                final Map<String, NanopubAction> actionMap = new HashMap<>();
×
102
                List<NanopubAction> allActions = new ArrayList<>();
×
103
                if (actions == null) {
×
104
                    allActions.addAll(Arrays.asList(NanopubAction.defaultActions));
×
105
                    allActions.addAll(NanopubAction.getActionsFromPreferences(NanodashPreferences.get()));
×
106
                } else {
107
                    allActions.addAll(actions);
×
108
                }
109
                for (NanopubAction action : allActions) {
×
110
                    if (isOwnNanopub && !action.isApplicableToOwnNanopubs()) continue;
×
111
                    if (isOwnNanopub && !hasLocalPubkey && !action.isApplicableToOthersNanopubs() && !Utils.hasNanodashLocation(pubkeyhash))
×
112
                        continue;
×
113
                    if (!isOwnNanopub && !action.isApplicableToOthersNanopubs()) continue;
×
114
                    if (!action.isApplicableTo(n.getNanopub())) continue;
×
115
                    actionList.add(action);
×
116
                    actionMap.put(action.getLinkLabel(n.getNanopub()), action);
×
117
                }
×
118
                header.add(new ActionMenu("action-menu", actionList, n));
×
119
            } else {
×
120
                header.add(new Label("action-menu", "").setVisible(false));
×
121
            }
122
            header.add(new DataView<IRI>("typespan", new ListDataProvider<IRI>(Utils.getTypes(n.getNanopub()))) {
×
123

124
                private static final long serialVersionUID = 1L;
125

126
                @Override
127
                protected void populateItem(Item<IRI> item) {
128
                    IRI typeIri = item.getModelObject();
×
129
                    String label = Utils.getTypeLabel(typeIri);
×
130
                    item.add(new BookmarkablePageLink<Void>("type", TypePage.class, new PageParameters().add("id", typeIri)).setBody(Model.of(label)));
×
131
                }
×
132

133
            });
134
            add(header);
×
135
        }
136

137
        if (hideFooter) {
×
138
            add(new Label("footer", "").setVisible(false));
×
139
        } else {
140
            WebMarkupContainer footer = new WebMarkupContainer("footer");
×
141
            if (n.getCreationTime() != null) {
×
142
                footer.add(new Label("datetime", simpleDateTimeFormat.format(n.getCreationTime().getTime())));
×
143
            } else {
144
                footer.add(new Label("datetime", "(undated)"));
×
145
            }
146

147
            List<IRI> authors = SimpleCreatorPattern.getAuthorList(n.getNanopub());
×
148
            WebMarkupContainer authorsSpan = new WebMarkupContainer("authors-span");
×
149
            if (authors.isEmpty()) {
×
150
                authorsSpan.setVisible(false);
×
151
                footer.add(new Label("creator-post", "").setVisible(false));
×
152
            } else {
153
                IRI mainAuthor = authors.get(0);
×
154
                BookmarkablePageLink<Void> mainAuthorLink = new BookmarkablePageLink<Void>("main-author-link", UserPage.class, new PageParameters().add("id", mainAuthor));
×
155
                String authorName = n.getFoafNameMap().get(mainAuthor.stringValue());
×
156
                if (authorName == null) {
×
157
                    authorName = User.getShortDisplayName(mainAuthor);
×
158
                }
159
                mainAuthorLink.add(new Label("main-author-text", authorName));
×
160
                authorsSpan.add(mainAuthorLink);
×
161
                if (authors.size() > 1) {
×
162
                    authorsSpan.add(new Label("authors-post", " et al. (authors)"));
×
163
                } else {
164
                    authorsSpan.add(new Label("authors-post", " (author)"));
×
165
                }
166
                footer.add(new Label("creator-post", " (creator)"));
×
167
            }
168
            footer.add(authorsSpan);
×
169

170
            PageParameters params = new PageParameters();
×
171

172
            // ----------
173
            // TODO Clean this up and move to helper method:
174
            IRI uIri = User.findSingleIdForPubkeyhash(pubkeyhash);
×
175
            if (uIri == null) {
×
176
                try {
177
                    Set<IRI> signers = SignatureUtils.getSignatureElement(n.getNanopub()).getSigners();
×
178
                    if (signers.size() == 1) {
×
179
                        uIri = signers.iterator().next();
×
180
                    } else {
181
                        Set<IRI> creators = SimpleCreatorPattern.getCreators(n.getNanopub());
×
182
                        if (creators.size() == 1) uIri = creators.iterator().next();
×
183
                    }
184
                } catch (MalformedCryptoElementException ex) {
×
185
                    logger.error("Error getting signer from nanopub {}", n.getUri(), ex);
×
186
                }
×
187
            }
188
            // ----------
189

190
            if (uIri != null) params.add("id", uIri);
×
191
            BookmarkablePageLink<Void> userLink = new BookmarkablePageLink<Void>("creator-link", UserPage.class, params);
×
192
            String userString;
193
            if (signerId != null) {
×
194
                userString = User.getShortDisplayNameForPubkeyhash(signerId, pubkeyhash);
×
195
            } else {
196
                userString = User.getShortDisplayNameForPubkeyhash(uIri, pubkeyhash);
×
197
            }
198
            userLink.add(new Label("creator-text", userString));
×
199
            footer.add(userLink);
×
200

201
            String positiveNotes = "";
×
202
            String negativeNotes = "";
×
203
            if (n.seemsToHaveSignature()) {
×
204
                try {
205
                    if (!n.hasValidSignature()) {
×
206
                        negativeNotes = "- invalid signature";
×
207
                    }
208
                } catch (Exception ex) {
×
209
                    logger.error("Error checking signature validity for nanopub {}", n.getUri(), ex);
×
210
                    negativeNotes = "- malformed or legacy signature";
×
211
                }
×
212
            }
213
            footer.add(new Label("positive-notes", positiveNotes));
×
214
            footer.add(new Label("negative-notes", negativeNotes));
×
215
            add(footer);
×
216
        }
217

218
        final TemplateData td = TemplateData.get();
×
219

220
        WebMarkupContainer assertion = new WebMarkupContainer("assertion");
×
221

222
        if (hideAssertion) {
×
223
            assertion.setVisible(false);
×
224
        } else {
225
            Template assertionTemplate = td.getTemplate(n.getNanopub());
×
226
            if (templateId != null) assertionTemplate = td.getTemplate(templateId);
×
227
            if (assertionTemplate == null) {
×
228
                assertionTemplate = td.getTemplate("http://purl.org/np/RAFu2BNmgHrjOTJ8SKRnKaRp-VP8AOOb7xX88ob0DZRsU");
×
229
            }
230
            List<StatementItem> assertionStatements = new ArrayList<>();
×
231
            ValueFiller assertionFiller = new ValueFiller(n.getNanopub(), ContextType.ASSERTION, false);
×
232
            TemplateContext context = new TemplateContext(ContextType.ASSERTION, assertionTemplate.getId(), "assertion-statement", n.getNanopub());
×
233
            populateStatementItemList(context, assertionFiller, assertionStatements);
×
234

235
            assertion.add(createStatementView("assertion-statements", assertionStatements));
×
236
            assertion.add(new DataView<Statement>("unused-assertion-statements", new ListDataProvider<Statement>(assertionFiller.getUnusedStatements())) {
×
237

238
                private static final long serialVersionUID = 1L;
239

240
                @Override
241
                protected void populateItem(Item<Statement> item) {
242
                    item.add(new TripleItem("unused-assertion-statement", item.getModelObject(), n.getNanopub(), null));
×
243
                }
×
244

245
            });
246
        }
247
        add(assertion);
×
248

249
        WebMarkupContainer provenance = new WebMarkupContainer("provenance");
×
250
        if (hideProvenance) {
×
251
            provenance.setVisible(false);
×
252
        } else {
253
            Template provenanceTemplate = td.getProvenanceTemplate(n.getNanopub());
×
254
            if (provenanceTemplate == null)
×
255
                provenanceTemplate = td.getTemplate("http://purl.org/np/RA3Jxq5JJjluUNEpiMtxbiIHa7Yt-w8f9FiyexEstD5R4");
×
256
            List<StatementItem> provenanceStatements = new ArrayList<>();
×
257
            ValueFiller provenanceFiller = new ValueFiller(n.getNanopub(), ContextType.PROVENANCE, false);
×
258
            TemplateContext prContext = new TemplateContext(ContextType.PROVENANCE, provenanceTemplate.getId(), "provenance-statement", n.getNanopub());
×
259
            populateStatementItemList(prContext, provenanceFiller, provenanceStatements);
×
260
            provenance.add(createStatementView("provenance-statements", provenanceStatements));
×
261
            provenance.add(new DataView<Statement>("unused-provenance-statements", new ListDataProvider<Statement>(provenanceFiller.getUnusedStatements())) {
×
262

263
                private static final long serialVersionUID = 1L;
264

265
                @Override
266
                protected void populateItem(Item<Statement> item) {
267
                    item.add(new TripleItem("unused-provenance-statement", item.getModelObject(), n.getNanopub(), null));
×
268
                }
×
269

270
            });
271
        }
272
        add(provenance);
×
273

274
        WebMarkupContainer pubInfo = new WebMarkupContainer("pubinfo");
×
275
        if (hidePubinfo) {
×
276
            pubInfo.setVisible(false);
×
277
        } else {
278
            ValueFiller pubinfoFiller = new ValueFiller(n.getNanopub(), ContextType.PUBINFO, false);
×
279

280
            // TODO We should do this better:
281
            List<String> pubinfoAuthorTemplateIds = new ArrayList<>();
×
282
            List<String> pubinfoTemplateIds = new ArrayList<>();
×
283
            for (IRI iri : td.getPubinfoTemplateIds(n.getNanopub())) {
×
284
                if (iri.stringValue().equals("https://w3id.org/np/RA16U9Wo30ObhrK1NzH7EsmVRiRtvEuEA_Dfc-u8WkUCA")) { // author list
×
285
                    pubinfoAuthorTemplateIds.add(iri.stringValue());
×
286
                } else if (iri.stringValue().equals("http://purl.org/np/RA4vTctL3Luaj8oI_sPiN7I_8xEnR_hkdz5gN7bCvZpNY")) { // authors
×
287
                    pubinfoAuthorTemplateIds.add(iri.stringValue());
×
288
                } else if (iri.stringValue().equals("http://purl.org/np/RAA2MfqdBCzmz9yVWjKLXNbyfBNcwsMmOqcNUxkk1maIM")) { // creator
×
289
                    pubinfoTemplateIds.add(0, iri.stringValue());
×
290
                } else {
291
                    pubinfoTemplateIds.add(iri.stringValue());
×
292
                }
293
            }
×
294
            pubinfoTemplateIds.addAll(0, pubinfoAuthorTemplateIds);
×
295
            pubinfoTemplateIds.add("https://w3id.org/np/RAXVsr624oEAJvCt1WZXoUJ90lFYC5LUMoYHgEUOwmrLw"); // user name
×
296
            pubinfoTemplateIds.add("https://w3id.org/np/RARJj78P72NR5edKOnu_f4ePE9NYYuW2m2pM-fEoobMBk"); // nanopub label
×
297
            pubinfoTemplateIds.add("https://w3id.org/np/RA8iXbwvOC7BwVHuvAhFV235j2582SyAYJ2sfov19ZOlg"); // nanopub type
×
298
            pubinfoTemplateIds.add("https://w3id.org/np/RALmzqHlrRfeTD8ESZdKFyDNYY6eFuyQ8GAe_4N5eVytc"); // timestamp
×
299
            pubinfoTemplateIds.add("https://w3id.org/np/RADVnztsdSc36ffAXTxiIdXpYEMLiJrRENqaJ2Qn2LX3Y"); // templates
×
300
            pubinfoTemplateIds.add("https://w3id.org/np/RAvqXPNKPf56b2226oqhKzARyvIhnpnTrRpLGC1cYweMw"); // introductions
×
301
            pubinfoTemplateIds.add("https://w3id.org/np/RAgIlomuR39mN-Z39bbv59-h2DgQBnLyNdL22YmOJ_VHM"); // labels from APIs
×
302
            pubinfoTemplateIds.add("https://w3id.org/np/RAoWx0AJvNw-WqkGgZO4k8udNCg6kMcGZARN3DgO_5TII"); // contributor names
×
303
            pubinfoTemplateIds.add("https://w3id.org/np/RAY_M7GUmyOTjXQbJArzhVVzQ5XvgHt0JR7h2LZo6TXvY"); // signature
×
304
            pubinfoTemplateIds.add("https://w3id.org/np/RA_TZ9tvF6sBewmbIGbTFguLOPUUS70huklacisZrYtYw"); // creation site
×
305
            pubinfoTemplateIds.add("https://w3id.org/np/RAE-zsHxw2VoE6emhSY_Fkr5p_li5Qb8FrREqUwdWdzyM"); // generic
×
306

307
            List<TemplateContext> contexts = new ArrayList<>();
×
308
            List<TemplateContext> genericContexts = new ArrayList<>();
×
309
            for (String s : pubinfoTemplateIds) {
×
310
                TemplateContext piContext = new TemplateContext(ContextType.PUBINFO, s, "pubinfo-statement", n.getNanopub());
×
311
                if (piContext.willMatchAnyTriple()) {
×
312
                    genericContexts.add(piContext);
×
313
                } else if (piContext.getTemplateId().equals("https://w3id.org/np/RAE-zsHxw2VoE6emhSY_Fkr5p_li5Qb8FrREqUwdWdzyM")) {
×
314
                    // TODO: This is a work-around; check why this template doesn't give true to willMatchAnyTriple()
315
                    genericContexts.add(piContext);
×
316
                } else {
317
                    contexts.add(piContext);
×
318
                }
319
            }
×
320
            contexts.addAll(genericContexts);  // make sure the generic one are at the end
×
321
            List<WebMarkupContainer> elements = new ArrayList<>();
×
322
            for (TemplateContext piContext : contexts) {
×
323
                WebMarkupContainer pubInfoElement = new WebMarkupContainer("pubinfo-element");
×
324
                List<StatementItem> pubinfoStatements = new ArrayList<>();
×
325
                populateStatementItemList(piContext, pubinfoFiller, pubinfoStatements);
×
326
                if (!pubinfoStatements.isEmpty()) {
×
327
                    pubInfoElement.add(createStatementView("pubinfo-statements", pubinfoStatements));
×
328
                    elements.add(pubInfoElement);
×
329
                }
330
            }
×
331
            pubInfo.add(new DataView<WebMarkupContainer>("pubinfo-elements", new ListDataProvider<WebMarkupContainer>(elements)) {
×
332

333
                private static final long serialVersionUID = 1L;
334

335
                @Override
336
                protected void populateItem(Item<WebMarkupContainer> item) {
337
                    item.add(item.getModelObject());
×
338
                }
×
339

340
            });
341
        }
342
        add(pubInfo);
×
343

344
        isInitialized = true;
×
345
    }
×
346

347
    /**
348
     * Hides the provenance part of the nanopub item.
349
     *
350
     * @return this NanopubItem instance for method chaining
351
     */
352
    public NanopubItem hideProvenance() {
353
        if (isInitialized) throw new RuntimeException("Nanopub item is already initialized");
×
354
        hideProvenance = true;
×
355
        return this;
×
356
    }
357

358
    /**
359
     * Sets whether the provenance part of the nanopub item should be hidden.
360
     *
361
     * @param hideProvenance true to hide provenance, false to show it
362
     * @return this NanopubItem instance for method chaining
363
     */
364
    public NanopubItem setProvenanceHidden(boolean hideProvenance) {
365
        if (isInitialized) throw new RuntimeException("Nanopub item is already initialized");
3!
366
        this.hideProvenance = hideProvenance;
3✔
367
        return this;
2✔
368
    }
369

370
    /**
371
     * Hides the pubinfo part of the nanopub item.
372
     *
373
     * @return this NanopubItem instance for method chaining
374
     */
375
    public NanopubItem hidePubinfo() {
376
        if (isInitialized) throw new RuntimeException("Nanopub item is already initialized");
×
377
        hidePubinfo = true;
×
378
        return this;
×
379
    }
380

381
    /**
382
     * Sets whether the pubinfo part of the nanopub item should be hidden.
383
     *
384
     * @param hidePubinfo true to hide pubinfo, false to show it
385
     * @return this NanopubItem instance for method chaining
386
     */
387
    public NanopubItem setPubinfoHidden(boolean hidePubinfo) {
388
        if (isInitialized) throw new RuntimeException("Nanopub item is already initialized");
3!
389
        this.hidePubinfo = hidePubinfo;
3✔
390
        return this;
2✔
391
    }
392

393
    /**
394
     * Hides the header part of the nanopub item.
395
     *
396
     * @return this NanopubItem instance for method chaining
397
     */
398
    public NanopubItem hideHeader() {
399
        if (isInitialized) throw new RuntimeException("Nanopub item is already initialized");
×
400
        hideHeader = true;
×
401
        return this;
×
402
    }
403

404
    /**
405
     * Sets whether the header part of the nanopub item should be hidden.
406
     *
407
     * @param hideHeader true to hide header, false to show it
408
     * @return this NanopubItem instance for method chaining
409
     */
410
    public NanopubItem setHeaderHidden(boolean hideHeader) {
411
        if (isInitialized) throw new RuntimeException("Nanopub item is already initialized");
3!
412
        this.hideHeader = hideHeader;
3✔
413
        return this;
2✔
414
    }
415

416
    /**
417
     * Hides the footer part of the nanopub item.
418
     *
419
     * @return this NanopubItem instance for method chaining
420
     */
421
    public NanopubItem hideFooter() {
422
        if (isInitialized) throw new RuntimeException("Nanopub item is already initialized");
×
423
        hideFooter = true;
×
424
        return this;
×
425
    }
426

427
    /**
428
     * Sets whether the footer part of the nanopub item should be hidden.
429
     *
430
     * @param hideFooter true to hide footer, false to show it
431
     * @return this NanopubItem instance for method chaining
432
     */
433
    public NanopubItem setFooterHidden(boolean hideFooter) {
434
        if (isInitialized) throw new RuntimeException("Nanopub item is already initialized");
3!
435
        this.hideFooter = hideFooter;
3✔
436
        return this;
2✔
437
    }
438

439
    /**
440
     * Sets the nanopub item to a minimal state, hiding assertion, action menu, provenance, and pubinfo.
441
     *
442
     * @return this NanopubItem instance for method chaining
443
     */
444
    public NanopubItem setMinimal() {
445
        if (isInitialized) throw new RuntimeException("Nanopub item is already initialized");
×
446
        this.hideAssertion = true;
×
447
        this.hideActionMenu = true;
×
448
        setProvenanceHidden(true).setPubinfoHidden(true);
×
449
        return this;
×
450
    }
451

452
    /**
453
     * Adds the given actions to the nanopub item.
454
     *
455
     * @param a a {@link com.knowledgepixels.nanodash.action.NanopubAction} object
456
     * @return this NanopubItem instance for method chaining
457
     */
458
    public NanopubItem addActions(NanopubAction... a) {
459
        if (isInitialized) throw new RuntimeException("Nanopub item is already initialized");
×
460
        if (actions == null) actions = new ArrayList<>();
×
461
        for (NanopubAction na : a) {
×
462
            actions.add(na);
×
463
        }
464
        return this;
×
465
    }
466

467
    /**
468
     * Sets the nanopub item to have no actions.
469
     *
470
     * @return this NanopubItem instance for method chaining
471
     */
472
    public NanopubItem noActions() {
473
        if (isInitialized) throw new RuntimeException("Nanopub item is already initialized");
×
474
        actions = new ArrayList<>();
×
475
        return this;
×
476
    }
477

478
    /**
479
     * {@inheritDoc}
480
     */
481
    @Override
482
    protected void onBeforeRender() {
483
        initialize();
×
484
        super.onBeforeRender();
×
485
    }
×
486

487
    private void populateStatementItemList(TemplateContext context, ValueFiller filler, List<StatementItem> list) {
488
        context.initStatements();
×
489
        if (signerId != null) {
×
490
            context.getComponentModels().put(NTEMPLATE.CREATOR_PLACEHOLDER, Model.of(signerId.stringValue()));
×
491
        }
492
        filler.fill(context);
×
493
        for (StatementItem si : context.getStatementItems()) {
×
494
            if (si.isMatched()) {
×
495
                list.add(si);
×
496
            }
497
        }
×
498
    }
×
499

500
    private DataView<StatementItem> createStatementView(String elementId, List<StatementItem> list) {
501
        return new DataView<StatementItem>(elementId, new ListDataProvider<StatementItem>(list)) {
×
502

503
            private static final long serialVersionUID = 1L;
504

505
            @Override
506
            protected void populateItem(Item<StatementItem> item) {
507
                item.add(item.getModelObject());
×
508
            }
×
509

510
        };
511
    }
512

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