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

knowledgepixels / nanopub-registry / 28113618611

24 Jun 2026 04:28PM UTC coverage: 31.926% (-0.2%) from 32.089%
28113618611

Pull #116

github

web-flow
Merge d931f8afc into eebd16ba4
Pull Request #116: Enhance and standardize logging across multiple components

313 of 1106 branches covered (28.3%)

Branch coverage included in aggregate %.

1048 of 3157 relevant lines covered (33.2%)

5.51 hits per line

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

91.89
src/main/java/com/knowledgepixels/registry/EntryStatus.java
1
package com.knowledgepixels.registry;
2

3
import org.bson.codecs.pojo.annotations.BsonProperty;
4
import org.slf4j.Logger;
5
import org.slf4j.LoggerFactory;
6

7
/**
8
 * The status field of several Documents, especially:
9
 * endorsements-loading, intro-lists, and accounts-loading.
10
 * <p>
11
 * The states of the different Document Types are not dependant of each other.
12
 * <p>
13
 * We decided to break with Java Conventions and have lowercase Enum Values,
14
 * which directly represent the string in the MongoDB for aesthetic reasons.
15
 */
16
public enum EntryStatus {
6✔
17

18
    /**
19
     * endorsements_loading,
20
     */
21
    toRetrieve, // WARNING: Breaking Change! it was "to-retrieve" before
18✔
22
    // We may avoid the change by adding an annotation
23
    // @BsonProperty(value = "to-retrieve") or having a custom toString()
24
    /**
25
     * accounts-loading
26
     */
27
    seen,
18✔
28
    /**
29
     * endorsements_loading,
30
     */
31
    discarded,
18✔
32
    /**
33
     * endorsements_loading,
34
     */
35
    retrieved,
18✔
36
    /**
37
     * accounts-loading
38
     */
39
    visited,
18✔
40
    /**
41
     * accounts-loading
42
     */
43
    expanded,
18✔
44
    /**
45
     * accounts-loading
46
     */
47
    skipped,
18✔
48
    /**
49
     * Pub-key, intro_type_hash,
50
     */
51
    encountered,
18✔
52
    /**
53
     * intro-list, endorse-list
54
     */
55
    loading,
18✔
56
    /**
57
     * accounts-loading
58
     */
59
    toLoad,
18✔
60
    /**
61
     * accountId, account-loading, intro-list, endorse-list
62
     */
63
    loaded,
18✔
64
    /**
65
     * accounts-loading, agent,
66
     */
67
    processed,
18✔
68
    /**
69
     * accounts-loading
70
     */
71
    aggregated,
18✔
72
    /**
73
     * accounts-loading
74
     */
75
    approved,
18✔
76
    /**
77
     * accounts-loading
78
     */
79
    contested,
18✔
80
    /**
81
     * accounts — quota reached, not all nanopubs loaded
82
     */
83
    capped;
18✔
84

85
    private static final Logger logger = LoggerFactory.getLogger(EntryStatus.class);
12✔
86

87
    // The code is inspired by: https://www.mongodb.com/community/forums/t/cannot-store-java-enum-values-in-mongodb/99719/3
88
    // It's not really necessary right now, since we call getValue by hand,
89
    // we may also just call toString()...
90
    @BsonProperty(value = "status")
91
    final String status;
92

93
    EntryStatus() {
12✔
94
        this.status = this.toString();
12✔
95
    }
3✔
96

97
    public static EntryStatus fromValue(String value) throws UnsupportedEntryStatusValueException {
98
        if (value == null) {
6!
99
            logger.warn("Attempted to convert null to EntryStatus");
×
100
            throw new IllegalArgumentException("EntryStatus value must not be null");
×
101
        }
102
        for (EntryStatus e : EntryStatus.values()) {
48✔
103
            if (e.toString().equals(value)) {
15✔
104
                return e;
6✔
105
            }
106
        }
107
        String msg = "Unsupported EntryStatus value: '" + value + "'.";
9✔
108
        logger.warn(msg);
9✔
109
        throw new UnsupportedEntryStatusValueException(msg);
15✔
110
    }
111

112
    public String getValue() {
113
        return this.status;
9✔
114
    }
115
}
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