/**
 * <p>Title: SiteHDAO Class>
 * <p>Description:	SiteHDAO is used to add site type information into the database using Hibernate.</p>
 * Copyright:    Copyright (c) year
 * Company: Washington University, School of Medicine, St. Louis.
 * @author Aniruddha Phadnis
 * @version 1.00
 * Created on Jul 21, 2005
 */

package edu.wustl.catissuecore.bizlogic;

import java.util.List;


import edu.wustl.catissuecore.dao.DAO;
import edu.wustl.catissuecore.domain.Site;
import edu.wustl.catissuecore.domain.User;
import edu.wustl.common.util.dbManager.DAOException;
import edu.wustl.common.util.logger.Logger;

/**
 * SiteHDAO is used to add site type information into the database using Hibernate.
 * @author aniruddha_phadnis
 */
public class SiteBizLogic extends DefaultBizLogic
{
	/**
     * Saves the storageType object in the database.
     * @param session The session in which the object is saved.
     * @param obj The storageType object to be saved.
     * @throws DAOException 
     */
	protected void insert(DAO dao, Object obj) throws DAOException
	{
		Site site = (Site)obj;

		Logger.out.debug("site.getCoordinator().getSystemIdentifier() "+site.getCoordinator().getSystemIdentifier());
		List list = dao.retrieve(User.class.getName(), "systemIdentifier", site.getCoordinator().getSystemIdentifier());
		Logger.out.debug("list "+list.size());
		if (list.size() != 0)
		{
		    User user = (User) list.get(0);
		    site.setCoordinator(user);
		}
		
		dao.insert(site.getAddress(),true);
	    dao.insert(site,true);
	}
	
	/**
     * Updates the persistent object in the database.
     * @param session The session in which the object is saved.
     * @param obj The object to be updated.
     * @throws DAOException 
     */
	protected void update(DAO dao, Object obj) throws DAOException
    {
    }
}
@@ -1118,203 +1118,19 @@
 j;%0D%0A
-%0D%0A%09%09Logger.out.debug(%22site.getCoordinator().getSystemIdentifier() %22+site.getCoordinator().getSystemIdentifier());%0D%0A%09%09List list = dao.retrieve(User.class.getName(), %22systemIdentifier%22, site.g
+%09%09%0D%0A%09%09s
 etCo
-o
 rdin
@@ -1138,183 +1138,18 @@
 tor(
-).getSystemIdentifier());%0D%0A%09%09Logger.out.debug(%22list %22+list.size());%0D%0A%09%09if (list.size() != 0)%0D%0A%09%09%7B%0D%0A%09%09    User user = (User) list.get(0);%0D%0A%09%09    site.setCoordinator(user);%0D%0A%09%09%7D
+dao,site);
 %0D%0A%09%09
@@ -1507,16 +1507,503 @@
 %0A    %7B%0D%0A
-    
+%09%09Site site = (Site)obj;%0D%0A%09%09%0D%0A%09%09setCordinator(dao,site);%0D%0A%09%09%0D%0A%09%09dao.update(site.getAddress());%0D%0A%09    dao.update(site);%0D%0A    %7D%0D%0A%09%0D%0A%09// This method sets the cordinator for a particular site.%0D%0A%09private void setCordinator(DAO dao,Site site) throws DAOException%0D%0A%09%7B%0D%0A%09%09List list = dao.retrieve(User.class.getName(), %22systemIdentifier%22, site.getCoordinator().getSystemIdentifier());%0D%0A%09%09%0D%0A%09%09if (list.size() != 0)%0D%0A%09%09%7B%0D%0A%09%09    User user = (User) list.get(0);%0D%0A%09%09    site.setCoordinator(user);%0D%0A%09%09%7D%0D%0A%09
 %7D%0D%0A%7D

Edit Functionality Enabled --- Update Function