contributionTypes)
+ {
+ if ( branchingActivity != null && branchingActivity.isChosenBranchingActivity()) {
+ contributionTypes.add(ContributionTypes.CHOSEN_BRANCHING);
+ }
+ }
+
+
}
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/strategy/ComplexActivityStrategy.java
===================================================================
diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -ra7351da17f548464a76295a73e9cc17450a6ff39
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/strategy/ComplexActivityStrategy.java (.../ComplexActivityStrategy.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf)
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/strategy/ComplexActivityStrategy.java (.../ComplexActivityStrategy.java) (revision a7351da17f548464a76295a73e9cc17450a6ff39)
@@ -24,6 +24,7 @@
package org.lamsfoundation.lams.learningdesign.strategy;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Iterator;
import org.lamsfoundation.lams.learningdesign.Activity;
@@ -39,7 +40,7 @@
* @author Jacky Fang 2005-2-23
* @version 1.1
*/
-public abstract class ComplexActivityStrategy implements Serializable
+public abstract class ComplexActivityStrategy implements Serializable, IContributionTypeStrategy
{
/**
* Check up all children completion status for a complex activity.
@@ -108,4 +109,32 @@
protected Activity getActivity() {
return getComplexActivity();
}
+
+ //---------------------------------------------------------------------
+ // Implementation of IContributeTypeStrategy
+ //---------------------------------------------------------------------
+ /**
+ * Template method that get contribute type according its sub concrete
+ * activity.
+ * @param activity the activity that has contribute type.
+ * @return an array of contribute types.
+ */
+ public Integer[] getContributionType()
+ {
+ ArrayList contributionTypes = new ArrayList();
+
+ //abstract method to polymorphically setup contribute type.
+ setUpContributionType(contributionTypes);
+
+ return (Integer[])contributionTypes.toArray(new Integer[contributionTypes.size()]);
+ }
+
+ /**
+ * Setup contribution type polymorphically according its activity type.
+ * Most complex activities don't have a contribution type, so default to setting up nothing
+ * @param contributionTypes the list that holds contribution types.
+ */
+ protected void setUpContributionType(ArrayList contributionTypes) {
+
+ }
}
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/strategy/IContributionTypeStrategy.java
===================================================================
diff -u
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/strategy/IContributionTypeStrategy.java (revision 0)
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/strategy/IContributionTypeStrategy.java (revision a7351da17f548464a76295a73e9cc17450a6ff39)
@@ -0,0 +1,39 @@
+/***************************************************************************
+ * 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
+ * ***********************************************************************/
+/* $Id$ */
+package org.lamsfoundation.lams.learningdesign.strategy;
+
+/**
+ * Methods for a strategy that gets the contribution types. Is used for both
+ * simple and complex activity strategies.
+ */
+public interface IContributionTypeStrategy
+{
+
+ /**
+ * Get contribute type according its sub concrete activity.
+ * @param activity the activity that has contribute type.
+ * @return an array of contribute types.
+ */
+ public Integer[] getContributionType();
+
+}
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/strategy/SimpleActivityStrategy.java
===================================================================
diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -ra7351da17f548464a76295a73e9cc17450a6ff39
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/strategy/SimpleActivityStrategy.java (.../SimpleActivityStrategy.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf)
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/strategy/SimpleActivityStrategy.java (.../SimpleActivityStrategy.java) (revision a7351da17f548464a76295a73e9cc17450a6ff39)
@@ -46,7 +46,7 @@
* @author Minhas
* @version 1.1
*/
-public abstract class SimpleActivityStrategy implements Serializable
+public abstract class SimpleActivityStrategy implements Serializable, IContributionTypeStrategy
{
//---------------------------------------------------------------------