本文整理汇总了Java中org.apache.helix.ZNRecord.getSimpleFields方法的典型用法代码示例。如果您正苦于以下问题:Java ZNRecord.getSimpleFields方法的具体用法?Java ZNRecord.getSimpleFields怎么用?Java ZNRecord.getSimpleFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.helix.ZNRecord
的用法示例。
在下文中一共展示了ZNRecord.getSimpleFields方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromZnRecord
import org.apache.helix.ZNRecord; //导入方法依赖的package包/类
public static AbstractTableConfig fromZnRecord(ZNRecord record) throws JsonParseException, JsonMappingException,
JsonProcessingException, JSONException, IOException {
Map<String, String> simpleFields = record.getSimpleFields();
JSONObject str = new JSONObject();
str.put("tableName", simpleFields.get("tableName"));
str.put("tableType", simpleFields.get("tableType"));
str.put("segmentsConfig", new JSONObject(simpleFields.get("segmentsConfig")));
str.put("tenants", new JSONObject(simpleFields.get("tenants")));
str.put("tableIndexConfig", new JSONObject(simpleFields.get("tableIndexConfig")));
str.put("metadata", new JSONObject(simpleFields.get("metadata")));
return init(str.toString());
}
示例2: getWorkflowContextNode
import org.apache.helix.ZNRecord; //导入方法依赖的package包/类
private void getWorkflowContextNode(ObjectNode workflowContextNode, ZNRecord record) {
if (record.getMapFields() != null) {
for (String fieldName : record.getMapFields().keySet()) {
JsonNode node = OBJECT_MAPPER.valueToTree(record.getMapField(fieldName));
workflowContextNode.put(fieldName, node);
}
}
if (record.getSimpleFields() != null) {
for (Map.Entry<String, String> entry : record.getSimpleFields().entrySet()) {
workflowContextNode
.put(entry.getKey(), JsonNodeFactory.instance.textNode(entry.getValue()));
}
}
}
示例3: fromZnRecord
import org.apache.helix.ZNRecord; //导入方法依赖的package包/类
@Nonnull
public static TableConfig fromZnRecord(@Nonnull ZNRecord znRecord)
throws IOException, JSONException {
Map<String, String> simpleFields = znRecord.getSimpleFields();
TableType tableType = TableType.valueOf(simpleFields.get(TABLE_TYPE_KEY).toUpperCase());
String tableName = TableNameBuilder.forType(tableType).tableNameWithType(simpleFields.get(TABLE_NAME_KEY));
SegmentsValidationAndRetentionConfig validationConfig =
OBJECT_MAPPER.readValue(simpleFields.get(VALIDATION_CONFIG_KEY), SegmentsValidationAndRetentionConfig.class);
TenantConfig tenantConfig = OBJECT_MAPPER.readValue(simpleFields.get(TENANT_CONFIG_KEY), TenantConfig.class);
IndexingConfig indexingConfig =
OBJECT_MAPPER.readValue(simpleFields.get(INDEXING_CONFIG_KEY), IndexingConfig.class);
TableCustomConfig customConfig =
OBJECT_MAPPER.readValue(simpleFields.get(CUSTOM_CONFIG_KEY), TableCustomConfig.class);
QuotaConfig quotaConfig = null;
String quotaConfigString = simpleFields.get(QUOTA_CONFIG_KEY);
if (quotaConfigString != null) {
quotaConfig = OBJECT_MAPPER.readValue(quotaConfigString, QuotaConfig.class);
quotaConfig.validate();
}
TableTaskConfig taskConfig = null;
String taskConfigString = simpleFields.get(TASK_CONFIG_KEY);
if (taskConfigString != null) {
taskConfig = OBJECT_MAPPER.readValue(taskConfigString, TableTaskConfig.class);
}
String routingConfigString = simpleFields.get(ROUTING_CONFIG_KEY);
RoutingConfig routingConfig = null;
if (routingConfigString != null) {
routingConfig = OBJECT_MAPPER.readValue(routingConfigString, RoutingConfig.class);
}
return new TableConfig(tableName, tableType, validationConfig, tenantConfig, indexingConfig, customConfig,
quotaConfig, taskConfig, routingConfig);
}