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

knowledgepixels / nanodash / 18155160356

01 Oct 2025 07:42AM UTC coverage: 13.788% (-0.03%) from 13.817%
18155160356

push

github

ashleycaselli
docs: add missing or update Javadoc annotations

445 of 4084 branches covered (10.9%)

Branch coverage included in aggregate %.

1155 of 7520 relevant lines covered (15.36%)

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

3
import com.knowledgepixels.nanodash.*;
4
import com.knowledgepixels.nanodash.page.ExplorePage;
5
import com.knowledgepixels.nanodash.page.NanodashPage;
6
import com.knowledgepixels.nanodash.template.*;
7
import org.apache.commons.lang3.Strings;
8
import org.apache.wicket.Component;
9
import org.apache.wicket.RestartResponseException;
10
import org.apache.wicket.ajax.AjaxEventBehavior;
11
import org.apache.wicket.ajax.AjaxRequestTarget;
12
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
13
import org.apache.wicket.feedback.FeedbackMessage;
14
import org.apache.wicket.markup.html.WebMarkupContainer;
15
import org.apache.wicket.markup.html.WebPage;
16
import org.apache.wicket.markup.html.basic.Label;
17
import org.apache.wicket.markup.html.form.CheckBox;
18
import org.apache.wicket.markup.html.form.Form;
19
import org.apache.wicket.markup.html.form.FormComponent;
20
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
21
import org.apache.wicket.markup.html.list.ListItem;
22
import org.apache.wicket.markup.html.list.ListView;
23
import org.apache.wicket.markup.html.panel.FeedbackPanel;
24
import org.apache.wicket.markup.html.panel.Panel;
25
import org.apache.wicket.markup.repeater.Item;
26
import org.apache.wicket.markup.repeater.data.DataView;
27
import org.apache.wicket.markup.repeater.data.ListDataProvider;
28
import org.apache.wicket.model.IModel;
29
import org.apache.wicket.model.Model;
30
import org.apache.wicket.request.mapper.parameter.PageParameters;
31
import org.apache.wicket.validation.IValidatable;
32
import org.apache.wicket.validation.IValidator;
33
import org.apache.wicket.validation.ValidationError;
34
import org.eclipse.rdf4j.model.IRI;
35
import org.eclipse.rdf4j.model.Literal;
36
import org.eclipse.rdf4j.model.Statement;
37
import org.eclipse.rdf4j.model.ValueFactory;
38
import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
39
import org.eclipse.rdf4j.model.vocabulary.FOAF;
40
import org.eclipse.rdf4j.model.vocabulary.RDFS;
41
import org.nanopub.MalformedNanopubException;
42
import org.nanopub.Nanopub;
43
import org.nanopub.NanopubAlreadyFinalizedException;
44
import org.nanopub.NanopubCreator;
45
import org.nanopub.extra.security.SignNanopub;
46
import org.nanopub.extra.security.SignatureAlgorithm;
47
import org.nanopub.extra.security.TransformContext;
48
import org.nanopub.extra.server.PublishNanopub;
49
import org.nanopub.extra.services.ApiResponseEntry;
50
import org.nanopub.vocabulary.NPX;
51
import org.nanopub.vocabulary.NTEMPLATE;
52
import org.slf4j.Logger;
53
import org.slf4j.LoggerFactory;
54
import org.wicketstuff.select2.ChoiceProvider;
55
import org.wicketstuff.select2.Response;
56
import org.wicketstuff.select2.Select2Choice;
57

58
import java.lang.reflect.InvocationTargetException;
59
import java.util.*;
60

61
/**
62
 * Form for publishing a nanopublication.
63
 */
