Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcOptionsContentDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcOptionsContentDAO.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcOptionsContentDAO.java 4 Oct 2005 08:16:29 -0000 1.1 @@ -0,0 +1,47 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *This program is free software; you can redistribute it and/or modify + *it under the terms of the GNU General Public License as published by + *the Free Software Foundation; either version 2 of the License, or + *(at your option) any later version. + * + *This program is distributed in the hope that it will be useful, + *but WITHOUT ANY WARRANTY; without even the implied warranty of + *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + *GNU General Public License for more details. + * + *You should have received a copy of the GNU General Public License + *along with this program; if not, write to the Free Software + *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + *USA + * + *http://www.gnu.org/licenses/gpl.txt + */ +package org.lamsfoundation.lams.tool.mc.dao; + +import org.lamsfoundation.lams.tool.mc.McOptionsContent; +import org.lamsfoundation.lams.tool.mc.dao.hibernate.McOptionsContentDAO; + + +/** + * + * @author ozgurd + * + */ +public interface IMcOptionsContentDAO +{ + public McOptionsContentDAO getMcOptionsContentByUID(Long uid); + + public McOptionsContent findMcOptionsContentById(Long mcQueOptionId); + + public McOptionsContent getMcOptionById(long mcQueOptionId); + + public void createOptionsContent(McOptionsContent mcOptionsContent); + + public void removeOptionsContent(long mcQueOptionId); + +} + + + Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUsrAttemptDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUsrAttemptDAO.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUsrAttemptDAO.java 4 Oct 2005 08:16:29 -0000 1.1 @@ -0,0 +1,45 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *This program is free software; you can redistribute it and/or modify + *it under the terms of the GNU General Public License as published by + *the Free Software Foundation; either version 2 of the License, or + *(at your option) any later version. + * + *This program is distributed in the hope that it will be useful, + *but WITHOUT ANY WARRANTY; without even the implied warranty of + *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + *GNU General Public License for more details. + * + *You should have received a copy of the GNU General Public License + *along with this program; if not, write to the Free Software + *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + *USA + * + *http://www.gnu.org/licenses/gpl.txt + */ +package org.lamsfoundation.lams.tool.mc.dao; + +import org.lamsfoundation.lams.tool.mc.McUsrAttempt; + + +/** + * + * @author ozgurd + * + */ +public interface IMcUsrAttemptDAO +{ + public McUsrAttempt getMcUserAttemptByUID(Long uid); + + public McUsrAttempt findMcUsrAttemptById(Long attemptId); + + public McUsrAttempt getMcUsrAttemptById(long attemptId); + + public void createUsrAttempt(McUsrAttempt mcUsrAttempt); + + public void removeUsrAttempt(long attemptId); + +} + + Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McOptionsContentDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McOptionsContentDAO.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McOptionsContentDAO.java 4 Oct 2005 08:16:29 -0000 1.1 @@ -0,0 +1,64 @@ +/* + * Created on 15/03/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.lamsfoundation.lams.tool.mc.dao.hibernate; + +import java.util.List; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.tool.mc.McOptionsContent; +import org.lamsfoundation.lams.tool.mc.dao.IMcOptionsContentDAO; +import org.springframework.orm.hibernate.support.HibernateDaoSupport; + + +/** + * @author ozgurd + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ + +public class McOptionsContentDAO extends HibernateDaoSupport implements IMcOptionsContentDAO { + static Logger logger = Logger.getLogger(McOptionsContentDAO.class.getName()); + + public McOptionsContentDAO getMcOptionsContentByUID(Long uid) + { + return (McOptionsContentDAO) this.getHibernateTemplate() + .get(McOptionsContentDAO.class, uid); + } + + public McOptionsContent findMcOptionsContentById(Long mcQueOptionId) + { + String query = "from McOptionsContent as mco where mco.mcContentId = ?"; + List content = getHibernateTemplate().find(query,mcQueOptionId); + + if(content!=null && content.size() == 0) + { + return null; + } + else + { + return (McOptionsContent)content.get(0); + } + + } + + public McOptionsContent getMcOptionById(long mcQueOptionId) + { + return (McOptionsContent) this.getHibernateTemplate().load(McOptionsContent.class, new Long(mcQueOptionId)); + } + + public void createOptionsContent(McOptionsContent mcOptionsContent) + { + this.getHibernateTemplate().save(mcOptionsContent); + } + + public void removeOptionsContent(long mcQueOptionId) + { + McOptionsContent mcQueContent= (McOptionsContent) this.getHibernateTemplate().load(McOptionsContent.class, new Long(mcQueOptionId)); + this.getHibernateTemplate().delete(mcQueContent); + } +} \ No newline at end of file Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUsrAttemptDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUsrAttemptDAO.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUsrAttemptDAO.java 4 Oct 2005 08:16:29 -0000 1.1 @@ -0,0 +1,67 @@ +/* + * Created on 15/03/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.lamsfoundation.lams.tool.mc.dao.hibernate; + +import java.util.List; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.tool.mc.McUsrAttempt; +import org.lamsfoundation.lams.tool.mc.dao.IMcUsrAttemptDAO; +import org.springframework.orm.hibernate.support.HibernateDaoSupport; + + + + +/** + * @author ozgurd + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ + +public class McUsrAttemptDAO extends HibernateDaoSupport implements IMcUsrAttemptDAO { + static Logger logger = Logger.getLogger(McUsrAttemptDAO.class.getName()); + + public McUsrAttempt getMcUserAttemptByUID(Long uid) + { + return (McUsrAttempt) this.getHibernateTemplate() + .get(McUsrAttempt.class, uid); + } + + public McUsrAttempt findMcUsrAttemptById(Long attemptId) + { + String query = "from McUsrAttempt as mca where mca.attemptId = ?"; + List content = getHibernateTemplate().find(query,attemptId); + + if(content!=null && content.size() == 0) + { + return null; + } + else + { + return (McUsrAttempt)content.get(0); + } + + } + + + public McUsrAttempt getMcUsrAttemptById(long attemptId) + { + return (McUsrAttempt) this.getHibernateTemplate().load(McUsrAttempt.class, new Long(attemptId)); + } + + public void createUsrAttempt(McUsrAttempt mcUsrAttempt) + { + this.getHibernateTemplate().save(mcUsrAttempt); + } + + public void removeUsrAttempt(long attemptId) + { + McUsrAttempt mcUsrAttempt= (McUsrAttempt) this.getHibernateTemplate().load(McUsrAttempt.class, new Long(attemptId)); + this.getHibernateTemplate().delete(mcUsrAttempt); + } +} \ No newline at end of file