@Override
public IndexedRepresentation fromSolrDocument(SolrDocument doc, List<String> fieldsToReturn) throws GenericException {
final IndexedRepresentation ret = super.fromSolrDocument(doc, fieldsToReturn);
ret.setAipId(SolrUtils.objectToString(doc.get(RodaConstants.REPRESENTATION_AIP_ID), null));
ret.setOriginal(
Boolean.TRUE.equals(SolrUtils.objectToBoolean(doc.get(RodaConstants.REPRESENTATION_ORIGINAL), Boolean.FALSE)));
ret.setType(SolrUtils.objectToString(doc.get(RodaConstants.REPRESENTATION_TYPE), null));
ret.setTitle(SolrUtils.objectToString(doc.get(RodaConstants.REPRESENTATION_TITLE), null));
ret.setSizeInBytes(SolrUtils.objectToLong(doc.get(RodaConstants.REPRESENTATION_SIZE_IN_BYTES), 0L));
ret.setNumberOfDataFiles(SolrUtils.objectToLong(doc.get(RodaConstants.REPRESENTATION_NUMBER_OF_DATA_FILES), 0L));
ret
.setNumberOfDataFolders(SolrUtils.objectToLong(doc.get(RodaConstants.REPRESENTATION_NUMBER_OF_DATA_FOLDERS), 0L));
ret.setNumberOfDocumentationFiles(
SolrUtils.objectToLong(doc.get(RodaConstants.REPRESENTATION_NUMBER_OF_DOCUMENTATION_FILES), 0L));
ret
.setNumberOfSchemaFiles(SolrUtils.objectToLong(doc.get(RodaConstants.REPRESENTATION_NUMBER_OF_SCHEMA_FILES), 0L));
ret.setAncestors(SolrUtils.objectToListString(doc.get(RodaConstants.AIP_ANCESTORS)));
ret.setCreatedOn(SolrUtils.objectToDate(doc.get(RodaConstants.REPRESENTATION_CREATED_ON)));
ret.setCreatedBy(SolrUtils.objectToString(doc.get(RodaConstants.REPRESENTATION_CREATED_BY), ""));
ret.setUpdatedOn(SolrUtils.objectToDate(doc.get(RodaConstants.REPRESENTATION_UPDATED_ON)));
ret.setUpdatedBy(SolrUtils.objectToString(doc.get(RodaConstants.REPRESENTATION_UPDATED_BY), ""));
ret.setRepresentationStates(SolrUtils.objectToListString(doc.get(RodaConstants.REPRESENTATION_STATES)));
Map<String, Object> indexedFields = new HashMap<>();
for (String field : fieldsToReturn) {
indexedFields.put(field, doc.get(field));
}
ret.setFields(indexedFields);
return ret;
}