diff --git a/pom.xml b/pom.xml
index 3a007ba1e..6f1d1c0c1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -120,7 +120,6 @@
org.quartz-scheduler
quartz
- ${sakai.quartz.version}
@@ -167,7 +166,6 @@
org.quartz-scheduler
quartz
- ${sakai.quartz.version}
diff --git a/sakai-evaluation-api/pom.xml b/sakai-evaluation-api/pom.xml
index 0786b1cfb..99df3fa51 100644
--- a/sakai-evaluation-api/pom.xml
+++ b/sakai-evaluation-api/pom.xml
@@ -139,13 +139,27 @@
commons-logging
commons-logging
+
+ org.apache.commons
+ commons-lang3
+
+
+
+
+ org.sakaiproject.edu-services.course-management
+ coursemanagement-api
+
+
+ org.sakaiproject.kernel
+ sakai-component-manager
+
org.sakaiproject.entitybroker
entitybroker-api
-
-
+
+
src/java
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/beans/EvalBeanUtils.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/beans/EvalBeanUtils.java
index 38a4feed0..2b1c3378c 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/beans/EvalBeanUtils.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/beans/EvalBeanUtils.java
@@ -21,6 +21,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.sakaiproject.component.cover.ServerConfigurationService;
import org.sakaiproject.evaluation.constant.EvalConstants;
import org.sakaiproject.evaluation.logic.EvalCommonLogic;
import org.sakaiproject.evaluation.logic.EvalSettings;
@@ -41,7 +42,15 @@
*/
public class EvalBeanUtils {
- private static Log log = LogFactory.getLog(EvalBeanUtils.class);
+ private static final Log LOG = LogFactory.getLog(EvalBeanUtils.class);
+
+ // Section awareness default setting from sakai.properties
+ private static final String SAKAI_PROP_EVALSYS_SECTION_AWARE_DEFAULT = "evalsys.section.aware.default";
+ private static final String SAKAI_PROP_EVALSYS_RESULTS_SHARING_DEFAULT = "evalsys.results.sharing.default";
+ private static final String SAKAI_PROP_EVALSYS_INSTRUCTOR_VIEW_RESPONSES_DEFAULT = "evalsys.instructor.view.responses.default";
+ private static final boolean EVALSYS_SECTION_AWARE_DEFAULT = ServerConfigurationService.getBoolean( SAKAI_PROP_EVALSYS_SECTION_AWARE_DEFAULT, false );
+ private static final String EVALSYS_RESULTS_SHARING_DEFAULT = ServerConfigurationService.getString( SAKAI_PROP_EVALSYS_RESULTS_SHARING_DEFAULT, EvalConstants.SHARING_VISIBLE );
+ private static final boolean EVALSYS_INSTRUCTOR_VIEW_RESPONSES_DEFAULT = ServerConfigurationService.getBoolean( SAKAI_PROP_EVALSYS_INSTRUCTOR_VIEW_RESPONSES_DEFAULT, true );
private EvalCommonLogic commonLogic;
public void setCommonLogic(EvalCommonLogic commonLogic) {
@@ -63,11 +72,11 @@ public void setSettings(EvalSettings settings) {
* @return number of responses needed before viewing is allowed, 0 indicates viewable now
*/
public int getResponsesNeededToViewForResponseRate(int responsesCount, int enrollmentsCount) {
- int responsesNeeded = 1;
+ int responsesNeeded;
if ( commonLogic.isUserAdmin( commonLogic.getCurrentUserId() ) ) {
responsesNeeded = 0;
} else {
- int minResponses = ((Integer) settings.get(EvalSettings.RESPONSES_REQUIRED_TO_VIEW_RESULTS)).intValue();
+ int minResponses = ((Integer) settings.get(EvalSettings.RESPONSES_REQUIRED_TO_VIEW_RESULTS));
responsesNeeded = minResponses - responsesCount;
if (responsesCount >= enrollmentsCount) {
// special check to make sure the cases where there is a very small enrollment count is still ok
@@ -107,6 +116,7 @@ public boolean checkUserPermission(String userId, String ownerId) {
* similar logic to {@link #getInstructorViewDateForEval(EvalEvaluation)}
*
* @param eval the evaluation
+ * @param evalState
* @return true if results can be viewed, false otherwise
*/
public boolean checkInstructorViewResultsForEval(EvalEvaluation eval, String evalState) {
@@ -140,7 +150,7 @@ public boolean checkInstructorViewResultsForEval(EvalEvaluation eval, String eva
if (instViewResultsSetting == null) {
instViewResultsEval = eval.getInstructorViewResults();
} else {
- instViewResultsEval = instViewResultsSetting.booleanValue();
+ instViewResultsEval = instViewResultsSetting;
}
}
}
@@ -183,7 +193,7 @@ public Date getInstructorViewDateForEval(EvalEvaluation eval) {
if (instViewResultsSetting == null) {
evalViewable = eval.getInstructorViewResults();
} else {
- evalViewable = instViewResultsSetting.booleanValue();
+ evalViewable = instViewResultsSetting;
}
}
if (evalViewable) {
@@ -238,7 +248,7 @@ public void setEvaluationDefaults(EvalEvaluation eval, String evaluationType) {
calendar.setTime( now );
if (eval.getStartDate() == null) {
eval.setStartDate(now);
- log.debug("Setting start date to default of: " + eval.getStartDate());
+ LOG.debug("Setting start date to default of: " + eval.getStartDate());
} else {
calendar.setTime(eval.getStartDate());
}
@@ -255,7 +265,7 @@ public void setEvaluationDefaults(EvalEvaluation eval, String evaluationType) {
// default the due date to the end of the start date + 1 day
Date endOfDay = EvalUtils.getEndOfDayDate( calendar.getTime() );
eval.setDueDate( endOfDay );
- log.debug("Setting due date to default of: " + eval.getDueDate());
+ LOG.debug("Setting due date to default of: " + eval.getDueDate());
} else {
calendar.setTime(eval.getDueDate());
}
@@ -270,7 +280,7 @@ public void setEvaluationDefaults(EvalEvaluation eval, String evaluationType) {
// assign stop date to equal due date for now
if (eval.getStopDate() == null) {
eval.setStopDate(eval.getDueDate());
- log.debug("Setting stop date to default of: " + eval.getStopDate());
+ LOG.debug("Setting stop date to default of: " + eval.getStopDate());
}
} else {
eval.setStopDate(null);
@@ -288,7 +298,7 @@ public void setEvaluationDefaults(EvalEvaluation eval, String evaluationType) {
if (eval.getViewDate() == null) {
// default the view date to the today + 2
eval.setViewDate(calendar.getTime());
- log.debug("Setting view date to default of: " + eval.getViewDate());
+ LOG.debug("Setting view date to default of: " + eval.getViewDate());
}
} else {
eval.setViewDate(null);
@@ -306,13 +316,13 @@ public void setEvaluationDefaults(EvalEvaluation eval, String evaluationType) {
}
// results viewable settings
- Date studentsDate = null;
+ Date studentsDate;
Boolean studentsView = (Boolean) settings.get(EvalSettings.STUDENT_ALLOWED_VIEW_RESULTS);
if (studentsView != null) {
eval.setStudentViewResults( studentsView );
}
- Date instructorsDate = null;
+ Date instructorsDate;
Boolean instructorsView = (Boolean) settings.get(EvalSettings.INSTRUCTOR_ALLOWED_VIEW_RESULTS);
if (instructorsView != null) {
eval.setInstructorViewResults( instructorsView );
@@ -330,10 +340,38 @@ public void setEvaluationDefaults(EvalEvaluation eval, String evaluationType) {
eval.setInstructorViewAllResults( instructorsAllViewSetting );
}
}
-
- if (eval.getResultsSharing() == null) {
- eval.setResultsSharing( EvalConstants.SHARING_VISIBLE );
+
+ // Section awareness default controlled by sakai.property
+ if( eval.getSectionAwareness() == null )
+ {
+ eval.setSectionAwareness( EVALSYS_SECTION_AWARE_DEFAULT );
}
+
+ // Results sharing default controlled by sakai.property
+ if( eval.getResultsSharing() == null )
+ {
+ if( !EvalConstants.SHARING_VISIBLE.equals( EVALSYS_RESULTS_SHARING_DEFAULT )
+ && !EvalConstants.SHARING_PRIVATE.equals( EVALSYS_RESULTS_SHARING_DEFAULT )
+ && !EvalConstants.SHARING_PUBLIC.equals( EVALSYS_RESULTS_SHARING_DEFAULT ) )
+ {
+ eval.setResultsSharing( EvalConstants.SHARING_VISIBLE );
+ }
+ else
+ {
+ eval.setResultsSharing( EVALSYS_RESULTS_SHARING_DEFAULT );
+ }
+ }
+
+ // Instructors view results default controlled by sakai.property
+ if( (Boolean) eval.getInstructorViewResults() == null )
+ {
+ eval.setInstructorViewResults( EVALSYS_INSTRUCTOR_VIEW_RESPONSES_DEFAULT );
+ }
+ if( eval.getInstructorViewAllResults() == null )
+ {
+ eval.setInstructorViewAllResults( EVALSYS_INSTRUCTOR_VIEW_RESPONSES_DEFAULT );
+ }
+
if (EvalConstants.SHARING_PRIVATE.equals(eval.getResultsSharing())) {
eval.setStudentViewResults( false );
eval.setInstructorViewResults( false );
@@ -470,7 +508,7 @@ public void fixupEvaluationDates(EvalEvaluation eval, boolean ignoreMinTimeDiff)
// force the due date to the end of the day if we are using dates only AND eval is not due yet
if (eval.getDueDate() != null) {
if (EvalUtils.checkStateBefore(eval.getState(), EvalConstants.EVALUATION_STATE_GRACEPERIOD, false) ) {
- log.info("Forcing date to end of day for non null due date: " + eval.getDueDate());
+ LOG.info("Forcing date to end of day for non null due date: " + eval.getDueDate());
eval.setDueDate( EvalUtils.getEndOfDayDate( eval.getDueDate() ) );
}
}
@@ -485,7 +523,7 @@ public void fixupEvaluationDates(EvalEvaluation eval, boolean ignoreMinTimeDiff)
// force the stop date to the end of the day if we are using dates only AND eval is not closed yet
if (eval.getStopDate() != null) {
if (EvalUtils.checkStateBefore(eval.getState(), EvalConstants.EVALUATION_STATE_CLOSED, false) ) {
- log.info("Forcing date to end of day for non null stop date: " + eval.getStopDate());
+ LOG.info("Forcing date to end of day for non null stop date: " + eval.getStopDate());
eval.setStopDate( EvalUtils.getEndOfDayDate( eval.getStopDate() ) );
}
}
@@ -494,7 +532,7 @@ public void fixupEvaluationDates(EvalEvaluation eval, boolean ignoreMinTimeDiff)
// Getting the system setting that tells what should be the minimum time difference between start date and due date.
int minHoursDifference = 0;
if (!ignoreMinTimeDiff) {
- minHoursDifference = ((Integer) settings.get(EvalSettings.EVAL_MIN_TIME_DIFF_BETWEEN_START_DUE)).intValue();
+ minHoursDifference = ((Integer) settings.get(EvalSettings.EVAL_MIN_TIME_DIFF_BETWEEN_START_DUE));
}
// Ensure minimum time difference between start and due/stop dates in eval - check this after the dates are set
if (eval.getDueDate() != null) {
@@ -512,7 +550,7 @@ public void fixupEvaluationDates(EvalEvaluation eval, boolean ignoreMinTimeDiff)
// force the view date to the end of the day if we are using dates only AND eval is not viewable yet
if (eval.getViewDate() != null) {
if (EvalUtils.checkStateBefore(eval.getState(), EvalConstants.EVALUATION_STATE_VIEWABLE, false) ) {
- log.info("Forcing date to end of day for non null stop date: " + eval.getViewDate());
+ LOG.info("Forcing date to end of day for non null stop date: " + eval.getViewDate());
eval.setViewDate( EvalUtils.getEndOfDayDate( eval.getViewDate() ) );
}
}
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/constant/EvalConstants.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/constant/EvalConstants.java
index cb2355ab1..c2d36aaf4 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/constant/EvalConstants.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/constant/EvalConstants.java
@@ -243,6 +243,36 @@ public class EvalConstants {
*/
public static final String HIERARCHY_PERM_ASSIGN_EVALUATION = "HierarchyAssignEval";
+ /**
+ * Hierarchy Rule for site titles
+ */
+ public static final String HIERARCHY_RULE_SITE = "SITE";
+
+ /**
+ * Hierarchy Rule for section titles
+ */
+ public static final String HIERARCHY_RULE_SECTION = "SECTION";
+
+ /**
+ * Hierarchy Rule qualifier 'contains'; site/section title must contain the rule text
+ */
+ public static final String HIERARCHY_QUALIFIER_CONTAINS = "CONTAINS";
+
+ /**
+ * Hierarchy Rule qualifier 'starts with'; site/section title must start with the rule text
+ */
+ public static final String HIERARCHY_QUALIFIER_STARTS_WITH = "STARTS_WITH";
+
+ /**
+ * Hierarchy Rule qualifier 'ends with'; site/section title must end with the rule text
+ */
+ public static final String HIERARCHY_QUALIFIER_ENDS_WITH = "ENDS_WITH";
+
+ /**
+ * Hierarchy Rule qualifier 'is'; site/section title must be exactly the rule text
+ */
+ public static final String HIERARCHY_QUALIFIER_IS = "IS";
+
/**
* Permission: User can create, update, delete evaluation templates
*/
@@ -325,6 +355,26 @@ public class EvalConstants {
*/
public final static String GROUP_TYPE_ADHOC = "Adhoc";
+ /**
+ * EvalGroup class: Section type (represents a section within a site)
+ */
+ public final static String GROUP_TYPE_SECTION = "Section";
+
+ /**
+ * Evaluation group id prefix denoting a site id to follow
+ */
+ public final static String GROUP_ID_SITE_PREFIX = "/site/";
+
+ /**
+ * Evaluation group id prefix denoting a section id to follow
+ */
+ public final static String GROUP_ID_SECTION_PREFIX = "/section/";
+
+ /**
+ * Evaluation group id prefix denoting a group id to follow
+ */
+ public final static String GROUP_ID_GROUP_PREFIX = "/group/";
+
/**
* Scale ideal setting: no selection of this scale is the ideal one
*/
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/dao/hbm/EvalEvaluation.hbm.xml b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/dao/hbm/EvalEvaluation.hbm.xml
index ed360d452..924d6316b 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/dao/hbm/EvalEvaluation.hbm.xml
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/dao/hbm/EvalEvaluation.hbm.xml
@@ -179,5 +179,8 @@
+
+
+
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/dao/hbm/EvalHierarchyRule.hbm.xml b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/dao/hbm/EvalHierarchyRule.hbm.xml
new file mode 100644
index 000000000..dbefa954e
--- /dev/null
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/dao/hbm/EvalHierarchyRule.hbm.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/jobmonitor/JobStatusReporter.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/jobmonitor/JobStatusReporter.java
index 4164a8aa0..d22e27408 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/jobmonitor/JobStatusReporter.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/jobmonitor/JobStatusReporter.java
@@ -36,6 +36,7 @@ public interface JobStatusReporter
/**
* @param jobId
* @param jobFailed TODO
+ * @param milestone
* @param detail
*/
public void reportError(String jobId, boolean jobFailed, String milestone, String detail);
@@ -43,6 +44,7 @@ public interface JobStatusReporter
/**
* @param jobId
* @param jobFailed TODO
+ * @param milestone
* @param detail TODO
*/
public void reportFinished(String jobId, boolean jobFailed, String milestone, String detail);
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/EvalAuthoringService.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/EvalAuthoringService.java
index be6de5464..3d5fd7849 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/EvalAuthoringService.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/EvalAuthoringService.java
@@ -66,7 +66,6 @@ public interface EvalAuthoringService {
*
* @param scale a scale object to be saved
* @param userId the internal user id (not username)
- * @throws UniqueFieldException is this scale title is already in use and this is not an adhoc scale
*/
public void saveScale(EvalScale scale, String userId);
@@ -459,7 +458,6 @@ public interface EvalAuthoringService {
*
* @param template the object to be saved
* @param userId the internal user id (not username)
- * @throws UniqueFieldException is this template title is already in use
*/
public void saveTemplate(EvalTemplate template, String userId);
@@ -473,7 +471,7 @@ public interface EvalAuthoringService {
* template is detected to be a hidden copy (indicating no one can see or use
* it other than the associated evaluation which would have locked it)
*
- * @param template the object to be removed
+ * @param templateId the object to be removed
* @param userId the internal user id (not username)
*/
public void deleteTemplate(Long templateId, String userId);
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/EvalEmailsLogic.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/EvalEmailsLogic.java
index cd2984d3f..6527db575 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/EvalEmailsLogic.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/EvalEmailsLogic.java
@@ -139,6 +139,7 @@ public EvalEmailMessage makeEmailMessage(String messageTemplate, String subjectT
/**
*
* @param jobStatusReporter TODO
+ * @param jobId
* @return
*/
public String[] sendConsolidatedReminderNotifications(JobStatusReporter jobStatusReporter, String jobId);
@@ -146,6 +147,7 @@ public EvalEmailMessage makeEmailMessage(String messageTemplate, String subjectT
/**
*
* @param jobStatusReporter TODO
+ * @param jobId
* @return
*/
public String[] sendConsolidatedAvailableNotifications(JobStatusReporter jobStatusReporter, String jobId);
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/EvalEvaluationService.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/EvalEvaluationService.java
index d33be236a..4e253f6d2 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/EvalEvaluationService.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/EvalEvaluationService.java
@@ -49,7 +49,7 @@ public interface EvalEvaluationService {
public static final String PDF_RESULTS_REPORT = "pdfResultsReport";
public static final String CSV_RESULTS_REPORT = "csvResultsReport";
public static final String PDF_RESULTS_REPORT_INDIVIDUAL = "pdfResultsReportIndividual";
-
+ public static final String CSV_TAKERS_REPORT = "csvTakersReport";
// EVALUATIONS
/**
@@ -504,6 +504,7 @@ public interface EvalEvaluationService {
* @param evalGroupIds an array of unique ids for eval groups,
* if null or empty then get all responses for all groups,
* NOTE: these ids are not validated
+ * @param completed
* @return the count of associated responses
*/
public int countResponses(String userId, Long[] evaluationIds, String[] evalGroupIds, Boolean completed);
@@ -558,6 +559,7 @@ public interface EvalEvaluationService {
/**
* Get an email template for an eval by type, will always return an email template
*
+ * @param evaluationId
* @param emailTemplateTypeConstant a constant, use the EMAIL_TEMPLATE constants from
* {@link org.sakaiproject.evaluation.constant.EvalConstants} to indicate the type
* @return the email template of the supplied type for this eval
@@ -653,13 +655,6 @@ public List getEvaluations(String searchString,
* id and a date.
* @param page The zero-based starting page. In other words, return a page of items beginning at index
* (pageSize * page).
- * @param availableEmailSent A boolean value indicating whether the summary data should include evals for which
- * available emails have been sent (if parameter is Boolean.TRUE) or have not been sent (if parameter is
- * Boolean.FALSE). A null value indicates all Active evals should be included.
- * @param emailTemplateType The category of email templates to include in the mapping (either
- * EvalConstants.EMAIL_TEMPLATE_CONSOLIDATED_AVAILABLE or EvalConstants.EMAIL_TEMPLATE_CONSOLIDATED_REMINDER,
- * but not both)
- *
* @return A mapping from user-id to data about the evals that user can take. The data for each users is
* a mapping from string values (EvalConstants.KEY_USER_ID, EvalConstants.KEY_USER_EID,
* EvalConstants.KEY_EMAIL_TEMPLATE_ID and EvalConstants.KEY_EARLIEST_DUE_DATE) to a String
@@ -699,6 +694,7 @@ public int selectConsoliatedEmailRecipients(boolean useAvailableEmailSent,
/**
* Remove all records from the the email processing queue and report the number of items removed.
+ * @return
*/
public int resetConsolidatedEmailRecipients();
@@ -720,13 +716,22 @@ public int selectConsoliatedEmailRecipients(boolean useAvailableEmailSent,
/**
* This is similar to but for the case of EvalEvaluationService.PDF_RESULTS_REPORT_INDIVIDUAL {@link #exportReport(EvalEvaluation, String, OutputStream, String)
+ * @param evaluation
+ * @param groupIds
* @param evaluateeId - evaluatee id to export
+ * @param outputStream
+ * @param exportType
*/
public void exportReport(EvalEvaluation evaluation, String groupIds, String evaluateeId, OutputStream outputStream, String exportType);
/**
* This just allows passing groupIds as a direct array
+ * @param evaluation
+ * @param groupIds
+ * @param evaluateeId
+ * @param outputStream
+ * @param exportType
* @see exportReport
*/
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/EvalEvaluationSetupService.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/EvalEvaluationSetupService.java
index 0979fee71..6d6110fd4 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/EvalEvaluationSetupService.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/EvalEvaluationSetupService.java
@@ -308,7 +308,7 @@ public interface EvalEvaluationSetupService {
* {@link #canControlEmailTemplate(String, Long, String)} to check
* if user can update this template and avoid possible exceptions
*
- * @param EmailTemplate emailTemplate object to be saved
+ * @param emailTemplate emailTemplate object to be saved
* @param userId the acting user, normally the current user, internal user id (not username)
*/
public void saveEmailTemplate(EvalEmailTemplate emailTemplate, String userId);
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/EvalLockManager.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/EvalLockManager.java
index 47ad4156b..a12cf60dd 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/EvalLockManager.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/EvalLockManager.java
@@ -28,7 +28,7 @@ public interface EvalLockManager {
* control the failure so instead we return null as a marker
*
* @param lockId the name of the lock which we are seeking
- * @param holderId a unique id for the holder of this lock (normally a server id)
+ * @param executerId a unique id for the executer of this lock (normally a server id)
* @param timePeriod the length of time (in milliseconds) that the lock should be valid for,
* set this very low for non-repeating processes (the length of time the process should take to run)
* and the length of the repeat period plus the time to run the process for repeating jobs
@@ -44,7 +44,7 @@ public interface EvalLockManager {
* control the failure so instead we return null as a marker
*
* @param lockId the name of the lock which we are seeking
- * @param holderId a unique id for the holder of this lock (normally a server id)
+ * @param executerId a unique id for the executer of this lock (normally a server id)
* @return true if a lock was released, false if not, null if failure
*/
public Boolean releaseLock(String lockId, String executerId);
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/externals/EvalExternalLogic.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/externals/EvalExternalLogic.java
index 50d9182d8..b24055e6b 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/externals/EvalExternalLogic.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/externals/EvalExternalLogic.java
@@ -29,7 +29,7 @@
* @author Aaron Zeckoski (aaronz@vt.edu)
*/
public interface EvalExternalLogic extends ExternalUsers, ExternalEvalGroups, ExternalEmail, ExternalSecurity,
- ExternalContent, ExternalScheduler, ExternalTextUtils, ExternalComponents, ExternalEntities {
+ ExternalContent, ExternalScheduler, ExternalTextUtils, ExternalComponents, ExternalEntities, ExternalHierarchyRules {
// EVAL USER retrieval
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/externals/ExternalEvalGroups.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/externals/ExternalEvalGroups.java
index 05d452d48..138f4e01b 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/externals/ExternalEvalGroups.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/externals/ExternalEvalGroups.java
@@ -49,6 +49,14 @@ public interface ExternalEvalGroups {
*/
public EvalGroup makeEvalGroupObject(String evalGroupId);
+ /**
+ * Construct a List of {@link EvalGroup} objects (child sections) based on the unique string id (parent site),
+ * group will have a special type {@link EvalConstants#GROUP_TYPE_INVALID} if data cannot be found
+ *
+ * @param evalGroupId the internal unique ID for an evalGroup
+ * @return a List of {@link EvalGroup} objects (special return if not found)
+ */
+ public List makeEvalGroupObjectsForSectionAwareness( String evalGroupId );
// ENROLLMENTS
@@ -57,18 +65,20 @@ public interface ExternalEvalGroups {
*
* @param evalGroupId the internal unique ID for an evalGroup
* @param permission a permission string constant
+ * @param sectionAware if returning users for one section of a site/group or all sections
* @return a Set of Strings which represent the user Ids of all users in the site with that permission
*/
- public Set getUserIdsForEvalGroup(String evalGroupId, String permission);
+ public Set getUserIdsForEvalGroup(String evalGroupId, String permission, Boolean sectionAware);
/**
* Get a count of all user ids that have a specific permission in a evalGroupId
*
* @param evalGroupId the internal unique ID for an evalGroup
* @param permission a permission string constant
+ * @param sectionAware if returning count of users for one section of a site/group or all sections
* @return a count of the users
*/
- public int countUserIdsForEvalGroup(String evalGroupId, String permission);
+ public int countUserIdsForEvalGroup(String evalGroupId, String permission, Boolean sectionAware);
/**
* Get a list of all eval groups that a user has a specific permission in
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/externals/ExternalHierarchyLogic.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/externals/ExternalHierarchyLogic.java
index e4cf8346c..3b26895d3 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/externals/ExternalHierarchyLogic.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/externals/ExternalHierarchyLogic.java
@@ -18,6 +18,7 @@
import java.util.List;
import java.util.Set;
+import org.sakaiproject.coursemanagement.api.Section;
import org.sakaiproject.evaluation.logic.model.EvalHierarchyNode;
import org.sakaiproject.evaluation.providers.EvalHierarchyProvider;
@@ -26,9 +27,37 @@
* This brings in the hierarchy information and gives us the ability to control the
* hierarchy
*
- * @author Aaron Zeckoski (aaron@caret.cam.ac.uk)
+ * @author Aaron Zeckoski (aaron@caret.cam.ac.uk), bjones86 (ExternalHierarchyRules)
*/
-public interface ExternalHierarchyLogic extends EvalHierarchyProvider, ExternalHierarchyPermissions {
+public interface ExternalHierarchyLogic extends EvalHierarchyProvider, ExternalHierarchyPermissions, ExternalHierarchyRules {
+
+ /**
+ * Determine what sections are attached (fall under) the given eval group ID.
+ * The given eval group ID could be a single site, in which case all sections
+ * attached to the site would be returned. The given eval group ID could also
+ * be a single section (/site//section/), in which case
+ * only the single section would be returned.
+ *
+ * @param evalGroupID
+ * @return a list of Section objects that fall under the given eval group ID
+ */
+ public List getSectionsUnderEvalGroup( String evalGroupID );
+
+ /**
+ * Utility method to determine which qualifier was chosen based on the final rule text
+ *
+ * @param ruleText - the final rule text from the DB
+ * @return the qualifier used for the final rule text
+ */
+ public String determineQualifierFromRuleText( String ruleText );
+
+ /**
+ * Utility method to remove the qualifier from the final rule text and return only the raw rule text
+ *
+ * @param ruleText - the final rule text from the DB
+ * @return the raw rule text with qualifier removed
+ */
+ public String removeQualifierFromRuleText( String ruleText );
/**
* Add a new node to a hierarchy
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/externals/ExternalHierarchyRules.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/externals/ExternalHierarchyRules.java
new file mode 100644
index 000000000..e9a09f296
--- /dev/null
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/externals/ExternalHierarchyRules.java
@@ -0,0 +1,94 @@
+/**
+ * Copyright 2005 Sakai Foundation Licensed under the
+ * Educational Community License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License. You may
+ * obtain a copy of the License at
+ *
+ * http://www.osedu.org/licenses/ECL-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an "AS IS"
+ * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.sakaiproject.evaluation.logic.externals;
+
+import java.util.List;
+
+import org.sakaiproject.evaluation.logic.model.HierarchyNodeRule;
+
+/**
+ * This allows for the hierarchy data to contain node rules
+ */
+public interface ExternalHierarchyRules
+{
+ /**
+ * Get all rules for the given node ID
+ *
+ * @param nodeID the ID of the node in question
+ * @return a List of Entry, where the first String in the entry is the rule text, and the second is the option selection
+ */
+ public List getRulesByNodeID( Long nodeID );
+
+ /**
+ * Get a specific rule by the given rule ID
+ *
+ * @param ruleID the ID of the rule to retrieve
+ * @return the HierarchyNodeRule asked for
+ */
+ public HierarchyNodeRule getRuleByID( Long ruleID );
+
+ /**
+ * Get all rules in the DB
+ *
+ * @return a List of HierarchyNodeRule
+ */
+ public List getAllRules();
+
+ /**
+ * Determine if the given rule is already applied to the given node
+ *
+ * @param ruleText - the rule text without qualifier applied
+ * @param qualifierSelection - the qualifier to be applied
+ * @param optionSelection - the option selection (site or section title)
+ * @param nodeID - the node id to check
+ * @return true/false if this rule already exists for the given node
+ */
+ public boolean isRuleAlreadyAssignedToNode( String ruleText, String qualifierSelection, String optionSelection, Long nodeID );
+
+ /**
+ * Assign the rule to the given node
+ *
+ * @param ruleText - the text of the rule
+ * @param qualifier - rule qualifier (is, contains, ends with, starts with)
+ * @param option - the rule option (site or section title)
+ * @param nodeID - the node this rule should be assigned to
+ */
+ public void assignNodeRule( String ruleText, String qualifier, String option, Long nodeID );
+
+ /**
+ * Remove the given rule from the system
+ *
+ * @param ruleID - the ID of the rule to be removed
+ */
+ public void removeNodeRule( Long ruleID );
+
+ /**
+ * Remove all rules for the give node ID.
+ *
+ * @param nodeID the ID of the node to remove all rules for
+ */
+ public void removeAllRulesForNode( Long nodeID );
+
+ /**
+ * Update the give rule for the given node
+ *
+ * @param ruleID - the ID of the rule to be updated
+ * @param ruleText - the new rule text
+ * @param qualifier - the new rule qualifier (is, contains, ends with, starts with)
+ * @param option - the new rule option (site or section title)
+ * @param nodeID - the ID of the node this rule is assigned to
+ */
+ public void updateNodeRule( Long ruleID, String ruleText, String qualifier, String option, Long nodeID );
+}
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/model/EvalHierarchyNode.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/model/EvalHierarchyNode.java
index 1d35ceea8..8886c5045 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/model/EvalHierarchyNode.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/model/EvalHierarchyNode.java
@@ -65,6 +65,9 @@ public EvalHierarchyNode() {}
/**
* Convenience constructor for testing
+ * @param id
+ * @param title
+ * @param description
*/
public EvalHierarchyNode(String id, String title, String description) {
this.id = id;
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/model/EvalScheduledJob.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/model/EvalScheduledJob.java
index 5ae23fef7..3f17fabd9 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/model/EvalScheduledJob.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/model/EvalScheduledJob.java
@@ -56,6 +56,10 @@ public EvalScheduledJob() { }
/**
* Basic constructor used when we know what the context (typically evalId + SEPARATOR + jobType) is
+ * @param uuid
+ * @param date
+ * @param componentId
+ * @param contextId
*/
public EvalScheduledJob(String uuid, Date date, String componentId, String contextId) {
this.uuid = uuid;
@@ -66,6 +70,11 @@ public EvalScheduledJob(String uuid, Date date, String componentId, String conte
/**
* Constructor to use when we know what the evalId is
+ * @param uuid
+ * @param date
+ * @param componentId
+ * @param evaluationId
+ * @param jobType
*/
public EvalScheduledJob(String uuid, Date date, String componentId, Long evaluationId,
String jobType) {
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/model/EvalUser.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/model/EvalUser.java
index 93562d0c8..1efa875af 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/model/EvalUser.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/model/EvalUser.java
@@ -107,6 +107,7 @@ public EvalUser(String userId, String type, String email, String username, Strin
* @param username the login name (eid) for the user or default text "------" if it cannot be found
* @param displayName the user display name or default text "--------" if it cannot be found
* @param sortName the name to use when sorting users or defaults to username if none set
+ * @param displayId
*/
public EvalUser(String userId, String type, String email, String username, String displayName, String sortName, String displayId) {
if (userId == null || "".equals(userId)) {
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/model/HierarchyNodeRule.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/model/HierarchyNodeRule.java
new file mode 100644
index 000000000..3d819fe4f
--- /dev/null
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/logic/model/HierarchyNodeRule.java
@@ -0,0 +1,110 @@
+/**
+ * Copyright 2005 Sakai Foundation Licensed under the
+ * Educational Community License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License. You may
+ * obtain a copy of the License at
+ *
+ * http://www.osedu.org/licenses/ECL-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an "AS IS"
+ * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.sakaiproject.evaluation.logic.model;
+
+import java.io.Serializable;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.sakaiproject.evaluation.model.EvalHierarchyRule;
+
+/**
+ * This represents a single hierarchy rule in the system.
+ */
+public class HierarchyNodeRule implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ private static final Log LOG = LogFactory.getLog( HierarchyNodeRule.class );
+
+ private Long id; // unique identifier
+ private Long nodeID; // the node this rule belongs to
+ private String rule; // the actual rule text (with qualifiers applied)
+ private String option; // the 'option' for the rule (site or section)
+
+ // Default constructor needed for reflection
+ public HierarchyNodeRule() {}
+
+ public HierarchyNodeRule( Long nodeID, String rule, String option )
+ {
+ if( nodeID == null || StringUtils.isBlank( rule ) || StringUtils.isBlank( option ) )
+ {
+ IllegalArgumentException iae = new IllegalArgumentException( "None of the inputs can be null or blank: nodeID=" + nodeID + ", rule=" + rule
+ + ", option=" + option );
+ LOG.warn( iae );
+ throw iae;
+ }
+
+ this.id = null; // Default to null
+ this.nodeID = nodeID;
+ this.rule = rule;
+ this.option = option;
+ }
+
+ public HierarchyNodeRule( EvalHierarchyRule rule )
+ {
+ if( rule == null || StringUtils.isBlank( rule.getRule() ) || StringUtils.isBlank( rule.getOpt() ) )
+ {
+ IllegalArgumentException iae = new IllegalArgumentException( "None of the inputs can be null or blank: EvalHierarchyRule=" + rule );
+ LOG.warn( iae );
+ throw iae;
+ }
+
+ this.id = rule.getId();
+ this.nodeID = rule.getNodeID();
+ this.rule = rule.getRule();
+ this.option = rule.getOpt();
+ }
+
+ // Getters
+ public Long getId() { return id; }
+ public Long getNodeID() { return nodeID; }
+ public String getRule() { return rule; }
+ public String getOption() { return option; }
+
+ // Setters
+ public void setId (Long id) { this.id = id; }
+ public void setNodeID (Long node) { this.nodeID = node; }
+ public void setRule (String rule) { this.rule = rule; }
+ public void setOption (String option) { this.option = option; }
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if( null == obj )
+ {
+ return false;
+ }
+ if( !( obj instanceof HierarchyNodeRule ) )
+ {
+ return false;
+ }
+ else
+ {
+ HierarchyNodeRule castObj = (HierarchyNodeRule) obj;
+ boolean eq = (this.id == null ? castObj.id == null : this.id.equals( castObj.id ))
+ && (this.nodeID == null ? false : this.nodeID.equals( castObj.nodeID ))
+ && (this.rule == null ? false : this.rule.equals( castObj.rule ))
+ && (this.option == null ? false : this.option.equals( castObj.option ));
+ return eq;
+ }
+ }
+
+ @Override
+ public int hashCode()
+ {
+ String hashStr = this.getClass().getName() + ":" + this.id + ":" + this.nodeID + ":" + this.rule + ":" + this.option;
+ return hashStr.hashCode();
+ }
+}
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalAnswer.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalAnswer.java
index d699fa02f..c0dc3cd29 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalAnswer.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalAnswer.java
@@ -99,6 +99,9 @@ public EvalAnswer() {
/**
* Special constructor (not for general use)
+ * @param response
+ * @param templateItem
+ * @param item
*/
public EvalAnswer(EvalResponse response, EvalTemplateItem templateItem, EvalItem item) {
this(response, templateItem, item, null, null, null, null, null, null);
@@ -106,6 +109,12 @@ public EvalAnswer(EvalResponse response, EvalTemplateItem templateItem, EvalItem
/**
* minimal constructor - text
+ * @param response
+ * @param templateItem
+ * @param item
+ * @param associatedId
+ * @param text
+ * @param associatedType
*/
public EvalAnswer(EvalResponse response, EvalTemplateItem templateItem, EvalItem item,
String associatedId, String associatedType, String text) {
@@ -114,6 +123,12 @@ public EvalAnswer(EvalResponse response, EvalTemplateItem templateItem, EvalItem
/**
* minimal constructor - numeric
+ * @param response
+ * @param templateItem
+ * @param item
+ * @param associatedId
+ * @param associatedType
+ * @param numeric
*/
public EvalAnswer(EvalResponse response, EvalTemplateItem templateItem, EvalItem item,
String associatedId, String associatedType, Integer numeric) {
@@ -122,6 +137,15 @@ public EvalAnswer(EvalResponse response, EvalTemplateItem templateItem, EvalItem
/**
* full constructor
+ * @param response
+ * @param templateItem
+ * @param item
+ * @param associatedId
+ * @param associatedType
+ * @param text
+ * @param numeric
+ * @param multiAnswerCode
+ * @param comment
*/
public EvalAnswer(EvalResponse response, EvalTemplateItem templateItem,
EvalItem item, String associatedId, String associatedType, String text,
@@ -215,6 +239,7 @@ public void setAssociatedType(String associatedType) {
* Returns the encoded answers for an MA type item,
* use {@link EvalUtils#decodeMultipleAnswers(String)} to
* decode these answers into the {@link #multipleAnswers} field
+ * @return
*/
public String getMultiAnswerCode() {
return multiAnswerCode;
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalAssignGroup.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalAssignGroup.java
index 913b06b28..c65645273 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalAssignGroup.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalAssignGroup.java
@@ -69,6 +69,10 @@ public EvalAssignGroup() {
/**
* BELOW minimal constructor, need to run this through a default setter method (setDefaults) to
* set the Booleans before saving, setDefaults(EvalEvaluation eval, EvalAssignHierarchy eah)
+ * @param owner
+ * @param evalGroupId
+ * @param evalGroupType
+ * @param evaluation
*/
public EvalAssignGroup(String owner, String evalGroupId, String evalGroupType,
EvalEvaluation evaluation) {
@@ -77,6 +81,13 @@ public EvalAssignGroup(String owner, String evalGroupId, String evalGroupType,
/**
* REQUIRED constructor
+ * @param owner
+ * @param evalGroupId
+ * @param evalGroupType
+ * @param evaluation
+ * @param instructorApproval
+ * @param instructorsViewResults
+ * @param studentsViewResults
*/
public EvalAssignGroup(String owner, String evalGroupId, String evalGroupType,
EvalEvaluation evaluation, Boolean instructorApproval,
@@ -86,6 +97,15 @@ public EvalAssignGroup(String owner, String evalGroupId, String evalGroupType,
/**
* full constructor
+ * @param owner
+ * @param evalGroupId
+ * @param evalGroupType
+ * @param evaluation
+ * @param instructorApproval
+ * @param instructorsViewResults
+ * @param studentsViewResults
+ * @param nodeId
+ * @param selectionSettings
*/
public EvalAssignGroup(String owner, String evalGroupId, String evalGroupType,
EvalEvaluation evaluation, Boolean instructorApproval,
@@ -171,6 +191,9 @@ public void setSelectionOption(String selectionType, String selectionOption) {
* Reduce code duplication
* Sets the given selection type and option into the given map,
* all params must not be null
+ * @param selectionType
+ * @param selectionOption
+ * @param selections
*/
public static void handleSelectionOption(String selectionType, String selectionOption,
Map selections) {
@@ -208,7 +231,7 @@ public static String encodeSelectionSettings(Map selections) {
/**
* Decodes a selectionSettings code string into a map of selections
- * @param encodedSelections the selectionSettings code string
+ * @param encoded the selectionSettings code string
* @return a map of selection setting constants -> selection option constants (empty map if the input is null)
*/
public static Map decodeSelectionSettings(String encoded) {
@@ -217,9 +240,9 @@ public static Map decodeSelectionSettings(String encoded) {
encoded = encoded.trim();
}
if (encoded == null || "".equals(encoded)) {
- selections = new HashMap(0);
+ selections = new HashMap<>(0);
} else {
- selections = new HashMap();
+ selections = new HashMap<>();
try {
// remove the outer brackets
encoded = encoded.substring(1, encoded.lastIndexOf('}'));
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalAssignHierarchy.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalAssignHierarchy.java
index f5c2402b1..646afae8a 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalAssignHierarchy.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalAssignHierarchy.java
@@ -85,6 +85,9 @@ public EvalAssignHierarchy() {
* BELOW min constructor
* Must use a default setting method to set the Booleans setDefaults(EvalEvaluation eval,
* EvalAssignHierarchy eah)
+ * @param owner
+ * @param nodeId
+ * @param evaluation
*/
public EvalAssignHierarchy(String owner, String nodeId, EvalEvaluation evaluation) {
this(owner, nodeId, evaluation, null, null, null, null, null);
@@ -98,6 +101,15 @@ public EvalAssignHierarchy(String owner, String nodeId, EvalEvaluation evaluatio
/**
* full constructor
+ * @param owner
+ * @param nodeId
+ * @param evaluation
+ * @param instructorApproval
+ * @param instructorsViewResults
+ * @param instructorsViewAllResults
+ * @param studentsViewResults
+ * @param instructorSelection
+ * @param assistantSelection
*/
public EvalAssignHierarchy(String owner, String nodeId, EvalEvaluation evaluation,
Boolean instructorApproval, Boolean instructorsViewResults, Boolean instructorsViewAllResults, Boolean studentsViewResults,
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalConfig.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalConfig.java
index c6d370e04..8f9be23d5 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalConfig.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalConfig.java
@@ -39,7 +39,10 @@ public class EvalConfig implements java.io.Serializable {
public EvalConfig() {
}
- /** full constructor */
+ /** full constructor
+ * @param name
+ * @param value
+ */
public EvalConfig(String name, String value) {
this.lastModified = new Date();
this.name = name;
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalEmailProcessingData.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalEmailProcessingData.java
index 684693e92..60c8dbea2 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalEmailProcessingData.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalEmailProcessingData.java
@@ -140,7 +140,7 @@ public Byte getProcessingStatus() {
return processingStatus;
}
/**
- * @param availableEmailStatus the availableEmailStatus to set
+ * @param processingStatus
*/
public void setProcessingStatus(Byte processingStatus) {
this.processingStatus = processingStatus;
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalEmailTemplate.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalEmailTemplate.java
index 83e5b11ed..1841e6002 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalEmailTemplate.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalEmailTemplate.java
@@ -62,6 +62,10 @@ public EvalEmailTemplate() {
/**
* minimal constructor
+ * @param owner
+ * @param type
+ * @param subject
+ * @param message
*/
public EvalEmailTemplate(String owner, String type, String subject, String message) {
this(owner, type, subject, message, null);
@@ -69,6 +73,11 @@ public EvalEmailTemplate(String owner, String type, String subject, String messa
/**
* full constructor
+ * @param owner
+ * @param message
+ * @param type
+ * @param subject
+ * @param defaultType
*/
public EvalEmailTemplate(String owner, String type, String subject, String message, String defaultType) {
this.lastModified = new Date();
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalEvaluation.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalEvaluation.java
index 0512cd652..97944664c 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalEvaluation.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalEvaluation.java
@@ -174,7 +174,7 @@ public class EvalEvaluation implements java.io.Serializable {
*/
private EvalTemplate template;
- private Set responses = new HashSet(0);
+ private Set responses = new HashSet<>(0);
/**
* Defines the sharing setting for the results of this evaluation, Uses the sharing constants:
@@ -204,7 +204,7 @@ public class EvalEvaluation implements java.io.Serializable {
private Boolean unregisteredAllowed;
- private Boolean availableEmailSent = new Boolean(false);
+ private Boolean availableEmailSent = false;
private Boolean locked;
@@ -231,6 +231,15 @@ public class EvalEvaluation implements java.io.Serializable {
*/
private String autoUseInsertion;
+ /**
+ * Controls whether or not the evaluation will be section aware. If this is set to true,
+ * evaluator's will only evaluate evaluatees that are in their section/roster in the
+ * site/group. Also, when creating the evaluation and releasing to HierarchyNodes, the
+ * creator will see a list of selectable sections that match the node rules, rather than
+ * a list of selectable sites if they elected not to make the evaluation section aware.
+ */
+ private Boolean sectionAwareness;
+
// NON_PERSISTENT
/**
@@ -302,7 +311,9 @@ public class EvalEvaluation implements java.io.Serializable {
public EvalEvaluation() {
}
- /** COPY constructor - this MUST be updated if fields are added to this object **/
+ /** COPY constructor - this MUST be updated if fields are added to this object
+ * @param eval
+ **/
public EvalEvaluation(EvalEvaluation eval) {
// construct evaluation from another one
this.id = eval.id;
@@ -344,6 +355,7 @@ public EvalEvaluation(EvalEvaluation eval) {
this.sendAvailableNotifications = eval.sendAvailableNotifications;
this.autoUseTag = eval.autoUseTag;
this.autoUseInsertion = eval.autoUseInsertion;
+ this.sectionAwareness = eval.sectionAwareness;
// NON_PERSISTENT
this.customStartDate = eval.customStartDate;
this.useDueDate = eval.useDueDate;
@@ -356,6 +368,14 @@ public EvalEvaluation(EvalEvaluation eval) {
/**
* minimal constructor
+ * @param type
+ * @param owner
+ * @param title
+ * @param startDate
+ * @param state
+ * @param resultsSharing
+ * @param reminderDays
+ * @param template
*/
public EvalEvaluation(String type, String owner, String title, Date startDate, String state,
String resultsSharing, Integer reminderDays, EvalTemplate template) {
@@ -364,6 +384,17 @@ public EvalEvaluation(String type, String owner, String title, Date startDate, S
/**
* general use constructor
+ * @param type
+ * @param owner
+ * @param title
+ * @param dueDate
+ * @param startDate
+ * @param stopDate
+ * @param viewDate
+ * @param state
+ * @param resultsSharing
+ * @param reminderDays
+ * @param template
*/
public EvalEvaluation(String type, String owner, String title, Date startDate, Date dueDate,
Date stopDate, Date viewDate, String state, String resultsSharing,
@@ -389,6 +420,36 @@ public EvalEvaluation(String type, String owner, String title, String instructio
/**
* full constructor without email flag
+ * @param type
+ * @param owner
+ * @param title
+ * @param instructions
+ * @param startDate
+ * @param dueDate
+ * @param stopDate
+ * @param viewDate
+ * @param studentViewResults
+ * @param studentsDate
+ * @param instructorViewResults
+ * @param instructorViewAllResults
+ * @param instructorsDate
+ * @param state
+ * @param resultsSharing
+ * @param instructorOpt
+ * @param reminderDays
+ * @param reminderFromEmail
+ * @param termId
+ * @param availableEmailTemplate
+ * @param reminderEmailTemplate
+ * @param template
+ * @param responses
+ * @param blankResponsesAllowed
+ * @param modifyResponsesAllowed
+ * @param unregisteredAllowed
+ * @param locked
+ * @param authControl
+ * @param evalCategory
+ * @param selectionSettings
*/
public EvalEvaluation(String type, String owner, String title, String instructions,
Date startDate, Date dueDate, Date stopDate, Date viewDate, Boolean studentViewResults,
@@ -408,6 +469,37 @@ public EvalEvaluation(String type, String owner, String title, String instructio
/**
* full constructor without all rolls can participate
+ * @param type
+ * @param owner
+ * @param title
+ * @param instructions
+ * @param startDate
+ * @param dueDate
+ * @param stopDate
+ * @param viewDate
+ * @param studentViewResults
+ * @param studentsDate
+ * @param instructorViewResults
+ * @param instructorViewAllResults
+ * @param instructorsDate
+ * @param state
+ * @param resultsSharing
+ * @param instructorOpt
+ * @param reminderDays
+ * @param reminderFromEmail
+ * @param termId
+ * @param availableEmailTemplate
+ * @param reminderEmailTemplate
+ * @param template
+ * @param responses
+ * @param blankResponsesAllowed
+ * @param modifyResponsesAllowed
+ * @param unregisteredAllowed
+ * @param locked
+ * @param authControl
+ * @param evalCategory
+ * @param selectionSettings
+ * @param emailOpenNotification
*/
public EvalEvaluation(String type, String owner, String title, String instructions,
Date startDate, Date dueDate, Date stopDate, Date viewDate, Boolean studentViewResults,
@@ -422,11 +514,95 @@ public EvalEvaluation(String type, String owner, String title, String instructio
this(type, owner, title, instructions, startDate, dueDate, stopDate, viewDate, studentViewResults, studentsDate, instructorViewResults, instructorViewAllResults, instructorsDate, state,
resultsSharing, instructorOpt, reminderDays, reminderFromEmail, termId, availableEmailTemplate, reminderEmailTemplate, template,
responses, blankResponsesAllowed, modifyResponsesAllowed, unregisteredAllowed, Boolean.FALSE ,locked, authControl,
- evalCategory, selectionSettings, Boolean.TRUE);
+ evalCategory, selectionSettings, Boolean.TRUE, Boolean.FALSE);
+ }
+
+ /**
+ * full constructor with sectionAware
+ * @param type
+ * @param owner
+ * @param title
+ * @param instructions
+ * @param startDate
+ * @param dueDate
+ * @param stopDate
+ * @param viewDate
+ * @param studentViewResults
+ * @param studentsDate
+ * @param instructorViewResults
+ * @param instructorViewAllResults
+ * @param instructorsDate
+ * @param state
+ * @param resultsSharing
+ * @param instructorOpt
+ * @param reminderDays
+ * @param reminderFromEmail
+ * @param termId
+ * @param availableEmailTemplate
+ * @param reminderEmailTemplate
+ * @param template
+ * @param responses
+ * @param blankResponsesAllowed
+ * @param modifyResponsesAllowed
+ * @param unregisteredAllowed
+ * @param locked
+ * @param authControl
+ * @param evalCategory
+ * @param selectionSettings
+ * @param emailOpenNotification
+ * @param sectionAwareness
+ */
+ public EvalEvaluation( String type, String owner, String title, String instructions,
+ Date startDate, Date dueDate, Date stopDate, Date viewDate, Boolean studentViewResults,
+ Date studentsDate, Boolean instructorViewResults, Boolean instructorViewAllResults, Date instructorsDate, String state,
+ String resultsSharing, String instructorOpt, Integer reminderDays,
+ String reminderFromEmail, String termId, EvalEmailTemplate availableEmailTemplate,
+ EvalEmailTemplate reminderEmailTemplate, EvalTemplate template,
+ Set responses, Boolean blankResponsesAllowed, Boolean modifyResponsesAllowed,
+ Boolean unregisteredAllowed, Boolean locked, String authControl,
+ String evalCategory, String selectionSettings, Boolean emailOpenNotification, Boolean sectionAwareness )
+ {
+ this( type, owner, title, instructions, startDate, dueDate, stopDate, viewDate, studentViewResults, studentsDate, instructorViewResults, instructorViewAllResults, instructorsDate, state,
+ resultsSharing, instructorOpt, reminderDays, reminderFromEmail, termId, availableEmailTemplate, reminderEmailTemplate, template,
+ responses, blankResponsesAllowed, modifyResponsesAllowed, unregisteredAllowed, Boolean.FALSE ,locked, authControl,
+ evalCategory, selectionSettings, Boolean.TRUE, sectionAwareness );
}
/**
* full constructor
+ * @param type
+ * @param owner
+ * @param title
+ * @param instructions
+ * @param startDate
+ * @param dueDate
+ * @param stopDate
+ * @param viewDate
+ * @param studentViewResults
+ * @param studentsDate
+ * @param instructorViewResults
+ * @param instructorViewAllResults
+ * @param instructorsDate
+ * @param state
+ * @param resultsSharing
+ * @param instructorOpt
+ * @param reminderDays
+ * @param reminderFromEmail
+ * @param termId
+ * @param availableEmailTemplate
+ * @param reminderEmailTemplate
+ * @param template
+ * @param responses
+ * @param blankResponsesAllowed
+ * @param modifyResponsesAllowed
+ * @param unregisteredAllowed
+ * @param allRolesParticipate
+ * @param locked
+ * @param authControl
+ * @param evalCategory
+ * @param selectionSettings
+ * @param emailOpenNotification
+ * @param sectionAwareness
*/
public EvalEvaluation(String type, String owner, String title, String instructions,
Date startDate, Date dueDate, Date stopDate, Date viewDate, Boolean studentViewResults,
@@ -436,7 +612,7 @@ public EvalEvaluation(String type, String owner, String title, String instructio
EvalEmailTemplate reminderEmailTemplate, EvalTemplate template,
Set responses, Boolean blankResponsesAllowed, Boolean modifyResponsesAllowed,
Boolean unregisteredAllowed, Boolean allRolesParticipate, Boolean locked, String authControl,
- String evalCategory, String selectionSettings, Boolean emailOpenNotification) {
+ String evalCategory, String selectionSettings, Boolean emailOpenNotification, Boolean sectionAwareness) {
this.lastModified = new Date();
this.type = type;
@@ -471,6 +647,7 @@ public EvalEvaluation(String type, String owner, String title, String instructio
this.evalCategory = evalCategory;
this.selectionSettings = selectionSettings;
this.sendAvailableNotifications = emailOpenNotification;
+ this.sectionAwareness = sectionAwareness;
}
/**
@@ -609,6 +786,7 @@ public void setSelectionOption(String selectionType, String selectionOption) {
/**
* This will return the current reminder status based on the coded value in the evaluation
+ * @return
*/
public EvalReminderStatus getCurrentReminderStatus() {
EvalReminderStatus rs;
@@ -768,6 +946,7 @@ public int getReminderDaysInt() {
}
/**
+ * @return
* @see #reminderDays
*/
public Integer getReminderDays() {
@@ -775,6 +954,7 @@ public Integer getReminderDays() {
}
/**
+ * @param reminderDays
* @see #reminderDays
*/
public void setReminderDays(Integer reminderDays) {
@@ -1020,5 +1200,19 @@ public void setLocalSelector(String localSelector) {
this.localSelector = localSelector;
}
-}
+ /**
+ * @return the sectionAware
+ */
+ public Boolean getSectionAwareness()
+ {
+ return this.sectionAwareness;
+ }
+ /**
+ * @param sectionAwareness the sectionAware to set
+ */
+ public void setSectionAwareness( Boolean sectionAwareness )
+ {
+ this.sectionAwareness = sectionAwareness;
+ }
+}
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalGroupNodes.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalGroupNodes.java
index a0a0f977d..321bb95eb 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalGroupNodes.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalGroupNodes.java
@@ -41,13 +41,18 @@ public class EvalGroupNodes implements java.io.Serializable {
public EvalGroupNodes() {
}
- /** minimal constructor */
+ /** minimal constructor
+ * @param lastModified
+ * @param nodeId */
public EvalGroupNodes(Date lastModified, String nodeId) {
this.lastModified = lastModified;
this.nodeId = nodeId;
}
- /** full constructor */
+ /** full constructor
+ * @param lastModified
+ * @param nodeId
+ * @param evalGroups */
public EvalGroupNodes(Date lastModified, String nodeId, String[] evalGroups) {
super();
this.lastModified = lastModified;
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalHierarchyRule.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalHierarchyRule.java
new file mode 100644
index 000000000..20b2e9492
--- /dev/null
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalHierarchyRule.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2005 Sakai Foundation Licensed under the
+ * Educational Community License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License. You may
+ * obtain a copy of the License at
+ *
+ * http://www.osedu.org/licenses/ECL-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an "AS IS"
+ * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.sakaiproject.evaluation.model;
+
+import java.io.Serializable;
+
+public class EvalHierarchyRule implements Serializable
+{
+ protected Long id;
+ protected Long nodeID;
+ protected String rule;
+ protected String opt;
+
+ // Default constructor
+ public EvalHierarchyRule() {};
+
+ // Parameterized constructor
+ public EvalHierarchyRule( Long nodeID, String rule, String opt )
+ {
+ this.nodeID = nodeID;
+ this.rule = rule;
+ this.opt = opt;
+ }
+
+ // Getters
+ public Long getId() { return this.id; }
+ public Long getNodeID() { return this.nodeID; }
+ public String getRule() { return this.rule; }
+ public String getOpt() { return this.opt; }
+
+ // Setters
+ public void setId ( Long id ) { this.id = id; }
+ public void setNodeID ( Long node ) { this.nodeID = node; }
+ public void setRule ( String rule ) { this.rule = rule; }
+ public void setOpt ( String opt ) { this.opt = opt; }
+}
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalItem.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalItem.java
index f68b60a3c..367a58228 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalItem.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalItem.java
@@ -52,7 +52,7 @@ public class EvalItem implements java.io.Serializable {
private EvalScale scale;
- private Set templateItems = new HashSet(0);
+ private Set templateItems = new HashSet<>(0);
/**
* display hint
@@ -117,12 +117,37 @@ public class EvalItem implements java.io.Serializable {
public EvalItem() {
}
- /** minimal constructor */
+ /**
+ * minimal constructor
+ * @param owner
+ * @param itemText
+ * @param sharing
+ * @param classification
+ * @param expert
+ */
public EvalItem(String owner, String itemText, String sharing, String classification, Boolean expert) {
this(owner, itemText, null, sharing, classification, expert, null, null, null, null, null, false, null, null, null, null);
}
- /** full constructor */
+ /**
+ * full constructor
+ * @param owner
+ * @param itemText
+ * @param description
+ * @param sharing
+ * @param classification
+ * @param expert
+ * @param expertDescription
+ * @param scale
+ * @param templateItems
+ * @param usesNA
+ * @param usesComment
+ * @param compulsory
+ * @param displayRows
+ * @param scaleDisplaySetting
+ * @param category
+ * @param locked
+ */
public EvalItem(String owner, String itemText, String description, String sharing, String classification,
Boolean expert, String expertDescription, EvalScale scale, Set templateItems,
Boolean usesNA, Boolean usesComment, Boolean compulsory,
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalItemGroup.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalItemGroup.java
index 7ed82c19b..7d98bec25 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalItemGroup.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalItemGroup.java
@@ -45,7 +45,7 @@ public class EvalItemGroup implements java.io.Serializable {
private EvalItemGroup parent;
- private Set groupItems = new HashSet(0);
+ private Set groupItems = new HashSet<>(0);
// Constructors
@@ -53,12 +53,24 @@ public class EvalItemGroup implements java.io.Serializable {
public EvalItemGroup() {
}
- /** minimal constructor */
+ /** minimal constructor
+ * @param owner
+ * @param type
+ * @param title */
public EvalItemGroup(String owner, String type, String title) {
this(owner, type, title, null, Boolean.FALSE, null, null);
}
- /** full constructor */
+ /**
+ * full constructor
+ * @param owner
+ * @param type
+ * @param title
+ * @param description
+ * @param expert
+ * @param parent
+ * @param groupItems
+ */
public EvalItemGroup(String owner, String type, String title, String description, Boolean expert,
EvalItemGroup parent, Set groupItems) {
this.lastModified = new Date();
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalLock.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalLock.java
index 0d1b78af5..dc64d689c 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalLock.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalLock.java
@@ -44,7 +44,9 @@ public class EvalLock implements java.io.Serializable {
public EvalLock() {
}
- /** full constructor */
+ /** full constructor
+ * @param name
+ * @param holder */
public EvalLock(String name, String holder) {
this.lastModified = new Date();
this.name = name;
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalResponse.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalResponse.java
index ae07d9953..842232a81 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalResponse.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalResponse.java
@@ -46,7 +46,7 @@ public class EvalResponse implements java.io.Serializable {
private Date endTime;
- private Set answers = new HashSet(0);
+ private Set answers = new HashSet<>(0);
private EvalEvaluation evaluation;
@@ -89,12 +89,26 @@ public class EvalResponse implements java.io.Serializable {
public EvalResponse() {
}
- /** minimal constructor */
+ /**
+ * minimal constructor
+ * @param owner
+ * @param evalGroupId
+ * @param evaluation
+ * @param startTime
+ */
public EvalResponse(String owner, String evalGroupId, EvalEvaluation evaluation, Date startTime) {
this(owner, evalGroupId, evaluation, startTime, null, null);
}
- /** full constructor */
+ /**
+ * full constructor
+ * @param owner
+ * @param evalGroupId
+ * @param evaluation
+ * @param startTime
+ * @param endTime
+ * @param answers
+ */
public EvalResponse(String owner, String evalGroupId, EvalEvaluation evaluation, Date startTime, Date endTime,
Set answers) {
this.lastModified = new Date();
@@ -171,7 +185,7 @@ public static String encodeSelections(Map selections) {
/**
* Decodes a selections code string into a map of selections
- * @param encodedSelections the selections code string
+ * @param encoded the selections code string
* @return a map of selection item category constants -> selection ids (empty map if the input is null)
*/
public static Map decodeSelections(String encoded) {
@@ -180,9 +194,9 @@ public static Map decodeSelections(String encoded) {
encoded = encoded.trim();
}
if (encoded == null || "".equals(encoded)) {
- selections = new HashMap(0);
+ selections = new HashMap<>(0);
} else {
- selections = new HashMap();
+ selections = new HashMap<>();
try {
// remove the outer brackets
encoded = encoded.substring(1, encoded.lastIndexOf('}'));
@@ -224,6 +238,7 @@ public Date getEndTime() {
*
Once an evaluation is submitted, it will be included in the metrics reporting. In the
* scenario where the user cannot modify responses but can save without submitting, this variable
* will keep track of whether the evaluation has been submitted yet.
+ * @return
* @returns true if this response has been submitted before or false if only saved.
*/
public boolean isSubmitted() {
@@ -245,11 +260,7 @@ public void isSubmitted(boolean submitted) {
}
public void setEndTime(Date endTime) {
- if (endTime == null) {
- complete = false;
- } else {
- complete = true;
- }
+ complete = endTime != null;
this.endTime = endTime;
}
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalScale.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalScale.java
index a5c982e47..b01154acc 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalScale.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalScale.java
@@ -77,12 +77,30 @@ public class EvalScale implements java.io.Serializable {
public EvalScale() {
}
- /** minimal constructor */
+ /**
+ * minimal constructor
+ * @param owner
+ * @param title
+ * @param mode
+ * @param sharing
+ * @param expert
+ */
public EvalScale(String owner, String title, String mode, String sharing, Boolean expert) {
this(owner, title, mode, sharing, expert, null, null, null, Boolean.FALSE);
}
- /** full constructor */
+ /**
+ * full constructor
+ * @param owner
+ * @param title
+ * @param mode
+ * @param sharing
+ * @param expert
+ * @param expertDescription
+ * @param ideal
+ * @param options
+ * @param locked
+ */
public EvalScale(String owner, String title, String mode, String sharing, Boolean expert, String expertDescription,
String ideal, String[] options, Boolean locked) {
this.lastModified = new Date();
@@ -194,6 +212,7 @@ public Long getCopyOf() {
* Indicates that this is a copy of an item and therefore should be hidden from views and
* only revealed when taking/previewing (not as part of item banks, etc.),
* this will be the id of the persistent object it is a copy of
+ * @param copyOf
*/
public void setCopyOf(Long copyOf) {
this.copyOf = copyOf;
@@ -207,6 +226,7 @@ public String getMode() {
* Should match the constants:
* {@link EvalConstants#SCALE_MODE_ADHOC} for scales used in MA/MC items
* {@link EvalConstants#SCALE_MODE_SCALE} for reusable scales for scaled items
+ * @param mode
*/
public void setMode(String mode) {
this.mode = mode;
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalTemplate.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalTemplate.java
index 1d0bb8e2b..6b3ba95f3 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalTemplate.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalTemplate.java
@@ -51,7 +51,7 @@ public class EvalTemplate implements java.io.Serializable {
private String expertDescription;
- private Set templateItems = new HashSet(0);
+ private Set templateItems = new HashSet<>(0);
private Boolean locked;
@@ -80,13 +80,31 @@ public class EvalTemplate implements java.io.Serializable {
public EvalTemplate() {
}
- /** minimal constructor */
+ /**
+ * minimal constructor
+ * @param owner
+ * @param type
+ * @param title
+ * @param sharing
+ * @param expert
+ */
public EvalTemplate(String owner, String type, String title, String sharing, Boolean expert) {
this(owner, type, title, title, sharing, expert, null, null, null, false);
}
- /** full constructor
- **/
+ /**
+ * full constructor
+ * @param owner
+ * @param type
+ * @param title
+ * @param description
+ * @param sharing
+ * @param expert
+ * @param expertDescription
+ * @param templateItems
+ * @param locked
+ * @param hidden
+ */
public EvalTemplate(String owner, String type, String title, String description, String sharing,
Boolean expert, String expertDescription, Set templateItems, Boolean locked,
boolean hidden) {
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalTemplateItem.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalTemplateItem.java
index e71e5e9f0..9b555351a 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalTemplateItem.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/model/EvalTemplateItem.java
@@ -115,7 +115,16 @@ public class EvalTemplateItem implements java.io.Serializable {
public EvalTemplateItem() {
}
- /** minimal constructor */
+ /**
+ * minimal constructor
+ * @param owner
+ * @param template
+ * @param item
+ * @param displayOrder
+ * @param category
+ * @param hierarchyLevel
+ * @param hierarchyNodeId
+ */
public EvalTemplateItem(String owner, EvalTemplate template, EvalItem item, Integer displayOrder,
String category, String hierarchyLevel,
String hierarchyNodeId) {
@@ -123,7 +132,24 @@ public EvalTemplateItem(String owner, EvalTemplate template, EvalItem item, Inte
null, null, null, null, null, null, null);
}
- /** full constructor */
+ /**
+ * full constructor
+ * @param owner
+ * @param template
+ * @param item
+ * @param displayOrder
+ * @param category
+ * @param hierarchyLevel
+ * @param hierarchyNodeId
+ * @param displayRows
+ * @param scaleDisplaySetting
+ * @param usesNA
+ * @param usesComment
+ * @param compulsory
+ * @param blockParent
+ * @param blockId
+ * @param resultsSharing
+ */
public EvalTemplateItem(String owner, EvalTemplate template, EvalItem item, Integer displayOrder,
String category, String hierarchyLevel,
String hierarchyNodeId, Integer displayRows, String scaleDisplaySetting, Boolean usesNA, Boolean usesComment,
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/toolaccess/EvaluationAccessAPI.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/toolaccess/EvaluationAccessAPI.java
index 2b2ec93e2..ba095c58c 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/toolaccess/EvaluationAccessAPI.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/toolaccess/EvaluationAccessAPI.java
@@ -16,9 +16,7 @@
package org.sakaiproject.evaluation.toolaccess;
import java.io.OutputStream;
-import java.util.List;
-import org.sakaiproject.entity.api.HttpAccess;
import org.sakaiproject.evaluation.model.EvalEvaluation;
public interface EvaluationAccessAPI {
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/ArrayUtils.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/ArrayUtils.java
index 417389a89..561cffe22 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/ArrayUtils.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/ArrayUtils.java
@@ -15,6 +15,7 @@
package org.sakaiproject.evaluation.utils;
import java.lang.reflect.Array;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
@@ -35,7 +36,7 @@ public class ArrayUtils {
* @return the original list with the duplicate objects removed
*/
public static List removeDuplicates(List list) {
- Set s = new HashSet();
+ Set s = new HashSet<>();
for (Iterator iter = list.iterator(); iter.hasNext();) {
T element = (T) iter.next();
if (! s.add(element)) {
@@ -57,12 +58,9 @@ public static T[] unique(T[] array) {
if (array == null || array.length == 0) {
return array;
}
- LinkedHashSet s = new LinkedHashSet(array.length);
+ LinkedHashSet s = new LinkedHashSet<>(array.length);
Class> type = array.getClass().getComponentType();
- for (int i = 0; i < array.length; i++) {
- T element = array[i];
- s.add(element);
- }
+ s.addAll( Arrays.asList( array ) );
T[] newArray;
if (s.size() == array.length) {
newArray = array;
@@ -103,8 +101,10 @@ public static T[] copy(T[] array) {
public static boolean contains(T[] array, T value) {
boolean foundValue = false;
if (value != null) {
- for (int i = 0; i < array.length; i++) {
- if (value.equals(array[i])) {
+ for( T array1 : array )
+ {
+ if( value.equals( array1 ) )
+ {
foundValue = true;
break;
}
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/ComparatorsUtils.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/ComparatorsUtils.java
index 23aed305f..5d0057581 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/ComparatorsUtils.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/ComparatorsUtils.java
@@ -35,7 +35,7 @@ public class ComparatorsUtils {
public static class EvaluationDueDateComparator implements Comparator, Serializable {
static private final long serialVersionUID = 31L;
public int compare(EvalEvaluation eval0, EvalEvaluation eval1) {
- int comparison = 0;
+ int comparison;
if (eval0.getDueDate() != null && eval1.getDueDate() != null) {
comparison = eval0.getDueDate().compareTo(eval1.getDueDate());
} else {
@@ -54,7 +54,7 @@ public int compare(EvalEvaluation eval0, EvalEvaluation eval1) {
public static class EvaluationDateTitleIdComparator implements Comparator, Serializable {
static private final long serialVersionUID = 31L;
public int compare(EvalEvaluation eval0, EvalEvaluation eval1) {
- int comparison = 0;
+ int comparison;
if (eval0.getDueDate() != null && eval1.getDueDate() != null) {
comparison = eval0.getDueDate().compareTo(eval1.getDueDate());
} else {
@@ -76,7 +76,7 @@ public int compare(EvalEvaluation eval0, EvalEvaluation eval1) {
public static class TemplateItemComparatorByOrder implements Comparator, Serializable {
static private final long serialVersionUID = 31L;
public int compare(EvalTemplateItem eti0, EvalTemplateItem eti1) {
- int comparison = 0;
+ int comparison;
comparison = eti0.getDisplayOrder().compareTo( eti1.getDisplayOrder() );
if (comparison == 0
&& eti0.getId() != null && eti1.getId() != null) {
@@ -112,7 +112,7 @@ public int compare(EvalItem item0, EvalItem item1) {
public static class ItemGroupComparatorByTitle implements Comparator, Serializable {
static private final long serialVersionUID = 31L;
public int compare(EvalItemGroup ig0, EvalItemGroup ig1) {
- int comparison = 0;
+ int comparison;
comparison = ig0.getTitle().compareTo( ig1.getTitle() );
if (comparison == 0) {
comparison = ig0.getId().compareTo(ig1.getId());
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/EvalUtils.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/EvalUtils.java
index 4f898ec7b..b83536bac 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/EvalUtils.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/EvalUtils.java
@@ -22,7 +22,6 @@
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
@@ -51,12 +50,12 @@
*/
public class EvalUtils {
- private static Log log = LogFactory.getLog(EvalUtils.class);
+ private static final Log LOG = LogFactory.getLog(EvalUtils.class);
private static HashMap stateNumbers;
static {
- stateNumbers = new HashMap();
+ stateNumbers = new HashMap<>();
for (int i = 0; i < EvalConstants.STATE_ORDER.length; i++) {
stateNumbers.put(EvalConstants.STATE_ORDER[i], i);
}
@@ -212,6 +211,7 @@ public static boolean validateStateConstant(String stateConstant) {
* Checks if a sharing constant is valid or null
*
* @param sharingConstant a sharing constant from EvalConstants.SHARING_*
+ * @return
* @throws IllegalArgumentException is the constant is null or does not match the set
*/
public static boolean validateSharingConstant(String sharingConstant) {
@@ -232,6 +232,7 @@ public static boolean validateSharingConstant(String sharingConstant) {
* Checks if an email include constant is valid or null
*
* @param includeConstant an email include constant from EvalConstants.EMAIL_INCLUDE_*
+ * @return
* @throws IllegalArgumentException is the constant is null or does not match the set
*/
public static boolean validateEmailIncludeConstant(String includeConstant) {
@@ -274,7 +275,7 @@ public static Date updateDueStopDates(EvalEvaluation eval, int minHoursLong) {
// Update due date
Date newDueDate = new Date( eval.getStartDate().getTime() + (1000l * 60l * 60l * (long)minHoursLong) );
- log.info("Fixing eval (" + eval.getId() + ") due date from " + eval.getDueDate() + " to " + newDueDate);
+ LOG.info("Fixing eval (" + eval.getId() + ") due date from " + eval.getDueDate() + " to " + newDueDate);
eval.setDueDate(newDueDate);
// Update stop date if needed
@@ -289,7 +290,7 @@ public static Date updateDueStopDates(EvalEvaluation eval, int minHoursLong) {
if (eval.getViewDate().equals(eval.getStopDate()) ||
eval.getViewDate().before(eval.getStopDate()) ) {
Date newView = new Date( eval.getStopDate().getTime() + 5000 );
- log.info("Fixing the view date from " + eval.getViewDate() + " to " + newView);
+ LOG.info("Fixing the view date from " + eval.getViewDate() + " to " + newView);
eval.setViewDate(newView);
}
}
@@ -314,7 +315,7 @@ public static Date getEndOfDayDate(Date d) {
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
if (!cal.getTime().equals(d)) {
- log.info("Setting a date to the end of the day from " + d + " to " + cal.getTime());
+ LOG.info("Setting a date to the end of the day from " + d + " to " + cal.getTime());
}
return cal.getTime();
}
@@ -329,10 +330,7 @@ public static Date getEndOfDayDate(Date d) {
public static boolean isTimeMidnight(Date d) {
Calendar cal = new GregorianCalendar();
cal.setTime(d);
- if (cal.get(Calendar.HOUR_OF_DAY) == 0 && cal.get(Calendar.MINUTE) == 0 && cal.get(Calendar.SECOND) == 0) {
- return true;
- }
- return false;
+ return cal.get(Calendar.HOUR_OF_DAY) == 0 && cal.get(Calendar.MINUTE) == 0 && cal.get(Calendar.SECOND) == 0;
}
/**
@@ -352,6 +350,7 @@ public static int getHoursDifference(Date date1, Date date2) {
/**
* Creates a unique title for an adhoc scale
+ * @param maxLength
* @return a unique scale title
*/
public static String makeUniqueIdentifier(int maxLength) {
@@ -451,17 +450,17 @@ public static String cleanupHtmlPtags(String cleanup) {
* @return a hashmap of answers, where key = templateItemId + answer.associatedType + answer.associatedId
*/
public static Map getAnswersMapByTempItemAndAssociated(EvalResponse response) {
- Map map = new HashMap();
+ Map map = new HashMap<>();
Set answers = response.getAnswers();
- for (Iterator it = answers.iterator(); it.hasNext();) {
- EvalAnswer answer = it.next();
+ for( EvalAnswer answer : answers )
+ {
// decode the stored answers into the int array
answer.multipleAnswers = EvalUtils.decodeMultipleAnswers(answer.getMultiAnswerCode());
// decode the NA value
decodeAnswerNA(answer);
// place the answers into a map which uses the TI, assocType, and assocId as a key
- String key = TemplateItemUtils.makeTemplateItemAnswerKey(answer.getTemplateItem().getId(),
- answer.getAssociatedType(), answer.getAssociatedId());
+ String key = TemplateItemUtils.makeTemplateItemAnswerKey(answer.getTemplateItem().getId(),
+ answer.getAssociatedType(), answer.getAssociatedId());
map.put(key, answer);
}
return map;
@@ -483,9 +482,10 @@ public static String encodeMultipleAnswers(Integer[] answerKeys) {
if (answerKeys != null && answerKeys.length > 0) {
Arrays.sort(answerKeys); // sort the keys first
StringBuilder sb = new StringBuilder();
- for (int i = 0; i < answerKeys.length; i++) {
+ for( Integer answerKey : answerKeys )
+ {
sb.append(SEPARATOR);
- sb.append(answerKeys[i]);
+ sb.append( answerKey );
}
sb.append(SEPARATOR);
encoded = sb.toString();
@@ -515,7 +515,7 @@ public static Integer[] decodeMultipleAnswers(String encodedAnswers) {
if ("".equals(split[i])) {
throw new IllegalArgumentException("This encoded string ("+encodedAnswers+") is invalid, it must have integers in it, example: :0:3:4:");
}
- decoded[i-1] = Integer.valueOf(split[i]).intValue();
+ decoded[i-1] = Integer.valueOf(split[i]);
}
Arrays.sort(decoded); // make sure it is sorted before returning the array
}
@@ -564,12 +564,7 @@ public static boolean decodeAnswerNA(EvalAnswer answer) {
if (answer == null) {
throw new IllegalArgumentException("answer cannot be null");
}
- boolean notApplicable = false;
- if (EvalConstants.NA_VALUE.equals(answer.getNumeric()) ) {
- notApplicable = true;
- } else {
- notApplicable = false;
- }
+ boolean notApplicable = EvalConstants.NA_VALUE.equals(answer.getNumeric());
answer.NA = notApplicable;
return notApplicable;
}
@@ -586,7 +581,7 @@ public static boolean decodeAnswerNA(EvalAnswer answer) {
* @return Human readable string with participant response rate.
*/
public static String makeResponseRateStringFromCounts(int responsesCount, int enrollmentsCount) {
- String returnString = null;
+ String returnString;
if (enrollmentsCount > 0) {
long percentage = Math.round( (((float)responsesCount) / (float)enrollmentsCount) * 100.0 );
returnString = percentage + "% ( " + responsesCount + " / " + enrollmentsCount + " )";
@@ -624,10 +619,10 @@ public static boolean isBlank(String value) {
public static List sortClosedEvalsToEnd(Collection evaluations) {
List l;
if (evaluations == null || evaluations.isEmpty()) {
- l = new ArrayList(0);
+ l = new ArrayList<>(0);
} else {
- l = new ArrayList(evaluations.size());
- ArrayList closedEvals = new ArrayList(evaluations.size());
+ l = new ArrayList<>(evaluations.size());
+ ArrayList closedEvals = new ArrayList<>(evaluations.size());
for (EvalEvaluation eval : evaluations) {
if (EvalUtils.checkStateBefore(eval.getState(), EvalConstants.EVALUATION_STATE_CLOSED, false)) {
l.add(eval);
@@ -650,7 +645,7 @@ public static List sortClosedEvalsToEnd(Collection evalGroups, List assignGroups) {
- List groups = new ArrayList();
+ List groups = new ArrayList<>();
for (int i=0; i evalGroups, List getUserIdsFromUserAssignments(Collection userAssignments) {
Set s;
if (userAssignments == null) {
- s = new HashSet(0);
+ s = new HashSet<>(0);
} else {
- s = new LinkedHashSet(userAssignments.size()); // maintain order
+ s = new LinkedHashSet<>(userAssignments.size()); // maintain order
for (EvalAssignUser evalAssignUser : userAssignments) {
if (evalAssignUser.getUserId() != null) {
s.add(evalAssignUser.getUserId());
@@ -696,9 +691,9 @@ public static Set getUserIdsFromUserAssignments(Collection getGroupIdsFromUserAssignments(Collection userAssignments) {
Set s;
if (userAssignments == null) {
- s = new HashSet(0);
+ s = new HashSet<>(0);
} else {
- s = new LinkedHashSet(userAssignments.size()); // maintain order
+ s = new LinkedHashSet<>(userAssignments.size()); // maintain order
for (EvalAssignUser evalAssignUser : userAssignments) {
if (evalAssignUser.getEvalGroupId() != null) {
s.add(evalAssignUser.getEvalGroupId());
@@ -716,7 +711,7 @@ public static Set getGroupIdsFromUserAssignments(Collection getEvalIdsFromEvaluations(Collection evaluations) {
- List l = new ArrayList();
+ List l = new ArrayList<>();
if (evaluations != null) {
for (EvalEvaluation eval : evaluations) {
if (eval.getId() != null) {
@@ -735,7 +730,7 @@ public static List getEvalIdsFromEvaluations(Collection ev
* @return the list of evalGroup Ids
*/
public static List getGroupIdsFromGroups(Collection groups) {
- List l = new ArrayList();
+ List l = new ArrayList<>();
if (groups != null) {
for (EvalGroup evalGroup : groups) {
l.add(evalGroup.evalGroupId);
@@ -752,7 +747,7 @@ public static List getGroupIdsFromGroups(Collection groups) {
* @return the list of EvalGroup objects for the given collection of evalGroupIds
*/
public static List makeGroupsFromGroupsIds(Collection evalGroupIds, EvalCommonLogic commonLogic) {
- List l = new ArrayList();
+ List l = new ArrayList<>();
if (evalGroupIds != null && evalGroupIds.size() > 0) {
for (String evalGroupId : evalGroupIds) {
EvalGroup group = commonLogic.makeEvalGroupObject(evalGroupId);
@@ -808,7 +803,7 @@ public static String getSelectionSetting(String selectionTypeConstant, EvalAssig
public static boolean safeBool(Boolean bool) {
boolean result = false;
if (bool != null) {
- result = bool.booleanValue();
+ result = bool;
}
return result;
}
@@ -821,7 +816,7 @@ public static boolean safeBool(Boolean bool) {
public static boolean safeBool(Boolean bool, boolean defaultIfNull) {
boolean result = defaultIfNull;
if (bool != null) {
- result = bool.booleanValue();
+ result = bool;
}
return result;
}
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/SettingsLogicUtils.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/SettingsLogicUtils.java
index d406ee00a..55dbb16f7 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/SettingsLogicUtils.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/SettingsLogicUtils.java
@@ -91,7 +91,7 @@ private static String checkString(String constant) {
/**
* A utility method to get a formatted String from a Date
- * @param the Date to be formated
+ * @param date the Date to be formated
* @return the String representation of the Date
*/
public static String getStringFromDate(Date date) {
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/TemplateItemDataList.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/TemplateItemDataList.java
index d3f49379a..bdf428ddb 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/TemplateItemDataList.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/TemplateItemDataList.java
@@ -233,11 +233,11 @@ public TemplateItemDataList(Long evaluationId, String evalGroupId,
List evalTemplateItems = authoringService.getTemplateItemsForEvaluation(evaluationId, hierarchyNodeIDs,
instructorIdsArray, new String[] {evalGroupId});
- Map> evalAssociates = new HashMap>();
- evalAssociates.put(EvalConstants.ITEM_CATEGORY_INSTRUCTOR, new ArrayList(instructorIds));
+ Map> evalAssociates = new HashMap<>();
+ evalAssociates.put(EvalConstants.ITEM_CATEGORY_INSTRUCTOR, new ArrayList<>(instructorIds));
// add in the assistants list if there are any
if (assistantIds.size() > 0) {
- evalAssociates.put(EvalConstants.ITEM_CATEGORY_ASSISTANT, new ArrayList(assistantIds));
+ evalAssociates.put(EvalConstants.ITEM_CATEGORY_ASSISTANT, new ArrayList<>(assistantIds));
}
List evalAnswers = null;
@@ -291,11 +291,11 @@ public TemplateItemDataList(Long evaluationId, String[] evalGroupIds,
evalHierarchyNodes = makeEvalNodesList(evalTemplateItems, hierarchyLogic);
}
- Map> evalAssociates = new HashMap>();
- evalAssociates.put(EvalConstants.ITEM_CATEGORY_INSTRUCTOR, new ArrayList(instructorIds));
+ Map> evalAssociates = new HashMap<>();
+ evalAssociates.put(EvalConstants.ITEM_CATEGORY_INSTRUCTOR, new ArrayList<>(instructorIds));
// add in the assistants list if there are any
if (assistantIds.size() > 0) {
- evalAssociates.put(EvalConstants.ITEM_CATEGORY_ASSISTANT, new ArrayList(assistantIds));
+ evalAssociates.put(EvalConstants.ITEM_CATEGORY_ASSISTANT, new ArrayList<>(assistantIds));
}
construct(evalTemplateItems, evalHierarchyNodes, evalAssociates, evalAnswers);
@@ -311,7 +311,7 @@ public TemplateItemDataList(Long evaluationId, String[] evalGroupIds,
private void construct(List allTemplateItems,
List hierarchyNodes, Map> associates,
List answers) {
- if (allTemplateItems == null || allTemplateItems.size() == 0) {
+ if (allTemplateItems == null || allTemplateItems.isEmpty()) {
throw new IllegalArgumentException("You must supply a non-null list of at least one template item to use this structure");
}
@@ -320,18 +320,18 @@ private void construct(List allTemplateItems,
if (hierarchyNodes != null) {
this.hierarchyNodes = hierarchyNodes;
} else {
- this.hierarchyNodes = new ArrayList();
+ this.hierarchyNodes = new ArrayList<>();
}
if (associates != null) {
this.associates = associates;
} else {
- this.associates = new HashMap>();
+ this.associates = new HashMap<>();
}
// ensure there is at least the default course category
if (! this.associates.containsKey(EvalConstants.ITEM_CATEGORY_COURSE)) {
- List courses = new ArrayList();
+ List courses = new ArrayList<>();
courses.add(null);
this.associates.put(EvalConstants.ITEM_CATEGORY_COURSE, courses);
}
@@ -339,7 +339,7 @@ private void construct(List allTemplateItems,
if (answers != null) {
this.answers = answers;
} else {
- this.answers = new ArrayList();
+ this.answers = new ArrayList<>();
}
buildDataStructure();
@@ -359,7 +359,7 @@ public int getNonChildItemsCount() {
return nonChildItemsCount;
}
- private List associateTypes = new ArrayList();
+ private List associateTypes = new ArrayList<>();
/**
* @return the correctly ordered list of all associate types for these template items
*/
@@ -384,8 +384,8 @@ public int getTemplateItemGroupsCount() {
* @see #associates map for more information about the possible returns
*/
public Set getAssociateIds(String associateType) {
- Set ids = new HashSet();
- Set sortedIds = new HashSet();
+ Set ids = new HashSet<>();
+ Set sortedIds = new HashSet<>();
if (this.associates.containsKey(associateType)) {
ids.addAll( this.associates.get(associateType) );
}
@@ -408,14 +408,14 @@ public Set getAssociateIds(String associateType) {
*/
public Map> getAutoInsertedItems() {
if (autoInsertMap == null) {
- autoInsertMap = new HashMap>();
+ autoInsertMap = new HashMap<>();
for (EvalTemplateItem templateItem : this.allTemplateItems) {
String autoUseTag = templateItem.getAutoUseInsertionTag();
if (autoUseTag != null) {
if (autoInsertMap.containsKey(autoUseTag)) {
autoInsertMap.get(autoUseTag).add(templateItem);
} else {
- List autoUseItems = new ArrayList();
+ List autoUseItems = new ArrayList<>();
autoUseItems.add(templateItem);
autoInsertMap.put(autoUseTag, autoUseItems);
}
@@ -445,13 +445,14 @@ public int countAutoInsertedItems() {
* @param includeHNG if not null, then only return wrapped items from this {@link HierarchyNodeGroup}
* @param includeBlockChildren if true then block children will be included in the flat list,
* otherwise they are only included in the {@link DataTemplateItem#blockChildItems} list
+ * @return
*/
protected List buildFlatDataList(TemplateItemGroup includeTIG, HierarchyNodeGroup includeHNG, boolean includeBlockChildren) {
if (templateItemGroups == null) {
buildDataStructure();
}
- List dataTemplateItems = new ArrayList();
+ List dataTemplateItems = new ArrayList<>();
// loop through and build the flattened list
for (int i = 0; i < templateItemGroups.size(); i++) {
TemplateItemGroup tig = templateItemGroups.get(i);
@@ -504,17 +505,19 @@ protected void buildDataStructure() {
buildAnswerMaps();
- templateItemGroups = new ArrayList();
+ templateItemGroups = new ArrayList<>();
if (allTemplateItems.size() > 0) {
// filter out the block child items, to get a list of non-child items
List nonChildItemsList = TemplateItemUtils.getNonChildItems(this.allTemplateItems);
nonChildItemsCount = nonChildItemsList.size();
// turn the map keys into a properly sorted list of types
- this.associateTypes = new ArrayList();
- for (int i = 0; i < EvalConstants.ITEM_CATEGORY_ORDER.length; i++) {
- if (associates.containsKey(EvalConstants.ITEM_CATEGORY_ORDER[i])) {
- associateTypes.add(EvalConstants.ITEM_CATEGORY_ORDER[i]);
+ this.associateTypes = new ArrayList<>();
+ for( String ITEM_CATEGORY_ORDER : EvalConstants.ITEM_CATEGORY_ORDER )
+ {
+ if( associates.containsKey( ITEM_CATEGORY_ORDER ) )
+ {
+ associateTypes.add( ITEM_CATEGORY_ORDER );
}
}
@@ -525,19 +528,19 @@ protected void buildDataStructure() {
List categoryNonChildItemsList = TemplateItemUtils.getCategoryTemplateItems(associateType, nonChildItemsList);
if (categoryNonChildItemsList.size() > 0) {
// apply listing ordering
- Set sortedAssociateIds = new HashSet();
+ Set sortedAssociateIds = new HashSet<>();
if( EvalConstants.ITEM_CATEGORY_INSTRUCTOR.equals(associateType) ){
sortedAssociateIds = getSortedUserIdsFromUsers( associateIds, EvalAssignUser.TYPE_EVALUATEE );
}else if( EvalConstants.ITEM_CATEGORY_ASSISTANT.equals(associateType) ){
sortedAssociateIds = getSortedUserIdsFromUsers( associateIds, EvalAssignUser.TYPE_ASSISTANT);
}else{
- sortedAssociateIds = new HashSet(associateIds);
+ sortedAssociateIds = new HashSet<>(associateIds);
}
for (String associateId : sortedAssociateIds) {
// handle the data creation for this associateId
TemplateItemGroup tig = new TemplateItemGroup(associateType, associateId);
- tig.hierarchyNodeGroups = new ArrayList();
+ tig.hierarchyNodeGroups = new ArrayList<>();
templateItemGroups.add(tig);
// now handle the hierarchy levels
@@ -579,8 +582,8 @@ private void addNodeTemplateItems(TemplateItemGroup tig, EvalHierarchyNode evalN
* the order of the answers inside the lists is effectively random
*/
protected void buildAnswerMaps() {
- answersMap = new HashMap>();
- responseAnswersMap = new HashMap>();
+ answersMap = new HashMap<>();
+ responseAnswersMap = new HashMap<>();
for (EvalAnswer answer : answers) {
// decode the stored answers into the int array
answer.multipleAnswers = EvalUtils.decodeMultipleAnswers(answer.getMultiAnswerCode());
@@ -593,7 +596,7 @@ protected void buildAnswerMaps() {
if (answersMap.containsKey(key)) {
answersMap.get(key).add(answer);
} else {
- List keyAnswers = new ArrayList();
+ List keyAnswers = new ArrayList<>();
keyAnswers.add(answer);
answersMap.put(key, keyAnswers);
}
@@ -602,7 +605,7 @@ protected void buildAnswerMaps() {
if (responseAnswersMap.containsKey(responseId)) {
responseAnswersMap.get(responseId).put(key, answer);
} else {
- Map keyAnswerMap = new HashMap();
+ Map keyAnswerMap = new HashMap<>();
keyAnswerMap.put(key, answer);
responseAnswersMap.put(responseId, keyAnswerMap);
}
@@ -616,7 +619,7 @@ protected void buildAnswerMaps() {
* @return the list of answers for this response id or empty list if none found
*/
public List getAnswersByResponseId(Long responseId) {
- List answersList = new ArrayList();
+ List answersList = new ArrayList<>();
if (responseAnswersMap.containsKey(responseId)) {
answersList.addAll(responseAnswersMap.get(responseId).values());
}
@@ -627,7 +630,7 @@ public List getAnswersByResponseId(Long responseId) {
* @return the list of all responseIds for the set of answers in this data structure
*/
public List getResponseIdsForAnswers() {
- List responseIdsList = new ArrayList();
+ List responseIdsList = new ArrayList<>();
responseIdsList.addAll(responseAnswersMap.keySet());
Collections.sort(responseIdsList);
return responseIdsList;
@@ -652,6 +655,7 @@ public class DataTemplateItem {
/**
* The unique key (templateItemAnswerKey) for this DTI,
* created using {@link TemplateItemUtils#makeTemplateItemAnswerKey(Long, String, String)}
+ * @return
*/
public String getKey() {
if (key == null) {
@@ -714,7 +718,7 @@ public DataTemplateItem(EvalTemplateItem templateItem, String associateType,
this.node = node;
if (TemplateItemUtils.isBlockParent(templateItem)) {
this.blockChildItems = TemplateItemUtils.getChildItems(allTemplateItems, templateItem.getId());
- this.templateItem.childTemplateItems = new ArrayList(blockChildItems); // for rendering
+ this.templateItem.childTemplateItems = new ArrayList<>(blockChildItems); // for rendering
} else if (TemplateItemUtils.isBlockChild(templateItem)) {
this.blockParentId = templateItem.getBlockId();
}
@@ -790,7 +794,7 @@ public boolean isBlockChild() {
* @return the list of all block children in this DTI as DTIs
*/
public List getBlockChildren() {
- ArrayList children = new ArrayList();
+ ArrayList children = new ArrayList<>();
if (this.blockChildItems != null) {
for (EvalTemplateItem eti : this.blockChildItems) {
children.add( new DataTemplateItem(eti, this.associateType, this.associateId, this.node) );
@@ -814,7 +818,7 @@ public boolean usesComments() {
* @return the list of all comments for this item
*/
public List getComments() {
- List comments = new ArrayList();
+ List comments = new ArrayList<>();
List answers = getAnswers();
if (answers != null) {
for (EvalAnswer answer : answers) {
@@ -837,7 +841,7 @@ public List getAnswers() {
if (answersMap.containsKey(key)) {
answers = answersMap.get(key);
} else {
- answers = new ArrayList();
+ answers = new ArrayList<>();
}
}
return answers;
@@ -911,7 +915,7 @@ public int getTemplateItemsCount() {
* does not include block children
*/
public List getTemplateItems() {
- List tis = new ArrayList();
+ List tis = new ArrayList<>();
for (HierarchyNodeGroup hng : hierarchyNodeGroups) {
tis.addAll(hng.templateItems);
}
@@ -930,7 +934,7 @@ public List getDataTemplateItems(boolean includeBlockChildren)
public TemplateItemGroup(String associateType, String associateId) {
this.associateType = associateType;
this.associateId = associateId;
- hierarchyNodeGroups = new ArrayList();
+ hierarchyNodeGroups = new ArrayList<>();
}
public TemplateItemGroup(String associateType, String associateId, List hierarchyNodeGroups) {
@@ -976,7 +980,7 @@ public List getDataTemplateItems(boolean includeBlockChildren)
public HierarchyNodeGroup(EvalHierarchyNode node) {
this.node = node;
- templateItems = new ArrayList();
+ templateItems = new ArrayList<>();
}
public HierarchyNodeGroup(EvalHierarchyNode node, List templateItems) {
@@ -1025,7 +1029,7 @@ public HierarchyNodeGroup(EvalHierarchyNode node, List templat
* @return the set of userIds
*/
public static Set getInstructorsForAnswers(List answers) {
- Set userIds = new HashSet();
+ Set userIds = new HashSet<>();
for (EvalAnswer answer: answers) {
if (EvalConstants.ITEM_CATEGORY_INSTRUCTOR.equals(answer.getAssociatedType())) {
if (! EvalUtils.isBlank(answer.getAssociatedId())) {
@@ -1045,7 +1049,7 @@ public static Set getInstructorsForAnswers(List answers) {
* @return the set of userIds
*/
public static Set getAssistantsForAnswers(List answers) {
- Set userIds = new HashSet();
+ Set userIds = new HashSet<>();
for (EvalAnswer answer: answers) {
if (EvalConstants.ITEM_CATEGORY_ASSISTANT.equals(answer.getAssociatedType())) {
if (! EvalUtils.isBlank(answer.getAssociatedId())) {
@@ -1074,7 +1078,7 @@ public static Set getAssistantsForAnswers(List answers) {
* e.g. {@link EvalConstants#ITEM_TYPE_MULTIPLECHOICE}
* @param scaleChoices the number of scale choices (normally this is the size of the {@link EvalScale#getOptions()} array.
* The returned integer array will be this big (+1 for NA), each index being a count of answers for that scale choice
- * @param answers the List of EvalAnswers to work with
+ * @param itemAnswers the List of EvalAnswers to work with
* @return an integer array which is the same size as the number of choices + 1 (for NA), ignore the last array entry if NA is not used for this item
* @throws IllegalArgumentException if this is not an itemType that has numeric answers (Scaled/MC/MA/...)
*/
@@ -1098,7 +1102,7 @@ else if (EvalConstants.ITEM_TYPE_MULTIPLEANSWER.equals(templateItemType)) {
// this multiple answer is not one that should be ignored
Integer[] decoded = EvalUtils.decodeMultipleAnswers(answer.getMultiAnswerCode());
for (Integer decodedAnswer: decoded) {
- incrementArraySafely(decodedAnswer.intValue(), togo);
+ incrementArraySafely(decodedAnswer, togo);
}
}
}
@@ -1106,7 +1110,7 @@ else if (EvalConstants.ITEM_TYPE_MULTIPLEANSWER.equals(templateItemType)) {
// standard handling for single answer items
if (! EvalConstants.NO_NUMERIC_ANSWER.equals(answer.getNumeric()) && answer.getNumeric() != null ) {
// this numeric answer is not one that should be ignored
- incrementArraySafely(answer.getNumeric().intValue(), togo);
+ incrementArraySafely(answer.getNumeric(), togo);
}
}
}
@@ -1144,13 +1148,13 @@ public static List makeEvalNodesList(List t
if (templateItems == null || hierarchyLogic == null) {
throw new IllegalArgumentException("inputs ("+templateItems+","+hierarchyLogic+") must not be null");
}
- Set nodeIds = new HashSet();
+ Set nodeIds = new HashSet<>();
for (EvalTemplateItem templateItem : templateItems) {
if (EvalConstants.HIERARCHY_LEVEL_NODE.equals(templateItem.getHierarchyLevel())) {
nodeIds.add(templateItem.getHierarchyNodeId());
}
}
- List hierarchyNodes = new ArrayList();
+ List hierarchyNodes = new ArrayList<>();
if (nodeIds.size() > 0) {
Set nodes = hierarchyLogic.getNodesByIds(nodeIds.toArray(new String[nodeIds.size()]));
hierarchyNodes = hierarchyLogic.getSortedNodes(nodes);
@@ -1165,8 +1169,8 @@ public static List makeEvalNodesList(List t
* @return the sorted set of user ids
*/
private Set getSortedUserIdsFromUsers( Collection userIds, String associatedType){
- List usersInList = new ArrayList();
- Set sortedIds = new LinkedHashSet();
+ List usersInList = new ArrayList<>();
+ Set sortedIds = new LinkedHashSet<>();
if( userIds != null && associatedType != null && evaluationService != null && evalGroupId != null && evaluationId != null){
List userList = evaluationService.getParticipantsForEval(evaluationId, null, new String[] { evalGroupId }, null, EvalEvaluationService.STATUS_ANY, null, null);
for( EvalAssignUser evalAssignUser : userList ){
@@ -1183,7 +1187,7 @@ private Set getSortedUserIdsFromUsers( Collection userIds, Strin
}
}
- if(sortedIds.size() == 0){
+ if(sortedIds.isEmpty()){
//No valid users found and userIds are not sorted, return the original userIds collection
sortedIds.addAll(userIds);
}
diff --git a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/TemplateItemUtils.java b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/TemplateItemUtils.java
index f5a1c4691..390624ab4 100644
--- a/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/TemplateItemUtils.java
+++ b/sakai-evaluation-api/src/java/org/sakaiproject/evaluation/utils/TemplateItemUtils.java
@@ -70,7 +70,7 @@ public static String getTemplateItemType(EvalTemplateItem templateItem) {
* @return a list of {@link EvalTemplateItem} in order by display order
*/
public static List makeTemplateItemsList(Collection templateItemsCollection) {
- List templateItemsList = new ArrayList();
+ List templateItemsList = new ArrayList<>();
for (EvalTemplateItem templateItem : templateItemsCollection) {
templateItemsList.add(templateItem);
@@ -86,7 +86,7 @@ public static List makeTemplateItemsList(Collection templateItemsCollection) {
- List templateItemsIds = new ArrayList();
+ List templateItemsIds = new ArrayList<>();
for (EvalTemplateItem templateItem : templateItemsCollection) {
templateItemsIds.add(templateItem.getId());
@@ -119,11 +119,11 @@ public static boolean checkTemplateItemsCategoryExists(String itemTypeConstant,
* guaranteed to return the items in the correct template item order
*
* @param itemTypeConstant and ITEM_CATEGORY constant from {@link EvalConstants}
- * @param itemList a list of {@link EvalTemplateItem} objects
+ * @param templateItemsList a list of {@link EvalTemplateItem} objects
* @return a list of {@link EvalTemplateItem} objects which have a specific category
*/
public static List getCategoryTemplateItems(String itemTypeConstant, List