use of co.cask.cdap.common.app.RunIds in project cdap by caskdata.
the class AppMetadataStore method getRunsForRunIds.
private Map<ProgramRunId, RunRecordMeta> getRunsForRunIds(final Set<ProgramRunId> runIds, String recordType, int limit) {
Set<MDSKey> keySet = new HashSet<>();
boolean includeVersionLessKeys = !upgradeComplete.get();
for (ProgramRunId programRunId : runIds) {
keySet.add(getProgramKeyBuilder(recordType, programRunId.getParent()).build());
if (includeVersionLessKeys && programRunId.getVersion().equals(ApplicationId.DEFAULT_VERSION)) {
keySet.add(getVersionLessProgramKeyBuilder(recordType, programRunId.getParent()).build());
}
}
Predicate<KeyValue<RunRecordMeta>> combinedFilter = input -> {
ProgramId programId = getProgramID(input.getKey());
RunRecordMeta meta = input.getValue();
ProgramRunId programRunId = programId.run(meta.getPid());
return runIds.contains(programRunId);
};
Map<MDSKey, RunRecordMeta> returnMap = listKV(keySet, RunRecordMeta.class, limit, combinedFilter);
return getProgramRunIdMap(returnMap);
}
Aggregations