Commit 67fec7b77baed433eb56c0dd30173ccfbf533b12

Authored by André Gonçalves
1 parent 5555b3b5dc

Sprint 10 + API 2.0 RC2

Showing 109 changed files with 11515 additions and 5406 deletions   Show diff stats

Too many changes.

To preserve performance only 100 of 109 files displayed.

1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2 - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-4.0.0.xsd"> 2 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3 <modelVersion>4.0.0</modelVersion> 3 <modelVersion>4.0.0</modelVersion>
4 4
5 <groupId>org.um.dsi.gavea</groupId> 5 <groupId>org.um.dsi.gavea</groupId>
6 <artifactId>degois-orcid-client</artifactId> 6 <artifactId>degois-orcid-client</artifactId>
7 - <version>2.0-rc1</version> 7 + <version>2.0-rc2</version>
8 8
9 <name>Orcid Client</name> 9 <name>Orcid Client</name>
10 10
11 - <repositories>  
12 - <repository>  
13 - <id>maven-restlet</id>  
14 - <name>Restlet repository</name>  
15 - <url>http://maven.restlet.com</url>  
16 - </repository>  
17 - </repositories>  
18 -  
19 <properties> 11 <properties>
20 - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 12 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  13 + <java.version>1.8</java.version>
21 14
22 - <restlet-version>2.3.5</restlet-version>  
23 - <jersey.version>2.22.2</jersey.version> 15 + <jersey.version>2.22.1</jersey.version>
24 <jaxb2-basics.version>0.9.5</jaxb2-basics.version> 16 <jaxb2-basics.version>0.9.5</jaxb2-basics.version>
25 <log4j.version>2.4</log4j.version> 17 <log4j.version>2.4</log4j.version>
26 <junit.version>4.12</junit.version> 18 <junit.version>4.12</junit.version>
@@ -29,11 +21,25 @@ @@ -29,11 +21,25 @@
29 <dependencies> 21 <dependencies>
30 <!-- Jersey Client --> 22 <!-- Jersey Client -->
31 <dependency> 23 <dependency>
  24 + <groupId>org.glassfish.jersey.core</groupId>
  25 + <artifactId>jersey-client</artifactId>
  26 + <version>${jersey.version}</version>
  27 + </dependency>
  28 + <dependency>
32 <groupId>org.glassfish.jersey.containers</groupId> 29 <groupId>org.glassfish.jersey.containers</groupId>
33 <artifactId>jersey-container-servlet</artifactId> 30 <artifactId>jersey-container-servlet</artifactId>
34 <version>${jersey.version}</version> 31 <version>${jersey.version}</version>
35 - </dependency>  
36 - 32 + </dependency>
  33 + <dependency>
  34 + <groupId>org.glassfish.jersey.media</groupId>
  35 + <artifactId>jersey-media-json-jackson</artifactId>
  36 + <version>${jersey.version}</version>
  37 + </dependency>
  38 + <dependency>
  39 + <groupId>org.glassfish.jersey.media</groupId>
  40 + <artifactId>jersey-media-jaxb</artifactId>
  41 + <version>${jersey.version}</version>
  42 + </dependency>
37 <!-- JAXB2 Commons --> 43 <!-- JAXB2 Commons -->
38 <dependency> 44 <dependency>
39 <groupId>org.jvnet.jaxb2_commons</groupId> 45 <groupId>org.jvnet.jaxb2_commons</groupId>
@@ -46,6 +52,13 @@ @@ -46,6 +52,13 @@
46 <artifactId>log4j-core</artifactId> 52 <artifactId>log4j-core</artifactId>
47 <version>${log4j.version}</version> 53 <version>${log4j.version}</version>
48 </dependency> 54 </dependency>
  55 + <!-- JUnit -->
  56 + <dependency>
  57 + <groupId>junit</groupId>
  58 + <artifactId>junit</artifactId>
  59 + <version>${junit.version}</version>
  60 + <scope>test</scope>
  61 + </dependency>
49 </dependencies> 62 </dependencies>
50 63
51 <build> 64 <build>
@@ -63,15 +76,12 @@ @@ -63,15 +76,12 @@
63 </executions> 76 </executions>
64 <configuration> 77 <configuration>
65 <noFileHeader>true</noFileHeader> 78 <noFileHeader>true</noFileHeader>
66 - <generateDirectory>${project.build.directory}/generated-sources  
67 - </generateDirectory>  
68 - <bindingDirectory>${basedir}/src/main/resources/binding  
69 - </bindingDirectory>  
70 - <schemaDirectory>${basedir}/src/main/resources/xsd  
71 - </schemaDirectory> 79 + <generateDirectory>${project.build.directory}/generated-sources</generateDirectory>
  80 + <bindingDirectory>${basedir}/src/main/resources/binding</bindingDirectory>
  81 + <schemaDirectory>${basedir}/src/main/resources/xsd</schemaDirectory>
