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

knowledgepixels / nanodash / 23847171852

01 Apr 2026 11:51AM UTC coverage: 15.884% (-0.4%) from 16.286%
23847171852

push

github

web-flow
Merge pull request #428 from knowledgepixels/feature/422-download-rdf

Add raw page content RDF download

769 of 6002 branches covered (12.81%)

Branch coverage included in aggregate %.

1938 of 11040 relevant lines covered (17.55%)

2.4 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 com.knowledgepixels.nanodash.NanodashPageRef;
4
import com.knowledgepixels.nanodash.SpaceMemberRole;
5
import com.knowledgepixels.nanodash.component.*;
6
import com.knowledgepixels.nanodash.domain.AbstractResourceWithProfile;
7
import com.knowledgepixels.nanodash.domain.MaintainedResource;
8
import com.knowledgepixels.nanodash.domain.Space;
9
import com.knowledgepixels.nanodash.repository.MaintainedResourceRepository;
10
import org.apache.wicket.Component;
11
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
12
import org.apache.wicket.markup.html.basic.Label;
13
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
14
import org.apache.wicket.model.Model;
15
import org.apache.wicket.request.mapper.parameter.PageParameters;
16
import org.eclipse.rdf4j.model.util.Values;
17

18
import java.util.List;
19

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

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

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

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

43
    public MaintainedResourcePage(final PageParameters parameters) {
44
        super(parameters);
×
45

46
        resource = MaintainedResourceRepository.get().findById(parameters.get("id").toString());
×
47
        Space space = resource.getSpace();
×
48
        resource.triggerDataUpdate();
×
49

50
        List<AbstractResourceWithProfile> superSpaces = resource.getAllSuperSpacesUntilRoot();
×
51
        superSpaces.add(resource.getSpace());
×
52
        superSpaces.add(resource);
×
53
        add(new TitleBar("titlebar", this, null,
×
54
                superSpaces.stream().map(ss -> new NanodashPageRef(SpacePage.class, new PageParameters().add("id", ss.getId()), ss.getLabel())).toArray(NanodashPageRef[]::new)
×
55
        ));
56

57
        add(new JustPublishedMessagePanel("justPublishedMessage", parameters));
×
58

59
        add(new Label("pagetitle", resource.getLabel() + " (resource) | nanodash"));
×
60
        add(new Label("resourcename", resource.getLabel()));
×
61
        add(new ExternalLinkWithActionsPanel("id", Model.of(resource.getId()), Model.of(resource.getLabel()), Values.iri(resource.getNanopubId())));
×
62

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

66
        boolean isAdmin = SpaceMemberRole.isCurrentUserAdmin(space);
×
67
        add(new AddViewDisplayButton("addviewdisplay",
×
68
                "https://w3id.org/np/RAe0zantvnJlVWIC2LueG1IAMktXGFIqCdWliok1rOrmU",
69
                "latest",
70
                resource.getId(),
×
71
                resource.getId(),
×
72
                new PageParameters()
73
                        .set("param_appliesToResource", resource.getId())
×
74
                        .set("refresh-upon-publish", resource.getId())
×
75
        ).setVisible(isAdmin));
×
76
        add(new DownloadRdfLinks("download-rdf", "resource", resource.getId()));
×
77

78
        if (resource.isDataInitialized()) {
×
79
            add(new ViewList("views", resource));
×
80
        } else {
81
            add(new AjaxLazyLoadPanel<Component>("views") {
×
82

83
                @Override
84
                public Component getLazyLoadComponent(String markupId) {
85
                    return new ViewList(markupId, resource);
×
86
                }
87

88
                @Override
89
                protected boolean isContentReady() {
90
                    return resource.isDataInitialized();
×
91
                }
92

93
                @Override
94
                public Component getLoadingComponent(String id) {
95
                    return new Label(id, "<div class=\"row-section\"><div class=\"col-12\">" + ResultComponent.getWaitIconHtml() + "</div></div>").setEscapeModelStrings(false);
×
96
                }
97

98
            });
99
        }
100
    }
×
101

102
    /**
103
     * Checks if auto-refresh is enabled for this page.
104
     *
105
     * @return true if auto-refresh is enabled, false otherwise
106
     */
107
    protected boolean hasAutoRefreshEnabled() {
108
        return true;
×
109
    }
110

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