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

kit-data-manager / pit-service / #324

13 Nov 2023 05:22PM UTC coverage: 72.606% (+11.8%) from 60.79%
#324

push

github

web-flow
Merge pull request #174 from kit-data-manager/dev-v2

Development branch for v2.0.0

136 of 205 new or added lines in 14 files covered. (66.34%)

4 existing lines in 3 files now uncovered.

872 of 1201 relevant lines covered (72.61%)

0.73 hits per line

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

95.56
/src/main/java/edu/kit/datamanager/pit/pidlog/KnownPid.java
1
package edu.kit.datamanager.pit.pidlog;
2

3
import java.io.Serializable;
4
import java.time.Instant;
5
import java.time.temporal.ChronoUnit;
6

7
import jakarta.persistence.Entity;
8
import jakarta.persistence.Id;
9
import jakarta.validation.constraints.NotBlank;
10
import jakarta.validation.constraints.NotNull;
11

12
/**
13
 * Stores information about a known PID so it can be stored in a database.
14
 * 
15
 * The use of storing this information is to have a logbook of all created PIDs.
16
 */
17
@Entity
18
public class KnownPid implements Serializable {
19
    @Id
20
    @NotBlank(message = "The known PID.")
21
    private String pid;
22
    @NotNull(message = "The date the PID was created")
23
    private Instant created;
24
    @NotNull(message = "The timestamp of the most recently performed modification.")
25
    private Instant modified;
26

27

28
    public KnownPid() {}
1✔
29

30
    public KnownPid(String pid, Instant created, Instant modified) {
1✔
31
        this.pid = pid;
1✔
32
        this.created = created;
1✔
33
        this.modified = modified;
1✔
34
    }
1✔
35

36
    public String getPid() {
37
        return pid;
1✔
38
    }
39

40
    public void setPid(String pid) {
41
        this.pid = pid;
1✔
42
    }
1✔
43

44
    public Instant getCreated() {
45
        return created;
1✔
46
    }
47

48
    public void setCreated(Instant created) {
49
        this.created = created.truncatedTo(ChronoUnit.MILLIS);
1✔
50
    }
1✔
51

52
    public Instant getModified() {
53
        return modified;
1✔
54
    }
55

56
    public void setModified(Instant modified) {
57
        this.modified = modified.truncatedTo(ChronoUnit.MILLIS);
1✔
58
    }
1✔
59

60
    @Override
61
    public int hashCode() {
62
        final int prime = 31;
1✔
63
        int result = 1;
1✔
64
        result = prime * result + ((created == null) ? 0 : created.hashCode());
1✔
65
        result = prime * result + ((modified == null) ? 0 : modified.hashCode());
1✔
66
        result = prime * result + ((pid == null) ? 0 : pid.hashCode());
1✔
67
        return result;
1✔
68
    }
69

70
    @Override
71
    public boolean equals(Object obj) {
72
        if (this == obj)
1✔
73
            return true;
1✔
74
        if (obj == null)
1✔
UNCOV
75
            return false;
×
76
        if (!(obj instanceof KnownPid))
1✔
77
            return false;
×
78
        KnownPid other = (KnownPid) obj;
1✔
79
        if (created == null) {
1✔
80
            if (other.created != null)
1✔
81
                return false;
1✔
82
        } else if (!created.equals(other.created))
1✔
83
            return false;
1✔
84
        if (modified == null) {
1✔
85
            if (other.modified != null)
1✔
86
                return false;
1✔
87
        } else if (!modified.equals(other.modified))
1✔
88
            return false;
1✔
89
        if (pid == null) {
1✔
90
            if (other.pid != null)
1✔
91
                return false;
1✔
92
        } else if (!pid.equals(other.pid))
1✔
93
            return false;
1✔
94
        return true;
1✔
95
    }
96

97
    @Override
98
    public String toString() {
99
        return "KnownPID [created=" + created + ", modified=" + modified + ", pid=" + pid + "]";
1✔
100
    }
101
}
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