Index: lams_build/lib/lams/lams.jar =================================================================== diff -u -r7acb20e485013e119c7dfd90854f123c09f147cb -rf6222f18a5fc2d8d13d7514afadef0fb204fb968 Binary files differ Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/outcome/Outcome.hbm.xml =================================================================== diff -u --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/outcome/Outcome.hbm.xml (revision 0) +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/outcome/Outcome.hbm.xml (revision f6222f18a5fc2d8d13d7514afadef0fb204fb968) @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/outcome/OutcomeScale.hbm.xml =================================================================== diff -u --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/outcome/OutcomeScale.hbm.xml (revision 0) +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/outcome/OutcomeScale.hbm.xml (revision f6222f18a5fc2d8d13d7514afadef0fb204fb968) @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/outcome/OutcomeScaleItem.hbm.xml =================================================================== diff -u --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/outcome/OutcomeScaleItem.hbm.xml (revision 0) +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/outcome/OutcomeScaleItem.hbm.xml (revision f6222f18a5fc2d8d13d7514afadef0fb204fb968) @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20180802.sql =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20180802.sql (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20180802.sql (revision f6222f18a5fc2d8d13d7514afadef0fb204fb968) @@ -0,0 +1,49 @@ +-- Turn off autocommit, so nothing is committed if there is an error +SET AUTOCOMMIT = 0; +SET FOREIGN_KEY_CHECKS=0; +----------------------Put all sql statements below here------------------------- + +-- LDEV-4644 Add learning outcomes tables + +CREATE TABLE lams_outcome_scale ( + scale_id MEDIUMINT AUTO_INCREMENT, + organisation_id BIGINT, + name VARCHAR(255), + code VARCHAR(50), + description TEXT, + create_by BIGINT, + create_date_time DATETIME NOT NULL, + PRIMARY KEY (scale_id), + CONSTRAINT FK_lams_outcome_scale_1 FOREIGN KEY (organisation_id) REFERENCES lams_organisation (organisation_id) ON DELETE CASCADE ON UPDATE CASCADE + ); + +CREATE TABLE lams_outcome_scale_item ( + item_id INT AUTO_INCREMENT, + scale_id MEDIUMINT, + value TINYINT, + name VARCHAR(255), + PRIMARY KEY (item_id), + CONSTRAINT FK_lams_outcome_scale_item_1 FOREIGN KEY (scale_id) REFERENCES lams_outcome_scale (scale_id) ON DELETE CASCADE ON UPDATE CASCADE + ); + +CREATE TABLE lams_outcome ( + outcome_id MEDIUMINT AUTO_INCREMENT, + organisation_id BIGINT, + scale_id MEDIUMINT NOT NULL, + name VARCHAR(255), + code VARCHAR(50), + description TEXT, + create_by BIGINT, + create_date_time DATETIME NOT NULL, + PRIMARY KEY (outcome_id), + CONSTRAINT FK_lams_outcome_1 FOREIGN KEY (organisation_id) REFERENCES lams_organisation (organisation_id) ON DELETE CASCADE ON UPDATE CASCADE, + -- Do not remove outcomes when a scale gets removed. Programmer needs to do it manually to make sure it is the right step. + CONSTRAINT FK_lams_outcome_2 FOREIGN KEY (scale_id) REFERENCES lams_outcome_scale (scale_id) ON UPDATE CASCADE + ); + +----------------------Put all sql statements above here------------------------- + +-- If there were no errors, commit and restore autocommit to on +COMMIT; +SET AUTOCOMMIT = 1; +SET FOREIGN_KEY_CHECKS=1; \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/outcome/Outcome.java =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/outcome/Outcome.java (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/outcome/Outcome.java (revision f6222f18a5fc2d8d13d7514afadef0fb204fb968) @@ -0,0 +1,81 @@ +package org.lamsfoundation.lams.outcome; + +import java.util.Date; + +import org.lamsfoundation.lams.usermanagement.Organisation; +import org.lamsfoundation.lams.usermanagement.User; + +public class Outcome { + private Long outcomeId; + private Organisation organisation; + private OutcomeScale scale; + private String name; + private String code; + private String description; + private User createBy; + private Date createDateTime; + + public Long getOutcomeId() { + return outcomeId; + } + + public void setOutcomeId(Long outcomeId) { + this.outcomeId = outcomeId; + } + + public Organisation getOrganisation() { + return organisation; + } + + public void setOrganisation(Organisation organisation) { + this.organisation = organisation; + } + + public OutcomeScale getScale() { + return scale; + } + + public void setScale(OutcomeScale scale) { + this.scale = scale; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public User getCreateBy() { + return createBy; + } + + public void setCreateBy(User createBy) { + this.createBy = createBy; + } + + public Date getCreateDateTime() { + return createDateTime; + } + + public void setCreateDateTime(Date createDateTime) { + this.createDateTime = createDateTime; + } +} \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/outcome/OutcomeScale.java =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/outcome/OutcomeScale.java (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/outcome/OutcomeScale.java (revision f6222f18a5fc2d8d13d7514afadef0fb204fb968) @@ -0,0 +1,84 @@ +package org.lamsfoundation.lams.outcome; + +import java.util.Date; +import java.util.HashSet; +import java.util.Set; + +import org.lamsfoundation.lams.usermanagement.Organisation; +import org.lamsfoundation.lams.usermanagement.User; + +public class OutcomeScale { + private Long scaleId; + private Organisation organisation; + private String name; + private String code; + private String description; + private User createBy; + private Date createDateTime; + + private Set items = new HashSet(); + + public Long getScaleId() { + return scaleId; + } + + public void setScaleId(Long scaleId) { + this.scaleId = scaleId; + } + + public Organisation getOrganisation() { + return organisation; + } + + public void setOrganisation(Organisation organisation) { + this.organisation = organisation; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public User getCreateBy() { + return createBy; + } + + public void setCreateBy(User createBy) { + this.createBy = createBy; + } + + public Date getCreateDateTime() { + return createDateTime; + } + + public void setCreateDateTime(Date createDateTime) { + this.createDateTime = createDateTime; + } + + public Set getItems() { + return items; + } + + public void setItems(Set items) { + this.items = items; + } +} \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/outcome/OutcomeScaleItem.java =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/outcome/OutcomeScaleItem.java (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/outcome/OutcomeScaleItem.java (revision f6222f18a5fc2d8d13d7514afadef0fb204fb968) @@ -0,0 +1,41 @@ +package org.lamsfoundation.lams.outcome; + +public class OutcomeScaleItem { + private Long itemId; + private OutcomeScale scale; + private Integer value; + private String name; + + public Long getItemId() { + return itemId; + } + + public void setItemId(Long itemId) { + this.itemId = itemId; + } + + public OutcomeScale getScale() { + return scale; + } + + public void setScale(OutcomeScale scale) { + this.scale = scale; + } + + public Integer getValue() { + return value; + } + + public void setValue(Integer value) { + this.value = value; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} \ No newline at end of file