本文整理了Java中org.apache.helix.messaging.ZNRecordRow
类的一些代码示例,展示了ZNRecordRow
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZNRecordRow
类的具体详情如下:
包路径:org.apache.helix.messaging.ZNRecordRow
类名称:ZNRecordRow
[英]A Normalized form of ZNRecord
[中]一种规范化的记录形式
代码示例来源:origin: apache/incubator-gobblin
List<ZNRecordRow> allRows = ZNRecordRow.flatten(HelixProperty.convertToList(properties));
(liveParticipants.contains(row.getRecordId()) || liveParticipants.contains(row.getMapSubKey()))) {
result.add(row);
Map<String, String> resultRow = new HashMap<String, String>();
resultRow.put("instanceName", !recipientCriteria.getInstanceName().equals("") ?
(!Strings.isNullOrEmpty(row.getMapSubKey()) ? row.getMapSubKey() : row.getRecordId()) : "");
resultRow.put("resourceName", !recipientCriteria.getResource().equals("") ? row.getRecordId() : "");
resultRow.put("partitionName", !recipientCriteria.getPartition().equals("") ? row.getMapKey() : "");
resultRow.put("partitionState", !recipientCriteria.getPartitionState().equals("") ? row.getMapValue() : "");
selected.add(resultRow);
代码示例来源:origin: org.apache.helix/helix-core
public static List<ZNRecordRow> flatten(Collection<ZNRecord> recordList) {
List<ZNRecordRow> result = new ArrayList<ZNRecordRow>();
for (ZNRecord record : recordList) {
result.addAll(flatten(record));
}
return result;
}
代码示例来源:origin: org.apache.helix/helix-core
public static List<ZNRecordRow> convertSimpleFields(ZNRecord record) {
List<ZNRecordRow> result = new ArrayList<ZNRecordRow>();
for (String key : record.getSimpleFields().keySet()) {
ZNRecordRow row = new ZNRecordRow();
row.putField(ZNRECORD_ID, record.getId());
row.putField(SIMPLE_KEY, key);
row.putField(SIMPLE_VALUE, record.getSimpleField(key));
result.add(row);
}
return result;
}
代码示例来源:origin: org.apache.helix/helix-core
public static List<ZNRecordRow> flatten(ZNRecord record) {
List<ZNRecordRow> result = convertMapFields(record);
result.addAll(convertListFields(record));
result.addAll(convertSimpleFields(record));
return result;
}
代码示例来源:origin: apache/helix
public static List<ZNRecordRow> flatten(Collection<ZNRecord> recordList) {
List<ZNRecordRow> result = new ArrayList<ZNRecordRow>();
for (ZNRecord record : recordList) {
result.addAll(flatten(record));
}
return result;
}
代码示例来源:origin: apache/helix
public static List<ZNRecordRow> convertSimpleFields(ZNRecord record) {
List<ZNRecordRow> result = new ArrayList<ZNRecordRow>();
for (String key : record.getSimpleFields().keySet()) {
ZNRecordRow row = new ZNRecordRow();
row.putField(ZNRECORD_ID, record.getId());
row.putField(SIMPLE_KEY, key);
row.putField(SIMPLE_VALUE, record.getSimpleField(key));
result.add(row);
}
return result;
}
代码示例来源:origin: apache/helix
public static List<ZNRecordRow> flatten(ZNRecord record) {
List<ZNRecordRow> result = convertMapFields(record);
result.addAll(convertListFields(record));
result.addAll(convertSimpleFields(record));
return result;
}
代码示例来源:origin: apache/incubator-gobblin
/**
* Check if a given row matches the specified criteria
* @param criteria the criteria
* @param row row of currently persisted data
* @return true if it matches, false otherwise
*/
private boolean rowMatches(Criteria criteria, ZNRecordRow row) {
String instanceName = normalizePattern(criteria.getInstanceName());
String resourceName = normalizePattern(criteria.getResource());
String partitionName = normalizePattern(criteria.getPartition());
String partitionState = normalizePattern(criteria.getPartitionState());
return stringMatches(instanceName, row.getMapSubKey()) && stringMatches(resourceName, row.getRecordId())
&& stringMatches(partitionName, row.getMapKey()) && stringMatches(partitionState, row.getMapValue());
}
代码示例来源:origin: apache/helix
public static List<ZNRecordRow> convertMapFields(ZNRecord record) {
List<ZNRecordRow> result = new ArrayList<ZNRecordRow>();
for (String key0 : record.getMapFields().keySet()) {
for (String key1 : record.getMapField(key0).keySet()) {
ZNRecordRow row = new ZNRecordRow();
row.putField(ZNRECORD_ID, record.getId());
row.putField(MAP_KEY, key0);
row.putField(MAP_SUBKEY, key1);
row.putField(MAP_VALUE, record.getMapField(key0).get(key1));
result.add(row);
}
}
return result;
}
代码示例来源:origin: org.apache.gobblin/gobblin-cluster
List<ZNRecordRow> allRows = ZNRecordRow.flatten(HelixProperty.convertToList(properties));
(liveParticipants.contains(row.getRecordId()) || liveParticipants.contains(row.getMapSubKey()))) {
result.add(row);
Map<String, String> resultRow = new HashMap<String, String>();
resultRow.put("instanceName", !recipientCriteria.getInstanceName().equals("") ?
(!Strings.isNullOrEmpty(row.getMapSubKey()) ? row.getMapSubKey() : row.getRecordId()) : "");
resultRow.put("resourceName", !recipientCriteria.getResource().equals("") ? row.getRecordId() : "");
resultRow.put("partitionName", !recipientCriteria.getPartition().equals("") ? row.getMapKey() : "");
resultRow.put("partitionState", !recipientCriteria.getPartitionState().equals("") ? row.getMapValue() : "");
selected.add(resultRow);
代码示例来源:origin: org.apache.helix/helix-core
public static List<ZNRecordRow> convertMapFields(ZNRecord record) {
List<ZNRecordRow> result = new ArrayList<ZNRecordRow>();
for (String key0 : record.getMapFields().keySet()) {
for (String key1 : record.getMapField(key0).keySet()) {
ZNRecordRow row = new ZNRecordRow();
row.putField(ZNRECORD_ID, record.getId());
row.putField(MAP_KEY, key0);
row.putField(MAP_SUBKEY, key1);
row.putField(MAP_VALUE, record.getMapField(key0).get(key1));
result.add(row);
}
}
return result;
}
代码示例来源:origin: com.linkedin.gobblin/gobblin-cluster
List<ZNRecordRow> allRows = ZNRecordRow.flatten(HelixProperty.convertToList(properties));
(liveParticipants.contains(row.getRecordId()) || liveParticipants.contains(row.getMapSubKey()))) {
result.add(row);
Map<String, String> resultRow = new HashMap<String, String>();
resultRow.put("instanceName", !recipientCriteria.getInstanceName().equals("") ?
(!Strings.isNullOrEmpty(row.getMapSubKey()) ? row.getMapSubKey() : row.getRecordId()) : "");
resultRow.put("resourceName", !recipientCriteria.getResource().equals("") ? row.getRecordId() : "");
resultRow.put("partitionName", !recipientCriteria.getPartition().equals("") ? row.getMapKey() : "");
resultRow.put("partitionState", !recipientCriteria.getPartitionState().equals("") ? row.getMapValue() : "");
selected.add(resultRow);
代码示例来源:origin: org.apache.helix/helix-core
public static List<ZNRecordRow> convertListFields(ZNRecord record) {
List<ZNRecordRow> result = new ArrayList<ZNRecordRow>();
for (String key : record.getListFields().keySet()) {
int order = 0;
for (String value : record.getListField(key)) {
ZNRecordRow row = new ZNRecordRow();
row.putField(ZNRECORD_ID, record.getId());
row.putField(LIST_KEY, key);
row.putField(LIST_VALUE, record.getSimpleField(key));
row.putField(LIST_VALUE_INDEX, "" + order);
order++;
result.add(row);
}
}
return result;
}
代码示例来源:origin: org.apache.helix/helix-core
/**
* Check if a given row matches the specified criteria
* @param criteria the criteria
* @param row row of currently persisted data
* @return true if it matches, false otherwise
*/
private boolean rowMatches(Criteria criteria, ZNRecordRow row) {
String instanceName = normalizePattern(criteria.getInstanceName());
String resourceName = normalizePattern(criteria.getResource());
String partitionName = normalizePattern(criteria.getPartition());
String partitionState = normalizePattern(criteria.getPartitionState());
return (stringMatches(instanceName, Strings.nullToEmpty(row.getMapSubKey())) ||
stringMatches(instanceName, Strings.nullToEmpty(row.getRecordId())))
&& stringMatches(resourceName, Strings.nullToEmpty(row.getRecordId()))
&& stringMatches(partitionName, Strings.nullToEmpty(row.getMapKey()))
&& stringMatches(partitionState, Strings.nullToEmpty(row.getMapValue()));
}
代码示例来源:origin: apache/helix
public static List<ZNRecordRow> convertListFields(ZNRecord record) {
List<ZNRecordRow> result = new ArrayList<ZNRecordRow>();
for (String key : record.getListFields().keySet()) {
int order = 0;
for (String value : record.getListField(key)) {
ZNRecordRow row = new ZNRecordRow();
row.putField(ZNRECORD_ID, record.getId());
row.putField(LIST_KEY, key);
row.putField(LIST_VALUE, record.getSimpleField(key));
row.putField(LIST_VALUE_INDEX, "" + order);
order++;
result.add(row);
}
}
return result;
}
代码示例来源:origin: apache/helix
/**
* Check if a given row matches the specified criteria
* @param criteria the criteria
* @param row row of currently persisted data
* @return true if it matches, false otherwise
*/
private boolean rowMatches(Criteria criteria, ZNRecordRow row) {
String instanceName = normalizePattern(criteria.getInstanceName());
String resourceName = normalizePattern(criteria.getResource());
String partitionName = normalizePattern(criteria.getPartition());
String partitionState = normalizePattern(criteria.getPartitionState());
return (stringMatches(instanceName, Strings.nullToEmpty(row.getMapSubKey())) ||
stringMatches(instanceName, Strings.nullToEmpty(row.getRecordId())))
&& stringMatches(resourceName, Strings.nullToEmpty(row.getRecordId()))
&& stringMatches(partitionName, Strings.nullToEmpty(row.getMapKey()))
&& stringMatches(partitionState, Strings.nullToEmpty(row.getMapValue()));
}
代码示例来源:origin: org.apache.gobblin/gobblin-cluster
/**
* Check if a given row matches the specified criteria
* @param criteria the criteria
* @param row row of currently persisted data
* @return true if it matches, false otherwise
*/
private boolean rowMatches(Criteria criteria, ZNRecordRow row) {
String instanceName = normalizePattern(criteria.getInstanceName());
String resourceName = normalizePattern(criteria.getResource());
String partitionName = normalizePattern(criteria.getPartition());
String partitionState = normalizePattern(criteria.getPartitionState());
return stringMatches(instanceName, row.getMapSubKey()) && stringMatches(resourceName, row.getRecordId())
&& stringMatches(partitionName, row.getMapKey()) && stringMatches(partitionState, row.getMapValue());
}
代码示例来源:origin: com.linkedin.gobblin/gobblin-cluster
/**
* Check if a given row matches the specified criteria
* @param criteria the criteria
* @param row row of currently persisted data
* @return true if it matches, false otherwise
*/
private boolean rowMatches(Criteria criteria, ZNRecordRow row) {
String instanceName = normalizePattern(criteria.getInstanceName());
String resourceName = normalizePattern(criteria.getResource());
String partitionName = normalizePattern(criteria.getPartition());
String partitionState = normalizePattern(criteria.getPartitionState());
return stringMatches(instanceName, row.getMapSubKey()) && stringMatches(resourceName, row.getRecordId())
&& stringMatches(partitionName, row.getMapKey()) && stringMatches(partitionState, row.getMapValue());
}
代码示例来源:origin: apache/helix
List<ZNRecordRow> allRows = ZNRecordRow.flatten(HelixProperty.convertToList(properties));
(liveParticipants.contains(row.getRecordId()) || liveParticipants.contains(row.getMapSubKey()))) {
result.add(row);
Map<String, String> resultRow = new HashMap<String, String>();
resultRow.put("instanceName", !recipientCriteria.getInstanceName().equals("") ?
(!Strings.isNullOrEmpty(row.getMapSubKey()) ? row.getMapSubKey() : row.getRecordId()) :
"");
resultRow.put("resourceName", !recipientCriteria.getResource().equals("") ? row.getRecordId()
: "");
resultRow.put("partitionName", !recipientCriteria.getPartition().equals("") ? row.getMapKey()
: "");
resultRow.put("partitionState",
!recipientCriteria.getPartitionState().equals("") ? row.getMapValue() : "");
selected.add(resultRow);
代码示例来源:origin: org.apache.helix/helix-core
List<ZNRecordRow> allRows = ZNRecordRow.flatten(HelixProperty.convertToList(properties));
(liveParticipants.contains(row.getRecordId()) || liveParticipants.contains(row.getMapSubKey()))) {
result.add(row);
Map<String, String> resultRow = new HashMap<String, String>();
resultRow.put("instanceName", !recipientCriteria.getInstanceName().equals("") ?
(!Strings.isNullOrEmpty(row.getMapSubKey()) ? row.getMapSubKey() : row.getRecordId()) :
"");
resultRow.put("resourceName", !recipientCriteria.getResource().equals("") ? row.getRecordId()
: "");
resultRow.put("partitionName", !recipientCriteria.getPartition().equals("") ? row.getMapKey()
: "");
resultRow.put("partitionState",
!recipientCriteria.getPartitionState().equals("") ? row.getMapValue() : "");
selected.add(resultRow);
内容来源于网络,如有侵权,请联系作者删除!