Project

General

Profile

« Previous | Next » 

Revision 51617

We do not want to register E55_Types

View differences:

CatalogueRegistrator.java
75 75
			case "E70_Thing":
76 76
				json = getJsonForThing(resource, resCatName);
77 77
				break;
78
			case "E55_Type":
79
				json = getJsonForType(resource, resCatName);
80
				break;
81 78
			case "E29_Design_or_Procedure":
82 79
				json = getJsonForDesignProcedure(resource, resCatName);
83 80
				break;
......
251 248
		return out.toString("UTF-8");
252 249
	}
253 250

  
254
	protected String getJsonForType(final Resource res, final String resNameForCatalogue) throws IOException {
255
		JsonFactory jsonFactory = new JsonFactory();
256
		final ByteArrayOutputStream out = new ByteArrayOutputStream();
257
		BufferedOutputStream bos = new BufferedOutputStream(out);
258
		JsonGenerator jg = jsonFactory.createGenerator(bos, JsonEncoding.UTF8);
259
		jg.writeStartObject();
260
		writeCommonFields(jg, res, resNameForCatalogue);
261

  
262
		jg.writeArrayFieldStart("extras");
263
		addExtra(jg, "system:type", E55_Type.getLocalName());
264
		//specific class
265
		addExtra(jg, "instance of", resourceReader.findSpecificType(res, E55_Type).getLocalName());
266
		if (res.getURI().startsWith(PARTHENOS_BASE_URL)) {
267
			addExtra(jg, "Parthenos URL", res.getURI());
268
		}
269
        //TODO: add additional metadata for Type, if any
270
		jg.writeEndArray();
271

  
272
		jg.writeEndObject();
273
		jg.close();
274
		return out.toString("UTF-8");
275
	}
276

  
277 251
	protected String getJsonForDesignProcedure(final Resource res, final String resNameForCatalogue) throws IOException {
278 252
		JsonFactory jsonFactory = new JsonFactory();
279 253
		final ByteArrayOutputStream out = new ByteArrayOutputStream();

Also available in: Unified diff