Index: lams_build/lib/lams/lams-learning.jar
===================================================================
diff -u -r0977a832c3e57655f1031778702ce6ea0e122985 -r3f60ecf7d3a92231a1089191ae75c68bc66e9595
Binary files differ
Index: lams_build/lib/lams/lams-monitoring.jar
===================================================================
diff -u -r1a2d0829cd190acb13d0531c34199d4ca02e9e4c -r3f60ecf7d3a92231a1089191ae75c68bc66e9595
Binary files differ
Index: lams_build/lib/lams/lams.jar
===================================================================
diff -u -rac080bcbd7d03cc64ea0b43091472ddbf23b30fd -r3f60ecf7d3a92231a1089191ae75c68bc66e9595
Binary files differ
Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/tool/SystemTool.hbm.xml
===================================================================
diff -u
--- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/tool/SystemTool.hbm.xml (revision 0)
+++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/tool/SystemTool.hbm.xml (revision 3f60ecf7d3a92231a1089191ae75c68bc66e9595)
@@ -0,0 +1,190 @@
+
+
+
+
+
+
+
+ @hibernate.class
+ table="lams_system_tool"
+
+ true
+
+
+
+ @hibernate.id
+ generator-class="native"
+ type="java.lang.Long"
+ column="system_tool_id"
+
+
+
+
+
+
+
+
+ @hibernate.property
+ column="learning_activity_type_id"
+ type="java.lang.Integer"
+ not-null="true"
+
+
+
+
+
+ @hibernate.property
+ column="tool_display_name"
+ length="255"
+ not-null="true"
+
+
+
+
+ @hibernate.property
+ column="description"
+ length="65535"
+
+
+
+
+
+ @hibernate.property
+ column="learner_url"
+ length="65535"
+ not-null="true"
+
+
+
+
+
+ @hibernate.property
+ column="learner_preview_url"
+ length="65535"
+ not-null="true"
+
+
+
+
+
+ @hibernate.property
+ column="learner_progress_url"
+ length="65535"
+ not-null="true"
+
+
+
+
+
+
+ @hibernate.property column="create_date_time"
+ length="19" not-null="true"
+
+
+
+
+
+ @hibernate.property
+ column="export_pfolio_learner_url"
+ length="65535"
+ not-null="false"
+
+
+
+
+
+ @hibernate.property
+ column="export_pfolio_class_url"
+ length="65535"
+ not-null="false"
+
+
+
+
+
+ @hibernate.property
+ column="monitor_url"
+ length="65535"
+ not-null="false"
+
+
+
+
+
+ @hibernate.property
+ column="contribute_url"
+ length="65535"
+ not-null="false"
+
+
+
+
+
Index: lams_common/db/model/lams_11.clay
===================================================================
diff -u -r4e938450de054d55b7b48e7cc241b18bea8b7816 -r3f60ecf7d3a92231a1089191ae75c68bc66e9595
--- lams_common/db/model/lams_11.clay (.../lams_11.clay) (revision 4e938450de054d55b7b48e7cc241b18bea8b7816)
+++ lams_common/db/model/lams_11.clay (.../lams_11.clay) (revision 3f60ecf7d3a92231a1089191ae75c68bc66e9595)
@@ -728,7 +728,7 @@
-
+
@@ -3564,7 +3564,7 @@
-
+
@@ -4263,7 +4263,7 @@
-
+
@@ -4402,7 +4402,7 @@
-
+
@@ -4637,6 +4637,119 @@
+
+Url details for system tools such as gates and grouping
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Unique signature for each version of a tool. <organisation><tool><version>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_common/db/sql/create_lams_11_tables.sql
===================================================================
diff -u -r4e938450de054d55b7b48e7cc241b18bea8b7816 -r3f60ecf7d3a92231a1089191ae75c68bc66e9595
--- lams_common/db/sql/create_lams_11_tables.sql (.../create_lams_11_tables.sql) (revision 4e938450de054d55b7b48e7cc241b18bea8b7816)
+++ lams_common/db/sql/create_lams_11_tables.sql (.../create_lams_11_tables.sql) (revision 3f60ecf7d3a92231a1089191ae75c68bc66e9595)
@@ -350,6 +350,30 @@
REFERENCES lams_grouping (grouping_id) ON DELETE NO ACTION ON UPDATE NO ACTION
)TYPE=InnoDB;
+CREATE TABLE lams_system_tool (
+ system_tool_id BIGINT(20) NOT NULL AUTO_INCREMENT
+ , learning_activity_type_id INT(11) NOT NULL
+ , tool_display_name VARCHAR(255) NOT NULL
+ , description TEXT
+ , learner_url TEXT
+ , learner_preview_url TEXT
+ , learner_progress_url TEXT
+ , export_pfolio_learner_url TEXT
+ , export_pfolio_class_url TEXT
+ , monitor_url TEXT
+ , contribute_url TEXT
+ , create_date_time DATETIME NOT NULL
+ , UNIQUE UQ_systool_activity_type (learning_activity_type_id)
+ , PRIMARY KEY (system_tool_id)
+ , INDEX (learning_activity_type_id)
+ , CONSTRAINT FK_lams_system_tool FOREIGN KEY (learning_activity_type_id)
+ REFERENCES lams_learning_activity_type (learning_activity_type_id) ON DELETE NO ACTION ON UPDATE NO ACTION
+)TYPE=InnoDB;
+ALTER TABLE lams_system_tool MODIFY COLUMN learner_preview_url TEXT
+ COMMENT 'Learner screen for preview a learning design. ';
+ALTER TABLE lams_system_tool MODIFY COLUMN learner_progress_url TEXT
+ COMMENT 'Teacher''s view of a learner''s screen.';
+
CREATE TABLE lams_tool (
tool_id BIGINT(20) NOT NULL AUTO_INCREMENT
, tool_signature VARCHAR(64) NOT NULL
Index: lams_common/db/sql/insert_types_data.sql
===================================================================
diff -u -r926232487d37b02c2bac7c07e59c735204f4792f -r3f60ecf7d3a92231a1089191ae75c68bc66e9595
--- lams_common/db/sql/insert_types_data.sql (.../insert_types_data.sql) (revision 926232487d37b02c2bac7c07e59c735204f4792f)
+++ lams_common/db/sql/insert_types_data.sql (.../insert_types_data.sql) (revision 3f60ecf7d3a92231a1089191ae75c68bc66e9595)
@@ -32,7 +32,6 @@
INSERT INTO lams_learning_activity_type VALUES (7, 'OPTIONS');
INSERT INTO lams_learning_activity_type VALUES (8, 'SEQUENCE');
-
INSERT INTO lams_gate_activity_level VALUES (1, 'LEARNER');
INSERT INTO lams_gate_activity_level VALUES (2, 'GROUP');
INSERT INTO lams_gate_activity_level VALUES (3, 'CLASS');
@@ -87,6 +86,32 @@
INSERT INTO lams_workspace_folder_content_type VALUES (1,'FILE');
INSERT INTO lams_workspace_folder_content_type VALUES (2,'PACKAGE');
+INSERT INTO lams_system_tool (system_tool_id, learning_activity_type_id, tool_display_name, description,
+ learner_url, learner_preview_url, learner_progress_url, export_pfolio_learner_url,
+ export_pfolio_class_url, monitor_url, contribute_url, create_date_time)
+VALUES (1, 2, 'Grouping', 'All types of grouping including random and chosen.',
+ 'learning/grouping.do?method=performGrouping', 'learning/grouping.do?method=performGrouping',
+ 'learning/grouping.do?method=viewGrouping', 'learning/grouping.do?method=viewGrouping',
+ null, null, null, now() );
+INSERT INTO lams_system_tool (system_tool_id, learning_activity_type_id, tool_display_name, description,
+ learner_url, learner_preview_url, learner_progress_url, export_pfolio_learner_url,
+ export_pfolio_class_url, monitor_url, contribute_url, create_date_time)
+VALUES (2, 3, 'Sync Gate', 'Gate: Synchronise Learners.',
+ 'learning/gate.do?method=knockGate', 'learning/gate.do?method=knockGate', null, null,
+ null, 'monitoring/gate.do?method=viewGate', 'monitoring/gate.do?method=viewGate', now() );
+INSERT INTO lams_system_tool (system_tool_id, learning_activity_type_id, tool_display_name, description,
+ learner_url, learner_preview_url, learner_progress_url, export_pfolio_learner_url,
+ export_pfolio_class_url, monitor_url, contribute_url, create_date_time)
+VALUES (3, 4, 'Schedule Gate', 'Gate: Opens/shuts at particular times.',
+ 'learning/gate.do?method=knockGate', 'learning/gate.do?method=knockGate', null, null,
+ null, 'monitoring/gate.do?method=viewGate', 'monitoring/gate.do?method=viewGate', now() );
+INSERT INTO lams_system_tool (system_tool_id, learning_activity_type_id, tool_display_name, description,
+ learner_url, learner_preview_url, learner_progress_url, export_pfolio_learner_url,
+ export_pfolio_class_url, monitor_url, contribute_url, create_date_time)
+VALUES (4, 5, 'Permission Gate', 'Gate: Opens under teacher or staff control.',
+ 'learning/gate.do?method=knockGate', 'learning/gate.do?method=knockGate', null, null,
+ null, 'monitoring/gate.do?method=viewGate', 'monitoring/gate.do?method=viewGate', now() );
+
Index: lams_common/src/java/org/lamsfoundation/lams/commonContext.xml
===================================================================
diff -u -ra7766445094c16b343aa56dc1f73fd3051cef1db -r3f60ecf7d3a92231a1089191ae75c68bc66e9595
--- lams_common/src/java/org/lamsfoundation/lams/commonContext.xml (.../commonContext.xml) (revision a7766445094c16b343aa56dc1f73fd3051cef1db)
+++ lams_common/src/java/org/lamsfoundation/lams/commonContext.xml (.../commonContext.xml) (revision 3f60ecf7d3a92231a1089191ae75c68bc66e9595)
@@ -53,6 +53,7 @@
org/lamsfoundation/lams/lesson/Lesson.hbm.xml
+ org/lamsfoundation/lams/tool/SystemTool.hbm.xml
org/lamsfoundation/lams/tool/Tool.hbm.xml
org/lamsfoundation/lams/tool/ToolContent.hbm.xml
org/lamsfoundation/lams/tool/ToolSession.hbm.xml
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/Activity.java
===================================================================
diff -u -r049f9b1332a5f65c5de9d5b4f891b93fe429ae63 -r3f60ecf7d3a92231a1089191ae75c68bc66e9595
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/Activity.java (.../Activity.java) (revision 049f9b1332a5f65c5de9d5b4f891b93fe429ae63)
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/Activity.java (.../Activity.java) (revision 3f60ecf7d3a92231a1089191ae75c68bc66e9595)
@@ -737,6 +737,11 @@
getActivityTypeId().intValue()== OPTIONS_ACTIVITY_TYPE;
}
+ public boolean isSystemToolActivity()
+ {
+ return isGateActivity() || isGroupingActivity();
+ }
+
public boolean isGateActivity()
{
return getActivityTypeId().intValue()== SCHEDULE_GATE_ACTIVITY_TYPE ||
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/GateActivity.java
===================================================================
diff -u -r34b959260a0f8f8285793a4481a95ca3580eabc5 -r3f60ecf7d3a92231a1089191ae75c68bc66e9595
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/GateActivity.java (.../GateActivity.java) (revision 34b959260a0f8f8285793a4481a95ca3580eabc5)
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/GateActivity.java (.../GateActivity.java) (revision 3f60ecf7d3a92231a1089191ae75c68bc66e9595)
@@ -20,7 +20,7 @@
* http://www.gnu.org/licenses/gpl.txt
* ****************************************************************
*/
-/* $$Id$$ */
+/* $Id$ */
package org.lamsfoundation.lams.learningdesign;
import java.io.Serializable;
@@ -36,7 +36,7 @@
/**
* @hibernate.class
*/
-public abstract class GateActivity extends SimpleActivity implements Serializable
+public abstract class GateActivity extends SystemToolActivity implements Serializable
{
public static final int LEARNER_GATE_LEVEL = 1;
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/GroupingActivity.java
===================================================================
diff -u -r34b959260a0f8f8285793a4481a95ca3580eabc5 -r3f60ecf7d3a92231a1089191ae75c68bc66e9595
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/GroupingActivity.java (.../GroupingActivity.java) (revision 34b959260a0f8f8285793a4481a95ca3580eabc5)
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/GroupingActivity.java (.../GroupingActivity.java) (revision 3f60ecf7d3a92231a1089191ae75c68bc66e9595)
@@ -20,11 +20,12 @@
* http://www.gnu.org/licenses/gpl.txt
* ****************************************************************
*/
-/* $$Id$$ */
+/* $Id$ */
package org.lamsfoundation.lams.learningdesign;
import java.io.Serializable;
import java.util.Date;
+
import org.apache.commons.lang.builder.ToStringBuilder;
import org.lamsfoundation.lams.learningdesign.strategy.GroupingActivityStrategy;
@@ -35,7 +36,7 @@
* A GroupingActivity creates Grouping.
* @author Manpreet Minhas
*/
-public class GroupingActivity extends SimpleActivity implements Serializable
+public class GroupingActivity extends SystemToolActivity implements Serializable
{
/** The grouping_ui_id of the Grouping that this activity creates */
private Integer createGroupingUIID;
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesignProcessor.java
===================================================================
diff -u -r049f9b1332a5f65c5de9d5b4f891b93fe429ae63 -r3f60ecf7d3a92231a1089191ae75c68bc66e9595
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesignProcessor.java (.../LearningDesignProcessor.java) (revision 049f9b1332a5f65c5de9d5b4f891b93fe429ae63)
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/LearningDesignProcessor.java (.../LearningDesignProcessor.java) (revision 3f60ecf7d3a92231a1089191ae75c68bc66e9595)
@@ -30,6 +30,7 @@
import org.apache.log4j.Logger;
import org.lamsfoundation.lams.learningdesign.dao.IActivityDAO;
+import org.lamsfoundation.lams.learningdesign.exception.LearningDesignProcessorException;
/** Run through a learning design, in the order of the activities. Process the learning design
* to produce somethings else.
@@ -55,24 +56,24 @@
}
/** A complex activity has been found. Do any processing needed at the start of the activity */
- public abstract void startComplexActivity(ComplexActivity activity);
+ public abstract void startComplexActivity(ComplexActivity activity) throws LearningDesignProcessorException ;
/** Do any processing needed at the end of a complex activity */
- public abstract void endComplexActivity(ComplexActivity activity);
+ public abstract void endComplexActivity(ComplexActivity activity) throws LearningDesignProcessorException ;
/** A simple activity has been found. Do any processing needed at the start of the activity */
- public abstract void startSimpleActivity(SimpleActivity activity);
+ public abstract void startSimpleActivity(SimpleActivity activity) throws LearningDesignProcessorException ;
/** Do any processing needed at the end of a complex activity */
- public abstract void endSimpleActivity(SimpleActivity activity);
+ public abstract void endSimpleActivity(SimpleActivity activity) throws LearningDesignProcessorException;
- public void parseLearningDesign() {
+ public void parseLearningDesign() throws LearningDesignProcessorException {
if ( getDesign() != null ) {
handleActivity(getDesign().getFirstActivity());
}
}
- protected void handleActivity( Activity activity ) {
+ protected void handleActivity( Activity activity ) throws LearningDesignProcessorException {
if ( activity == null ) {
log.warn("Parsing activity method handleActivity got a null activity. Learning design was "+getDesign());
} else {
@@ -93,7 +94,7 @@
}
}
- protected void handleComplexActivity( Activity activity ) {
+ protected void handleComplexActivity( Activity activity ) throws LearningDesignProcessorException {
// ensure it is a real activity not a CGLIB proxy
ComplexActivity complex = (ComplexActivity) activityDAO.getActivityByActivityId(activity.getActivityId(),SimpleActivity.class);
startComplexActivity(complex);
@@ -111,7 +112,7 @@
}
- protected void handleSimpleActivity( Activity activity ) {
+ protected void handleSimpleActivity( Activity activity ) throws LearningDesignProcessorException {
// ensure it is a real activity not a CGLIB proxy
SimpleActivity simple = (SimpleActivity) activityDAO.getActivityByActivityId(activity.getActivityId(),SimpleActivity.class);
startSimpleActivity(simple);
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/SystemToolActivity.java
===================================================================
diff -u
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/SystemToolActivity.java (revision 0)
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/SystemToolActivity.java (revision 3f60ecf7d3a92231a1089191ae75c68bc66e9595)
@@ -0,0 +1,107 @@
+/****************************************************************
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $Id$ */
+package org.lamsfoundation.lams.learningdesign;
+
+import java.io.Serializable;
+
+
+/**
+ * Groups gate and grouping activities into system tools. Used to access the system_tool table.
+ * @hibernate.class
+ */
+public abstract class SystemToolActivity extends SimpleActivity implements Serializable
+{
+
+ /** full constructor */
+ public SystemToolActivity(Long activityId,
+ Integer id,
+ String description,
+ String title,
+ Integer xcoord,
+ Integer ycoord,
+ Integer orderId,
+ Boolean defineLater,
+ java.util.Date createDateTime,
+ LearningLibrary learningLibrary,
+ Activity parentActivity,
+ Activity libraryActivity,
+ Integer parentUIID,
+ LearningDesign learningDesign,
+ Grouping grouping,
+ Integer activityTypeId,
+ Transition transitionTo,
+ Transition transitionFrom,
+ String languageFile)
+ {
+ super(activityId,
+ id,
+ description,
+ title,
+ xcoord,
+ ycoord,
+ orderId,
+ defineLater,
+ createDateTime,
+ learningLibrary,
+ parentActivity,
+ libraryActivity,
+ parentUIID,
+ learningDesign,
+ grouping,
+ activityTypeId,
+ transitionTo,
+ transitionFrom,
+ languageFile);
+ }
+
+ /** default constructor */
+ public SystemToolActivity()
+ {
+ }
+
+ /** minimal constructor */
+ public SystemToolActivity(Long activityId,
+ Boolean defineLater,
+ java.util.Date createDateTime,
+ org.lamsfoundation.lams.learningdesign.LearningLibrary learningLibrary,
+ org.lamsfoundation.lams.learningdesign.Activity parentActivity,
+ org.lamsfoundation.lams.learningdesign.LearningDesign learningDesign,
+ org.lamsfoundation.lams.learningdesign.Grouping grouping,
+ Integer activityTypeId,
+ Transition transitionTo,
+ Transition transitionFrom)
+ {
+ super(activityId,
+ defineLater,
+ createDateTime,
+ learningLibrary,
+ parentActivity,
+ learningDesign,
+ grouping,
+ activityTypeId,
+ transitionTo,
+ transitionFrom);
+ }
+
+}
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/exception/LearningDesignProcessorException.java
===================================================================
diff -u
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/exception/LearningDesignProcessorException.java (revision 0)
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/exception/LearningDesignProcessorException.java (revision 3f60ecf7d3a92231a1089191ae75c68bc66e9595)
@@ -0,0 +1,54 @@
+/****************************************************************
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $Id$ */
+package org.lamsfoundation.lams.learningdesign.exception;
+
+public class LearningDesignProcessorException extends Exception {
+
+ public LearningDesignProcessorException(){
+
+ }
+ public LearningDesignProcessorException(String message){
+ super(message);
+ }
+ /**
+ * Constructor for wrapping the throwable object
+ * @param cause
+ */
+ public LearningDesignProcessorException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ /**
+ * Constructor for wrapping both the customized error message and
+ * throwable exception object.
+ * @param message
+ * @param cause
+ */
+ public LearningDesignProcessorException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+}
Index: lams_common/src/java/org/lamsfoundation/lams/tool/SystemTool.java
===================================================================
diff -u
--- lams_common/src/java/org/lamsfoundation/lams/tool/SystemTool.java (revision 0)
+++ lams_common/src/java/org/lamsfoundation/lams/tool/SystemTool.java (revision 3f60ecf7d3a92231a1089191ae75c68bc66e9595)
@@ -0,0 +1,310 @@
+/****************************************************************
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $Id$ */
+package org.lamsfoundation.lams.tool;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+
+/**
+ * Represents the URLs for the internal functionality such as grouping and gates.
+ * Eventually these will become "pluggable" tools, so that we can have other
+ * types of grouping/gates, without making changes to the core.
+ *
+ * @hibernate.class table="lams_system_tool"
+ */
+public class SystemTool implements Serializable {
+
+ /** identifier field */
+ private Long systemToolId;
+
+ /** persistent field - the type of activity */
+ private Integer activityTypeId;
+
+ /** persistent field */
+ private String toolDisplayName;
+
+ /** nullable persistent field */
+ private String description;
+
+ /** persistent field */
+ private String learnerUrl;
+
+ /** persistent field */
+ private String learnerPreviewUrl;
+
+ /** persistent field */
+ private String learnerProgressUrl;
+
+ /** persistent field */
+ private String exportPortfolioLearnerUrl;
+
+ /** persistent field */
+ private String exportPortfolioClassUrl;
+
+ /** persistent field */
+ private String monitorUrl;
+
+ /** persistent field */
+ private String contributeUrl;
+
+ /** persistent field */
+ private Date createDateTime;
+
+ /**
+ * Entries for an tool in a language property file
+ */
+ public static final String I18N_DISPLAY_NAME = "tool.display.name";
+ public static final String I18N_DESCRIPTION = "tool.description";
+
+ /** full constructor */
+ public SystemTool(Long systemToolId,
+ Integer activityTypeId,
+ String displayName,
+ String description,
+ String learnerUrl,
+ String learnerPreviewUrl,
+ String learnerProgressUrl,
+ String exportPortfolioLearnerUrl,
+ String exportPortfolioClassUrl,
+ String monitorUrl,
+ String contributeUrl,
+ Date createDateTime)
+ {
+ this.systemToolId = systemToolId;
+ this.activityTypeId = activityTypeId;
+ this.toolDisplayName = displayName;
+ this.description = description;
+
+ this.learnerUrl = learnerUrl;
+ this.learnerPreviewUrl = learnerPreviewUrl;
+ this.learnerProgressUrl = learnerProgressUrl;
+ this.exportPortfolioLearnerUrl = exportPortfolioLearnerUrl;
+ this.exportPortfolioClassUrl = exportPortfolioClassUrl;
+ this.monitorUrl = monitorUrl;
+ this.contributeUrl = contributeUrl;
+
+ this.createDateTime = createDateTime;
+ }
+
+ /** default constructor */
+ public SystemTool() {
+ }
+
+ /**
+ * @hibernate.id generator-class="native" type="java.lang.Long"
+ * column="system_tool_id"
+ */
+ public Long getSystemToolId() {
+ return this.systemToolId;
+ }
+
+ public void setSystemToolId(Long systemToolId) {
+ this.systemToolId = systemToolId;
+ }
+
+
+ /**
+ * @hibernate.property column="learning_activity_type_id" type="java.lang.Integer"
+ * not-null="true"
+ */
+ public Integer getActivityTypeId() {
+ return this.activityTypeId;
+ }
+
+ public void setActivityTypeId(Integer activityTypeId) {
+ this.activityTypeId = activityTypeId;
+ }
+
+ /**
+ * @hibernate.property column="tool_display_name" length="255"
+ * not-null="true"
+ */
+ public String getToolDisplayName() {
+ return this.toolDisplayName;
+ }
+
+ public void setToolDisplayName(String toolDisplayName) {
+ this.toolDisplayName = toolDisplayName;
+ }
+
+ /**
+ * @hibernate.property column="description" length="65535"
+ */
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @hibernate.property column="learner_url" length="65535"
+ * not-null="true"
+ */
+ public String getLearnerUrl() {
+ return this.learnerUrl;
+ }
+
+ public void setLearnerUrl(String learnerUrl) {
+ this.learnerUrl = learnerUrl;
+ }
+
+ /**
+ * @hibernate.property column="learner_preview_url" length="65535"
+ * not-null="false"
+ */
+ public String getLearnerPreviewUrl() {
+ return this.learnerPreviewUrl;
+ }
+
+ public void setLearnerPreviewUrl(String learnerPreviewUrl) {
+ this.learnerPreviewUrl = learnerPreviewUrl;
+ }
+
+ /**
+ * @hibernate.property column="learner_progress_url" length="65535"
+ * not-null="false"
+ */
+ public String getLearnerProgressUrl() {
+ return this.learnerProgressUrl;
+ }
+
+ public void setLearnerProgressUrl(String learnerProgressUrl) {
+ this.learnerProgressUrl = learnerProgressUrl;
+ }
+
+ /**
+ * @hibernate.property column="export_pfolio_learner_url" length="65535"
+ * not-null="false"
+ */
+ public String getExportPortfolioLearnerUrl() {
+ return this.exportPortfolioLearnerUrl;
+ }
+
+ public void setExportPortfolioLearnerUrl(String exportPortfolioLearnerUrl) {
+ this.exportPortfolioLearnerUrl = exportPortfolioLearnerUrl;
+ }
+
+ /**
+ * @hibernate.property column="export_pfolio_class_url" length="65535"
+ * not-null="false"
+ */
+ public String getExportPortfolioClassUrl() {
+ return this.exportPortfolioClassUrl;
+ }
+
+ public void setExportPortfolioClassUrl(String exportPortfolioClassUrl) {
+ this.exportPortfolioClassUrl = exportPortfolioClassUrl;
+ }
+
+ /**
+ * @hibernate.property column="create_date_time"
+ length="19" not-null="true"
+ * @return Returns the createDateTime.
+ */
+ public Date getCreateDateTime()
+ {
+ return createDateTime;
+ }
+ /**
+ * @param createDateTime The createDateTime to set.
+ */
+ public void setCreateDateTime(Date createDateTime)
+ {
+ this.createDateTime = createDateTime;
+ }
+
+
+ /**
+ * Does this tool support contribute? Will be true if the contributeURL is not null/empty string.
+ */
+ public boolean getSupportsContribute()
+ {
+ String contributeURL = getContributeUrl();
+ return ( contributeURL != null && contributeURL.trim().length() > 0);
+ }
+
+
+ /**
+ * @hibernate.property column="contribute_url" length="65535" not-null="false"
+ * @return Returns the contributeUrl.
+ */
+ public String getContributeUrl()
+ {
+ return contributeUrl;
+ }
+ /**
+ * @param contributeUrl The contributUrl to set.
+ */
+ public void setContributeUrl(String contributeUrl)
+ {
+ this.contributeUrl = contributeUrl;
+ }
+
+ /**
+ * @hibernate.property column="monitor_url" length="65535" not-null="false"
+ * @return Returns the monitorUrl.
+ */
+ public String getMonitorUrl()
+ {
+ return monitorUrl;
+ }
+ /**
+ * @param monitorUrl The monitorUrl to set.
+ */
+ public void setMonitorUrl(String monitorUrl)
+ {
+ this.monitorUrl = monitorUrl;
+ }
+
+
+ public String toString() {
+ return new ToStringBuilder(this)
+ .append("systemToolId", getSystemToolId())
+ .append("activityTypeId",getActivityTypeId())
+ .toString();
+ }
+
+ public boolean equals(Object other) {
+ if ( (this == other ) ) return true;
+ if ( !(other instanceof SystemTool) ) return false;
+ SystemTool castOther = (SystemTool) other;
+ return new EqualsBuilder()
+ .append(this.getSystemToolId(), castOther.getSystemToolId())
+ .isEquals();
+ }
+
+ public int hashCode() {
+ return new HashCodeBuilder()
+ .append(getSystemToolId())
+ .toHashCode();
+ }
+
+}
Index: lams_common/src/java/org/lamsfoundation/lams/tool/dao/ISystemToolDAO.java
===================================================================
diff -u
--- lams_common/src/java/org/lamsfoundation/lams/tool/dao/ISystemToolDAO.java (revision 0)
+++ lams_common/src/java/org/lamsfoundation/lams/tool/dao/ISystemToolDAO.java (revision 3f60ecf7d3a92231a1089191ae75c68bc66e9595)
@@ -0,0 +1,36 @@
+/****************************************************************
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $Id$ */
+package org.lamsfoundation.lams.tool.dao;
+
+import org.lamsfoundation.lams.dao.IBaseDAO;
+import org.lamsfoundation.lams.tool.SystemTool;
+
+public interface ISystemToolDAO extends IBaseDAO
+{
+
+ public SystemTool getSystemToolByID(final Long systemToolID);
+
+ public SystemTool getSystemToolByActivityTypeId(final Integer activityTypeId);
+
+}
Index: lams_common/src/java/org/lamsfoundation/lams/tool/dao/hibernate/SystemToolDAO.java
===================================================================
diff -u
--- lams_common/src/java/org/lamsfoundation/lams/tool/dao/hibernate/SystemToolDAO.java (revision 0)
+++ lams_common/src/java/org/lamsfoundation/lams/tool/dao/hibernate/SystemToolDAO.java (revision 3f60ecf7d3a92231a1089191ae75c68bc66e9595)
@@ -0,0 +1,56 @@
+/****************************************************************
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id$ */
+package org.lamsfoundation.lams.tool.dao.hibernate;
+
+import org.hibernate.HibernateException;
+import org.hibernate.Session;
+import org.lamsfoundation.lams.dao.hibernate.BaseDAO;
+import org.lamsfoundation.lams.tool.SystemTool;
+import org.lamsfoundation.lams.tool.dao.ISystemToolDAO;
+import org.springframework.orm.hibernate3.HibernateCallback;
+
+public class SystemToolDAO extends BaseDAO implements ISystemToolDAO {
+
+ private static final String LOAD_TOOL_BY_ACT_TYPE = "from tool in class SystemTool where tool.activityTypeId=:activityTypeId";
+
+ public SystemTool getSystemToolByID(final Long systemToolID)
+ {
+ return (SystemTool)getHibernateTemplate().get(SystemTool.class,systemToolID);
+ }
+
+ public SystemTool getSystemToolByActivityTypeId(final Integer activityTypeId)
+ {
+ return (SystemTool) getHibernateTemplate().execute(new HibernateCallback()
+ {
+ public Object doInHibernate(Session session) throws HibernateException
+ {
+ return session.createQuery(LOAD_TOOL_BY_ACT_TYPE)
+ .setInteger("activityTypeId",activityTypeId)
+ .uniqueResult();
+ }
+ });
+ }
+
+}
Index: lams_common/src/java/org/lamsfoundation/lams/tool/service/ILamsCoreToolService.java
===================================================================
diff -u -r34b959260a0f8f8285793a4481a95ca3580eabc5 -r3f60ecf7d3a92231a1089191ae75c68bc66e9595
--- lams_common/src/java/org/lamsfoundation/lams/tool/service/ILamsCoreToolService.java (.../ILamsCoreToolService.java) (revision 34b959260a0f8f8285793a4481a95ca3580eabc5)
+++ lams_common/src/java/org/lamsfoundation/lams/tool/service/ILamsCoreToolService.java (.../ILamsCoreToolService.java) (revision 3f60ecf7d3a92231a1089191ae75c68bc66e9595)
@@ -30,7 +30,6 @@
import org.lamsfoundation.lams.learningdesign.Activity;
import org.lamsfoundation.lams.learningdesign.ToolActivity;
import org.lamsfoundation.lams.lesson.Lesson;
-import org.lamsfoundation.lams.tool.ToolAccessMode;
import org.lamsfoundation.lams.tool.ToolSession;
import org.lamsfoundation.lams.tool.exception.DataMissingException;
import org.lamsfoundation.lams.tool.exception.LamsToolServiceException;
@@ -147,29 +146,62 @@
/**
* Return tool activity url for a learner. See also getToolPreviewURL, getToolLearnerProgressURL
- * @param activity the requested activity.
+ * @param lesson id - needed for the SystemToolActivities
+ * @param activity the requested activity - should be either a ToolActivity or a SystemToolActivity
* @param learner the current learner.
- * @return the tool access url with tool session id and access mode.
+ * @return the tool access url with tool session id or activity id
*/
- public String getToolLearnerURL(ToolActivity activity, User learner) throws LamsToolServiceException;
+ public String getToolLearnerURL(Long lessonID, Activity activity, User learner) throws LamsToolServiceException;
/**
* Return tool activity url for running a tool in preview mode. See also getToolLearnerURL, getToolLearnerProgressURL
- * @param activity the requested activity.
+ * @param lesson id - needed for the SystemToolActivities
+ * @param activity the requested activity - should be either a ToolActivity or a SystemToolActivity
* @param learner the current learner.
- * @return the tool access url with tool session id and access mode.
+ * @return the tool access url with tool session id or activity id
*/
- public String getToolLearnerPreviewURL(ToolActivity activity, User learner) throws LamsToolServiceException;
+ public String getToolLearnerPreviewURL(Long lessonID, Activity activity, User learner) throws LamsToolServiceException;
/**
* Return tool activity url for running a tool in preview mode. See also getToolLearnerURL, getToolPreviewURL
- * @param activity the requested activity.
+ * @param lesson id - needed for the SystemToolActivities
+ * @param activity the requested activity - should be either a ToolActivity or a SystemToolActivity
* @param learner the current learner.
- * @return the tool access url with tool session id and access mode.
+ * @return the tool access url with tool session id or activity id
*/
- public String getToolLearnerProgressURL(ToolActivity activity, User learner) throws LamsToolServiceException;
+ public String getToolLearnerProgressURL(Long lessonID, Activity activity, User learner) throws LamsToolServiceException;
/**
+ * Return tool activity url for monitoring.
+ * @param lesson id - needed for the SystemToolActivities
+ * @param activity the requested activity - should be either a ToolActivity or a SystemToolActivity
+ * @return the tool access url with tool session id or activity id
+ */
+ public String getToolMonitoringURL(Long lessonID, Activity activity) throws LamsToolServiceException;
+
+ /**
+ * Return the contribution url for monitoring.
+ * @param lesson id - needed for the SystemToolActivities
+ * @param activity the requested activity - should be either a ToolActivity or a SystemToolActivity
+ * @return the tool access url with tool session id or activity id
+ */
+ public String getToolContributionURL(Long lessonID, Activity activity) throws LamsToolServiceException;
+
+ /**
+ * Return the define later url for monitoring.
+ * @param activity the requested activity - must be a a ToolActivity. System Activities don't support define later.
+ * @return the tool access url with tool content id
+ */
+ public String getToolDefineLaterURL(ToolActivity activity) throws LamsToolServiceException;
+
+ /**
+ * Return the moderate url for monitoring.
+ * @param activity the requested activity - must be a a ToolActivity. System Activities don't support moderation.
+ * @return the tool access url with tool content id
+ */
+ public String getToolModerateURL(ToolActivity activity) throws LamsToolServiceException;
+
+ /**
* Get all the tool sessions for a lesson. The resulting list is not sorted.
* @return list of ToolSession objects
*/
Index: lams_common/src/java/org/lamsfoundation/lams/tool/service/LamsCoreToolService.java
===================================================================
diff -u -r5519ec0c3c96eabe88a9a5f9b98f6d86e5c2ffa9 -r3f60ecf7d3a92231a1089191ae75c68bc66e9595
--- lams_common/src/java/org/lamsfoundation/lams/tool/service/LamsCoreToolService.java (.../LamsCoreToolService.java) (revision 5519ec0c3c96eabe88a9a5f9b98f6d86e5c2ffa9)
+++ lams_common/src/java/org/lamsfoundation/lams/tool/service/LamsCoreToolService.java (.../LamsCoreToolService.java) (revision 3f60ecf7d3a92231a1089191ae75c68bc66e9595)
@@ -32,10 +32,12 @@
import org.lamsfoundation.lams.learningdesign.Activity;
import org.lamsfoundation.lams.learningdesign.ToolActivity;
import org.lamsfoundation.lams.lesson.Lesson;
+import org.lamsfoundation.lams.tool.SystemTool;
import org.lamsfoundation.lams.tool.ToolContentIDGenerator;
import org.lamsfoundation.lams.tool.ToolContentManager;
import org.lamsfoundation.lams.tool.ToolSession;
import org.lamsfoundation.lams.tool.ToolSessionManager;
+import org.lamsfoundation.lams.tool.dao.ISystemToolDAO;
import org.lamsfoundation.lams.tool.dao.IToolSessionDAO;
import org.lamsfoundation.lams.tool.exception.DataMissingException;
import org.lamsfoundation.lams.tool.exception.LamsToolServiceException;
@@ -64,6 +66,7 @@
//---------------------------------------------------------------------
private ApplicationContext context;
private IToolSessionDAO toolSessionDAO;
+ private ISystemToolDAO systemToolDAO;
private ToolContentIDGenerator contentIDGenerator;
//---------------------------------------------------------------------
// Inversion of Control Methods - Method injection
@@ -84,6 +87,14 @@
this.toolSessionDAO = toolSessionDAO;
}
+ public ISystemToolDAO getSystemToolDAO() {
+ return systemToolDAO;
+ }
+
+ public void setSystemToolDAO(ISystemToolDAO systemToolDAO) {
+ this.systemToolDAO = systemToolDAO;
+ }
+
/**
* @param contentIDGenerator The contentIDGenerator to set.
*/
@@ -284,34 +295,127 @@
/**
- * @see org.lamsfoundation.lams.tool.service.ILamsCoreToolService#getToolLearnerURL(org.lamsfoundation.lams.learningdesign.ToolActivity, org.lamsfoundation.lams.usermanagement.User)
+ * @see org.lamsfoundation.lams.tool.service.ILamsCoreToolService#getToolLearnerURL(java.lang.Long, org.lamsfoundation.lams.learningdesign.Activity, org.lamsfoundation.lams.usermanagement.User)
*/
- public String getToolLearnerURL(ToolActivity activity,User learner) throws LamsToolServiceException
+ public String getToolLearnerURL(Long lessonID, Activity activity,User learner) throws LamsToolServiceException
{
- String toolURL = activity.getTool().getLearnerUrl();
- return setupToolURLWithToolSession(activity, learner, toolURL);
+ if ( activity.isToolActivity() ) {
+ ToolActivity toolActivity = (ToolActivity) activity;
+ String toolURL = toolActivity.getTool().getLearnerUrl();
+ return setupToolURLWithToolSession(toolActivity, learner, toolURL);
+ } else if ( activity.isSystemToolActivity() ){
+ SystemTool sysTool = systemToolDAO.getSystemToolByActivityTypeId(activity.getActivityTypeId());
+ if ( sysTool != null ) {
+ return setupURLWithActivityLessonID(activity, lessonID, sysTool.getLearnerUrl());
+ }
+ }
+ return null;
}
/**
- * @see org.lamsfoundation.lams.tool.service.ILamsCoreToolService#getToolLearnerPreviewURL(org.lamsfoundation.lams.learningdesign.ToolActivity, org.lamsfoundation.lams.usermanagement.User)
+ * @see org.lamsfoundation.lams.tool.service.ILamsCoreToolService#getToolLearnerPreviewURL(java.lang.Long, org.lamsfoundation.lams.learningdesign.Activity, org.lamsfoundation.lams.usermanagement.User)
*/
- public String getToolLearnerPreviewURL(ToolActivity activity,User authorLearner) throws LamsToolServiceException
+ public String getToolLearnerPreviewURL(Long lessonID, Activity activity,User authorLearner) throws LamsToolServiceException
{
- String toolURL = activity.getTool().getLearnerPreviewUrl();
- return setupToolURLWithToolSession(activity, authorLearner, toolURL);
+ if ( activity.isToolActivity() ) {
+ ToolActivity toolActivity = (ToolActivity) activity;
+ String toolURL = toolActivity.getTool().getLearnerPreviewUrl();
+ return setupToolURLWithToolSession(toolActivity, authorLearner, toolURL);
+ } else if ( activity.isSystemToolActivity() ){
+ SystemTool sysTool = systemToolDAO.getSystemToolByActivityTypeId(activity.getActivityTypeId());
+ if ( sysTool != null ) {
+ return setupURLWithActivityLessonID(activity, lessonID, sysTool.getLearnerPreviewUrl());
+ }
+ }
+ return null;
}
/**
- * @see org.lamsfoundation.lams.tool.service.ILamsCoreToolService#getToolLearnerProgressURL(org.lamsfoundation.lams.learningdesign.ToolActivity, org.lamsfoundation.lams.usermanagement.User)
+ * @see org.lamsfoundation.lams.tool.service.ILamsCoreToolService#getToolLearnerProgressURL(java.lang.Long, org.lamsfoundation.lams.learningdesign.Activity, org.lamsfoundation.lams.usermanagement.User)
*/
- public String getToolLearnerProgressURL(ToolActivity activity,User learner) throws LamsToolServiceException
+ public String getToolLearnerProgressURL(Long lessonID, Activity activity,User learner) throws LamsToolServiceException
{
- String toolURL = activity.getTool().getLearnerProgressUrl();
- toolURL = appendUserIDToURL(learner, toolURL);
- return setupToolURLWithToolSession(activity, learner, toolURL);
+ if ( activity.isToolActivity() ) {
+ ToolActivity toolActivity = (ToolActivity) activity;
+ String toolURL = toolActivity.getTool().getLearnerProgressUrl();
+ toolURL = appendUserIDToURL(learner, toolURL);
+ return setupToolURLWithToolSession(toolActivity, learner, toolURL);
+ } else if ( activity.isSystemToolActivity() ){
+ SystemTool sysTool = systemToolDAO.getSystemToolByActivityTypeId(activity.getActivityTypeId());
+ if ( sysTool != null ) {
+ return setupURLWithActivityLessonID(activity, lessonID, sysTool.getLearnerProgressUrl());
+ }
+ }
+ return null;
}
/**
+ * @see org.lamsfoundation.lams.tool.service.ILamsCoreToolService#getToolMonitoringURL(java.lang.Long, org.lamsfoundation.lams.learningdesign.Activity, org.lamsfoundation.lams.usermanagement.User)
+ */
+ public String getToolMonitoringURL(Long lessonID, Activity activity) throws LamsToolServiceException {
+
+ if ( activity.isToolActivity() ) {
+ ToolActivity toolActivity = (ToolActivity) activity;
+ String url = toolActivity.getTool().getMonitorUrl();
+ if ( url != null )
+ return setupToolURLWithToolContent(toolActivity, url);
+ } else if ( activity.isSystemToolActivity() ){
+ SystemTool sysTool = systemToolDAO.getSystemToolByActivityTypeId(activity.getActivityTypeId());
+ if ( sysTool != null ) {
+ return setupURLWithActivityLessonID(activity, lessonID, sysTool.getMonitorUrl());
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @see org.lamsfoundation.lams.tool.service.ILamsCoreToolService#getToolContributionURL(java.lang.Long, org.lamsfoundation.lams.learningdesign.Activity, org.lamsfoundation.lams.usermanagement.User)
+ */
+ public String getToolContributionURL(Long lessonID, Activity activity) throws LamsToolServiceException {
+
+ if ( activity.isToolActivity() ) {
+ ToolActivity toolActivity = (ToolActivity) activity;
+ String url = toolActivity.getTool().getContributeUrl();
+ if ( url != null )
+ return setupToolURLWithToolContent(toolActivity, url);
+ } else if ( activity.isSystemToolActivity() ){
+ SystemTool sysTool = systemToolDAO.getSystemToolByActivityTypeId(activity.getActivityTypeId());
+ if ( sysTool != null ) {
+ return setupURLWithActivityLessonID(activity, lessonID, sysTool.getContributeUrl());
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @see org.lamsfoundation.lams.tool.service.ILamsCoreToolService#getDefineLaterURL(org.lamsfoundation.lams.learningdesign.ToolActivity, org.lamsfoundation.lams.usermanagement.User)
+ */
+ public String getToolDefineLaterURL(ToolActivity activity) throws LamsToolServiceException {
+
+ if ( activity.isToolActivity() ) {
+ ToolActivity toolActivity = (ToolActivity) activity;
+ String url = toolActivity.getTool().getDefineLaterUrl();
+ if ( url != null )
+ return setupToolURLWithToolContent(toolActivity, url);
+ }
+ return null;
+ }
+
+ /**
+ * @see org.lamsfoundation.lams.tool.service.ILamsCoreToolService#getModerateURL(org.lamsfoundation.lams.learningdesign.ToolActivity, org.lamsfoundation.lams.usermanagement.User)
+ */
+ public String getToolModerateURL(ToolActivity activity) throws LamsToolServiceException {
+
+ if ( activity.isToolActivity() ) {
+ ToolActivity toolActivity = (ToolActivity) activity;
+ String url = toolActivity.getTool().getModerationUrl();
+ if ( url != null )
+ return setupToolURLWithToolContent(toolActivity, url);
+ }
+ return null;
+ }
+
+ /**
* Add the user id to the url
*/
private String appendUserIDToURL(User user, String toolURL)
@@ -344,6 +448,21 @@
toolSession.getToolSessionId().toString());
}
+ public String setupURLWithActivityLessonID(Activity activity, Long lessonID, String learnerURL) {
+ String url = learnerURL;
+ if ( activity != null ) {
+ url = WebUtil.appendParameterToURL(url,
+ AttributeNames.PARAM_ACTIVITY_ID,
+ activity.getActivityId().toString());
+ }
+ if ( lessonID != null ) {
+ WebUtil.appendParameterToURL(url,
+ AttributeNames.PARAM_LESSON_ID,
+ lessonID.toString());
+ }
+ return url;
+ }
+
/**
* @see org.lamsfoundation.lams.tool.service.ILamsCoreToolService#setupToolURLWithToolContent(org.lamsfoundation.lams.learningdesign.ToolActivity, java.lang.String)
*/
@@ -371,4 +490,5 @@
return context.getBean(toolActivity.getTool().getServiceName());
}
+
}
Index: lams_common/src/java/org/lamsfoundation/lams/toolApplicationContext.xml
===================================================================
diff -u -r049f9b1332a5f65c5de9d5b4f891b93fe429ae63 -r3f60ecf7d3a92231a1089191ae75c68bc66e9595
--- lams_common/src/java/org/lamsfoundation/lams/toolApplicationContext.xml (.../toolApplicationContext.xml) (revision 049f9b1332a5f65c5de9d5b4f891b93fe429ae63)
+++ lams_common/src/java/org/lamsfoundation/lams/toolApplicationContext.xml (.../toolApplicationContext.xml) (revision 3f60ecf7d3a92231a1089191ae75c68bc66e9595)
@@ -15,7 +15,11 @@
+
+
+
+
@@ -36,6 +40,7 @@
singleton="false"
>
+
Index: lams_common/test/java/org/lamsfoundation/lams/tool/service/TestLamsCoreToolService.java
===================================================================
diff -u -r34b959260a0f8f8285793a4481a95ca3580eabc5 -r3f60ecf7d3a92231a1089191ae75c68bc66e9595
--- lams_common/test/java/org/lamsfoundation/lams/tool/service/TestLamsCoreToolService.java (.../TestLamsCoreToolService.java) (revision 34b959260a0f8f8285793a4481a95ca3580eabc5)
+++ lams_common/test/java/org/lamsfoundation/lams/tool/service/TestLamsCoreToolService.java (.../TestLamsCoreToolService.java) (revision 3f60ecf7d3a92231a1089191ae75c68bc66e9595)
@@ -93,7 +93,7 @@
public void testGetToolLearnerURL() throws LamsToolServiceException
{
- String learnerUrl = toolService.getToolLearnerURL(testNonGroupedActivity,testUser);
+ String learnerUrl = toolService.getToolLearnerURL(TEST_LESSON_ID, testNonGroupedActivity,testUser);
assertNotNull(learnerUrl);
assertTrue(learnerUrl.indexOf("?")>0);
assertTrue(learnerUrl.indexOf(AttributeNames.PARAM_TOOL_SESSION_ID)>0);
@@ -102,7 +102,7 @@
public void testGetToolLearnerProgressURL() throws LamsToolServiceException
{
- String monitorUrl = toolService.getToolLearnerProgressURL(testNonGroupedActivity,testUser);
+ String monitorUrl = toolService.getToolLearnerProgressURL(TEST_LESSON_ID, testNonGroupedActivity,testUser);
assertNotNull(monitorUrl);
log.info("monitor url:"+monitorUrl);
@@ -113,7 +113,7 @@
public void testGetToolLearnerPreviewURL() throws LamsToolServiceException
{
- String authorUrl = toolService.getToolLearnerPreviewURL(testNonGroupedActivity,testUser);
+ String authorUrl = toolService.getToolLearnerPreviewURL(TEST_LESSON_ID, testNonGroupedActivity,testUser);
assertNotNull(authorUrl);
log.info("author url:"+authorUrl);
@@ -124,7 +124,7 @@
public void testGetToolLearnerURLForGroupedTool() throws LamsToolServiceException
{
- String learnerUrl = toolService.getToolLearnerURL(testGroupedActivity,testUser);
+ String learnerUrl = toolService.getToolLearnerURL(TEST_LESSON_ID, testGroupedActivity,testUser);
assertNotNull(learnerUrl);
log.info("Non grouped activity learner url:"+learnerUrl);