72 <schemaIncludes> 82 <schemaIncludes>
73 - <include>common_2.0_rc1/*.xsd</include>  
74 - <include>record_2.0_rc1/*.xsd</include> 83 + <include>common_2.0_rc2/*.xsd</include>
  84 + <include>record_2.0_rc2/*.xsd</include>
75 </schemaIncludes> 85 </schemaIncludes>
76 <episode>false</episode> 86 <episode>false</episode>
77 <args> 87 <args>
@@ -111,8 +121,8 @@ @@ -111,8 +121,8 @@
111 <version>3.3</version> 121 <version>3.3</version>
112 <inherited>true</inherited> 122 <inherited>true</inherited>
113 <configuration> 123 <configuration>
114 - <source/>  
115 - <target/> 124 + <source>${java.version}</source>
  125 + <target>${java.version}</target>
116 </configuration> 126 </configuration>
117 </plugin> 127 </plugin>
118 <plugin> 128 <plugin>
@@ -122,10 +132,7 @@ @@ -122,10 +132,7 @@
122 <configuration> 132 <configuration>
123 <skipTests>true</skipTests> 133 <skipTests>true</skipTests>
124 </configuration> 134 </configuration>
125 - </plugin> 135 + </plugin>
126 </plugins> 136 </plugins>
127 -  
128 </build> 137 </build>
129 -</project>  
130 -  
131 - 138 +</project>
132 \ No newline at end of file 139 \ No newline at end of file
src/main/java/org/um/dsi/gavea/orcid/client/BaseOrcidOAuthClient.java
@@ -160,12 +160,16 @@ public class BaseOrcidOAuthClient implements Serializable { @@ -160,12 +160,16 @@ public class BaseOrcidOAuthClient implements Serializable {
160 } 160 }
161 161
162 protected void exceptionBuilder(Response response) throws OrcidClientException { 162 protected void exceptionBuilder(Response response) throws OrcidClientException {
163 - if(response.getStatus() > 300) {  
164 - if(response.getStatus() == 400) { 163 + if (response.getStatus() > 300) {
  164 + if (response.getStatus() == 400) {
165 Error error = response.readEntity(Error.class); 165 Error error = response.readEntity(Error.class);
166 throw new OrcidClientException(error.getResponseCode(), error.getUserMessage(), error.getErrorCode(), error.getDeveloperMessage()); 166 throw new OrcidClientException(error.getResponseCode(), error.getUserMessage(), error.getErrorCode(), error.getDeveloperMessage());
167 } else 167 } else
168 throw new OrcidClientException(response.getStatus(), response.getStatus() + " - " + response.getStatusInfo().getReasonPhrase()); 168 throw new OrcidClientException(response.getStatus(), response.getStatus() + " - " + response.getStatusInfo().getReasonPhrase());
169 } 169 }
170 } 170 }
  171 +
  172 + public String getClientId() {
  173 + return clientId;
  174 + }
171 } 175 }
src/main/java/org/um/dsi/gavea/orcid/client/OrcidOAuthClient.java
@@ -15,9 +15,31 @@ import org.um.dsi.gavea.orcid.client.constants.OrcidConstants; @@ -15,9 +15,31 @@ import org.um.dsi.gavea.orcid.client.constants.OrcidConstants;
15 import org.um.dsi.gavea.orcid.client.exception.OrcidClientException; 15 import org.um.dsi.gavea.orcid.client.exception.OrcidClientException;
16 import org.um.dsi.gavea.orcid.client.extend.ScopePathTypeExt; 16 import org.um.dsi.gavea.orcid.client.extend.ScopePathTypeExt;
17 import org.um.dsi.gavea.orcid.model.activities.ActivitiesSummary; 17 import org.um.dsi.gavea.orcid.model.activities.ActivitiesSummary;
  18 +import org.um.dsi.gavea.orcid.model.address.Address;
  19 +import org.um.dsi.gavea.orcid.model.address.Addresses;
18 import org.um.dsi.gavea.orcid.model.common.ScopePathType; 20 import org.um.dsi.gavea.orcid.model.common.ScopePathType;
  21 +import org.um.dsi.gavea.orcid.model.education.Education;
  22 +import org.um.dsi.gavea.orcid.model.education.EducationSummary;
  23 +import org.um.dsi.gavea.orcid.model.email.Emails;
  24 +import org.um.dsi.gavea.orcid.model.employment.Employment;
  25 +import org.um.dsi.gavea.orcid.model.employment.EmploymentSummary;
19 import org.um.dsi.gavea.orcid.model.funding.Funding; 26 import org.um.dsi.gavea.orcid.model.funding.Funding;
  27 +import org.um.dsi.gavea.orcid.model.funding.FundingSummary;
  28 +import org.um.dsi.gavea.orcid.model.keyword.Keyword;
  29 +import org.um.dsi.gavea.orcid.model.keyword.Keywords;
  30 +import org.um.dsi.gavea.orcid.model.othername.OtherName;
  31 +import org.um.dsi.gavea.orcid.model.othername.OtherNames;
  32 +import org.um.dsi.gavea.orcid.model.peerreview.PeerReview;
  33 +import org.um.dsi.gavea.orcid.model.peerreview.PeerReviewSummary;
  34 +import org.um.dsi.gavea.orcid.model.person.Person;
  35 +import org.um.dsi.gavea.orcid.model.person.externalidentifier.ExternalIdentifier;
  36 +import org.um.dsi.gavea.orcid.model.person.externalidentifier.ExternalIdentifiers;
  37 +import org.um.dsi.gavea.orcid.model.personaldetails.Biography;
  38 +import org.um.dsi.gavea.orcid.model.personaldetails.PersonalDetails;
  39 +import org.um.dsi.gavea.orcid.model.researcherurl.ResearcherUrl;
  40 +import org.um.dsi.gavea.orcid.model.researcherurl.ResearcherUrls;
20 import org.um.dsi.gavea.orcid.model.work.Work; 41 import org.um.dsi.gavea.orcid.model.work.Work;
  42 +import org.um.dsi.gavea.orcid.model.work.WorkSummary;
21 43
22 public class OrcidOAuthClient extends BaseOrcidOAuthClient { 44 public class OrcidOAuthClient extends BaseOrcidOAuthClient {
23 private static final long serialVersionUID = -6655680509383446710L; 45 private static final long serialVersionUID = -6655680509383446710L;
@@ -29,12 +51,20 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -29,12 +51,20 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
29 } 51 }
30 52
31 53
  54 + /**
  55 + *
  56 + * @param scopes
  57 + * @param state
  58 + * @param orcidOrEmail
  59 + * @return
  60 + * @throws Exception
  61 + */
