1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.mycore.orcid.user;
20
21 import java.io.IOException;
22
23 import org.jdom2.JDOMException;
24 import org.mycore.datamodel.metadata.MCRObjectID;
25 import org.mycore.orcid.MCRORCIDProfile;
26 import org.mycore.orcid.works.MCRWorksSection;
27 import org.xml.sax.SAXException;
28
29 public class MCRPublicationStatus {
30
31 private MCRUserStatus user;
32
33 private String objectID;
34
35 private boolean isUsersPublication = false;
36
37 private boolean isInORCIDProfile = false;
38
39 private String putCode = null;
40
41 MCRPublicationStatus(MCRORCIDUser orcidUser, MCRObjectID oid)
42 throws JDOMException, IOException, SAXException {
43 this.user = orcidUser.getStatus();
44
45 this.objectID = oid.toString();
46
47 if (user.isORCIDUser()) {
48 isUsersPublication = orcidUser.isMyPublication(oid);
49
50 MCRORCIDProfile profile = orcidUser.getProfile();
51 MCRWorksSection works = profile.getWorksSection();
52 isInORCIDProfile = works.containsWork(oid);
53
54 if (isInORCIDProfile) {
55 putCode = works.findWork(oid).get().getPutCode();
56 }
57 }
58 }
59
60 public MCRUserStatus getUserStatus() {
61 return user;
62 }
63
64 public String getObjectID() {
65 return objectID;
66 }
67
68 public boolean isUsersPublication() {
69 return isUsersPublication;
70 }
71
72 public boolean isInORCIDProfile() {
73 return isInORCIDProfile;
74 }
75
76 public String getPutCode() {
77 return putCode;
78 }
79 }