]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
e3b041d947c1e568bd3c0ad18e7ca1f00070d2d9
[tmp/jakarta-migration.git] /
1 package org.collectionspace.services.nuxeo.elasticsearch.anthro;
2
3 import java.util.Map;
4
5 import org.codehaus.jackson.node.ObjectNode;
6
7 import org.collectionspace.services.nuxeo.elasticsearch.DefaultESDocumentWriter;
8 import org.nuxeo.ecm.core.api.DocumentModel;
9
10 public class AnthroESDocumentWriter extends DefaultESDocumentWriter {
11
12         @Override
13         public ObjectNode getDenormValues(DocumentModel doc) {
14                 ObjectNode denormValues = super.getDenormValues(doc);
15                 String docType = doc.getType();
16
17                 if (docType.startsWith("CollectionObject")) {
18                         // Create a list of collection years from the field collection date structured date.
19
20                         Map<String, Object> fieldCollectionDateGroup = (Map<String, Object>) doc.getProperty("collectionobjects_common", "fieldCollectionDateGroup");
21
22                         denormValues.putArray("collectionYears").addAll(structDateToYearNodes(fieldCollectionDateGroup));
23                 }
24
25                 return denormValues;
26         }
27 }