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

knowledgepixels / nanodash / 18887862897

28 Oct 2025 08:10PM UTC coverage: 14.821% (-0.4%) from 15.199%
18887862897

push

github

tkuhn
feat(MaintainedResourcePage): Show namespace, if available

527 of 4486 branches covered (11.75%)

Branch coverage included in aggregate %.

1380 of 8381 relevant lines covered (16.47%)

0.73 hits per line

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

0.0
src/main/java/com/knowledgepixels/nanodash/page/MaintainedResourcePage.java
1
package com.knowledgepixels.nanodash.page;
2

3
import java.util.ArrayList;
4
import java.util.List;
5

6
import org.apache.wicket.Component;
7
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
8
import org.apache.wicket.markup.html.basic.Label;
9
import org.apache.wicket.markup.html.link.AbstractLink;
10
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
11
import org.apache.wicket.model.Model;
12
import org.apache.wicket.request.mapper.parameter.PageParameters;
13
import org.nanopub.extra.services.FailedApiCallException;
14

15
import com.knowledgepixels.nanodash.MaintainedResource;
16
import com.knowledgepixels.nanodash.Space;
17
import com.knowledgepixels.nanodash.component.ButtonList;
18
import com.knowledgepixels.nanodash.component.TitleBar;
19
import com.knowledgepixels.nanodash.component.ViewList;
20

21
/**
22
 * This class represents a page for a maintained resource.
23
 */
24
public class MaintainedResourcePage extends NanodashPage {
25

26
    /**
27
     * The mount path for this page.
28
     */
29
    public static final String MOUNT_PATH = "/resource";
30

31
    /**
32
     * {@inheritDoc}
33
     */
34
    @Override
35
    public String getMountPath() {
36
        return MOUNT_PATH;
×
37
    }
38

39
    /**
40
     * Maintained resource object with the data shown on this page.
41
     */
42
    private MaintainedResource resource;
43

44
    public MaintainedResourcePage(final PageParameters parameters) throws FailedApiCallException {
45
        super(parameters);
×
46

47
        resource = MaintainedResource.get(parameters.get("id").toString());
×
48

49
        add(new TitleBar("titlebar", this, "connectors"));
×
50

51
        add(new Label("pagetitle", resource.getLabel() + " (resource) | nanodash"));
×
52
        add(new Label("resourcename", resource.getLabel()));
×
53
        add(new BookmarkablePageLink<Void>("id", ExplorePage.class, parameters.set("label", resource.getLabel())).setBody(Model.of(resource.getId())));
×
54
        add(new BookmarkablePageLink<Void>("np", ExplorePage.class, new PageParameters().add("id", resource.getNanopubId())));
×
55

56
        String namespaceUri = resource.getNamespace() == null ? "" : resource.getNamespace();
×
57
        add(new BookmarkablePageLink<Void>("namespace", ExplorePage.class, new PageParameters().add("id", namespaceUri)).setBody(Model.of(namespaceUri)));
×
58

59
        Space space = resource.getSpace();
×
60
        add(new BookmarkablePageLink<Void>("space", SpacePage.class, new PageParameters().add("id", space.getId())).setBody(Model.of(space.getLabel())));
×
61

62
        final List<AbstractLink> viewButtons = new ArrayList<>();
×
63
        AbstractLink addViewButton = new BookmarkablePageLink<NanodashPage>("button", PublishPage.class, new PageParameters()
×
64
                .add("template", "https://w3id.org/np/RAxERE0cQ9jLQZ5VjeA-1v3XnE9ugxLpFG8vpkAd5FqHE")
×
65
                .add("param_resource", resource.getId())
×
66
                .add("context", resource.getId())
×
67
            );
68
        addViewButton.setBody(Model.of("+ view"));
×
69
        viewButtons.add(addViewButton);
×
70

71
        if (resource.isDataInitialized()) {
×
72
            add(new ViewList("views", resource));
×
73
            add(new ButtonList("view-buttons", space, null, null, viewButtons));
×
74
        } else {
75
            add(new AjaxLazyLoadPanel<Component>("views") {
×
76
    
77
                @Override
78
                public Component getLazyLoadComponent(String markupId) {
79
                    return new ViewList(markupId, resource);
×
80
                }
81
    
82
                @Override
83
                protected boolean isContentReady() {
84
                    return resource.isDataInitialized();
×
85
                }
86
    
87
            });
88
            add(new AjaxLazyLoadPanel<Component>("view-buttons") {
×
89
    
90
                @Override
91
                public Component getLazyLoadComponent(String markupId) {
92
                    return new ButtonList(markupId, space, null, null, viewButtons);
×
93
                }
94
    
95
                @Override
96
                protected boolean isContentReady() {
97
                    return resource.isDataInitialized();
×
98
                }
99

100
                public Component getLoadingComponent(String id) {
101
                    return new Label(id).setVisible(false);
×
102
                };
103
    
104
            });
105
        }
106
    }
×
107

108
    /**
109
     * Checks if auto-refresh is enabled for this page.
110
     *
111
     * @return true if auto-refresh is enabled, false otherwise
112
     */
113
    protected boolean hasAutoRefreshEnabled() {
114
        return true;
×
115
    }
116

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