use of org.vertexium.ElementType in project vertexium by visallo.
the class IdStrategy method extendedDataRowIdFromSearchHit.
public ExtendedDataRowId extendedDataRowIdFromSearchHit(SearchHit hit) {
SearchHitField elementTypeField = hit.getFields().get(Elasticsearch5SearchIndex.ELEMENT_TYPE_FIELD_NAME);
if (elementTypeField == null) {
throw new VertexiumException("Could not find field: " + Elasticsearch5SearchIndex.ELEMENT_TYPE_FIELD_NAME);
}
ElementType elementType = ElasticsearchDocumentType.parse(elementTypeField.getValue().toString()).toElementType();
SearchHitField elementIdField = hit.getFields().get(Elasticsearch5SearchIndex.ELEMENT_ID_FIELD_NAME);
if (elementIdField == null) {
throw new VertexiumException("Could not find field: " + Elasticsearch5SearchIndex.ELEMENT_ID_FIELD_NAME);
}
String elementId = elementIdField.getValue();
SearchHitField tableNameField = hit.getFields().get(Elasticsearch5SearchIndex.EXTENDED_DATA_TABLE_NAME_FIELD_NAME);
if (tableNameField == null) {
throw new VertexiumException("Could not find field: " + Elasticsearch5SearchIndex.EXTENDED_DATA_TABLE_NAME_FIELD_NAME);
}
String tableName = tableNameField.getValue();
SearchHitField rowIdField = hit.getFields().get(Elasticsearch5SearchIndex.EXTENDED_DATA_TABLE_ROW_ID_FIELD_NAME);
if (rowIdField == null) {
throw new VertexiumException("Could not find field: " + Elasticsearch5SearchIndex.EXTENDED_DATA_TABLE_ROW_ID_FIELD_NAME);
}
String rowId = rowIdField.getValue();
return new ExtendedDataRowId(elementType, elementId, tableName, rowId);
}
Aggregations