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

knowledgepixels / nanodash / 23337744284

20 Mar 2026 09:55AM UTC coverage: 16.351% (+0.02%) from 16.327%
23337744284

Pull #410

github

web-flow
Merge 2e8bc3131 into 3faec6ac7
Pull Request #410: fix: update Space and MaintainedResource data when root nanopub changes

729 of 5525 branches covered (13.19%)

Branch coverage included in aggregate %.

1871 of 10376 relevant lines covered (18.03%)

2.47 hits per line

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

73.33
src/main/java/com/knowledgepixels/nanodash/domain/SpaceFactory.java
1
package com.knowledgepixels.nanodash.domain;
2

3
import org.nanopub.extra.services.ApiResponseEntry;
4

5
import java.util.HashSet;
6
import java.util.Set;
7

8
/**
9
 * Factory class for creating Space instances from API response entries.
10
 */
11
public class SpaceFactory {
12

13
    private SpaceFactory() {
14
    }
15

16
    /**
17
     * Retrieves an existing Space instance based on the API response entry or creates a new one if it doesn't exist.
18
     *
19
     * @param apiResponseEntry The API response entry containing space data.
20
     * @return A new Space instance initialized with the data from the API response entry.
21
     */
22
    public static Space getOrCreate(ApiResponseEntry apiResponseEntry) {
23
        String id = apiResponseEntry.get("space");
12✔
24
        AbstractResourceWithProfile existing = AbstractResourceWithProfile.get(id);
9✔
25
        if (existing instanceof Space space) {
9!
26
            space.updateFromApi(apiResponseEntry);
×
27
            return space;
×
28
        }
29
        return new Space(apiResponseEntry);
15✔
30
    }
31

32
    /**
33
     * Removes Space instances that are no longer active based on the provided set of active IDs.
34
     *
35
     * @param activeIds A set of active space IDs that should be retained. Any Space instance with an ID not in this set will be removed.
36
     */
37
    public static void removeStale(Set<String> activeIds) {
38
        new HashSet<>(AbstractResourceWithProfile.getInstances(Space.class).keySet())
18✔
39
                .stream()
9✔
40
                .filter(id -> !activeIds.contains(id))
24!
41
                .forEach(id -> AbstractResourceWithProfile.removeInstance(Space.class, id));
3✔
42
    }
3✔
43

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