blob: 36d8118d982bd4f2722c15c9b3df62a4f5e4daef [file] [log] [blame]
/**
* Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Florian Pirchner - Initial implementation
*/
package org.eclipse.osbp.runtime.web.vaadin.common.data;
import java.util.List;
import org.eclipse.osbp.runtime.common.filter.SortOrder;
import com.vaadin.data.Container.Filter;
// TODO: Auto-generated Javadoc
/**
* The Interface IBeanSearchService.
*
* @param <BEAN>
* the generic type
*/
public interface IBeanSearchService<BEAN> {
/**
* Returns the count of all bean matching the filter.
*
* @param filters
* the filters
* @return the int
*/
int size(List<Filter> filters);
/**
* Returns true, if the the bean exists for the given filter.
*
* @param bean
* the bean
* @param filters
* the filters
* @return true, if successful
*/
boolean contains(BEAN bean, List<Filter> filters);
/**
* Returns the next bean for the given one using the filter and the
* sortOrder.
*
* @param bean
* the bean
* @param filters
* the filters
* @param sortOrder
* the sort order
* @return the next bean
*/
BEAN getNextBean(BEAN bean, List<Filter> filters, SortOrder sortOrder);
/**
* Returns the previous bean for the given one using the filter and the
* sortOrder.
*
* @param bean
* the bean
* @param filters
* the filters
* @param sortOrder
* the sort order
* @return the previous bean
*/
BEAN getPreviousBean(BEAN bean, List<Filter> filters, SortOrder sortOrder);
/**
* Returns the first bean for the given filter and the sortOrder.
*
* @param filters
* the filters
* @param sortOrder
* the sort order
* @return the first bean
*/
BEAN getFirstBean(List<Filter> filters, SortOrder sortOrder);
/**
* Returns the last bean for the given filter and the sortOrder.
*
* @param filters
* the filters
* @param sortOrder
* the sort order
* @return the last bean
*/
BEAN getLastBean(List<Filter> filters, SortOrder sortOrder);
/**
* Returns true, if the given bean is the first one for the filter and
* sortOrder.
*
* @param bean
* the bean
* @param filters
* the filters
* @param sortOrder
* the sort order
* @return true, if is first bean
*/
boolean isFirstBean(BEAN bean, List<Filter> filters, SortOrder sortOrder);
/**
* Returns true, if the given bean is the last one for the filter and
* sortOrder.
*
* @param bean
* the bean
* @param filters
* the filters
* @param sortOrder
* the sort order
* @return true, if is last bean
*/
boolean isLastBean(BEAN bean, List<Filter> filters, SortOrder sortOrder);
/**
* Returns the index of the given bean for the filter and sortOrder.
*
* @param bean
* the bean
* @param filters
* the filters
* @param sortOrder
* the sort order
* @return the int
*/
int indexOf(BEAN bean, List<Filter> filters, SortOrder sortOrder);
/**
* Loads the bean from the dto service.
*
* @param bean
* @return
*/
BEAN refresh(BEAN bean);
/**
* Returns the bean for the given index, filter and sortOrder.
*
* @param index
* the index
* @param filters
* the filters
* @param sortOrder
* the sort order
* @return the bean by index
*/
BEAN getBeanByIndex(int index, List<Filter> filters, SortOrder sortOrder);
/**
* Returns a list of beans with size &lt;= numberOfItems, starting from the
* startIndex in respect to the filter and sortOrder.
*
* @param startIndex
* the start index
* @param numberOfItems
* the number of items
* @param filters
* the filters
* @param sortOrder
* the sort order
* @return the beans by index
*/
List<BEAN> getBeansByIndex(int startIndex, int numberOfItems, List<Filter> filters, SortOrder sortOrder);
}