Project

General

Profile

« Previous | Next » 

Revision 7517

include size and format datcite elements (optional) and use more general resourceType without formatId in them (Dataset/metadata and Dataset/data). http://schema.datacite.org/meta/kernel-2.2/doc/DataCite-MetadataKernel_v2.2.pdf

View differences:

src/edu/ucsb/nceas/metacat/dataone/DOIService.java
25 25
import java.io.InputStream;
26 26
import java.text.SimpleDateFormat;
27 27
import java.util.Arrays;
28
import java.util.Collections;
29 28
import java.util.HashMap;
30 29

  
31 30
import org.apache.log4j.Logger;
32 31
import org.apache.wicket.protocol.http.MockHttpServletRequest;
33 32
import org.dataone.client.D1Client;
34
import org.dataone.service.exceptions.InsufficientResources;
35 33
import org.dataone.service.exceptions.InvalidRequest;
36 34
import org.dataone.service.exceptions.InvalidToken;
37 35
import org.dataone.service.exceptions.NotAuthorized;
......
40 38
import org.dataone.service.exceptions.ServiceFailure;
41 39
import org.dataone.service.types.v1.Identifier;
42 40
import org.dataone.service.types.v1.Node;
41
import org.dataone.service.types.v1.ObjectFormat;
43 42
import org.dataone.service.types.v1.Permission;
44 43
import org.dataone.service.types.v1.Person;
45 44
import org.dataone.service.types.v1.Session;
......
174 173
				
175 174
				// publication year
176 175
				SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
177
				String year = sdf .format(sysMeta.getDateUploaded());
176
				String year = sdf.format(sysMeta.getDateUploaded());
178 177
				
179 178
				// type
180
				String resourceType = DataCiteProfileResourceTypeValues.DATASET.toString() + "/" + sysMeta.getFormatId().getValue();
179
				String resourceType = lookupResourceType(sysMeta);
181 180
				
181
				// format
182
				String format = sysMeta.getFormatId().getValue();
183
				
184
				//size
185
				String size = sysMeta.getSize().toString();
186
				
182 187
				// target (URL)
183 188
				String target = node.getBaseURL() + "/v1/object/" + identifier;
184 189
				
......
192 197
					export = InternalProfileValues.YES.toString();
193 198
				}
194 199
				
195
				// set the metadata fields
200
				// set the datacite metadata fields
196 201
				metadata.put(DataCiteProfile.TITLE.toString(), title);
197 202
				metadata.put(DataCiteProfile.CREATOR.toString(), creator);
198 203
				metadata.put(DataCiteProfile.PUBLISHER.toString(), publisher);
199 204
				metadata.put(DataCiteProfile.PUBLICATION_YEAR.toString(), year);
200 205
				metadata.put(DataCiteProfile.RESOURCE_TYPE.toString(), resourceType);
206
				metadata.put(DataCiteProfile.FORMAT.toString(), format);
207
				metadata.put(DataCiteProfile.SIZE.toString(), size);
201 208
				metadata.put(InternalProfile.TARGET.toString(), target);
202 209
				metadata.put(InternalProfile.STATUS.toString(), status);
203 210
				metadata.put(InternalProfile.EXPORT.toString(), export);
......
297 304
		}
298 305
		return title;
299 306
	}
307
	
308
	private String lookupResourceType(SystemMetadata sysMeta) {
309
		String resourceType = DataCiteProfileResourceTypeValues.DATASET.toString();
310
		try {
311
			ObjectFormat objectFormat = D1Client.getCN().getFormat(sysMeta.getFormatId());
312
			resourceType += "/" + objectFormat.getFormatType().toLowerCase();
313
		} catch (Exception e) {
314
			// ignore
315
			logMetacat.warn("Could not lookup resource type for formatId" + e.getMessage());
316
		}
317
		
318
		return resourceType;
319
	}
300 320

  
301 321
	/**
302 322
	 * Lookup the citable name for the given Subject

Also available in: Unified diff