Project

General

Profile

« Previous | Next » 

Revision 46705

View differences:

PublicationManagerImpl.java
139 139
		Publication publication = new Publication();
140 140
		InputStream is = null;
141 141

  
142

  
142 143
		try {
143 144
			is = new URL("http://api.crossref.org/works/" + doi).openStream();
144 145
			ObjectMapper mapper = new ObjectMapper();
......
162 163
				publication.setDate(this.parsePublicationDate(root.path("message").path("issued")));
163 164
				publication.setJournal(this.parseJournal(root.path("message").path("container-title"), root.path("message").path("ISSN")));
164 165
				publication.getJournal().setPublisher(this.parsePublisher(root.path("message").path("publisher")));
165

  
166
				/*publication.setAffiliations(new ArrayList<Affiliation>());
166
				System.out.println("get");
167
				publication.setAuthors(new ArrayList<Author>());
167 168
				for (JsonNode author : root.path("message").path("author")) {
168
					publication.getAffiliations().add(this.parseAffiliation(author));
169
				}*/
169
					publication.getAuthors().add(this.parseAffiliation(author));
170
				}
170 171

  
171 172
				publication.setLicense(root.path("message").path("license").path(0).path("URL").textValue());
172 173

  
......
191 192
		return publication;
192 193
	}
193 194

  
194
	private Affiliation parseAffiliation(JsonNode author) {
195
		User user = new User();
195
	private Author parseAffiliation(JsonNode author) {
196
		/*User user = new User();
196 197
		user.setFirstname(author.path("given").textValue());
197 198
		user.setLastname(author.path("family").textValue());
198 199
		user.setAffiliations(new ArrayList<Affiliation>());
199 200

  
200 201
		Affiliation af = new Affiliation();
201 202
		user.getAffiliations().add(af);
202
		return af;
203
		return af;*/
204

  
205
		Author a = new Author();
206
		a.setFirstname(author.path("given").textValue());
207
		a.setLastname(author.path("family").textValue());
208
		return a;
209

  
210

  
211

  
203 212
	}
204 213

  
205 214
	private Publisher parsePublisher(JsonNode publisherName) {
206 215
		Publisher publisher = new Publisher();
207 216

  
208 217
		publisher.setName(publisherName.textValue());
209

  
210
		/*publisher.setBank_address(publisherManager.getBankAddress().toString());
211
		publisher.setBank_holder(null);
212
		publisher.setBank_iban(null);
213
		publisher.setBank_name(null);*/
214
		
215
		publisher.setBankAccount(new BankAccount());
216

  
218
		System.out.println("set");
219
		publisher.setBankAccount(new BankAccount(null,publisherManager.getBankAddress().toString(),
220
				null,null,null));
221
		System.out.println("set");
217 222
		publisher.setId("crossref::" + DigestUtils.md5Hex(publisher.getName()));
218 223
		publisher.setSource("crossref");
219 224

  
......
245 250
			journal.setSource("crossref");
246 251
			journal.setId("crossref::" + DigestUtils.md5Hex(journal.getTitle()));
247 252
		}
253

  
248 254
		return journal;
249 255
	}
250 256

  

Also available in: Unified diff