blob: 12f725ef42cbd1da069dbe1eb9680a1c77760946 [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 org.eclipse.osbp.dsl.dto.lib.impl.DtoServiceAccess;
import org.eclipse.osbp.runtime.common.filter.IDTOService;
import org.osgi.service.component.annotations.Component;
/**
* Tries to create a bean search service backed by a DTO-Service.
*/
@SuppressWarnings("restriction")
@Component
public class StatefulDelegatingDtoSearchServiceFactoryDelegate implements
IBeanSearchServiceFactoryDelegate {
@Override
public <BEAN> IBeanSearchService<BEAN> createService(Class<BEAN> bean) {
// if a service that delegates to the database could be found, use it.
IDTOService<BEAN> service = DtoServiceAccess.getService(bean);
if (service != null) {
return new StatefulDelegatingDtoSearchService<BEAN>(service, bean);
}
return null;
}
}