32 public String getAuthorizeUriLogin(final List<ScopePathType> scopes, final String state, final String orcidOrEmail) throws Exception { 62 public String getAuthorizeUriLogin(final List<ScopePathType> scopes, final String state, final String orcidOrEmail) throws Exception {
33 63
34 String orcidId = null; 64 String orcidId = null;
35 String email = null; 65 String email = null;
36 - if(orcidOrEmail != null && !"".equals(orcidOrEmail)) {  
37 - if(isValidOrcidId(orcidOrEmail)) 66 + if (orcidOrEmail != null && !"".equals(orcidOrEmail)) {
  67 + if (isValidOrcidId(orcidOrEmail))
38 orcidId = orcidOrEmail; 68 orcidId = orcidOrEmail;
39 else 69 else
40 email = orcidOrEmail; 70 email = orcidOrEmail;
@@ -43,14 +73,36 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -43,14 +73,36 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
43 return getAuthorizeUri(scopes, state, orcidId, null, null, email, null, true); 73 return getAuthorizeUri(scopes, state, orcidId, null, null, email, null, true);
44 } 74 }
45 75
  76 + /**
  77 + *
  78 + * @param scopes
  79 + * @param state
  80 + * @param familyNames
  81 + * @param givenNames
  82 + * @return
  83 + * @throws Exception
  84 + */
46 public String getAuthorizeUriRegistration(final List<ScopePathType> scopes, final String state, final String familyNames, final String givenNames) throws Exception { 85 public String getAuthorizeUriRegistration(final List<ScopePathType> scopes, final String state, final String familyNames, final String givenNames) throws Exception {
47 return getAuthorizeUri(scopes, state, null, familyNames, givenNames, null, null, false); 86 return getAuthorizeUri(scopes, state, null, familyNames, givenNames, null, null, false);
48 } 87 }
49 88
  89 + /**
  90 + *
  91 + * @param scopes
  92 + * @param state
  93 + * @param orcidId
  94 + * @param familyNames
  95 + * @param givenNames
  96 + * @param email
  97 + * @param lang
  98 + * @param login
  99 + * @return
  100 + * @throws Exception
  101 + */
50 private String getAuthorizeUri(final List<ScopePathType> scopes, final String state, final String orcidId, final String familyNames, final String givenNames, final String email, final String lang, 102 private String getAuthorizeUri(final List<ScopePathType> scopes, final String state, final String orcidId, final String familyNames, final String givenNames, final String email, final String lang,
51 final boolean login) throws Exception { 103 final boolean login) throws Exception {
52 104
53 - if(scopes == null) 105 + if (scopes == null)
54 throw new Exception("Cannot create Authorize Uri - missing scopes"); 106 throw new Exception("Cannot create Authorize Uri - missing scopes");
55 107
56 UriBuilder builder = UriBuilder.fromUri(loginUri); 108 UriBuilder builder = UriBuilder.fromUri(loginUri);
@@ -88,7 +140,12 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -88,7 +140,12 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
88 return builder.toString(); 140 return builder.toString();
89 } 141 }
90 142
91 - 143 + /**
  144 + *
  145 + * @param authorizationCode
  146 + * @return
  147 + * @throws OrcidClientException
  148 + */
92 public OrcidAccessToken getAccessTokens(final String authorizationCode) throws OrcidClientException { 149 public OrcidAccessToken getAccessTokens(final String authorizationCode) throws OrcidClientException {
93 MultivaluedMap<String, String> formData = new MultivaluedHashMap<String, String>(); 150 MultivaluedMap<String, String> formData = new MultivaluedHashMap<String, String>();
94 formData.add("client_id", clientId); 151 formData.add("client_id", clientId);
@@ -108,7 +165,265 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -108,7 +165,265 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
108 165
109 return response.readEntity(ActivitiesSummary.class); 166 return response.readEntity(ActivitiesSummary.class);
110 } finally { 167 } finally {
111 - if(response != null) 168 + if (response != null)
  169 + response.close();
  170 + }
  171 + }
  172 +
  173 +
  174 + /* Address */
  175 + public Addresses readAddresses(final OrcidAccessToken token) throws OrcidClientException {
  176 + Response response = null;
  177 + try {
  178 + response = get(OrcidConstants.ENDPOINT_ADDRESS, token, null);
  179 +
  180 + return response.readEntity(Addresses.class);
  181 + } finally {
  182 + if (response != null)
  183 + response.close();
  184 + }
  185 + }
  186 +
  187 + public Address readAddress(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  188 + Response response = null;
  189 + try {
  190 + response = get(OrcidConstants.ENDPOINT_ADDRESS, token, putCode);
  191 +
  192 + return response.readEntity(Address.class);
  193 + } finally {
  194 + if (response != null)
  195 + response.close();
  196 + }
  197 + }
  198 +
  199 + public void addAddress(final OrcidAccessToken token, Address address) throws OrcidClientException {
  200 + Response response = null;
  201 + try {
  202 + response = post(OrcidConstants.ENDPOINT_ADDRESS, token, Entity.entity(address, MediaType.APPLICATION_XML_TYPE));
  203 + } finally {
  204 + if (response != null)
  205 + response.close();
  206 + }
  207 + }
  208 +
  209 + public void updateAddress(final OrcidAccessToken token, final String putCode, final Address address) throws OrcidClientException {
  210 + Response response = null;
  211 + try {
  212 + response = put(OrcidConstants.ENDPOINT_ADDRESS, token, putCode, Entity.entity(address, MediaType.APPLICATION_XML_TYPE));
  213 + } finally {
  214 + if (response != null)
  215 + response.close();
  216 + }
  217 + }
  218 +
  219 + public void deleteAddress(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  220 + Response response = null;
  221 + try {
  222 + response = delete(OrcidConstants.ENDPOINT_ADDRESS, token, putCode);
  223 + } finally {
  224 + if (response != null)
  225 + response.close();
  226 + }
  227 + }
  228 +
  229 +
  230 + /* Biography */
  231 + public Biography readBiography(final OrcidAccessToken token) throws OrcidClientException {
  232 + Response response = null;
  233 + try {
  234 + response = get(OrcidConstants.ENDPOINT_BIOGRAPHY, token, null);
  235 +
  236 + return response.readEntity(Biography.class);
  237 + } finally {
  238 + if (response != null)
  239 + response.close();
  240 + }
  241 + }
  242 +
  243 +
  244 + /* Education */
  245 + public Education readEducation(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  246 + Response response = null;
  247 + try {
  248 + response = get(OrcidConstants.ENDPOINT_EDUCATION, token, putCode);
  249 +
  250 + return response.readEntity(Education.class);
  251 + } finally {
  252 + if (response != null)
  253 + response.close();
  254 + }
  255 + }
  256 +
  257 + public EducationSummary readEducationSummary(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  258 + Response response = null;
  259 + try {
  260 + response = get(OrcidConstants.ENDPOINT_EDUCATION_SUMMARY, token, putCode);
  261 +
  262 + return response.readEntity(EducationSummary.class);
  263 + } finally {
  264 + if (response != null)
  265 + response.close();
  266 + }
  267 + }
  268 +
  269 + public String addEducation(final OrcidAccessToken token, final Education education) throws OrcidClientException {
  270 + Response response = null;
  271 + try {
  272 + response = post(OrcidConstants.ENDPOINT_EDUCATION, token, Entity.entity(education, MediaType.APPLICATION_XML_TYPE));
  273 +
  274 + return retrievePutCode(response);
  275 + } finally {
  276 + if (response != null)
  277 + response.close();
  278 + }
  279 + }
  280 +
  281 + public void updateEducation(final OrcidAccessToken token, final String putCode, final Education education) throws OrcidClientException {
  282 + Response response = null;
  283 + try {
  284 + response = put(OrcidConstants.ENDPOINT_EDUCATION, token, putCode, Entity.entity(education, MediaType.APPLICATION_XML_TYPE));
  285 + } finally {
  286 + if (response != null)
  287 + response.close();
  288 + }
  289 + }
  290 +
  291 + public void deleteEducation(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  292 + Response response = null;
  293 + try {
  294 + response = delete(OrcidConstants.ENDPOINT_EDUCATION, token, putCode);
  295 + } finally {
  296 + if (response != null)
  297 + response.close();
  298 + }
  299 + }
  300 +
  301 +
  302 + /* Email */
  303 + public Emails readEmails(final OrcidAccessToken token) throws OrcidClientException {
  304 + Response response = null;
  305 + try {
  306 + response = get(OrcidConstants.ENDPOINT_EMAIL, token, null);
  307 +
  308 + return response.readEntity(Emails.class);
  309 + } finally {
  310 + if (response != null)
  311 + response.close();
  312 + }
  313 + }
  314 +
  315 +
  316 + /* Employment */
  317 + public Employment readEmployment(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  318 + Response response = null;
  319 + try {
  320 + response = get(OrcidConstants.ENDPOINT_EMPLOYMENT, token, putCode);
  321 +
  322 + return response.readEntity(Employment.class);
  323 + } finally {
  324 + if (response != null)
  325 + response.close();
  326 + }
  327 + }
  328 +
  329 + public EmploymentSummary readEmploymentSummary(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  330 + Response response = null;
  331 + try {
  332 + response = get(OrcidConstants.ENDPOINT_EMPLOYMENT_SUMMARY, token, putCode);
  333 +
  334 + return response.readEntity(EmploymentSummary.class);
  335 + } finally {
  336 + if (response != null)
  337 + response.close();
  338 + }
  339 + }
  340 +
  341 + public String addEmployment(final OrcidAccessToken token, final Employment employment) throws OrcidClientException {
  342 + Response response = null;
  343 + try {
  344 + response = post(OrcidConstants.ENDPOINT_EMPLOYMENT, token, Entity.entity(employment, MediaType.APPLICATION_XML_TYPE));
  345 +
  346 + return retrievePutCode(response);
  347 + } finally {
  348 + if (response != null)
  349 + response.close();
  350 + }
  351 + }
  352 +
  353 + public void updateEmployment(final OrcidAccessToken token, final String putCode, final Employment employment) throws OrcidClientException {
  354 + Response response = null;
  355 + try {
  356 + response = put(OrcidConstants.ENDPOINT_EMPLOYMENT, token, putCode, Entity.entity(employment, MediaType.APPLICATION_XML_TYPE));
  357 + } finally {
  358 + if (response != null)
  359 + response.close();
  360 + }
  361 + }
  362 +
  363 + public void deleteEmployment(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  364 + Response response = null;
  365 + try {
  366 + response = delete(OrcidConstants.ENDPOINT_EMPLOYMENT, token, putCode);
  367 + } finally {
  368 + if (response != null)
  369 + response.close();
  370 + }
  371 + }
  372 +
  373 +
  374 + /* External Identifier */
  375 + public ExternalIdentifiers readExternalIdentifiers(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  376 + Response response = null;
  377 + try {
  378 + response = get(OrcidConstants.ENDPOINT_EXTERNAL_IDENTIFIERS, token, putCode);
  379 +
  380 + return response.readEntity(ExternalIdentifiers.class);
  381 + } finally {
  382 + if (response != null)
  383 + response.close();
  384 + }
  385 + }
  386 +
  387 + public ExternalIdentifier readExternalIdentifier(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  388 + Response response = null;
  389 + try {
  390 + response = get(OrcidConstants.ENDPOINT_EXTERNAL_IDENTIFIERS, token, putCode);
  391 +
  392 + return response.readEntity(ExternalIdentifier.class);
  393 + } finally {
  394 + if (response != null)
  395 + response.close();
  396 + }
  397 + }
  398 +
  399 + public String addExternalIdentifier(final OrcidAccessToken token, final ExternalIdentifier externalIdentifier) throws OrcidClientException {
  400 + Response response = null;
  401 + try {
  402 + response = post(OrcidConstants.ENDPOINT_EXTERNAL_IDENTIFIERS, token, Entity.entity(externalIdentifier, MediaType.APPLICATION_XML_TYPE));
  403 +
  404 + return retrievePutCode(response);
  405 + } finally {
  406 + if (response != null)
  407 + response.close();
  408 + }
  409 + }
  410 +
  411 + public void updateExternalIdentifier(final OrcidAccessToken token, final String putCode, final ExternalIdentifier externalIdentifier) throws OrcidClientException {
  412 + Response response = null;
  413 + try {
  414 + response = put(OrcidConstants.ENDPOINT_EXTERNAL_IDENTIFIERS, token, putCode, Entity.entity(externalIdentifier, MediaType.APPLICATION_XML_TYPE));
  415 + } finally {
  416 + if (response != null)
  417 + response.close();
  418 + }
  419 + }
  420 +
  421 + public void deleteExternalIdentifier(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  422 + Response response = null;
  423 + try {
  424 + response = delete(OrcidConstants.ENDPOINT_EXTERNAL_IDENTIFIERS, token, putCode);
  425 + } finally {
  426 + if (response != null)
112 response.close(); 427 response.close();
113 } 428 }
114 } 429 }
@@ -122,7 +437,18 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -122,7 +437,18 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
122 437
123 return response.readEntity(Funding.class); 438 return response.readEntity(Funding.class);
124 } finally { 439 } finally {
125 - if(response != null) 440 + if (response != null)
  441 + response.close();
  442 + }
  443 + }
  444 + public FundingSummary readFundingSummary(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  445 + Response response = null;
  446 + try {
  447 + response = get(OrcidConstants.ENDPOINT_FUNDING_SUMMARY, token, putCode);
  448 +
  449 + return response.readEntity(FundingSummary.class);
  450 + } finally {
  451 + if (response != null)
126 response.close(); 452 response.close();
127 } 453 }
128 } 454 }
@@ -132,18 +458,11 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -132,18 +458,11 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
132 try { 458 try {
133 response = post(OrcidConstants.ENDPOINT_FUNDING, token, Entity.entity(funding, MediaType.APPLICATION_XML_TYPE)); 459 response = post(OrcidConstants.ENDPOINT_FUNDING, token, Entity.entity(funding, MediaType.APPLICATION_XML_TYPE));
134 460
135 - String location = response.getLocation().toString();  
136 - if(location != null && !"".equals(location)) {  
137 - String putCode = location.substring(location.lastIndexOf("/") + 1, location.length());  
138 - if(putCode.matches("\\d+"))  
139 - return putCode;  
140 - } 461 + return retrievePutCode(response);
141 } finally { 462 } finally {
142 - if(response != null) 463 + if (response != null)
143 response.close(); 464 response.close();
144 } 465 }
145 -  
146 - return null;  
147 } 466 }
148 467
149 public void updateFunding(final OrcidAccessToken token, final String putCode, final Funding funding) throws OrcidClientException { 468 public void updateFunding(final OrcidAccessToken token, final String putCode, final Funding funding) throws OrcidClientException {
@@ -151,7 +470,7 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -151,7 +470,7 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
151 try { 470 try {
152 response = put(OrcidConstants.ENDPOINT_FUNDING, token, putCode, Entity.entity(funding, MediaType.APPLICATION_XML_TYPE)); 471 response = put(OrcidConstants.ENDPOINT_FUNDING, token, putCode, Entity.entity(funding, MediaType.APPLICATION_XML_TYPE));
153 } finally { 472 } finally {
154 - if(response != null) 473 + if (response != null)
155 response.close(); 474 response.close();
156 } 475 }
157 } 476 }
@@ -161,7 +480,266 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -161,7 +480,266 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
161 try { 480 try {
162 response = delete(OrcidConstants.ENDPOINT_FUNDING, token, putCode); 481 response = delete(OrcidConstants.ENDPOINT_FUNDING, token, putCode);
163 } finally { 482 } finally {
164 - if(response != null) 483 + if (response != null)
  484 + response.close();
  485 + }
  486 + }
  487 +
  488 +
  489 + /* Keyword */
  490 + public Keywords readKeywords(final OrcidAccessToken token) throws OrcidClientException {
  491 + Response response = null;
  492 + try {
  493 + response = get(OrcidConstants.ENDPOINT_KEYWORDS, token, null);
  494 +
  495 + return response.readEntity(Keywords.class);
  496 + } finally {
  497 + if (response != null)
  498 + response.close();
  499 + }
  500 + }
  501 +
  502 + public Keyword readKeyword(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  503 + Response response = null;
  504 + try {
  505 + response = get(OrcidConstants.ENDPOINT_KEYWORDS, token, putCode);
  506 +
  507 + return response.readEntity(Keyword.class);
  508 + } finally {
  509 + if (response != null)
  510 + response.close();
  511 + }
  512 + }
  513 +
  514 + public String addKeyword(final OrcidAccessToken token, final Keyword keyword) throws OrcidClientException {
  515 + Response response = null;
  516 + try {
  517 + response = post(OrcidConstants.ENDPOINT_KEYWORDS, token, Entity.entity(keyword, MediaType.APPLICATION_XML_TYPE));
  518 +
  519 + return retrievePutCode(response);
  520 + } finally {
  521 + if (response != null)
  522 + response.close();
  523 + }
  524 + }
  525 +
  526 + public void updateKeyword(final OrcidAccessToken token, final String putCode, final Keyword keyword) throws OrcidClientException {
  527 + Response response = null;
  528 + try {
  529 + response = put(OrcidConstants.ENDPOINT_KEYWORDS, token, putCode, Entity.entity(keyword, MediaType.APPLICATION_XML_TYPE));
  530 + } finally {
  531 + if (response != null)
  532 + response.close();
  533 + }
  534 + }
  535 +
  536 + public void deleteKeyword(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  537 + Response response = null;
  538 + try {
  539 + response = delete(OrcidConstants.ENDPOINT_KEYWORDS, token, putCode);
  540 + } finally {
  541 + if (response != null)
  542 + response.close();
  543 + }
  544 + }
  545 +
  546 +
  547 + /* Other Name */
  548 + public OtherNames readOtherNames(final OrcidAccessToken token) throws OrcidClientException {
  549 + Response response = null;
  550 + try {
  551 + response = get(OrcidConstants.ENDPOINT_OTHER_NAMES, token, null);
  552 +
  553 + return response.readEntity(OtherNames.class);
  554 + } finally {
  555 + if (response != null)
  556 + response.close();
  557 + }
  558 + }
  559 +
  560 + public OtherName readOtherName(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  561 + Response response = null;
  562 + try {
  563 + response = get(OrcidConstants.ENDPOINT_OTHER_NAMES, token, putCode);
  564 +
  565 + return response.readEntity(OtherName.class);
  566 + } finally {
  567 + if (response != null)
  568 + response.close();
  569 + }
  570 + }
  571 +
  572 + public String addOtherName(final OrcidAccessToken token, final OtherName otherName) throws OrcidClientException {
  573 + Response response = null;
  574 + try {
  575 + response = post(OrcidConstants.ENDPOINT_OTHER_NAMES, token, Entity.entity(otherName, MediaType.APPLICATION_XML_TYPE));
  576 +
  577 + return retrievePutCode(response);
  578 + } finally {
  579 + if (response != null)
  580 + response.close();
  581 + }
  582 + }
  583 +
  584 + public void updateOtherName(final OrcidAccessToken token, final String putCode, final OtherName otherName) throws OrcidClientException {
  585 + Response response = null;
  586 + try {
  587 + response = put(OrcidConstants.ENDPOINT_OTHER_NAMES, token, putCode, Entity.entity(otherName, MediaType.APPLICATION_XML_TYPE));
  588 + } finally {
  589 + if (response != null)
  590 + response.close();
  591 + }
  592 + }
  593 +
  594 + public void deleteOtherName(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  595 + Response response = null;
  596 + try {
  597 + response = delete(OrcidConstants.ENDPOINT_OTHER_NAMES, token, putCode);
  598 + } finally {
  599 + if (response != null)
  600 + response.close();
  601 + }
  602 + }
  603 +
  604 +
  605 + /* Peer Review */
  606 + public PeerReview readPeerReview(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  607 + Response response = null;
  608 + try {
  609 + response = get(OrcidConstants.ENDPOINT_PEERREVIEW, token, putCode);
  610 +
  611 + return response.readEntity(PeerReview.class);
  612 + } finally {
  613 + if (response != null)
  614 + response.close();
  615 + }
  616 + }
  617 + public PeerReviewSummary readPeerReviewSummary(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  618 + Response response = null;
  619 + try {
  620 + response = get(OrcidConstants.ENDPOINT_PEERREVIEW_SUMMARY, token, putCode);
  621 +
  622 + return response.readEntity(PeerReviewSummary.class);
  623 + } finally {
  624 + if (response != null)
  625 + response.close();
  626 + }
  627 + }
  628 +
  629 + public String addPeerReview(final OrcidAccessToken token, final PeerReview peerReview) throws OrcidClientException {
  630 + Response response = null;
  631 + try {
  632 + response = post(OrcidConstants.ENDPOINT_PEERREVIEW, token, Entity.entity(peerReview, MediaType.APPLICATION_XML_TYPE));
  633 +
  634 + return retrievePutCode(response);
  635 + } finally {
  636 + if (response != null)
  637 + response.close();
  638 + }
  639 + }
  640 +
  641 + public void updatePeerReview(final OrcidAccessToken token, final String putCode, final PeerReview peerReview) throws OrcidClientException {
  642 + Response response = null;
  643 + try {
  644 + response = put(OrcidConstants.ENDPOINT_PEERREVIEW, token, putCode, Entity.entity(peerReview, MediaType.APPLICATION_XML_TYPE));
  645 + } finally {
  646 + if (response != null)
  647 + response.close();
  648 + }
  649 + }
  650 +
  651 + public void deletePeerReview(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  652 + Response response = null;
  653 + try {
  654 + response = delete(OrcidConstants.ENDPOINT_PEERREVIEW, token, putCode);
  655 + } finally {
  656 + if (response != null)
  657 + response.close();
  658 + }
  659 + }
  660 +
  661 +
  662 + /* Person */
  663 + public Person readPerson(final OrcidAccessToken token) throws OrcidClientException {
  664 + Response response = null;
  665 + try {
  666 + response = get(OrcidConstants.ENDPOINT_PERSON, token, null);
  667 +
  668 + return response.readEntity(Person.class);
  669 + } finally {
  670 + if (response != null)
  671 + response.close();
  672 + }
  673 + }
  674 +
  675 +
  676 + /* Personal Details */
  677 + public PersonalDetails readPersonalDetails(final OrcidAccessToken token) throws OrcidClientException {
  678 + Response response = null;
  679 + try {
  680 + response = get(OrcidConstants.ENDPOINT_PERSONAL_DETAILS, token, null);
  681 +
  682 + return response.readEntity(PersonalDetails.class);
  683 + } finally {
  684 + if (response != null)
  685 + response.close();
  686 + }
  687 + }
  688 +
  689 +
  690 + /* Researcher Url */
  691 + public ResearcherUrls readResearcherUrls(final OrcidAccessToken token) throws OrcidClientException {
  692 + Response response = null;
  693 + try {
  694 + response = get(OrcidConstants.ENDPOINT_RESEARCHER_URLS, token, null);
  695 +
  696 + return response.readEntity(ResearcherUrls.class);
  697 + } finally {
  698 + if (response != null)
  699 + response.close();
  700 + }
  701 + }
  702 +
  703 + public ResearcherUrl readResearcherUrl(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  704 + Response response = null;
  705 + try {
  706 + response = get(OrcidConstants.ENDPOINT_RESEARCHER_URLS, token, putCode);
  707 +
  708 + return response.readEntity(ResearcherUrl.class);
  709 + } finally {
  710 + if (response != null)
  711 + response.close();
  712 + }
  713 + }
  714 +
  715 + public String addResearcherUrl(final OrcidAccessToken token, final ResearcherUrl researcherUrl) throws OrcidClientException {
  716 + Response response = null;
  717 + try {
  718 + response = post(OrcidConstants.ENDPOINT_RESEARCHER_URLS, token, Entity.entity(researcherUrl, MediaType.APPLICATION_XML_TYPE));
  719 +
  720 + return retrievePutCode(response);
  721 + } finally {
  722 + if (response != null)
  723 + response.close();
  724 + }
  725 + }
  726 +
  727 + public void updateResearcherUrl(final OrcidAccessToken token, final String putCode, final ResearcherUrl researcherUrl) throws OrcidClientException {
  728 + Response response = null;
  729 + try {
  730 + response = put(OrcidConstants.ENDPOINT_RESEARCHER_URLS, token, putCode, Entity.entity(researcherUrl, MediaType.APPLICATION_XML_TYPE));
  731 + } finally {
  732 + if (response != null)
  733 + response.close();
  734 + }
  735 + }
  736 +
  737 + public void deleteResearcherUrl(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  738 + Response response = null;
  739 + try {
  740 + response = delete(OrcidConstants.ENDPOINT_RESEARCHER_URLS, token, putCode);
  741 + } finally {
  742 + if (response != null)
165 response.close(); 743 response.close();
166 } 744 }
167 } 745 }
@@ -175,7 +753,19 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -175,7 +753,19 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
175 753
176 return response.readEntity(Work.class); 754 return response.readEntity(Work.class);
177 } finally { 755 } finally {
178 - if(response != null) 756 + if (response != null)
  757 + response.close();
  758 + }
  759 + }
  760 +
  761 + public WorkSummary readWorkSummary(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
  762 + Response response = null;
  763 + try {
  764 + response = get(OrcidConstants.ENDPOINT_WORK_SUMMARY, token, putCode);
  765 +
  766 + return response.readEntity(WorkSummary.class);
  767 + } finally {
  768 + if (response != null)
179 response.close(); 769 response.close();
180 } 770 }
181 } 771 }
@@ -184,18 +774,12 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -184,18 +774,12 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
184 Response response = null; 774 Response response = null;
185 try { 775 try {
186 response = post(OrcidConstants.ENDPOINT_WORK, token, Entity.entity(work, MediaType.APPLICATION_XML_TYPE)); 776 response = post(OrcidConstants.ENDPOINT_WORK, token, Entity.entity(work, MediaType.APPLICATION_XML_TYPE));
187 - String location = response.getLocation().toString();  
188 - if (location != null && !"".equals(location)) {  
189 - String putCode = location.substring(location.lastIndexOf("/") + 1, location.length());  
190 - if (putCode.matches("\\d+"))  
191 - return putCode;  
192 - } 777 +
  778 + return retrievePutCode(response);
193 } finally { 779 } finally {
194 - if(response != null) 780 + if (response != null)
195 response.close(); 781 response.close();
196 } 782 }
197 -  
198 - return null;  
199 } 783 }
200 784
201 public void updateWork(final OrcidAccessToken token, final String putCode, final Work work) throws OrcidClientException { 785 public void updateWork(final OrcidAccessToken token, final String putCode, final Work work) throws OrcidClientException {
@@ -203,7 +787,7 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -203,7 +787,7 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
203 try { 787 try {
204 response = put(OrcidConstants.ENDPOINT_WORK, token, putCode, Entity.entity(work, MediaType.APPLICATION_XML_TYPE)); 788 response = put(OrcidConstants.ENDPOINT_WORK, token, putCode, Entity.entity(work, MediaType.APPLICATION_XML_TYPE));
205 } finally { 789 } finally {
206 - if(response != null) 790 + if (response != null)
207 response.close(); 791 response.close();
208 } 792 }
209 } 793 }
@@ -213,11 +797,33 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -213,11 +797,33 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
213 try { 797 try {
214 response = delete(OrcidConstants.ENDPOINT_WORK, token, putCode); 798 response = delete(OrcidConstants.ENDPOINT_WORK, token, putCode);
215 } finally { 799 } finally {
216 - if(response != null) 800 + if (response != null)
217 response.close(); 801 response.close();
218 } 802 }
219 } 803 }
220 804
  805 +
  806 + /**
  807 + *
  808 + * @param response
  809 + * @return
  810 + */
  811 + private String retrievePutCode(Response response) {
  812 + String location = response.getLocation().toString();
  813 + if (location != null && !"".equals(location)) {
  814 + String putCode = location.substring(location.lastIndexOf("/") + 1, location.length());
  815 + if (putCode.matches("\\d+"))
  816 + return putCode;
  817 + }
  818 +
  819 + return null;
  820 + }
  821 +
  822 + /**
  823 + *
  824 + * @param value
  825 + * @return
  826 + */