64
public class PublishForm extends Panel {
65

66
    private static final Logger logger = LoggerFactory.getLogger(PublishForm.class);
×
67

68
    private static ValueFactory vf = SimpleValueFactory.getInstance();
×
69

70
    private static String creatorPubinfoTemplateId = "https://w3id.org/np/RAukAcWHRDlkqxk7H2XNSegc1WnHI569INvNr-xdptDGI";
×
71
    private static String licensePubinfoTempalteId = "https://w3id.org/np/RA0J4vUn_dekg-U1kK3AOEt02p9mT2WO03uGxLDec1jLw";
×
72
    private static String defaultProvTemplateId = "https://w3id.org/np/RA7lSq6MuK_TIC6JMSHvLtee3lpLoZDOqLJCLXevnrPoU";
×
73
    private static String supersedesPubinfoTemplateId = "https://w3id.org/np/RAoTD7udB2KtUuOuAe74tJi1t3VzK0DyWS7rYVAq1GRvw";
×
74
    private static String derivesFromPubinfoTemplateId = "https://w3id.org/np/RARW4MsFkHuwjycNElvEVtuMjpf4yWDL10-0C5l2MqqRQ";
×
75

76
    private static String[] fixedPubInfoTemplates = new String[]{creatorPubinfoTemplateId, licensePubinfoTempalteId};
×
77

78
    /**
79
     * Fill modes for the nanopublication to be created.
80
     */
81
    public enum FillMode {
×
82
        /**
83
         * Use fill mode
84
         */
85
        USE,
×
86
        /**
87
         * Supersede fill mode
88
         */
89
        SUPERSEDE,
×
90
        /**
91
         * Derive fill mode
92
         */
93
        DERIVE
×
94
    }
95

96
    protected Form<?> form;
97
    protected FeedbackPanel feedbackPanel;
98
    private final TemplateContext assertionContext;
99
    private TemplateContext provenanceContext;
100
    private List<TemplateContext> pubInfoContexts = new ArrayList<>();
×
101
    private Map<String, TemplateContext> pubInfoContextMap = new HashMap<>();
×
102
    private List<TemplateContext> requiredPubInfoContexts = new ArrayList<>();
×
103
    private String targetNamespace;
104
    private Class<? extends WebPage> confirmPageClass;
105

106
    /**
107
     * Constructor for the PublishForm.
108
     *
109
     * @param id               the Wicket component ID
110
     * @param pageParams       the parameters for the page, which may include information on how to fill the form
111
     * @param publishPageClass the class of the page to redirect to after successful publication
112
     * @param confirmPageClass the class of the confirmation page to show after publication
113
     */
114
    public PublishForm(String id, final PageParameters pageParams, Class<? extends WebPage> publishPageClass, Class<? extends WebPage> confirmPageClass) {
115
        super(id);
×
116
        setOutputMarkupId(true);
×
117
        this.confirmPageClass = confirmPageClass;
×
118

119
        WebMarkupContainer linkMessageItem = new WebMarkupContainer("link-message-item");
×
120
        if (pageParams.get("link-message").isNull()) {
×
121
            linkMessageItem.add(new Label("link-message", ""));
×
122
            linkMessageItem.setVisible(false);
×
123
        } else {
124
            linkMessageItem.add(new Label("link-message", Utils.sanitizeHtml(pageParams.get("link-message").toString())).setEscapeModelStrings(false));
×
125
        }
126
        add(linkMessageItem);
×
127

128
        final Nanopub fillNp;
129
        final FillMode fillMode;
130
        boolean fillOnlyAssertion = false;
×
131
        if (!pageParams.get("use").isNull()) {
×
132
            fillNp = Utils.getNanopub(pageParams.get("use").toString());
×
133
            fillMode = FillMode.USE;
×
134
        } else if (!pageParams.get("use-a").isNull()) {
×
135
            fillNp = Utils.getNanopub(pageParams.get("use-a").toString());
×
136
            fillMode = FillMode.USE;
×
137
            fillOnlyAssertion = true;
×
138
        } else if (!pageParams.get("supersede").isNull()) {
×
139
            fillNp = Utils.getNanopub(pageParams.get("supersede").toString());
×
140
            fillMode = FillMode.SUPERSEDE;
×
141
            targetNamespace = pageParams.get("supersede").toString().replaceFirst("RA[A-Za-z0-9-_]{43}$", "");
×
142
        } else if (!pageParams.get("supersede-a").isNull()) {
×
143
            fillNp = Utils.getNanopub(pageParams.get("supersede-a").toString());
×
144
            fillMode = FillMode.SUPERSEDE;
×
145
            fillOnlyAssertion = true;
×
146
        } else if (!pageParams.get("derive").isNull()) {
×
147
            fillNp = Utils.getNanopub(pageParams.get("derive").toString());
×
148
            fillMode = FillMode.DERIVE;
×
149
        } else if (!pageParams.get("derive-a").isNull()) {
×
150
            fillNp = Utils.getNanopub(pageParams.get("derive-a").toString());
×
151
            fillMode = FillMode.DERIVE;
×
152
            fillOnlyAssertion = true;
×
153
        } else if (!pageParams.get("fill-all").isNull()) {
×
154
            // TODO: This is deprecated and should be removed at some point
155
            fillNp = Utils.getNanopub(pageParams.get("fill-all").toString());
×
156
            fillMode = FillMode.USE;
×
157
        } else if (!pageParams.get("fill").isNull()) {
×
158
            // TODO: This is deprecated and should be removed at some point
159
            fillNp = Utils.getNanopub(pageParams.get("fill").toString());
×
160
            fillMode = FillMode.SUPERSEDE;
×
161
        } else {
162
            fillNp = null;
×
163
            fillMode = null;
×
164
        }
165

166
        final TemplateData td = TemplateData.get();
×
167

168
        // TODO Properly integrate this namespace feature:
169
        String templateId = pageParams.get("template").toString();
×
170
        if (td.getTemplate(templateId).getTargetNamespace() != null) {
×
171
            targetNamespace = td.getTemplate(templateId).getTargetNamespace();
×
172
        }
173
        if (!pageParams.get("target-namespace").isNull()) {
×
174
            targetNamespace = pageParams.get("target-namespace").toString();
×
175
        }
176
        if (targetNamespace == null) {
×
177
            targetNamespace = Template.DEFAULT_TARGET_NAMESPACE;
×
178
        }
179
        String targetNamespaceLabel = targetNamespace + "...";
×
180
        targetNamespace = targetNamespace + "~~~ARTIFACTCODE~~~/";
×
181

182
        assertionContext = new TemplateContext(ContextType.ASSERTION, templateId, "statement", targetNamespace);
×
183
        assertionContext.setFillMode(fillMode);
×
184
        final String prTemplateId;
185
        if (pageParams.get("prtemplate").toString() != null) {
×
186
            prTemplateId = pageParams.get("prtemplate").toString();
×
187
        } else {
188
            if (fillNp != null && !fillOnlyAssertion) {
×
189
                if (td.getProvenanceTemplateId(fillNp) != null) {
×
190
                    prTemplateId = td.getProvenanceTemplateId(fillNp).stringValue();
×
191
                } else {
192
                    prTemplateId = "http://purl.org/np/RAcm8OurwUk15WOgBM9wySo-T3a5h6as4K8YR5MBrrxUc";
×
193
                }
194
            } else if (assertionContext.getTemplate().getDefaultProvenance() != null) {
×
195
                prTemplateId = assertionContext.getTemplate().getDefaultProvenance().stringValue();
×
196
            } else {
197
                prTemplateId = defaultProvTemplateId;
×
198
            }
199
        }
200
        provenanceContext = new TemplateContext(ContextType.PROVENANCE, prTemplateId, "pr-statement", targetNamespace);
×
201
        for (String t : fixedPubInfoTemplates) {
×
202
            // TODO consistently check for latest versions of templates here and below:
203
            TemplateContext c = new TemplateContext(ContextType.PUBINFO, t, "pi-statement", targetNamespace);
×
204
            pubInfoContexts.add(c);
×
205
            pubInfoContextMap.put(c.getTemplate().getId(), c);
×
206
            requiredPubInfoContexts.add(c);
×
207
        }
208
        if (fillMode == FillMode.SUPERSEDE) {
×
209
            TemplateContext c = new TemplateContext(ContextType.PUBINFO, supersedesPubinfoTemplateId, "pi-statement", targetNamespace);
×
210
            pubInfoContexts.add(c);
×
211
            pubInfoContextMap.put(supersedesPubinfoTemplateId, c);
×
212
            //requiredPubInfoContexts.add(c);
213
            c.setParam("np", fillNp.getUri().stringValue());
×
214
        } else if (fillMode == FillMode.DERIVE) {
×
215
            TemplateContext c = new TemplateContext(ContextType.PUBINFO, derivesFromPubinfoTemplateId, "pi-statement", targetNamespace);
×
216
            pubInfoContexts.add(c);
×
217
            pubInfoContextMap.put(derivesFromPubinfoTemplateId, c);
×
218
            c.setParam("np", fillNp.getUri().stringValue());
×
219
        }
220
        for (IRI r : assertionContext.getTemplate().getRequiredPubinfoElements()) {
×
221
            String latestId = QueryApiAccess.getLatestVersionId(r.stringValue());
×
222
            if (pubInfoContextMap.containsKey(r.stringValue()) || pubInfoContextMap.containsKey(latestId)) continue;
×
223
            TemplateContext c = new TemplateContext(ContextType.PUBINFO, r.stringValue(), "pi-statement", targetNamespace);
×
224
            pubInfoContexts.add(c);
×
225
            pubInfoContextMap.put(c.getTemplateId(), c);
×
226
            requiredPubInfoContexts.add(c);
×
227
        }
×
228
        Map<Integer, TemplateContext> piParamIdMap = new HashMap<>();
×
229
        for (String k : pageParams.getNamedKeys()) {
×
230
            if (!k.matches("pitemplate[1-9][0-9]*")) continue;
×
231
            Integer i = Integer.parseInt(k.replaceFirst("^pitemplate([1-9][0-9]*)$", "$1"));
×
232
            String tid = pageParams.get(k).toString();
×
233
            // TODO Allow for automatically using latest template version:
234
            //String piTempalteIdLatest = QueryApiAccess.getLatestVersionId(tid);
235
            TemplateContext c = createPubinfoContext(tid);
×
236
            if (piParamIdMap.containsKey(i)) {
×
237
                // TODO: handle this error better
238
                logger.error("ERROR: pitemplate param identifier assigned multiple times: {}", i);
×
239
            }
240
            piParamIdMap.put(i, c);
×
241
        }
×
242
        if (fillNp != null && !fillOnlyAssertion) {
×
243
            for (IRI piTemplateId : td.getPubinfoTemplateIds(fillNp)) {
×
244
                String piTempalteIdLatest = QueryApiAccess.getLatestVersionId(piTemplateId.stringValue());
×
245
                if (piTempalteIdLatest.equals(supersedesPubinfoTemplateId)) continue;
×
246
                if (!pubInfoContextMap.containsKey(piTempalteIdLatest)) {
×
247
                    // TODO Allow for automatically using latest template version
248
                    createPubinfoContext(piTemplateId.stringValue());
×
249
                }
250
            }
×
251
        }
252
        for (String k : pageParams.getNamedKeys()) {
×
253
            if (k.startsWith("param_")) assertionContext.setParam(k.substring(6), pageParams.get(k).toString());
×
254
            if (k.startsWith("prparam_")) provenanceContext.setParam(k.substring(8), pageParams.get(k).toString());
×
255
            if (k.matches("piparam[1-9][0-9]*_.*")) {
×
256
                Integer i = Integer.parseInt(k.replaceFirst("^piparam([1-9][0-9]*)_.*$", "$1"));
×
257
                if (!piParamIdMap.containsKey(i)) {
×
258
                    // TODO: handle this error better
259
                    logger.error("ERROR: pitemplate param identifier not found: {}", i);
×
260
                    continue;
×
261
                }
262
                String n = k.replaceFirst("^piparam[1-9][0-9]*_(.*)$", "$1");
×
263
                logger.info(n);
×
264
                piParamIdMap.get(i).setParam(n, pageParams.get(k).toString());
×
265
            }
266
        }
×
267

268
        // Init statements only now, in order to pick up parameter values:
269
        assertionContext.initStatements();
×
270
        provenanceContext.initStatements();
×
271
        for (TemplateContext c : pubInfoContexts) {
×
272
            c.initStatements();
×
273
        }
×
274

275
        String latestAssertionId = QueryApiAccess.getLatestVersionId(assertionContext.getTemplateId());
×
276
        if (!assertionContext.getTemplateId().equals(latestAssertionId)) {
×
277
            add(new Label("newversion", "There is a new version of this assertion template:"));
×
278
            PageParameters params = new PageParameters(pageParams);
×
279
            params.set("template", latestAssertionId).remove("formobj");
×
280
            add(new BookmarkablePageLink<Void>("newversionlink", publishPageClass, params));
×
281
            if ("latest".equals(pageParams.get("template-version").toString())) {
×
282
                throw new RestartResponseException(publishPageClass, params);
×
283
            }
284
        } else {
×
285
            add(new Label("newversion", "").setVisible(false));
×
286
            add(new Label("newversionlink", "").setVisible(false));
×
287
        }
288

289
        final Nanopub improveNp;
290
        if (!pageParams.get("improve").isNull()) {
×
291
            improveNp = Utils.getNanopub(pageParams.get("improve").toString());
×
292
        } else {
293
            improveNp = null;
×
294
        }
295

296
        final List<Statement> unusedStatementList = new ArrayList<>();
×
297
        final List<Statement> unusedPrStatementList = new ArrayList<>();
×
298
        final List<Statement> unusedPiStatementList = new ArrayList<>();
×
299
        if (fillNp != null) {
×
300
            ValueFiller filler = new ValueFiller(fillNp, ContextType.ASSERTION, true, fillMode);
×
301
            filler.fill(assertionContext);
×
302
            unusedStatementList.addAll(filler.getUnusedStatements());
×
303

304
            if (!fillOnlyAssertion) {
×
305
                ValueFiller prFiller = new ValueFiller(fillNp, ContextType.PROVENANCE, true);
×
306
                prFiller.fill(provenanceContext);
×
307
                unusedPrStatementList.addAll(prFiller.getUnusedStatements());
×
308

309
                ValueFiller piFiller = new ValueFiller(fillNp, ContextType.PUBINFO, true);
×
310
                if (!assertionContext.getTemplate().getTargetNanopubTypes().isEmpty()) {
×
311
                    for (Statement st : new ArrayList<>(piFiller.getUnusedStatements())) {
×
312
                        if (st.getSubject().stringValue().equals(LocalUri.PREFIX + "nanopub") && st.getPredicate().equals(NPX.HAS_NANOPUB_TYPE)) {
×
313
                            if (assertionContext.getTemplate().getTargetNanopubTypes().contains(st.getObject())) {
×
314
                                piFiller.removeUnusedStatement(st);
×
315
                            }
316
                        }
317
                    }
×
318
                }
319
                for (TemplateContext c : pubInfoContexts) {
×
320
                    piFiller.fill(c);
×
321
                }
×
322
                piFiller.removeUnusedStatements(NanodashSession.get().getUserIri(), FOAF.NAME, null);
×
323
                if (piFiller.hasUnusedStatements()) {
×
324
                    final String handcodedStatementsTemplateId = "https://w3id.org/np/RAMEgudZsQ1bh1fZhfYnkthqH6YSXpghSE_DEN1I-6eAI";
×
325
                    if (!pubInfoContextMap.containsKey(handcodedStatementsTemplateId)) {
×
326
                        TemplateContext c = createPubinfoContext(handcodedStatementsTemplateId);
×
327
                        c.initStatements();
×
328
                        piFiller.fill(c);
×
329
                    }
330
                }
331
                unusedPiStatementList.addAll(piFiller.getUnusedStatements());
×
332
                // TODO: Also use pubinfo templates stated in nanopub to be filled in?
333
//                                Set<IRI> pubinfoTemplateIds = Template.getPubinfoTemplateIds(fillNp);
334
//                                if (!pubinfoTemplateIds.isEmpty()) {
335
//                                        ValueFiller piFiller = new ValueFiller(fillNp, ContextType.PUBINFO);
336
//                                        for (IRI pubinfoTemplateId : pubinfoTemplateIds) {
337
//                                                // TODO: Make smart choice on the ordering in trying to fill in all pubinfo elements
338
//                                                piFiller.fill(pubInfoContextMap.get(pubinfoTemplateId.stringValue()));
339
//                                        }
340
//                                        warningMessage += (piFiller.getWarningMessage() == null ? "" : "Publication info: " + piFiller.getWarningMessage() + " ");
341
//                                }
342
            }
343
        } else if (improveNp != null) {
×
344
            ValueFiller filler = new ValueFiller(improveNp, ContextType.ASSERTION, true);
×
345
            filler.fill(assertionContext);
×
346
            unusedStatementList.addAll(filler.getUnusedStatements());
×
347
        }
348
        if (!unusedStatementList.isEmpty()) {
×
349
            add(new Label("warnings", "Some content from the existing nanopublication could not be filled in:"));
×
350
        } else {
351
            add(new Label("warnings", "").setVisible(false));
×
352
        }
353
        add(new DataView<Statement>("unused-statements", new ListDataProvider<Statement>(unusedStatementList)) {
×
354

355
            @Override
356
            protected void populateItem(Item<Statement> item) {
357
                item.add(new TripleItem("unused-statement", item.getModelObject(), (fillNp != null ? fillNp : improveNp), null));
×
358
            }
×
359

360
        });
361
        add(new DataView<Statement>("unused-prstatements", new ListDataProvider<Statement>(unusedPrStatementList)) {
×
362

363
            @Override
364
            protected void populateItem(Item<Statement> item) {
365
                item.add(new TripleItem("unused-prstatement", item.getModelObject(), (fillNp != null ? fillNp : improveNp), null));
×
366
            }
×
367

368
        });
369
        add(new DataView<Statement>("unused-pistatements", new ListDataProvider<Statement>(unusedPiStatementList)) {
×
370

371
            @Override
372
            protected void populateItem(Item<Statement> item) {
373
                item.add(new TripleItem("unused-pistatement", item.getModelObject(), (fillNp != null ? fillNp : improveNp), null));
×
374
            }
×
375

376
        });
377

378
        // Finalize statements, which picks up parameter values in repetitions:
379
        assertionContext.finalizeStatements();
×
380
        provenanceContext.finalizeStatements();
×
381
        for (TemplateContext c : pubInfoContexts) {
×
382
            c.finalizeStatements();
×
383
        }
×
384

385
        final CheckBox consentCheck = new CheckBox("consentcheck", new Model<>(false));
×
386
        consentCheck.setRequired(true);
×
387
        consentCheck.add(new InvalidityHighlighting());
×
388
        consentCheck.add(new IValidator<Boolean>() {
×
389

390
            @Override
391
            public void validate(IValidatable<Boolean> validatable) {
392
                if (!Boolean.TRUE.equals(validatable.getValue())) {
×
393
                    validatable.error(new ValidationError("You need to check the checkbox that you understand the consequences."));
×
394
                }
395
            }
×
396

397
        });
398

399
        form = new Form<Void>("form") {
×
400

401
            @Override
402
            protected void onConfigure() {
403
                super.onConfigure();
×
404
                form.getFeedbackMessages().clear();
×
405
//                                formComponents.clear();
406
            }
×
407

408
            protected void onSubmit() {
409
                logger.info("Publish form submitted");
×
410
                Nanopub signedNp = null;
×
411
                try {
412
                    Nanopub np = createNanopub();
×
413
                    logger.info("Nanopublication created: {}", np.getUri());
×
414
                    TransformContext tc = new TransformContext(SignatureAlgorithm.RSA, NanodashSession.get().getKeyPair(), NanodashSession.get().getUserIri(), false, false, false);
×
415
                    signedNp = SignNanopub.signAndTransform(np, tc);
×
416
                    logger.info("Nanopublication signed: {}", signedNp.getUri());
×
417
                    String npUrl = PublishNanopub.publish(signedNp);
×
418
                    logger.info("Nanopublication published: {}", npUrl);
×
419
                } catch (Exception ex) {
×
420
                    signedNp = null;
×
421
                    logger.error("Nanopublication publishing failed: {}", ex.getMessage());
×
422
                    String message = ex.getClass().getName();
×
423
                    if (ex.getMessage() != null) message = ex.getMessage();
×
424
                    feedbackPanel.error(message);
×
425
                }
×
426
                if (signedNp != null) {
×
427
                    throw new RestartResponseException(getConfirmPage(signedNp, pageParams));
×
428
                } else {
429
                    logger.error("Nanopublication publishing failed");
×
430
                }
431
            }
×
432

433
            @Override
434
            protected void onValidate() {
435
                super.onValidate();
×
436
                for (Component fc : assertionContext.getComponents()) {
×
437
                    processFeedback(fc);
×
438
                }
×
439
                for (Component fc : provenanceContext.getComponents()) {
×
440
                    processFeedback(fc);
×
441
                }
×
442
                for (TemplateContext c : pubInfoContexts) {
×
443
                    for (Component fc : c.getComponents()) {
×
444
                        processFeedback(fc);
×
445
                    }
×
446
                }
×
447
            }
×
448

449
            private void processFeedback(Component c) {
450
                if (c instanceof FormComponent) {
×
451
                    ((FormComponent<?>) c).processInput();
×
452
                }
453
                for (FeedbackMessage fm : c.getFeedbackMessages()) {
×
454
                    form.getFeedbackMessages().add(fm);
×
455
                }
×
456
            }
×
457

458
        };
459
        form.setOutputMarkupId(true);
×
460

461
        form.add(new Label("nanopub-namespace", targetNamespaceLabel));
×
462

463
        form.add(new BookmarkablePageLink<Void>("templatelink", ExplorePage.class, new PageParameters().add("id", assertionContext.getTemplate().getId())));
×
464
        form.add(new Label("templatename", assertionContext.getTemplate().getLabel()));
×
465
        String description = assertionContext.getTemplate().getLabel();
×
466
        if (description == null) description = "";
×
467
        form.add(new Label("templatedesc", assertionContext.getTemplate().getDescription()).setEscapeModelStrings(false));
×
468

469
        form.add(new ListView<StatementItem>("statements", assertionContext.getStatementItems()) {
×
470

471
            protected void populateItem(ListItem<StatementItem> item) {
472
                item.add(item.getModelObject());
×
473
            }
×
474

475
        });
476

477
        final Map<String, Boolean> handledProvTemplates = new HashMap<>();
×
478
        final String defaultProvTemplateId;
479
        if (assertionContext.getTemplate().getDefaultProvenance() != null) {
×
480
            defaultProvTemplateId = assertionContext.getTemplate().getDefaultProvenance().stringValue();
×
481
            handledProvTemplates.put(defaultProvTemplateId, true);
×
482
        } else {
483
            defaultProvTemplateId = null;
×
484
        }
485
        final List<String> recommendedProvTemplateOptionIds = new ArrayList<>();
×
486
        final List<String> provTemplateOptionIds = new ArrayList<>();
×
487
        if (pageParams.get("prtemplate-options").isNull()) {
×
488
            // TODO Make this dynamic and consider updated templates:
489
            recommendedProvTemplateOptionIds.add("https://w3id.org/np/RA7lSq6MuK_TIC6JMSHvLtee3lpLoZDOqLJCLXevnrPoU");
×
490
            recommendedProvTemplateOptionIds.add("http://purl.org/np/RAcTpoh5Ra0ssqmcpOgWdaZ_YiPE6demO6cpw-2RvSNs8");
×
491
            recommendedProvTemplateOptionIds.add("http://purl.org/np/RA4LGtuOqTIMqVAkjnfBXk1YDcAPNadP5CGiaJiBkdHCQ");
×
492
            recommendedProvTemplateOptionIds.add("http://purl.org/np/RAl_-VTw9Re_uRF8r8y0rjlfnu7FlhTa8xg_8xkcweqiE");
×
493
            recommendedProvTemplateOptionIds.add("https://w3id.org/np/RASORV2mMEVpS4lWh2bwUTEcV-RWjbD9RPbN7J0PIeYAU");
×
494
            recommendedProvTemplateOptionIds.add("http://purl.org/np/RAjkBbM5yQm7hKH1l_Jk3HAUqWi3Bd57TPmAOZCsZmi_M");
×
495
            recommendedProvTemplateOptionIds.add("http://purl.org/np/RAGXx_k9eQMnXaCbsXMsJbGClwZtQEGNg0GVJu6amdAVw");
×
496
            recommendedProvTemplateOptionIds.add("http://purl.org/np/RA1fnITI3Pu1UQ0CHghNpys3JwQrM32LBnjmDLoayp9-4");
×
497
            recommendedProvTemplateOptionIds.add("http://purl.org/np/RAJgbsGeGdTG-zq_gU0TLw4s3raMgoRk-mPlc2DSLXvE0");
×
498
            recommendedProvTemplateOptionIds.add("http://purl.org/np/RA6SXfhUY-xeblZU8HhPddw6tsu-C5NXevG6C_zv4bMxU");
×
499
            for (String s : recommendedProvTemplateOptionIds) {
×
500
                handledProvTemplates.put(s, true);
×
501
            }
×
502

503
            for (ApiResponseEntry t : td.getProvenanceTemplates()) {
×
504
                String tid = t.get("np");
×
505
                if (handledProvTemplates.containsKey(tid)) continue;
×
506
                provTemplateOptionIds.add(tid);
×
507
                handledProvTemplates.put(tid, true);
×
508
            }
×
509
        } else {
510
            for (String s : pageParams.get("prtemplate-options").toString().split(" ")) {
×
511
                if (handledProvTemplates.containsKey(s)) continue;
×
512
                recommendedProvTemplateOptionIds.add(s);
×
513
                handledProvTemplates.put(s, true);
×
514
            }
515
        }
516

517
        ChoiceProvider<String> prTemplateChoiceProvider = new ChoiceProvider<String>() {
×
518

519
            @Override
520
            public String getDisplayValue(String object) {
521
                if (object == null || object.isEmpty()) return "";
×
522
                Template t = td.getTemplate(object);
×
523
                if (t != null) return t.getLabel();
×
524
                return object;
×
525
            }
526

527
            @Override
528
            public String getIdValue(String object) {
529
                return object;
×
530
            }
531

532
            // Getting strange errors with Tomcat if this method is not overridden:
533
            @Override
534
            public void detach() {
535
            }
×
536

537
            @Override
538
            public void query(String term, int page, Response<String> response) {
539
                if (term == null) term = "";
×
540
                term = term.toLowerCase();
×
541
                if (pageParams.get("prtemplate").toString() != null) {
×
542
                    // Using this work-around with "——" because 'optgroup' is not available through Wicket's Select2 classes
543
                    response.add("—— default for this link ——");
×
544
                    response.add(prTemplateId);
×
545
                }
546
                if (defaultProvTemplateId != null) {
×
547
                    response.add("—— default for this template ——");
×
548
                    response.add(defaultProvTemplateId);
×
549
                }
550
                if (!recommendedProvTemplateOptionIds.isEmpty()) {
×
551
                    if (pageParams.get("prtemplate-options").isNull()) {
×
552
                        response.add("—— recommended ——");
×
553
                    }
554
                    for (String s : recommendedProvTemplateOptionIds) {
×
555
                        if (s.toLowerCase().contains(term) || getDisplayValue(s).toLowerCase().contains(term)) {
×
556
                            response.add(s);
×
557
                        }
558
                    }
×
559
                }
560
                if (!provTemplateOptionIds.isEmpty()) {
×
561
                    response.add("—— others ——");
×
562
                    for (String s : provTemplateOptionIds) {
×
563
                        if (s.toLowerCase().contains(term) || getDisplayValue(s).toLowerCase().contains(term)) {
×
564
                            response.add(s);
×
565
                        }
566
                    }
×
567
                }
568
            }
×
569

570
            @Override
571
            public Collection<String> toChoices(Collection<String> ids) {
572
                return ids;
×
573
            }
574

575
        };
576
        final IModel<String> prTemplateModel = Model.of(provenanceContext.getTemplate().getId());
×
577
        Select2Choice<String> prTemplateChoice = new Select2Choice<String>("prtemplate", prTemplateModel, prTemplateChoiceProvider);
×
578
        prTemplateChoice.setRequired(true);
×
579
        prTemplateChoice.getSettings().setCloseOnSelect(true);
×
580
        prTemplateChoice.add(new AjaxFormComponentUpdatingBehavior("change") {
×
581

582
            @Override
583
            protected void onUpdate(AjaxRequestTarget target) {
584
                String o = prTemplateModel.getObject();
×
585
                if (o.startsWith("——")) {
×
586
                    o = provenanceContext.getTemplate().getId();
×
587
                    prTemplateModel.setObject(o);
×
588
                }
589
                provenanceContext = new TemplateContext(ContextType.PROVENANCE, prTemplateModel.getObject(), "pr-statement", targetNamespace);
×
590
                provenanceContext.initStatements();
×
591
                refreshProvenance(target);
×
592
                provenanceContext.finalizeStatements();
×
593
            }
×
594

595
        });
596
        form.add(prTemplateChoice);
×
597
        refreshProvenance(null);
×
598

599
        final Map<String, Boolean> handledPiTemplates = new HashMap<>();
×
600
        final List<String> recommendedPiTemplateOptionIds = new ArrayList<>();
×
601
        final List<String> piTemplateOptionIds = new ArrayList<>();
×
602
        // TODO Make this dynamic and consider updated templates:
603
        recommendedPiTemplateOptionIds.add("http://purl.org/np/RAXflINqt3smqxV5Aq7E9lzje4uLdkKIOefa6Bp8oJ8CY");
×
604
        recommendedPiTemplateOptionIds.add("https://w3id.org/np/RARW4MsFkHuwjycNElvEVtuMjpf4yWDL10-0C5l2MqqRQ");
×
605
        recommendedPiTemplateOptionIds.add("https://w3id.org/np/RA16U9Wo30ObhrK1NzH7EsmVRiRtvEuEA_Dfc-u8WkUCA");
×
606
        recommendedPiTemplateOptionIds.add("http://purl.org/np/RAdyqI6k07V5nAS82C6hvIDtNWk179EIV4DV-sLbOFKg4");
×
607
        recommendedPiTemplateOptionIds.add("https://w3id.org/np/RAjvEpLZUE7rMoa8q6mWSsN6utJDp-5FmgO47YGsbgw3w");
×
608
        recommendedPiTemplateOptionIds.add("http://purl.org/np/RAxuGRKID6yNg63V5Mf0ot2NjncOnodh-mkN3qT_1txGI");
×
609
        for (TemplateContext c : pubInfoContexts) {
×
610
            String s = c.getTemplate().getId();
×
611
            handledPiTemplates.put(s, true);
×
612
        }
×
613
        for (String s : recommendedPiTemplateOptionIds) {
×
614
            handledPiTemplates.put(s, true);
×
615
        }
×
616

617
        for (ApiResponseEntry entry : td.getPubInfoTemplates()) {
×
618
            String tid = entry.get("np");
×
619
            if (handledPiTemplates.containsKey(tid)) continue;
×
620
            piTemplateOptionIds.add(tid);
×
621
            handledPiTemplates.put(tid, true);
×
622
        }
×
623

624
        ChoiceProvider<String> piTemplateChoiceProvider = new ChoiceProvider<String>() {
×
625

626
            @Override
627
            public String getDisplayValue(String object) {
628
                if (object == null || object.isEmpty()) return "";
×
629
                Template t = td.getTemplate(object);
×
630
                if (t != null) return t.getLabel();
×
631
                return object;
×
632
            }
633

634
            @Override
635
            public String getIdValue(String object) {
636
                return object;
×
637
            }
638

639
            // Getting strange errors with Tomcat if this method is not overridden:
640
            @Override
641
            public void detach() {
642
            }
×
643

644
            @Override
645
            public void query(String term, int page, Response<String> response) {
646
                if (term == null) term = "";
×
647
                term = term.toLowerCase();
×
648
                if (!recommendedPiTemplateOptionIds.isEmpty()) {
×
649
                    response.add("—— recommended ——");
×
650
                    for (String s : recommendedPiTemplateOptionIds) {
×
651
                        boolean isAlreadyUsed = false;
×
652
                        for (TemplateContext c : pubInfoContexts) {
×
653
                            // TODO: make this more efficient/nicer
654
                            if (c.getTemplate().getId().equals(s)) {
×
655
                                isAlreadyUsed = true;
×
656
                                break;
×
657
                            }
658
                        }
×
659
                        if (isAlreadyUsed) continue;
×
660
                        if (s.toLowerCase().contains(term) || getDisplayValue(s).toLowerCase().contains(term)) {
×
661
                            response.add(s);
×
662
                        }
663
                    }
×
664
                }
665
                if (!piTemplateOptionIds.isEmpty()) {
×
666
                    response.add("—— others ——");
×
667
                    for (String s : piTemplateOptionIds) {
×
668
                        boolean isAlreadyUsed = false;
×
669
                        for (TemplateContext c : pubInfoContexts) {
×
670
                            // TODO: make this more efficient/nicer
671
                            if (c.getTemplate().getId().equals(s)) {
×
672
                                isAlreadyUsed = true;
×
673
                                break;
×
674
                            }
675
                        }
×
676
                        if (isAlreadyUsed) continue;
×
677
                        if (s.toLowerCase().contains(term) || getDisplayValue(s).toLowerCase().contains(term)) {
×
678
                            response.add(s);
×
679
                        }
680
                    }
×
681
                }
682
            }
×
683

684
            @Override
685
            public Collection<String> toChoices(Collection<String> ids) {
686
                return ids;
×
687
            }
688

689
        };
690
        final IModel<String> newPiTemplateModel = Model.of();
×
691
        Select2Choice<String> piTemplateChoice = new Select2Choice<String>("pitemplate", newPiTemplateModel, piTemplateChoiceProvider);
×
692
        piTemplateChoice.getSettings().setCloseOnSelect(true);
×
693
        piTemplateChoice.getSettings().setPlaceholder("add element...");
×
694
        piTemplateChoice.add(new AjaxFormComponentUpdatingBehavior("change") {
×
695

696
            @Override
697
            protected void onUpdate(AjaxRequestTarget target) {
698
                if (newPiTemplateModel.getObject().startsWith("——")) {
×
699
                    newPiTemplateModel.setObject(null);
×
700
                    refreshPubInfo(target);
×
701
                    return;
×
702
                }
703
                String id = newPiTemplateModel.getObject();
×
704
                TemplateContext c = new TemplateContext(ContextType.PUBINFO, id, "pi-statement", targetNamespace);
×
705
                c.initStatements();
×
706
                pubInfoContexts.add(c);
×
707
                newPiTemplateModel.setObject(null);
×
708
                refreshPubInfo(target);
×
709
                c.finalizeStatements();
×
710
            }
×
711

712
        });
713
        form.add(piTemplateChoice);
×
714
        refreshPubInfo(null);
×
715

716
        form.add(consentCheck);
×
717
        add(form);
×
718

719
        feedbackPanel = new FeedbackPanel("feedback");
×
720
        feedbackPanel.setOutputMarkupId(true);
×
721
        add(feedbackPanel);
×
722
    }
×
723

724
    private void refreshProvenance(AjaxRequestTarget target) {
725
        if (target != null) {
×
726
            form.remove("prtemplatelink");
×
727
            form.remove("pr-statements");
×
728
            target.add(form);
×
729
            target.appendJavaScript("updateElements();");
×
730
        }
731
        form.add(new BookmarkablePageLink<Void>("prtemplatelink", ExplorePage.class, new PageParameters().add("id", provenanceContext.getTemplate().getId())));
×
732
        ListView<StatementItem> list = new ListView<StatementItem>("pr-statements", provenanceContext.getStatementItems()) {
×
733

734
            protected void populateItem(ListItem<StatementItem> item) {
735
                item.add(item.getModelObject());
×
736
            }
×
737

738
        };
739
        list.setOutputMarkupId(true);
×
740
        form.add(list);
×
741
    }
×
742

743
    private void refreshPubInfo(AjaxRequestTarget target) {
744
        ListView<TemplateContext> list = new ListView<TemplateContext>("pis", pubInfoContexts) {
×
745

746
            protected void populateItem(ListItem<TemplateContext> item) {
747
                final TemplateContext pic = item.getModelObject();
×
748
                item.add(new Label("pitemplatename", pic.getTemplate().getLabel()));
×
749
                item.add(new BookmarkablePageLink<Void>("pitemplatelink", ExplorePage.class, new PageParameters().add("id", pic.getTemplate().getId())));
×
750
                Label remove = new Label("piremove", "×");
×
751
                item.add(remove);
×
752
                remove.add(new AjaxEventBehavior("click") {
×
753

754
                    @Override
755
                    protected void onEvent(AjaxRequestTarget target) {
756
                        pubInfoContexts.remove(pic);
×
757
                        target.add(PublishForm.this);
×
758
                        target.appendJavaScript("updateElements();");
×
759
                    }
×
760

761
                });
762
                if (requiredPubInfoContexts.contains(pic)) remove.setVisible(false);
×
763
                item.add(new ListView<StatementItem>("pi-statements", pic.getStatementItems()) {
×
764

765
                    protected void populateItem(ListItem<StatementItem> item) {
766
                        item.add(item.getModelObject());
×
767
                    }
×
768

769
                });
770
            }
×
771

772
        };
773
        list.setOutputMarkupId(true);
×
774
        if (target == null) {
×
775
            form.add(list);
×
776
        } else {
777
            form.remove("pis");
×
778
            form.add(list);
×
779
            target.add(form);
×
780
            target.appendJavaScript("updateElements();");
×
781
        }
782
    }
×
783

784
    private TemplateContext createPubinfoContext(String piTemplateId) {
785
        TemplateContext c;
786
        if (pubInfoContextMap.containsKey(piTemplateId)) {
×
787
            c = pubInfoContextMap.get(piTemplateId);
×
788
        } else {
789
            c = new TemplateContext(ContextType.PUBINFO, piTemplateId, "pi-statement", targetNamespace);
×
790
            pubInfoContextMap.put(piTemplateId, c);
×
791
            pubInfoContexts.add(c);
×
792
        }
793
        return c;
×
794
    }
795

796
    private synchronized Nanopub createNanopub() throws MalformedNanopubException, NanopubAlreadyFinalizedException {
797
        assertionContext.getIntroducedIris().clear();
×
798
        NanopubCreator npCreator = new NanopubCreator(targetNamespace);
×
799
        npCreator.setAssertionUri(vf.createIRI(targetNamespace + "assertion"));
×
800
        assertionContext.propagateStatements(npCreator);
×
801
        provenanceContext.propagateStatements(npCreator);
×
802
        for (TemplateContext c : pubInfoContexts) {
×
803
            c.propagateStatements(npCreator);
×
804
        }
×
805
        for (IRI introducedIri : assertionContext.getIntroducedIris()) {
×
806
            npCreator.addPubinfoStatement(NPX.INTRODUCES, introducedIri);
×
807
        }
×
808
        for (IRI embeddedIri : assertionContext.getEmbeddedIris()) {
×
809
            npCreator.addPubinfoStatement(NPX.EMBEDS, embeddedIri);
×
810
        }
×
811
        npCreator.addNamespace("this", targetNamespace);
×
812
        npCreator.addNamespace("sub", targetNamespace + "/");
×
813
        npCreator.addTimestampNow();
×
814
        IRI templateUri = assertionContext.getTemplate().getNanopub().getUri();
×
815
        npCreator.addPubinfoStatement(NTEMPLATE.WAS_CREATED_FROM_TEMPLATE, templateUri);
×
816
        IRI prTemplateUri = provenanceContext.getTemplate().getNanopub().getUri();
×
817
        npCreator.addPubinfoStatement(NTEMPLATE.WAS_CREATED_FROM_PROVENANCE_TEMPLATE, prTemplateUri);
×
818
        for (TemplateContext c : pubInfoContexts) {
×
819
            IRI piTemplateUri = c.getTemplate().getNanopub().getUri();
×
820
            npCreator.addPubinfoStatement(NTEMPLATE.WAS_CREATED_FROM_PUBINFO_TEMPLATE, piTemplateUri);
×
821
        }
×
822
        String nanopubLabel = getNanopubLabel(npCreator);
×
823
        if (nanopubLabel != null) {
×
824
            npCreator.addPubinfoStatement(RDFS.LABEL, vf.createLiteral(nanopubLabel));
×
825
        }
826
        for (IRI type : assertionContext.getTemplate().getTargetNanopubTypes()) {
×
827
            npCreator.addPubinfoStatement(NPX.HAS_NANOPUB_TYPE, type);
×
828
        }
×
829
        IRI userIri = NanodashSession.get().getUserIri();
×
830
        if (User.getName(userIri) != null) {
×
831
            npCreator.addPubinfoStatement(userIri, FOAF.NAME, vf.createLiteral(User.getName(userIri)));
×
832
            npCreator.addNamespace("foaf", FOAF.NAMESPACE);
×
833
        }
834
        String websiteUrl = NanodashPreferences.get().getWebsiteUrl();
×
835
        if (websiteUrl != null) {
×
836
            npCreator.addPubinfoStatement(NPX.WAS_CREATED_AT, vf.createIRI(websiteUrl));
×
837
        }
838
        return npCreator.finalizeNanopub();
×
839
    }
840

841
    private String getNanopubLabel(NanopubCreator npCreator) {
842
        if (assertionContext.getTemplate().getNanopubLabelPattern() == null) return null;
×
843

844
        Map<IRI, String> labelMap = new HashMap<>();
×
845
        for (Statement st : npCreator.getCurrentPubinfoStatements()) {
×
846
            if (st.getPredicate().equals(RDFS.LABEL) && st.getObject() instanceof Literal objL) {
×
847
                labelMap.put((IRI) st.getSubject(), objL.stringValue());
×
848
            }
849
        }
×
850

851
        String nanopubLabel = assertionContext.getTemplate().getNanopubLabelPattern();
×
852
        while (nanopubLabel.matches(".*\\$\\{[_a-zA-Z0-9-]+\\}.*")) {
×
853
            String placeholderPostfix = nanopubLabel.replaceFirst("^.*\\$\\{([_a-zA-Z0-9-]+)\\}.*$", "$1");
×
854
            IRI placeholderIriHash = vf.createIRI(assertionContext.getTemplateId() + "#" + placeholderPostfix);
×
855
            IRI placeholderIriSlash = vf.createIRI(assertionContext.getTemplateId() + "/" + placeholderPostfix);
×
856
            IRI placeholderIri = null;
×
857
            String placeholderValue = "";
×
858
            if (assertionContext.getComponentModels().get(placeholderIriSlash) != null) {
×
859
                placeholderIri = placeholderIriSlash;
×
860
            } else {
861
                placeholderIri = placeholderIriHash;
×
862
            }
863
            IModel<String> m = assertionContext.getComponentModels().get(placeholderIri);
×
864
            if (m != null) placeholderValue = m.orElse("").getObject();
×
865
            if (placeholderValue == null) placeholderValue = "";
×
866
            String placeholderLabel = placeholderValue;
×
867
            if (assertionContext.getTemplate().isUriPlaceholder(placeholderIri)) {
×
868
                try {
869
                    // TODO Fix this. It doesn't work for placeholders with auto-encode placeholders, etc.
870
                    //      Not sure we need labels for these, but this code should be improved anyway.
871
                    String prefix = assertionContext.getTemplate().getPrefix(placeholderIri);
×
872
                    if (prefix != null) placeholderValue = prefix + placeholderValue;
×
873
                    IRI placeholderValueIri = vf.createIRI(placeholderValue);
×
874
                    String l = assertionContext.getTemplate().getLabel(placeholderValueIri);
×
875
                    if (labelMap.containsKey(placeholderValueIri)) {
×
876
                        l = labelMap.get(placeholderValueIri);
×
877
                    }
878
                    if (l == null) l = GuidedChoiceItem.getLabel(placeholderValue);
×
879
                    if (assertionContext.getTemplate().isAgentPlaceholder(placeholderIri) && !placeholderValue.isEmpty()) {
×
880
                        l = User.getName(vf.createIRI(placeholderValue));
×
881
                    }
882
                    if (l != null && !l.isEmpty()) {
×
883
                        placeholderLabel = l.replaceFirst(" - .*$", "");
×
884
                    } else {
885
                        placeholderLabel = Utils.getShortNameFromURI(placeholderValueIri);
×
886
                    }
887
                } catch (Exception ex) {
×
888
                    logger.error("Nanopub label placeholder IRI error: {}", ex.getMessage());
×
889
                }
×
890
            }
891
            placeholderLabel = placeholderLabel.replaceAll("\\s+", " ");
×
892
            if (placeholderLabel.length() > 100) placeholderLabel = placeholderLabel.substring(0, 97) + "...";
×
893
            nanopubLabel = Strings.CS.replace(nanopubLabel, "${" + placeholderPostfix + "}", placeholderLabel);
×
894
        }
×
895
        return nanopubLabel;
×
896
    }
897

898
    private NanodashPage getConfirmPage(Nanopub signedNp, PageParameters pageParams) {
899
        try {
900
            return (NanodashPage) confirmPageClass.getConstructor(Nanopub.class, PageParameters.class).newInstance(signedNp, pageParams);
×
901
        } catch (InstantiationException | IllegalAccessException | IllegalArgumentException |
×
902
                 InvocationTargetException | NoSuchMethodException | SecurityException ex) {
903
            logger.error("Could not create instance of confirmation page: {}", ex.getMessage());
×
904
        }
905
        return null;
×
906
    }
907

908
    /**
909
     * Returns a hint whether the form is stateless or not.
910
     *
911
     * @return false if the form is stateful, true if it is stateless.
912
     */
913
    // This is supposed to solve the problem that sometimes (but only sometimes) form content is reset
914
    // if the user browses other pages in parallel:
915
    protected boolean getStatelessHint() {
916
        return false;
×
917
    }
918

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