diff --git a/api/pom.xml b/api/pom.xml
index dd40ade2..2dfb535c 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -43,7 +43,7 @@
org.hibernate
- hibernate-core
+ hibernate
diff --git a/api/src/java/org/sakaiproject/attendance/logic/AttendanceLogic.java b/api/src/java/org/sakaiproject/attendance/logic/AttendanceLogic.java
index 5fe1e86b..6460c811 100644
--- a/api/src/java/org/sakaiproject/attendance/logic/AttendanceLogic.java
+++ b/api/src/java/org/sakaiproject/attendance/logic/AttendanceLogic.java
@@ -169,8 +169,9 @@ public interface AttendanceLogic {
*
* @param aE, the AttendanceEvent to update
* @param s, the Status to set the AttendanceRecords (if null, uses the default of the AttendanceSite)
+ * @return the success of the operation
*/
- void updateAttendanceRecordsForEvent(AttendanceEvent aE, Status s);
+ boolean updateAttendanceRecordsForEvent(AttendanceEvent aE, Status s);
/**
* Update all AttendanceRecords where the user belongs to the supplied group for an AttendanceEvent
@@ -179,8 +180,9 @@ public interface AttendanceLogic {
* @param s, the Status to use (if null, use the Site's default status)
* @param groupId, only update the AttendanceRecords for members of the groupID (if null or empty calls
* {@link org.sakaiproject.attendance.logic.AttendanceLogic#updateAttendanceRecordsForEvent(AttendanceEvent, Status)})
+ * @return success of the operation
*/
- void updateAttendanceRecordsForEvent(AttendanceEvent aE, Status s, String groupId);
+ boolean updateAttendanceRecordsForEvent(AttendanceEvent aE, Status s, String groupId);
/**
* Creates AttendanceRecords for an AttendanceEvent using a default Status for the provided Student IDs
@@ -188,8 +190,9 @@ public interface AttendanceLogic {
* @param attendanceEvent, the AttendanceEvent
* @param defaultStatus, the status to use (if null use the site default)
* @param missingStudentIds, a List of UserIDs which need records
+ * @return the success of the operation
*/
- void updateMissingRecordsForEvent(AttendanceEvent attendanceEvent, Status defaultStatus, List missingStudentIds);
+ boolean updateMissingRecordsForEvent(AttendanceEvent attendanceEvent, Status defaultStatus, List missingStudentIds);
/**
* Get statistics (total counts for each status) for an event
diff --git a/impl/pom.xml b/impl/pom.xml
index 40a43880..cf6153c2 100644
--- a/impl/pom.xml
+++ b/impl/pom.xml
@@ -48,11 +48,7 @@
org.springframework
- spring-core
-
-
- org.springframework
- spring-orm
+ spring
net.sf.ehcache
@@ -68,7 +64,7 @@
org.hibernate
- hibernate-core
+ hibernate
com.itextpdf
diff --git a/impl/src/java/org/sakaiproject/attendance/dao/AttendanceDao.java b/impl/src/java/org/sakaiproject/attendance/dao/AttendanceDao.java
index ec7ba3f4..4940097c 100644
--- a/impl/src/java/org/sakaiproject/attendance/dao/AttendanceDao.java
+++ b/impl/src/java/org/sakaiproject/attendance/dao/AttendanceDao.java
@@ -122,7 +122,7 @@ public interface AttendanceDao {
* @param aRs, a List of AttendanceRecords
* @return success of the operation
*/
- void updateAttendanceRecords(List aRs);
+ boolean updateAttendanceRecords(List aRs);
/**
* Update a set of AttendanceStatuses
@@ -130,7 +130,7 @@ public interface AttendanceDao {
* @param attendanceStatusList, a List of AttendanceStatuses
* @return success of the operation
*/
- void updateAttendanceStatuses(List attendanceStatusList);
+ boolean updateAttendanceStatuses(List attendanceStatusList);
/**
* Get a list of the active statuses in an Attendance Site
diff --git a/impl/src/java/org/sakaiproject/attendance/dao/impl/AttendanceDaoImpl.java b/impl/src/java/org/sakaiproject/attendance/dao/impl/AttendanceDaoImpl.java
index c1952d61..6003a3a9 100644
--- a/impl/src/java/org/sakaiproject/attendance/dao/impl/AttendanceDaoImpl.java
+++ b/impl/src/java/org/sakaiproject/attendance/dao/impl/AttendanceDaoImpl.java
@@ -216,28 +216,26 @@ public boolean updateAttendanceRecord(AttendanceRecord aR) {
/**
* {@inheritDoc}
*/
- public void updateAttendanceRecords(List aRs) {
- for(AttendanceRecord aR : aRs) {
- try {
- getHibernateTemplate().saveOrUpdate(aR);
- log.info("save attendanceRecord id: " + aR.getId());
- } catch (Exception e) {
- log.error("update attendanceRecords failed.", e);
- }
+ public boolean updateAttendanceRecords(List aRs) {
+ try{
+ getHibernateTemplate().saveOrUpdateAll(aRs);
+ return true;
+ } catch (Exception e) {
+ log.error("update attendanceRecords failed.", e);
+ return false;
}
}
/**
* {@inheritDoc}
*/
- public void updateAttendanceStatuses(List attendanceStatusList) {
- for(AttendanceStatus aS : attendanceStatusList) {
- try {
- getHibernateTemplate().saveOrUpdate(aS);
- log.info("AttendanceStatus saved, id: " + aS.getId());
- } catch (Exception e) {
- log.error("update attendanceStatuses failed.", e);
- }
+ public boolean updateAttendanceStatuses(List attendanceStatusList) {
+ try{
+ getHibernateTemplate().saveOrUpdateAll(attendanceStatusList);
+ return true;
+ } catch (Exception e) {
+ log.error("update attendanceStatuses failed.", e);
+ return false;
}
}
@@ -255,7 +253,7 @@ public List getActiveStatusesForSite(final AttendanceSite atte
@Override
public Object doInHibernate(Session session) throws HibernateException, SQLException {
Query q = session.getNamedQuery(QUERY_GET_ACTIVE_ATTENDANCE_STATUSES_FOR_SITE);
- q.setParameter(ATTENDANCE_SITE, attendanceSite, new ManyToOneType(null, "org.sakaiproject.attendance.model.AttendanceSite"));
+ q.setParameter(ATTENDANCE_SITE, attendanceSite, new ManyToOneType("org.sakaiproject.attendance.model.AttendanceSite"));
return q.list();
}
};
@@ -281,7 +279,7 @@ public List getAllStatusesForSite(final AttendanceSite attenda
@Override
public Object doInHibernate(Session session) throws HibernateException, SQLException {
Query q = session.getNamedQuery(QUERY_GET_ALL_ATTENDANCE_STATUSES_FOR_SITE);
- q.setParameter(ATTENDANCE_SITE, attendanceSite, new ManyToOneType(null, "org.sakaiproject.attendance.model.AttendanceSite"));
+ q.setParameter(ATTENDANCE_SITE, attendanceSite, new ManyToOneType("org.sakaiproject.attendance.model.AttendanceSite"));
return q.list();
}
};
@@ -328,7 +326,7 @@ public AttendanceGrade getAttendanceGrade(final String userID, final AttendanceS
@Override
public Object doInHibernate(Session session) throws HibernateException, SQLException {
Query q = session.getNamedQuery(QUERY_GET_ATTENDANCE_GRADE);
- q.setParameter(ATTENDANCE_SITE, aS, new ManyToOneType(null, "org.sakaiproject.attendance.model.AttendanceSite"));
+ q.setParameter(ATTENDANCE_SITE, aS, new ManyToOneType("org.sakaiproject.attendance.model.AttendanceSite"));
q.setParameter(USER_ID, userID, new StringType());
return q.uniqueResult();
}
@@ -355,7 +353,7 @@ public List getAttendanceGrades(final AttendanceSite aS) {
@Override
public Object doInHibernate(Session session) throws HibernateException, SQLException {
Query q = session.getNamedQuery(QUERY_GET_ATTENDANCE_GRADES_FOR_SITE);
- q.setParameter(ATTENDANCE_SITE, aS, new ManyToOneType(null, "org.sakaiproject.attendance.model.AttendanceSite"));
+ q.setParameter(ATTENDANCE_SITE, aS, new ManyToOneType("org.sakaiproject.attendance.model.AttendanceSite"));
return q.list();
}
};
@@ -419,7 +417,7 @@ private List getEventsForAttendanceSiteHelper(final AttendanceS
@Override
public Object doInHibernate(Session session) throws HibernateException, SQLException {
Query q = session.getNamedQuery(QUERY_GET_ATTENDANCE_EVENTS_FOR_SITE);
- q.setParameter(ATTENDANCE_SITE, aS, new ManyToOneType(null, "org.sakaiproject.attendance.model.AttendanceSite"));
+ q.setParameter(ATTENDANCE_SITE, aS, new ManyToOneType("org.sakaiproject.attendance.model.AttendanceSite"));
return q.list();
}
};
diff --git a/impl/src/java/org/sakaiproject/attendance/logic/AttendanceLogicImpl.java b/impl/src/java/org/sakaiproject/attendance/logic/AttendanceLogicImpl.java
index 16445543..0ba87236 100644
--- a/impl/src/java/org/sakaiproject/attendance/logic/AttendanceLogicImpl.java
+++ b/impl/src/java/org/sakaiproject/attendance/logic/AttendanceLogicImpl.java
@@ -70,8 +70,9 @@ public AttendanceSite getCurrentAttendanceSite() {
}
}
- generateMissingAttendanceStatusesForSite(currentAttendanceSite);
- currentAttendanceSite = getAttendanceSite(currentSiteID);
+ if(generateMissingAttendanceStatusesForSite(currentAttendanceSite)) {
+ currentAttendanceSite = getAttendanceSite(currentSiteID);
+ }
return currentAttendanceSite;
}
@@ -193,7 +194,7 @@ public boolean updateAttendanceRecord(AttendanceRecord aR) throws IllegalArgumen
/**
* {@inheritDoc}
*/
- public void updateAttendanceRecordsForEvent(AttendanceEvent aE, Status s) {
+ public boolean updateAttendanceRecordsForEvent(AttendanceEvent aE, Status s) {
aE = getAttendanceEvent(aE.getId());
List records = new ArrayList(aE.getRecords());
@@ -205,15 +206,15 @@ public void updateAttendanceRecordsForEvent(AttendanceEvent aE, Status s) {
aR.setStatus(s);
}
- dao.updateAttendanceRecords(records);
+ return dao.updateAttendanceRecords(records);
}
/**
* {@inheritDoc}
*/
- public void updateAttendanceRecordsForEvent(AttendanceEvent aE, Status s, String groupId) {
+ public boolean updateAttendanceRecordsForEvent(AttendanceEvent aE, Status s, String groupId) {
if(groupId == null || groupId.isEmpty()) {
- updateAttendanceRecordsForEvent(aE, s);
+ return updateAttendanceRecordsForEvent(aE, s);
} else {
aE = getAttendanceEvent(aE.getId());
List allRecords = new ArrayList(aE.getRecords());
@@ -237,14 +238,14 @@ public void updateAttendanceRecordsForEvent(AttendanceEvent aE, Status s, String
aR.setStatus(s);
}
- dao.updateAttendanceRecords(recordsToUpdate);
+ return dao.updateAttendanceRecords(recordsToUpdate);
}
}
/**
* {@inheritDoc}
*/
- public void updateMissingRecordsForEvent(AttendanceEvent attendanceEvent, Status defaultStatus, List missingStudentIds) {
+ public boolean updateMissingRecordsForEvent(AttendanceEvent attendanceEvent, Status defaultStatus, List missingStudentIds) {
List recordList = new ArrayList();
if(defaultStatus == null) {
@@ -258,8 +259,9 @@ public void updateMissingRecordsForEvent(AttendanceEvent attendanceEvent, Status
recordList.add(attendanceRecord);
}
}
- dao.updateAttendanceRecords(recordList);
+ return dao.updateAttendanceRecords(recordList);
}
+ return false;
}
/**
@@ -495,7 +497,7 @@ private void generateStatsHelper(Map m, Status s, int base) {
}
}
- private void generateMissingAttendanceStatusesForSite(AttendanceSite attendanceSite) {
+ private boolean generateMissingAttendanceStatusesForSite(AttendanceSite attendanceSite) {
Set currentAttendanceStatuses = attendanceSite.getAttendanceStatuses();
List previouslyCreatedStatuses = new ArrayList();
List statusesToBeAdded = new ArrayList();
@@ -521,7 +523,8 @@ private void generateMissingAttendanceStatusesForSite(AttendanceSite attendanceS
}
}
- dao.updateAttendanceStatuses(statusesToBeAdded);
+ return statusesToBeAdded.isEmpty() || dao.updateAttendanceStatuses(statusesToBeAdded);
+
}
private int getNextSortOrder(List attendanceStatusList) {
diff --git a/pack/src/webapp/WEB-INF/components.xml b/pack/src/webapp/WEB-INF/components.xml
index db0425df..03f234a9 100644
--- a/pack/src/webapp/WEB-INF/components.xml
+++ b/pack/src/webapp/WEB-INF/components.xml
@@ -14,9 +14,10 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-
+
+
+
+
+ init-method="init"
+ singleton="true">
diff --git a/pom.xml b/pom.xml
index 3c621b12..b9ae2022 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
org.sakaiproject
master
- 11-SNAPSHOT
+ 2.9.3
../master/pom.xml
@@ -96,17 +96,17 @@
org.slf4j
slf4j-log4j12
- ${sakai.slf4j.version}
+ 1.4.2
org.slf4j
slf4j-api
- ${sakai.slf4j.version}
+ 1.4.2
log4j
log4j
- ${sakai.log4j.version}
+ 1.2.14
org.projectlombok
@@ -116,20 +116,20 @@
org.springframework
- spring-core
- ${sakai.spring.version}
+ spring
+ 2.5.6.SEC03
provided
net.sf.ehcache
ehcache-core
- ${sakai.ehcache.version}
+ 1.7.2
provided
commons-lang
commons-lang
- ${sakai.commons.lang.version}
+ 2.5
provided
diff --git a/tool/src/java/org/sakaiproject/attendance/tool/pages/EventView.java b/tool/src/java/org/sakaiproject/attendance/tool/pages/EventView.java
index 1407cafb..fe19de7a 100644
--- a/tool/src/java/org/sakaiproject/attendance/tool/pages/EventView.java
+++ b/tool/src/java/org/sakaiproject/attendance/tool/pages/EventView.java
@@ -108,10 +108,11 @@ private void init() {
final Form> setAllForm = new Form("set-all-form"){
@Override
protected void onSubmit() {
- attendanceLogic.updateAttendanceRecordsForEvent(attendanceEvent, setAllStatus.getModelObject(), selectedGroup);
- String who = selectedGroup == null?"":" for " + sakaiProxy.getGroupTitleForCurrentSite(selectedGroup);
- getSession().info("All attendance records " + who + " for " + attendanceEvent.getName() + " set to " + setAllStatus.getModelObject());
- setResponsePage(new EventView(attendanceEvent, returnPage, selectedGroup));
+ if(attendanceLogic.updateAttendanceRecordsForEvent(attendanceEvent, setAllStatus.getModelObject(), selectedGroup)){
+ String who = selectedGroup == null?"":" for " + sakaiProxy.getGroupTitleForCurrentSite(selectedGroup);
+ getSession().info("All attendance records " + who + " for " + attendanceEvent.getName() + " set to " + setAllStatus.getModelObject());
+ setResponsePage(new EventView(attendanceEvent, returnPage, selectedGroup));
+ }
}
};
diff --git a/tool/src/webapp/WEB-INF/web.xml b/tool/src/webapp/WEB-INF/web.xml
index 75681461..2e022bf4 100644
--- a/tool/src/webapp/WEB-INF/web.xml
+++ b/tool/src/webapp/WEB-INF/web.xml
@@ -66,7 +66,7 @@
- org.sakaiproject.util.SakaiContextLoaderListener
+ org.sakaiproject.util.ContextLoaderListener