package kr.co.i4way.genesys.config;

import java.util.Collection;

import com.genesyslab.platform.applicationblocks.com.ConfigException;
import com.genesyslab.platform.applicationblocks.com.IConfService;
import com.genesyslab.platform.applicationblocks.com.objects.CfgPlaceGroup;
import com.genesyslab.platform.applicationblocks.com.queries.CfgPlaceGroupQuery;

public class PlaceGroup {
	
	public PlaceGroup(){
	}
	
	public CfgPlaceGroup SelectPlaceGroup(
			int iTenantDBID,
			int iDbid, 
			final IConfService service)
					throws ConfigException, InterruptedException {
		// Read configuration objects:
		CfgPlaceGroup rtnPlaceGroup = null;
		CfgPlaceGroupQuery placegroupquery = new CfgPlaceGroupQuery();
		placegroupquery.setTenantDbid(iTenantDBID);
		placegroupquery.setDbid(iDbid);
		Collection<CfgPlaceGroup> placegroups = service.retrieveMultipleObjects(CfgPlaceGroup.class,
				placegroupquery);
		for(CfgPlaceGroup placegroup : placegroups){
			rtnPlaceGroup = placegroup;
		}

		return rtnPlaceGroup;
	}
	
	public CfgPlaceGroup SelectPlaceGroup(
			int iTenantDBID,
			String sObjName,
			final IConfService service)
					throws ConfigException, InterruptedException {
		// Read configuration objects:
		CfgPlaceGroup rtnPlaceGroup = null;
		CfgPlaceGroupQuery placegroupquery = new CfgPlaceGroupQuery();
		placegroupquery.setTenantDbid(iTenantDBID);
		placegroupquery.setName(sObjName);
		Collection<CfgPlaceGroup> placegroups = service.retrieveMultipleObjects(CfgPlaceGroup.class,
				placegroupquery);
		for(CfgPlaceGroup placegroup : placegroups){
			rtnPlaceGroup = placegroup;
		}

		return rtnPlaceGroup;
	}	
	

}
