All Downloads are FREE. Search and download functionalities are using the official Maven repository.

li.strolch.search.ActivitySearch Maven / Gradle / Ivy

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));
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy