use of com.b2international.snowowl.core.merge.Merges in project snow-owl by b2ihealthcare.
the class SearchMergeRequest method doExecute.
@Override
public Merges doExecute(RepositoryContext context) {
final ExpressionBuilder queryBuilder = Expressions.builder();
// add mergerequest type filter
queryBuilder.filter(RemoteJobEntry.Expressions.matchRequestType(ImmutableSet.of(BranchRebaseRequest.class.getSimpleName(), BranchMergeRequest.class.getSimpleName())));
if (containsKey(OptionKey.SOURCE)) {
queryBuilder.filter(RemoteJobEntry.Expressions.matchParameter(SOURCE_FIELD, getCollection(OptionKey.SOURCE, String.class)));
}
if (containsKey(OptionKey.TARGET)) {
queryBuilder.filter(RemoteJobEntry.Expressions.matchParameter(TARGET_FIELD, getCollection(OptionKey.TARGET, String.class)));
}
if (containsKey(OptionKey.STATUS)) {
queryBuilder.filter(RemoteJobEntry.Expressions.matchParameter(STATUS_FIELD, getCollection(OptionKey.STATUS, String.class)));
}
final RemoteJobs jobs = context.service(RemoteJobTracker.class).search(queryBuilder.build(), Integer.MAX_VALUE);
final ObjectMapper mapper = context.service(ObjectMapper.class);
final List<Merge> items = jobs.stream().map(job -> createMergefromJobEntry(job, mapper)).collect(Collectors.toList());
return new Merges(items, jobs.getSearchAfter(), jobs.getLimit(), jobs.getTotal());
}
Aggregations