private PrestoContextRules getValueTopicContextRules(PrestoTopic valueTopic) { PrestoContext context = rules.getContext(); PrestoContext subcontext = PrestoContext.createSubContext(context, field, valueTopic); PrestoContextRules subrules = presto.getPrestoContextRules(subcontext); return subrules; }
private Object getValue(PrestoTopic valueTopic) { PrestoContextRules subrules = getValueTopicContextRules(valueTopic); FieldValues fieldValues = presto.getFieldValues(subrules, valueField); List<? extends Object> values = fieldValues.getValues(); return values.isEmpty() ? null : values.get(0); }
private ValueFieldConfig getValueFieldConfig(PrestoTopic valueTopic, String valueFieldId) { String valueTypeId = valueTopic.getTypeId(); ValueFieldConfig valueFieldConfig = valueFieldConfigCache.get(valueTypeId); if (valueFieldConfig == null) { PrestoDataProvider dataProvider = presto.getDataProvider(); PrestoSchemaProvider schemaProvider = presto.getSchemaProvider(); PrestoType valueType = schemaProvider.getTypeById(valueTypeId); PrestoField valueField = valueType.getFieldById(valueFieldId); Comparator<Object> valueComparator = null; ObjectNode extra = ExtraUtils.getFieldExtraNode(valueField); if (extra != null) { JsonNode handlerNode = extra.path("valueComparator"); if (handlerNode.isObject()) { FieldValueComparator handler = AbstractHandler.getHandler( dataProvider, schemaProvider, FieldValueComparator.class, (ObjectNode) handlerNode); if (handler != null) { handler.setPresto(presto); } valueComparator = handler; } } if (valueComparator == null) { valueComparator = new FieldComparator(valueField, false); } valueFieldConfig = new ValueFieldConfig(presto, rules, field, valueField, valueComparator); valueFieldConfigCache.put(valueTypeId, valueFieldConfig); } return valueFieldConfig; }