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

com.dooapp.gaedo.finders.id.IdBasedServiceHelper Maven / Gradle / Ivy

The newest version!
package com.dooapp.gaedo.finders.id;

import java.util.Collection;
import java.util.List;

import com.dooapp.gaedo.finders.FieldInformer;
import com.dooapp.gaedo.finders.FinderCrudService;
import com.dooapp.gaedo.finders.Informer;
import com.dooapp.gaedo.finders.QueryBuilder;
import com.dooapp.gaedo.finders.QueryExpression;
import com.dooapp.gaedo.finders.expressions.Expressions;
import com.dooapp.gaedo.properties.Property;

/**
 * Helper class simplifying the writing of an IdBasedService by providing some helper methods
 * @author ndx
 *
 */
public class IdBasedServiceHelper> {

	private List idProperties;
	private FinderCrudService backEnd;

	public IdBasedServiceHelper(List idProperties,
					FinderCrudService backEnd) {
		this.idProperties = idProperties;
		this.backEnd = backEnd;
	}
	
	public DataType findById(final Object... id) {
		return backEnd.find().matching(new QueryBuilder() {

			@Override
			public QueryExpression createMatchingExpression(
					InformerType informer) {
				
				QueryExpression returned = null;
				for(int index=0; index getIdProperties() {
		return idProperties;
	}

	public boolean assignId(DataType value, Object... id) {
		for(int index=0; index




© 2015 - 2025 Weber Informatics LLC | Privacy Policy