li.strolch.search.ActivitySearch Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of agent Show documentation
Show all versions of agent Show documentation
Strolch Agent which is the runtime for Strolch
The newest version!
package li.strolch.search;
import static li.strolch.model.StrolchModelConstants.PolicyConstants.PARAM_ORDER;
import li.strolch.model.Order;
import li.strolch.model.activity.Activity;
import li.strolch.persistence.api.StrolchTransaction;
/**
* Performs a search for {@link Activity} elements
*/
public class ActivitySearch extends StrolchSearch {
private SearchNavigator navigator;
@Override
protected SearchNavigator getNavigator() {
return this.navigator;
}
@Override
public ActivitySearch types(String... types) {
this.navigator = tx -> tx.streamActivities(types);
return this;
}
public ActivitySearch forOrder(Order order) {
types(order.getType());
where(relation(PARAM_ORDER).isEqualTo(order.getId()));
return this;
}
@Override
public ActivitySearch where(SearchExpression expression) {
super.where(expression);
return this;
}
@Override
public ActivitySearch internal() {
super.internal();
return this;
}
@Override
public ActivitySearchResult search(StrolchTransaction tx) {
return new ActivitySearchResult(prepareSearch(tx));
}
}