Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20170623.sql =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20170623.sql (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20170623.sql (revision efe322b3756d88ff1fb7d149a3f4e267065eca40) @@ -0,0 +1,36 @@ +-- Turn off autocommit, so nothing is committed if there is an error + +SET AUTOCOMMIT = 0; +SET FOREIGN_KEY_CHECKS=0; + +-- LDEV-4366 Add tables for Kumalive + +CREATE TABLE lams_kumalive ( + kumalive_id BIGINT(20) NOT NULL AUTO_INCREMENT + , organisation_id BIGINT(20) NOT NULL + , created_by BIGINT(20) + , finished TINYINT(1) NOT NULL DEFAULT 0 + , name VARCHAR(250) + , PRIMARY KEY (kumalive_id) + , CONSTRAINT FK_lams_kumalive_1 FOREIGN KEY (organisation_id) + REFERENCES lams_organisation (organisation_id) ON DELETE CASCADE ON UPDATE CASCADE + , CONSTRAINT FK_lams_kumalive_2 FOREIGN KEY (created_by) + REFERENCES lams_user (user_id) ON DELETE SET NULL ON UPDATE CASCADE +); + +CREATE TABLE lams_kumalive_score ( + kumalive_id BIGINT(20) NOT NULL + , user_id BIGINT(20) NOT NULL + , score TINYINT + , PRIMARY KEY (kumalive_id, user_id) + , CONSTRAINT FK_lams_kumalive_score_1 FOREIGN KEY (kumalive_id) + REFERENCES lams_kumalive (kumalive_id) ON DELETE CASCADE ON UPDATE CASCADE + , CONSTRAINT FK_lams_kumalive_score_2 FOREIGN KEY (user_id) + REFERENCES lams_user (user_id) ON DELETE CASCADE ON UPDATE CASCADE +); + + +-- If there were no errors, commit and restore autocommit to on +SET FOREIGN_KEY_CHECKS=0; +COMMIT; +SET AUTOCOMMIT = 1; Index: lams_learning/conf/hibernate/mappings/org/lamsfoundation/lams/learning/kumalive/Kumalive.hbm.xml =================================================================== diff -u --- lams_learning/conf/hibernate/mappings/org/lamsfoundation/lams/learning/kumalive/Kumalive.hbm.xml (revision 0) +++ lams_learning/conf/hibernate/mappings/org/lamsfoundation/lams/learning/kumalive/Kumalive.hbm.xml (revision efe322b3756d88ff1fb7d149a3f4e267065eca40) @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_learning/src/java/org/lamsfoundation/lams/learning/kumalive/dao/IKumaliveDAO.java =================================================================== diff -u --- lams_learning/src/java/org/lamsfoundation/lams/learning/kumalive/dao/IKumaliveDAO.java (revision 0) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/kumalive/dao/IKumaliveDAO.java (revision efe322b3756d88ff1fb7d149a3f4e267065eca40) @@ -0,0 +1,29 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +package org.lamsfoundation.lams.learning.kumalive.dao; + +import org.lamsfoundation.lams.dao.IBaseDAO; + +public interface IKumaliveDAO extends IBaseDAO { +} \ No newline at end of file Index: lams_learning/src/java/org/lamsfoundation/lams/learning/kumalive/dao/hibernate/KumaliveDAO.java =================================================================== diff -u --- lams_learning/src/java/org/lamsfoundation/lams/learning/kumalive/dao/hibernate/KumaliveDAO.java (revision 0) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/kumalive/dao/hibernate/KumaliveDAO.java (revision efe322b3756d88ff1fb7d149a3f4e267065eca40) @@ -0,0 +1,32 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +package org.lamsfoundation.lams.learning.kumalive.dao.hibernate; + +import org.lamsfoundation.lams.dao.hibernate.LAMSBaseDAO; +import org.lamsfoundation.lams.learning.kumalive.dao.IKumaliveDAO; +import org.springframework.stereotype.Repository; + +@Repository +public class KumaliveDAO extends LAMSBaseDAO implements IKumaliveDAO { +} \ No newline at end of file Index: lams_learning/src/java/org/lamsfoundation/lams/learning/kumalive/model/Kumalive.java =================================================================== diff -u --- lams_learning/src/java/org/lamsfoundation/lams/learning/kumalive/model/Kumalive.java (revision 0) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/kumalive/model/Kumalive.java (revision efe322b3756d88ff1fb7d149a3f4e267065eca40) @@ -0,0 +1,95 @@ +/*************************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * ***********************************************************************/ + +package org.lamsfoundation.lams.learning.kumalive.model; + +import java.io.Serializable; +import java.util.Map; + +import org.lamsfoundation.lams.usermanagement.Organisation; +import org.lamsfoundation.lams.usermanagement.User; + +public class Kumalive implements Serializable { + + private static final long serialVersionUID = -7932572065216398930L; + + private Long kumaliveId; + private Organisation organisation; + private User createdBy; + private String name; + private Boolean finished; + private Map scores; + + public Kumalive(Organisation organisation, User createdBy, String name) { + this.organisation = organisation; + this.createdBy = createdBy; + this.name = name; + } + + public Long getKumaliveId() { + return kumaliveId; + } + + public void setKumaliveId(Long kumaliveId) { + this.kumaliveId = kumaliveId; + } + + public Organisation getOrganisation() { + return organisation; + } + + public void setOrganisation(Organisation organisation) { + this.organisation = organisation; + } + + public User getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(User createdBy) { + this.createdBy = createdBy; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Boolean getFinished() { + return finished; + } + + public void setFinished(Boolean finished) { + this.finished = finished; + } + + public Map getScores() { + return scores; + } + + public void setScores(Map scores) { + this.scores = scores; + } +} \ No newline at end of file