221 private boolean isValidOrcidId(final String value) { 827 private boolean isValidOrcidId(final String value) {
222 return value.matches("([0-9]{4})-([0-9]{4})-([0-9]{4})-([0-9]{3})(?:[0-9X]{1})"); 828 return value.matches("([0-9]{4})-([0-9]{4})-([0-9]{4})-([0-9]{3})(?:[0-9X]{1})");
223 } 829 }
src/main/java/org/um/dsi/gavea/orcid/client/constants/OrcidConstants.java
@@ -4,16 +4,31 @@ import javax.ws.rs.core.MediaType; @@ -4,16 +4,31 @@ import javax.ws.rs.core.MediaType;
4 4
5 public final class OrcidConstants { 5 public final class OrcidConstants {
6 6
7 - public final static String API_VERSION = "v2.0_rc1"; 7 + public final static String API_VERSION = "v2.0_rc2";
8 8
9 public final static String ENDPOINT_OAUTH_AUTHORIZE = "/oauth/authorize"; 9 public final static String ENDPOINT_OAUTH_AUTHORIZE = "/oauth/authorize";
10 public final static String ENDPOINT_OAUTH_TOKEN = "/oauth/token"; 10 public final static String ENDPOINT_OAUTH_TOKEN = "/oauth/token";
  11 +
11 public final static String ENDPOINT_ACTIVITIES = "/activities"; 12 public final static String ENDPOINT_ACTIVITIES = "/activities";
12 - public final static String ENDPOINT_EDUCATON = "/education"; 13 + public final static String ENDPOINT_ADDRESS = "/address";
  14 + public final static String ENDPOINT_BIOGRAPHY = "/biography";
  15 + public final static String ENDPOINT_EDUCATION = "/education";
  16 + public final static String ENDPOINT_EDUCATION_SUMMARY = "/education/summary";
  17 + public final static String ENDPOINT_EMAIL = "/email";
13 public final static String ENDPOINT_EMPLOYMENT = "/employment"; 18 public final static String ENDPOINT_EMPLOYMENT = "/employment";
  19 + public final static String ENDPOINT_EMPLOYMENT_SUMMARY = "/employment/summary";
  20 + public final static String ENDPOINT_EXTERNAL_IDENTIFIERS = "/external-identifiers";
14 public final static String ENDPOINT_FUNDING = "/funding"; 21 public final static String ENDPOINT_FUNDING = "/funding";
  22 + public final static String ENDPOINT_FUNDING_SUMMARY = "/funding/summary";
  23 + public final static String ENDPOINT_KEYWORDS = "/keywords";
  24 + public final static String ENDPOINT_OTHER_NAMES = "/other-names";
15 public final static String ENDPOINT_PEERREVIEW = "/peer-review"; 25 public final static String ENDPOINT_PEERREVIEW = "/peer-review";
  26 + public final static String ENDPOINT_PEERREVIEW_SUMMARY = "/peer-review/summary";
  27 + public final static String ENDPOINT_PERSON = "/person";
  28 + public final static String ENDPOINT_PERSONAL_DETAILS = "/personal-details";
  29 + public final static String ENDPOINT_RESEARCHER_URLS = "/researcher-urls";
16 public final static String ENDPOINT_WORK = "/work"; 30 public final static String ENDPOINT_WORK = "/work";
  31 + public final static String ENDPOINT_WORK_SUMMARY = "/work/summary";
17 32
18 public final static String APPLICATION_VND_ORCID_XML = "application/vnd.orcid+xml"; 33 public final static String APPLICATION_VND_ORCID_XML = "application/vnd.orcid+xml";
19 public final static MediaType APPLICATION_VND_ORCID_XML_TYPE = new MediaType("application", "vnd.orcid+xml"); 34 public final static MediaType APPLICATION_VND_ORCID_XML_TYPE = new MediaType("application", "vnd.orcid+xml");
src/main/resources/binding/orcid-2.0_rc1.xjb
@@ -1,66 +0,0 @@ @@ -1,66 +0,0 @@
1 -<?xml version="1.0" encoding="UTF-8"?>  
2 -<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"  
3 - xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"  
4 - xmlns:namespace="http://jaxb2-commons.dev.java.net/namespace-prefix"  
5 - jaxb:version="2.1">  
6 -  
7 - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc1/activities-2.0_rc1.xsd" node="/xs:schema">  
8 - <jaxb:globalBindings>  
9 - <jaxb:serializable uid="1" />  
10 - </jaxb:globalBindings>  
11 -  
12 - <jaxb:schemaBindings>  
13 - <jaxb:package name="org.um.dsi.gavea.orcid.model.activities" />  
14 - </jaxb:schemaBindings>  
15 - </jaxb:bindings>  
16 -  
17 - <jaxb:bindings schemaLocation="../xsd/common_2.0_rc1/common-2.0_rc1.xsd" node="/xs:schema">  
18 - <jaxb:schemaBindings>  
19 - <jaxb:package name="org.um.dsi.gavea.orcid.model.common" />  
20 - </jaxb:schemaBindings>  
21 -  
22 - <jaxb:bindings node="//xs:complexType[@name='client-id']/xs:sequence/xs:choice/xs:sequence/xs:element[@name='path']">  
23 - <jaxb:property name="uri-path" />  
24 - </jaxb:bindings>  
25 -  
26 - <jaxb:bindings node="//xs:complexType[@name='orcid-id']/xs:sequence/xs:choice/xs:sequence/xs:element[@name='path']">  
27 - <jaxb:property name="uri-path" />  
28 - </jaxb:bindings>  
29 - </jaxb:bindings>  
30 -  
31 - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc1/education-2.0_rc1.xsd" node="/xs:schema">  
32 - <jaxb:schemaBindings>  
33 - <jaxb:package name="org.um.dsi.gavea.orcid.model.education" />  
34 - </jaxb:schemaBindings>  
35 - </jaxb:bindings>  
36 -  
37 - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc1/employment-2.0_rc1.xsd" node="/xs:schema">  
38 - <jaxb:schemaBindings>  
39 - <jaxb:package name="org.um.dsi.gavea.orcid.model.employment" />  
40 - </jaxb:schemaBindings>  
41 - </jaxb:bindings>  
42 -  
43 - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc1/funding-2.0_rc1.xsd" node="/xs:schema">  
44 - <jaxb:schemaBindings>  
45 - <jaxb:package name="org.um.dsi.gavea.orcid.model.funding" />  
46 - </jaxb:schemaBindings>  
47 - </jaxb:bindings>  
48 -  
49 - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc1/peer-review-2.0_rc1.xsd" node="/xs:schema">  
50 - <jaxb:schemaBindings>  
51 - <jaxb:package name="org.um.dsi.gavea.orcid.model.peerreview" />  
52 - </jaxb:schemaBindings>  
53 - </jaxb:bindings>  
54 -  
55 - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc1/work-2.0_rc1.xsd" node="/xs:schema">  
56 - <jaxb:schemaBindings>  
57 - <jaxb:package name="org.um.dsi.gavea.orcid.model.work" />  
58 - </jaxb:schemaBindings>  
59 - </jaxb:bindings>  
60 -  
61 - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc1/error-2.0_rc1.xsd" node="/xs:schema">  
62 - <jaxb:schemaBindings>  
63 - <jaxb:package name="org.um.dsi.gavea.orcid.model.error" />  
64 - </jaxb:schemaBindings>  
65 - </jaxb:bindings>  
66 -</jaxb:bindings>  
67 \ No newline at end of file 0 \ No newline at end of file
src/main/resources/binding/orcid-2.0_rc2.xjb
@@ -0,0 +1,164 @@ @@ -0,0 +1,164 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
  3 + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
  4 + xmlns:namespace="http://jaxb2-commons.dev.java.net/namespace-prefix"
  5 + jaxb:version="2.1">
  6 +
  7 + <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/activities-2.0_rc2.xsd" node="/xs:schema">
  8 + <jaxb:globalBindings>
  9 + <jaxb:serializable uid="1" />
  10 + </jaxb:globalBindings>
  11 +
  12 + <jaxb:schemaBindings>
  13 + <jaxb:package name="org.um.dsi.gavea.orcid.model.activities" />
  14 + </jaxb:schemaBindings>
  15 + </jaxb:bindings>
  16 +
  17 + <jaxb:bindings schemaLocation="../xsd/common_2.0_rc2/common-2.0_rc2.xsd" node="/xs:schema">
  18 + <jaxb:schemaBindings>
  19 + <jaxb:package name="org.um.dsi.gavea.orcid.model.common" />
  20 + </jaxb:schemaBindings>
  21 +
  22 + <jaxb:bindings node="//xs:complexType[@name='client-id']/xs:sequence/xs:choice/xs:sequence/xs:element[@name='path']">
  23 + <jaxb:property name="uri-path" />
  24 + </jaxb:bindings>
  25 +
  26 + <jaxb:bindings node="//xs:complexType[@name='orcid-id']/xs:sequence/xs:choice/xs:sequence/xs:element[@name='path']">
  27 + <jaxb:property name="uri-path" />
  28 + </jaxb:bindings>
  29 + </jaxb:bindings>
  30 +
  31 + <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/address-2.0_rc2.xsd" node="/xs:schema">
  32 + <jaxb:schemaBindings>
  33 + <jaxb:package name="org.um.dsi.gavea.orcid.model.address" />
  34 + </jaxb:schemaBindings>
  35 +
  36 + <jaxb:bindings node="//xs:complexType[@name='address']">
  37 + <jaxb:property name="address-ctype" />
  38 + <jaxb:class name="AddressCtype" />
  39 + </jaxb:bindings>
  40 + </jaxb:bindings>
  41 +
  42 + <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/education-2.0_rc2.xsd" node="/xs:schema">
  43 + <jaxb:schemaBindings>
  44 + <jaxb:package name="org.um.dsi.gavea.orcid.model.education" />
  45 + </jaxb:schemaBindings>
  46 + </jaxb:bindings>
  47 +
  48 + <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/email-2.0_rc2.xsd" node="/xs:schema">
  49 + <jaxb:schemaBindings>
  50 + <jaxb:package name="org.um.dsi.gavea.orcid.model.email" />
  51 + </jaxb:schemaBindings>
  52 +
  53 + <jaxb:bindings node="//xs:complexType[@name='email']">
  54 + <jaxb:property name="email-ctype" />
  55 + <jaxb:class name="EmailCtype" />
  56 + </jaxb:bindings>
  57 + </jaxb:bindings>
  58 +
  59 + <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/employment-2.0_rc2.xsd" node="/xs:schema">
  60 + <jaxb:schemaBindings>
  61 + <jaxb:package name="org.um.dsi.gavea.orcid.model.employment" />
  62 + </jaxb:schemaBindings>
  63 + </jaxb:bindings>
  64 +
  65 + <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/error-2.0_rc2.xsd" node="/xs:schema">
  66 + <jaxb:schemaBindings>
  67 + <jaxb:package name="org.um.dsi.gavea.orcid.model.error" />
  68 + </jaxb:schemaBindings>
  69 + </jaxb:bindings>
  70 +
  71 + <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/funding-2.0_rc2.xsd" node="/xs:schema">
  72 + <jaxb:schemaBindings>
  73 + <jaxb:package name="org.um.dsi.gavea.orcid.model.funding" />
  74 + </jaxb:schemaBindings>
  75 +
  76 + <jaxb:bindings node="//xs:element[@name='summary']">
  77 + <jaxb:property name="funding-summary" />
  78 + <jaxb:class name="FundingSummary" />
  79 + </jaxb:bindings>
  80 + </jaxb:bindings>
  81 +
  82 + <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/keyword-2.0_rc2.xsd" node="/xs:schema">
  83 + <jaxb:schemaBindings>
  84 + <jaxb:package name="org.um.dsi.gavea.orcid.model.keyword" />
  85 + </jaxb:schemaBindings>
  86 +
  87 + <jaxb:bindings node="//xs:complexType[@name='keyword']">
  88 + <jaxb:property name="keyword-ctype" />
  89 + <jaxb:class name="KeywordCtype" />
  90 + </jaxb:bindings>
  91 + </jaxb:bindings>
  92 +
  93 + <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/other-name-2.0_rc2.xsd" node="/xs:schema">
  94 + <jaxb:schemaBindings>
  95 + <jaxb:package name="org.um.dsi.gavea.orcid.model.othername" />
  96 + </jaxb:schemaBindings>
  97 +
  98 + <jaxb:bindings node="//xs:complexType[@name='other-name']">
  99 + <jaxb:property name="other-name-ctype" />
  100 + <jaxb:class name="OtherNameCtype" />
  101 + </jaxb:bindings>
  102 + </jaxb:bindings>
  103 +
  104 + <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/peer-review-2.0_rc2.xsd" node="/xs:schema">
  105 + <jaxb:schemaBindings>
  106 + <jaxb:package name="org.um.dsi.gavea.orcid.model.peerreview" />
  107 + </jaxb:schemaBindings>
  108 +
  109 + <jaxb:bindings node="//xs:element[@name='summary']">
  110 + <jaxb:property name="peer-review-summary" />
  111 + <jaxb:class name="PeerReviewSummary" />
  112 + </jaxb:bindings>
  113 + </jaxb:bindings>
  114 +
  115 + <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/person-2.0_rc2.xsd" node="/xs:schema">
  116 + <jaxb:schemaBindings>
  117 + <jaxb:package name="org.um.dsi.gavea.orcid.model.person" />
  118 + </jaxb:schemaBindings>
  119 + </jaxb:bindings>
  120 +
  121 + <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/person-external-identifier-2.0_rc2.xsd" node="/xs:schema">
  122 + <jaxb:schemaBindings>
  123 + <jaxb:package name="org.um.dsi.gavea.orcid.model.person.externalidentifier" />
  124 + </jaxb:schemaBindings>
  125 + </jaxb:bindings>
  126 +
  127 + <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/personal-details-2.0_rc2.xsd" node="/xs:schema">
  128 + <jaxb:schemaBindings>
  129 + <jaxb:package name="org.um.dsi.gavea.orcid.model.personaldetails" />
  130 + </jaxb:schemaBindings>
  131 +
  132 + <jaxb:bindings node="//xs:complexType[@name='name']">
  133 + <jaxb:property name="name-ctype" />
  134 + <jaxb:class name="NameCtype" />
  135 + </jaxb:bindings>
  136 +
  137 + <jaxb:bindings node="//xs:complexType[@name='biography']">
  138 + <jaxb:property name="biography-ctype" />
  139 + <jaxb:class name="BiographyCtype" />
  140 + </jaxb:bindings>
  141 +
  142 + <jaxb:bindings node="//xs:complexType[@name='credit-name']">
  143 + <jaxb:property name="credit-name-ctype" />
  144 + <jaxb:class name="CreditNameCtype" />
  145 + </jaxb:bindings>
  146 + </jaxb:bindings>
  147 +
  148 + <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/researcher-url-2.0_rc2.xsd" node="/xs:schema">
  149 + <jaxb:schemaBindings>
  150 + <jaxb:package name="org.um.dsi.gavea.orcid.model.researcherurl" />
  151 + </jaxb:schemaBindings>
  152 +
  153 + <jaxb:bindings node="//xs:complexType[@name='researcher-url']">
  154 + <jaxb:property name="researcher-url-ctype" />
  155 + <jaxb:class name="ResearcherUrlCtype" />
  156 + </jaxb:bindings>
  157 + </jaxb:bindings>
  158 +
  159 + <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/work-2.0_rc2.xsd" node="/xs:schema">
  160 + <jaxb:schemaBindings>
  161 + <jaxb:package name="org.um.dsi.gavea.orcid.model.work" />
  162 + </jaxb:schemaBindings>
  163 + </jaxb:bindings>
  164 +</jaxb:bindings>
0 \ No newline at end of file 165 \ No newline at end of file
src/main/resources/xsd/common_2.0_rc1/common-2.0_rc1.xsd
@@ -1,1594 +0,0 @@ @@ -1,1594 +0,0 @@
1 -<?xml version="1.0" encoding="UTF-8"?>  
2 -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"  
3 - xmlns:sch="http://purl.oclc.org/dsdl/schematron" elementFormDefault="qualified"  
4 - targetNamespace="http://www.orcid.org/ns/common" xmlns:common="http://www.orcid.org/ns/common">  
5 - <xs:annotation>  
6 - <xs:documentation>  
7 - =============================================================================  
8 -  
9 - ORCID (R) Open Source  
10 - http://orcid.org  
11 -  
12 - Copyright (c) 2012-2014 ORCID,  
13 - Inc.  
14 - Licensed under an MIT-Style License (MIT)  
15 - http://orcid.org/open-source-license  
16 -  
17 - This copyright and license  
18 - information (including a link to the full  
19 - license)  
20 - shall be included in  
21 - its entirety in all copies or substantial portion of  
22 - the software.  
23 -  
24 - =============================================================================  
25 - The schema describes the message format used for ORCID API requests  
26 - and responses.  
27 - The top level element is orcid-message.  
28 - </xs:documentation>  
29 - <xs:appinfo>  
30 - <sch:title>Schematron validation</sch:title>  
31 - <sch:ns prefix="orcid" uri="http://www.orcid.org/ns/orcid" />  
32 - </xs:appinfo>  
33 - </xs:annotation>  
34 -  
35 - <xs:element name="last-modified-date">  
36 - <xs:complexType>  
37 - <xs:annotation>  
38 - <xs:documentation>The date time when the element was last modified.  
39 - </xs:documentation>  
40 - </xs:annotation>  
41 - <xs:simpleContent>  
42 - <xs:extension base="xs:dateTime" />  
43 - </xs:simpleContent>  
44 - </xs:complexType>  
45 - </xs:element>  
46 -  
47 - <xs:element name="created-date">  
48 - <xs:complexType>  
49 - <xs:annotation>  
50 - <xs:documentation>The date time when element was created.  
51 - </xs:documentation>  
52 - </xs:annotation>  
53 - <xs:simpleContent>  
54 - <xs:extension base="xs:dateTime" />  
55 - </xs:simpleContent>  
56 - </xs:complexType>  
57 - </xs:element>  
58 -  
59 - <xs:element name="read-date">  
60 - <xs:complexType>  
61 - <xs:annotation>  
62 - <xs:documentation>The date time when element was first read by the user.  
63 - </xs:documentation>  
64 - </xs:annotation>  
65 - <xs:simpleContent>  
66 - <xs:extension base="xs:dateTime" />  
67 - </xs:simpleContent>  
68 - </xs:complexType>  
69 - </xs:element>  
70 -  
71 - <xs:element name="archived-date">  
72 - <xs:complexType>