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

knowledgepixels / nanodash / 17380144000

01 Sep 2025 02:12PM UTC coverage: 12.03% (+0.05%) from 11.978%
17380144000

push

github

ashleycaselli
refactor: replace printStackTrace with logger.error for better error handling

330 of 3850 branches covered (8.57%)

Branch coverage included in aggregate %.

958 of 6857 relevant lines covered (13.97%)

0.62 hits per line

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

7.87
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 tempalteId;
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 tempalteId the ID of the template to use for rendering the assertion.
64
     */
65
    public NanopubItem(String id, NanopubElement n, String tempalteId) {
66
        super(id);
3✔
67
        this.n = n;
3✔
68
        this.tempalteId = tempalteId;
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
                }
×
186
            }
187
            // ----------
188

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

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

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

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

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

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

236
                private static final long serialVersionUID = 1L;
237

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

243
            });
244
        }
245
        add(assertion);
×
246

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

261
                private static final long serialVersionUID = 1L;
262

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

268
            });
269
        }
270
        add(provenance);
×
271

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

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

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

331
                private static final long serialVersionUID = 1L;
332

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

338
            });
339
        }
340
        add(pubInfo);
×
341

342
        isInitialized = true;
×
343
    }
×
344

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

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

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

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

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

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

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

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

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

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

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

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

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

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

501
            private static final long serialVersionUID = 1L;
502

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

508
        };
509
    }
510

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