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

com.hack23.cia.service.impl.GenericDataContainer Maven / Gradle / Ivy

/*
 * Copyright 2010 James Pether Sörling
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *	$Id$
 *  $HeadURL$
*/
package com.hack23.cia.service.impl;

import java.io.Serializable;
import java.util.List;

import javax.persistence.metamodel.SingularAttribute;

import com.hack23.cia.service.api.DataContainer;
import com.hack23.cia.service.data.api.DataViewer;

/**
 * The Class GenericDataContainer.
 *
 * @param 
 *            the generic type
 * @param 
 *            the generic type
 */
final class GenericDataContainer implements
DataContainer {



	/** The data proxy. */
	private final DataViewer dataProxy;

	/** The clazz. */
	private final Class clazz;

	/**
	 * Instantiates a new generic data container.
	 *
	 * @param clazz
	 *            the clazz
	 * @param dataViewer
	 *            the data viewer
	 */
	GenericDataContainer(final Class clazz, final DataViewer dataViewer) {
		this.clazz = clazz;
		dataProxy = dataViewer;
	}

	@Override
	public List getAll() {
		return dataProxy.getAll(clazz);
	}

	@Override
	public List getAllOrderBy(final SingularAttribute property) {
		return dataProxy.getAllOrderBy(clazz,property);
	}



	@Override
	public List getAllBy(
			final SingularAttribute property,
			final Object value) {
		return dataProxy.findListByProperty(clazz, property, value);
	}

	@Override
	public T load(final I id) {
		return dataProxy.load(clazz, id);

	}

	@Override
	public List findListByProperty(final Object[] values,
			final SingularAttribute... properties) {
		return dataProxy.findListByProperty(clazz, values, properties);
	}

	@Override
	public  T findByQueryProperty(final Class clazz,
			final SingularAttribute property,
			final Class clazz2,
			final SingularAttribute property2, final Object value) {
		return dataProxy.findByQueryProperty(clazz, property, clazz2, property2, value);
	}

	@Override
	public  List findListByEmbeddedProperty(final Class clazz,
			final SingularAttribute property,
			final Class clazz2,
			final SingularAttribute property2, final Object value) {
		return dataProxy.findListByEmbeddedProperty(clazz, property, clazz2, property2, value);
	}

	@Override
	public List findOrderedListByProperty(final SingularAttribute orderByProperty, final Object[] values,
			final SingularAttribute... properties) {
		return dataProxy.findOrderedListByProperty(clazz,orderByProperty,values, properties);
	}

	@Override
	public  List findOrderedListByEmbeddedProperty(final Class clazz, final SingularAttribute property,
			final Class clazz2, final SingularAttribute property2, final Object value,
			final SingularAttribute orderByProperty) {
		return dataProxy.findOrderedListByEmbeddedProperty(clazz,property,clazz2,property2,value,orderByProperty);
	}

	@Override
	public  List findOrderedByPropertyListByEmbeddedProperty(final Class clazz, final SingularAttribute property,
			final Class clazz2, final SingularAttribute property2, final Object value,
			final SingularAttribute orderByProperty) {
		return dataProxy.findOrderedByPropertyListByEmbeddedProperty(clazz,property,clazz2,property2,value,orderByProperty);
	}

	@Override
	public List findOrderedListByProperty(final SingularAttribute property, final Object value,
			final SingularAttribute orderByProperty) {
		return dataProxy.findOrderedListByProperty(clazz,property,value,orderByProperty);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy