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

knowledgepixels / nanodash / 22677265677

04 Mar 2026 03:53PM UTC coverage: 15.903% (-0.05%) from 15.951%
22677265677

Pull #372

github

web-flow
Merge ca0bc354b into a74c65742
Pull Request #372: Add component for showing full URIs as plain links + ExploreDisplayMenu

701 of 5343 branches covered (13.12%)

Branch coverage included in aggregate %.

1727 of 9925 relevant lines covered (17.4%)

2.38 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.component.*;
5
import com.knowledgepixels.nanodash.domain.AbstractResourceWithProfile;
6
import com.knowledgepixels.nanodash.domain.MaintainedResource;
7
import com.knowledgepixels.nanodash.domain.Space;
8
import com.knowledgepixels.nanodash.repository.MaintainedResourceRepository;
9
import org.apache.wicket.Component;
10
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
11
import org.apache.wicket.markup.html.basic.Label;
12
import org.apache.wicket.markup.html.link.AbstractLink;
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.ArrayList;
19
import java.util.List;
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 final MaintainedResource resource;
43

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

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

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

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

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

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

67
        final List<AbstractLink> viewButtons = new ArrayList<>();
×
68
        viewButtons.add(new AddViewDisplayButton("button",
×
69
                        "https://w3id.org/np/RAe0zantvnJlVWIC2LueG1IAMktXGFIqCdWliok1rOrmU",
70
                        "latest",
71
                        resource.getId(),
×
72
                        resource.getId(),
×
73
                        new PageParameters()
74
                                .set("param_appliesToResource", resource.getId())
×
75
                                .set("refresh-upon-publish", resource.getId())
×
76
                )
77
        );
78

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

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

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

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

99
            });
100
        }
101
    }
×
102

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

112
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc