Skip to content
This repository has been archived by the owner on Feb 1, 2019. It is now read-only.

Commit

Permalink
EVALSYS-1472 Support for roster/section based delivery (sakaicontrib#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjones86 committed Jun 14, 2016
1 parent 6f203e9 commit 209fb6f
Show file tree
Hide file tree
Showing 253 changed files with 7,549 additions and 3,781 deletions.
2 changes: 0 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>${sakai.quartz.version}</version>
</dependency>
</dependencies>
</profile>
Expand Down Expand Up @@ -167,7 +166,6 @@
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>${sakai.quartz.version}</version>
</dependency>
</dependencies>
</profile>
Expand Down
18 changes: 16 additions & 2 deletions sakai-evaluation-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,27 @@
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>

<!-- Section awareness dependencies -->
<dependency>
<groupId>org.sakaiproject.edu-services.course-management</groupId>
<artifactId>coursemanagement-api</artifactId>
</dependency>
<dependency>
<groupId>org.sakaiproject.kernel</groupId>
<artifactId>sakai-component-manager</artifactId>
</dependency>

<dependency>
<groupId>org.sakaiproject.entitybroker</groupId>
<artifactId>entitybroker-api</artifactId>
</dependency>

</dependencies>
</dependencies>

<build>
<sourceDirectory>src/java</sourceDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -140,7 +150,7 @@ public boolean checkInstructorViewResultsForEval(EvalEvaluation eval, String eva
if (instViewResultsSetting == null) {
instViewResultsEval = eval.getInstructorViewResults();
} else {
instViewResultsEval = instViewResultsSetting.booleanValue();
instViewResultsEval = instViewResultsSetting;
}
}
}
Expand Down Expand Up @@ -183,7 +193,7 @@ public Date getInstructorViewDateForEval(EvalEvaluation eval) {
if (instViewResultsSetting == null) {
evalViewable = eval.getInstructorViewResults();
} else {
evalViewable = instViewResultsSetting.booleanValue();
evalViewable = instViewResultsSetting;
}
}
if (evalViewable) {
Expand Down Expand Up @@ -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());
}
Expand All @@ -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());
}
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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 );
Expand All @@ -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 );
Expand Down Expand Up @@ -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() ) );
}
}
Expand All @@ -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() ) );
}
}
Expand All @@ -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) {
Expand All @@ -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() ) );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,5 +179,8 @@
<property name="localSelector" type="java.lang.String">
<column name="LOCAL_SELECTOR" length="255" />
</property>
<property name="sectionAwareness" type="java.lang.Boolean">
<column name="SECTION_AWARE" />
</property>
</class>
</hibernate-mapping>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping default-cascade="none">
<class name="org.sakaiproject.evaluation.model.EvalHierarchyRule" table="EVAL_HIERARCHY_RULE" dynamic-insert="false" dynamic-update="false">

<id name="id" type="java.lang.Long" unsaved-value="null">
<column name="ID" />
<generator class="native" />
</id>

<property name="nodeID" type="java.lang.Long">
<column name="NODE_ID" not-null="true" />
</property>

<property name="rule" type="java.lang.String">
<column name="RULE" not-null="true" length="255" />
</property>

<property name="opt" type="java.lang.String">
<column name="OPT" not-null="true" length="10" />
</property>

</class>
</hibernate-mapping>
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ public interface JobStatusReporter
/**
* @param jobId
* @param jobFailed TODO
* @param milestone
* @param detail
*/
public void reportError(String jobId, boolean jobFailed, String milestone, String detail);

/**
* @param jobId
* @param jobFailed TODO
* @param milestone
* @param detail TODO
*/
public void reportFinished(String jobId, boolean jobFailed, String milestone, String detail);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand All @@ -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);
Expand Down
Loading

0 comments on commit 209fb6f

Please sign in to comment.