Skip to content

Commit 6f03716

Browse files
author
nmacedo
committed
merge reverted
1 parent 1d2e4bc commit 6f03716

File tree

7 files changed

+74
-97
lines changed

7 files changed

+74
-97
lines changed

src/test/java/pt/ptcris/test/PTCRISExample.java

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
import java.util.logging.SimpleFormatter;
1212

1313
import org.um.dsi.gavea.orcid.client.exception.OrcidClientException;
14-
import org.um.dsi.gavea.orcid.model.common.ExternalId;
15-
import org.um.dsi.gavea.orcid.model.common.ExternalIds;
1614
import org.um.dsi.gavea.orcid.model.common.RelationshipType;
15+
import org.um.dsi.gavea.orcid.model.work.ExternalIdentifier;
16+
import org.um.dsi.gavea.orcid.model.work.ExternalIdentifierType;
1717
import org.um.dsi.gavea.orcid.model.work.Work;
18+
import org.um.dsi.gavea.orcid.model.work.WorkExternalIdentifiers;
1819
import org.um.dsi.gavea.orcid.model.work.WorkTitle;
1920
import org.um.dsi.gavea.orcid.model.work.WorkType;
2021

@@ -90,16 +91,16 @@ private static Work work0() {
9091
title.setTitle("Yet Another Work Updated Once");
9192
work.setTitle(title);
9293

93-
ExternalId e = new ExternalId();
94-
e.setExternalIdRelationship(RelationshipType.SELF);
95-
e.setExternalIdValue("3000");
96-
e.setExternalIdType("DOI");
94+
ExternalIdentifier e = new ExternalIdentifier();
95+
e.setRelationship(RelationshipType.SELF);
96+
e.setExternalIdentifierId("3000");
97+
e.setExternalIdentifierType(ExternalIdentifierType.DOI);
9798

98-
ExternalIds uids = new ExternalIds();
99+
WorkExternalIdentifiers uids = new WorkExternalIdentifiers();
99100

100-
uids.getExternalId().add(e);
101+
uids.getWorkExternalIdentifier().add(e);
101102

102-
work.setExternalIds(uids);
103+
work.setExternalIdentifiers(uids);
103104

104105
work.setType(WorkType.CONFERENCE_PAPER);
105106

@@ -112,22 +113,22 @@ private static Work work1() {
112113
title.setTitle("A Work Updated Once");
113114
work.setTitle(title);
114115

115-
ExternalId e = new ExternalId();
116-
e.setExternalIdRelationship(RelationshipType.SELF);
117-
e.setExternalIdValue("4000");
118-
e.setExternalIdType("EID");
116+
ExternalIdentifier e = new ExternalIdentifier();
117+
e.setRelationship(RelationshipType.SELF);
118+
e.setExternalIdentifierId("4000");
119+
e.setExternalIdentifierType(ExternalIdentifierType.EID);
119120

120-
ExternalId e1 = new ExternalId();
121-
e1.setExternalIdRelationship(RelationshipType.SELF);
122-
e1.setExternalIdValue("00001");
123-
e1.setExternalIdType("DOI");
121+
ExternalIdentifier e1 = new ExternalIdentifier();
122+
e1.setRelationship(RelationshipType.SELF);
123+
e1.setExternalIdentifierId("00001");
124+
e1.setExternalIdentifierType(ExternalIdentifierType.DOI);
124125

125-
ExternalIds uids = new ExternalIds();
126+
WorkExternalIdentifiers uids = new WorkExternalIdentifiers();
126127

127-
uids.getExternalId().add(e);
128-
uids.getExternalId().add(e1);
128+
uids.getWorkExternalIdentifier().add(e);
129+
uids.getWorkExternalIdentifier().add(e1);
129130

130-
work.setExternalIds(uids);
131+
work.setExternalIdentifiers(uids);
131132

132133
work.setType(WorkType.CONFERENCE_PAPER);
133134

@@ -140,18 +141,18 @@ private static Work work2() {
140141
title.setTitle("Another Work Updated Twice");
141142
work.setTitle(title);
142143

143-
ExternalId e = new ExternalId();
144-
e.setExternalIdRelationship(RelationshipType.SELF);
144+
ExternalIdentifier e = new ExternalIdentifier();
145+
e.setRelationship(RelationshipType.SELF);
145146
// avoids conflicts
146-
e.setExternalIdValue(String.valueOf(System.currentTimeMillis()));
147+
e.setExternalIdentifierId(String.valueOf(System.currentTimeMillis()));
147148

148-
e.setExternalIdType("DOI");
149+
e.setExternalIdentifierType(ExternalIdentifierType.DOI);
149150

150-
ExternalIds uids = new ExternalIds();
151+
WorkExternalIdentifiers uids = new WorkExternalIdentifiers();
151152

152-
uids.getExternalId().add(e);
153+
uids.getWorkExternalIdentifier().add(e);
153154

154-
work.setExternalIds(uids);
155+
work.setExternalIdentifiers(uids);
155156

156157
work.setType(WorkType.JOURNAL_ARTICLE);
157158

src/test/java/pt/ptcris/test/TestHelper.java

Lines changed: 40 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
import java.util.logging.Logger;
77
import java.util.logging.SimpleFormatter;
88

9-
import org.um.dsi.gavea.orcid.model.common.ExternalId;
10-
import org.um.dsi.gavea.orcid.model.common.ExternalIds;
119
import org.um.dsi.gavea.orcid.model.common.FuzzyDate;
1210
import org.um.dsi.gavea.orcid.model.common.FuzzyDate.Year;
1311
import org.um.dsi.gavea.orcid.model.common.RelationshipType;
12+
import org.um.dsi.gavea.orcid.model.work.ExternalIdentifier;
13+
import org.um.dsi.gavea.orcid.model.work.ExternalIdentifierType;
1414
import org.um.dsi.gavea.orcid.model.work.Work;
15+
import org.um.dsi.gavea.orcid.model.work.WorkExternalIdentifiers;
1516
import org.um.dsi.gavea.orcid.model.work.WorkTitle;
1617
import org.um.dsi.gavea.orcid.model.work.WorkType;
1718

@@ -25,8 +26,8 @@ public class TestHelper {
2526
public static Work work(BigInteger key, String meta) {
2627
Work work = new Work();
2728

28-
ExternalIds uids = new ExternalIds();
29-
work.setExternalIds(uids);
29+
WorkExternalIdentifiers uids = new WorkExternalIdentifiers();
30+
work.setExternalIdentifiers(uids);
3031

3132
work.setPutCode(key);
3233

@@ -50,114 +51,89 @@ public static Work work(BigInteger key, String meta) {
5051
public static Work workDOI(BigInteger key, String meta, String doi) {
5152
Work work = work(key, meta);
5253

53-
ExternalId e1 = new ExternalId();
54-
e1.setExternalIdRelationship(RelationshipType.SELF);
55-
e1.setExternalIdValue(doi);
56-
e1.setExternalIdType("doi");
54+
ExternalIdentifier e1 = new ExternalIdentifier();
55+
e1.setRelationship(RelationshipType.SELF);
56+
e1.setExternalIdentifierId(doi);
57+
e1.setExternalIdentifierType(ExternalIdentifierType.DOI);
5758

58-
work.getExternalIds().getExternalId().add(e1);
59+
work.getExternalIdentifiers().getWorkExternalIdentifier().add(e1);
5960

6061
return work;
6162
}
6263

63-
public static Work workUnk(BigInteger key, String meta, String doi) {
64-
Work work = work(key, meta);
65-
66-
ExternalId e1 = new ExternalId();
67-
e1.setExternalIdRelationship(RelationshipType.SELF);
68-
e1.setExternalIdValue(doi);
69-
e1.setExternalIdType("ukn");
70-
71-
work.getExternalIds().getExternalId().add(e1);
72-
73-
return work;
74-
}
75-
76-
public static Work workDOIUnk(BigInteger key, String meta, String doi, String eid) {
77-
Work work = workDOI(key, meta, doi);
78-
79-
ExternalId e = new ExternalId();
80-
e.setExternalIdRelationship(RelationshipType.SELF);
81-
e.setExternalIdValue(eid);
82-
e.setExternalIdType("wosuid-");
83-
84-
work.getExternalIds().getExternalId().add(e);
85-
return work;
86-
}
87-
8864
public static Work workHANDLE(BigInteger key, String meta, String handle) {
8965
Work work = work(key, meta);
9066

91-
ExternalId e1 = new ExternalId();
92-
e1.setExternalIdRelationship(RelationshipType.SELF);
93-
e1.setExternalIdValue(handle);
94-
e1.setExternalIdType("handle");
67+
ExternalIdentifier e1 = new ExternalIdentifier();
68+
e1.setRelationship(RelationshipType.SELF);
69+
e1.setExternalIdentifierId(handle);
70+
e1.setExternalIdentifierType(ExternalIdentifierType.HANDLE);
9571

96-
work.getExternalIds().getExternalId().add(e1);
72+
work.getExternalIdentifiers().getWorkExternalIdentifier().add(e1);
9773

9874
return work;
9975
}
10076

10177
public static Work workDOIEID(BigInteger key, String meta, String doi, String eid) {
10278
Work work = workDOI(key, meta, doi);
10379

104-
ExternalId e = new ExternalId();
105-
e.setExternalIdRelationship(RelationshipType.SELF);
106-
e.setExternalIdValue(eid);
107-
e.setExternalIdType("eid");
80+
ExternalIdentifier e = new ExternalIdentifier();
81+
e.setRelationship(RelationshipType.SELF);
82+
e.setExternalIdentifierId(eid);
83+
e.setExternalIdentifierType(ExternalIdentifierType.EID);
10884

109-
work.getExternalIds().getExternalId().add(e);
85+
work.getExternalIdentifiers().getWorkExternalIdentifier().add(e);
11086
return work;
11187
}
11288

11389
public static Work workDOIHANDLE(BigInteger key, String meta, String doi, String handle) {
11490
Work work = workDOI(key, meta, doi);
11591

116-
ExternalId e = new ExternalId();
117-
e.setExternalIdRelationship(RelationshipType.SELF);
118-
e.setExternalIdValue(handle);
119-
e.setExternalIdType("handle");
92+
ExternalIdentifier e = new ExternalIdentifier();
93+
e.setRelationship(RelationshipType.SELF);
94+
e.setExternalIdentifierId(handle);
95+
e.setExternalIdentifierType(ExternalIdentifierType.HANDLE);
12096

121-
work.getExternalIds().getExternalId().add(e);
97+
work.getExternalIdentifiers().getWorkExternalIdentifier().add(e);
12298

12399
return work;
124100
}
125101

126102
public static Work workEIDHANDLE(BigInteger key, String meta, String eid, String handle) {
127103
Work work = workHANDLE(key, meta, handle);
128104

129-
ExternalId e = new ExternalId();
130-
e.setExternalIdRelationship(RelationshipType.SELF);
131-
e.setExternalIdValue(eid);
132-
e.setExternalIdType("eid");
105+
ExternalIdentifier e = new ExternalIdentifier();
106+
e.setRelationship(RelationshipType.SELF);
107+
e.setExternalIdentifierId(eid);
108+
e.setExternalIdentifierType(ExternalIdentifierType.EID);
133109

134-
work.getExternalIds().getExternalId().add(e);
110+
work.getExternalIdentifiers().getWorkExternalIdentifier().add(e);
135111

136112
return work;
137113
}
138114

139115
public static Work workDOIEIDHANDLE(BigInteger key, String meta, String doi, String eid, String handle) {
140116
Work work = workDOIEID(key, meta, doi, eid);
141117

142-
ExternalId e2 = new ExternalId();
143-
e2.setExternalIdRelationship(RelationshipType.SELF);
144-
e2.setExternalIdValue(handle);
145-
e2.setExternalIdType("handle");
118+
ExternalIdentifier e2 = new ExternalIdentifier();
119+
e2.setRelationship(RelationshipType.SELF);
120+
e2.setExternalIdentifierId(handle);
121+
e2.setExternalIdentifierType(ExternalIdentifierType.HANDLE);
146122

147-
work.getExternalIds().getExternalId().add(e2);
123+
work.getExternalIdentifiers().getWorkExternalIdentifier().add(e2);
148124

149125
return work;
150126
}
151127

152128
public static Work workDOIDOIEIDHANDLE(BigInteger key, String meta, String doi1, String doi2, String eid, String handle) {
153129
Work work = workDOIEIDHANDLE(key, meta, doi1, eid, handle);
154130

155-
ExternalId e1 = new ExternalId();
156-
e1.setExternalIdRelationship(RelationshipType.SELF);
157-
e1.setExternalIdValue(doi2);
158-
e1.setExternalIdType("doi");
131+
ExternalIdentifier e1 = new ExternalIdentifier();
132+
e1.setRelationship(RelationshipType.SELF);
133+
e1.setExternalIdentifierId(doi2);
134+
e1.setExternalIdentifierType(ExternalIdentifierType.DOI);
159135

160-
work.getExternalIds().getExternalId().add(e1);
136+
work.getExternalIdentifiers().getWorkExternalIdentifier().add(e1);
161137

162138
return work;
163139
}

src/test/java/pt/ptcris/test/scenarios/Scenario01.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ List<Work> expectedImportedInvalidWorks() {
5656
@Override
5757
Set<String> expectedInvalidCodes(BigInteger putCode) {
5858
Set<String> res = new HashSet<String>();
59-
res.add(ORCIDHelper.INVALID_EXTERNALIDENTIFIERS);
59+
res.add(ORCIDHelper.INVALID_WORKEXTERNALIDENTIFIERS);
6060
return res;
6161
}
6262

src/test/java/pt/ptcris/test/scenarios/Scenario02.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ List<Work> expectedImportedInvalidWorks() {
6565
@Override
6666
Set<String> expectedInvalidCodes(BigInteger putCode) {
6767
Set<String> res = new HashSet<String>();
68-
res.add(ORCIDHelper.INVALID_EXTERNALIDENTIFIERS);
68+
res.add(ORCIDHelper.INVALID_WORKEXTERNALIDENTIFIERS);
6969
return res;
7070
}
7171

src/test/java/pt/ptcris/test/scenarios/Scenario03.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ List<Work> expectedImportedInvalidWorks() {
5656
@Override
5757
Set<String> expectedInvalidCodes(BigInteger putCode) {
5858
Set<String> res = new HashSet<String>();
59-
res.add(ORCIDHelper.INVALID_EXTERNALIDENTIFIERS);
59+
res.add(ORCIDHelper.INVALID_WORKEXTERNALIDENTIFIERS);
6060
return res;
6161
}
6262

src/test/java/pt/ptcris/test/scenarios/Scenario15.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ List<Work> expectedImportedInvalidWorks() {
5151
@Override
5252
Set<String> expectedInvalidCodes(BigInteger putCode) {
5353
Set<String> res = new HashSet<String>();
54-
res.add(ORCIDHelper.INVALID_EXTERNALIDENTIFIERS);
54+
res.add(ORCIDHelper.INVALID_WORKEXTERNALIDENTIFIERS);
5555
return res;
5656
}
5757

src/test/java/pt/ptcris/test/scenarios/Scenario16.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ List<Work> expectedImportedInvalidWorks() {
6262
@Override
6363
Set<String> expectedInvalidCodes(BigInteger putCode) {
6464
Set<String> res = new HashSet<String>();
65-
res.add(ORCIDHelper.INVALID_EXTERNALIDENTIFIERS);
65+
res.add(ORCIDHelper.INVALID_WORKEXTERNALIDENTIFIERS);
6666
return res;
6767
}
6868

0 commit comments

Comments
 (0)