/***
 * Excerpted from "Domain-Driven Design Using Naked Objects",
 * published by The Pragmatic Bookshelf.
 * Copyrights apply to this code. It may not be used to create training material, 
 * courses, books, articles, and the like. Contact us if you are in doubt.
 * We make no guarantees that this code is fit for any purpose. 
 * Visit http://www.pragmaticprogrammer.com/titles/dhnako for more book information.
***/
package com.pragprog.dhnako.carserv.jpa.vehicle;

import java.util.List;

import org.nakedobjects.applib.AbstractFactoryAndRepository;
import org.nakedobjects.applib.annotation.MemberOrder;
import org.nakedobjects.applib.query.QueryDefault;

import com.pragprog.dhnako.carserv.dom.vehicle.VehicleType;
import com.pragprog.dhnako.carserv.dom.vehicle.VehicleTypeRepository;

public class VehicleTypeRepositoryJpa 
		extends AbstractFactoryAndRepository 
		implements VehicleTypeRepository {

	// {{ Identification
	public String iconName() {
		return "VehicleType";
	}
	// }}

	// {{ all Types
	@MemberOrder(sequence = "1")
	public List<VehicleType> allTypes() {
		return allInstances(VehicleType.class);
	}
	// }}

	// {{ find Type
	@MemberOrder(sequence = "2")
	public VehicleType findType(final String fullyQualifiedClassName) {
		return firstMatch(
				QueryDefault.create(VehicleType.class, 
				"findVehicleTypeByFullyQualifiedClassName", "fullyQualifiedClassName", fullyQualifiedClassName));
	}
	// }}
	
}
