Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to wicket 9 #123

Merged
merged 9 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>attendance</artifactId>
<groupId>org.sakaiproject.attendance</groupId>
<version>23-SNAPSHOT</version>
<version>25-SNAPSHOT</version>
</parent>

<name>attendance - API</name>
Expand All @@ -45,8 +45,8 @@
<artifactId>hibernate-core</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>

<!-- Sakai dependencies -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

/**
* Created by james on 7/11/17.
Expand All @@ -29,49 +28,11 @@
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
public class AttendanceUserGroupStats {
private static final long serialVersionUID = 1L;

private String userID;
private String groupId;
private AttendanceSite attendanceSite;


public AttendanceUserGroupStats(String userID, AttendanceSite attendanceSite) {
this.userID = userID;
this.attendanceSite = attendanceSite;
}

@Override
public boolean equals (final Object obj) {
if(obj == null) {
return false;
}

if(obj == this) {
return true;
}

if(obj.getClass() != getClass()) {
return false;
}

final AttendanceUserGroupStats other = (AttendanceUserGroupStats) obj;
return new EqualsBuilder()
.appendSuper(super.equals(obj))
.append(this.userID, other.userID)
.append(this.groupId, other.groupId)
.append(this.attendanceSite, other.attendanceSite)
.isEquals();
}

@Override
public int hashCode() {
return new HashCodeBuilder()
.appendSuper(super.hashCode())
.append(this.userID)
.append(this.groupId)
.append(this.attendanceSite.getId())
.toHashCode();
}
}
10 changes: 5 additions & 5 deletions impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>attendance</artifactId>
<groupId>org.sakaiproject.attendance</groupId>
<version>23-SNAPSHOT</version>
<version>25-SNAPSHOT</version>
</parent>

<name>attendance - Implementation</name>
Expand Down Expand Up @@ -58,12 +58,12 @@
<artifactId>ehcache-core</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.sakaiproject.grading.api.CategoryDefinition;
import org.sakaiproject.grading.api.ConflictingAssignmentNameException;
import org.sakaiproject.grading.api.GradingService;
import org.sakaiproject.tool.api.Tool;
import org.sakaiproject.tool.api.ToolManager;

import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,18 @@
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.sakaiproject.authz.api.*;
import org.sakaiproject.component.api.ServerConfigurationService;
import org.sakaiproject.entity.api.ResourceProperties;
import org.sakaiproject.entity.api.ResourcePropertiesEdit;
import org.sakaiproject.event.api.EventTrackingService;
import org.sakaiproject.exception.IdUnusedException;
import org.sakaiproject.site.api.Group;
import org.sakaiproject.site.api.Site;
import org.sakaiproject.site.api.SiteService;
import org.sakaiproject.time.api.Time;
import org.sakaiproject.tool.api.Session;
import org.sakaiproject.tool.api.SessionManager;
import org.sakaiproject.tool.api.ToolManager;
import org.sakaiproject.user.api.*;
import org.sakaiproject.util.ResourceLoader;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

import java.util.*;

Expand Down Expand Up @@ -66,7 +60,6 @@ public String getCurrentSiteTitle() {
return siteService.getSite(getCurrentSiteId()).getTitle();
} catch (IdUnusedException e) {
log.error("getCurrentSiteTitle()", e);
e.printStackTrace();
return "";
}
}
Expand Down Expand Up @@ -242,7 +235,6 @@ public List<String> getAvailableGroupsForSite(String siteId) {
return returnList;
} catch (IdUnusedException e) {
log.error("getAvailableGroupIdsForSite " + siteId + " IdUnusedException");
e.printStackTrace();
return new ArrayList<String>();
}
}
Expand All @@ -262,7 +254,6 @@ public User getUser(String userId) {
return userDirectoryService.getUser(userId);
} catch (UserNotDefinedException e) {
log.error("Unable to get user " + userId + " " + e);
e.printStackTrace();
return null;
}
}
Expand All @@ -275,7 +266,6 @@ public final User getUserByEID(String userEid) {
return userDirectoryService.getUserByEid(userEid);
} catch (UserNotDefinedException e) {
log.error("Unable to get user " + userEid + " " + e);
e.printStackTrace();
return null;
}
}
Expand Down Expand Up @@ -333,7 +323,6 @@ public String getGroupTitle(String siteId, String groupId) {
}
} catch (IdUnusedException e) {
log.error("Unable to get group title", e);
e.printStackTrace();
}
return "";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void execute() {
if("".equals(summary)) {
log.info("AttendanceStatCalc no sites left to sync");
} else {
log.info("AttendanceStatCalc done, but there are errors\n" + summary);
log.info("AttendanceStatCalc done, but there are errors\n{}", summary);
}
} else {
while(!ids.isEmpty()) {
Expand All @@ -63,10 +63,10 @@ public void execute() {
calculateStats(id);
lastId = id > lastId ? id : lastId++; // never-ending loop protection
}
log.info("AttendanceStatCalc in progress " + getSummary());
log.info("AttendanceStatCalc in progress {}", getSummary());
ids = dao.getAttendanceSiteBatch(syncTime, lastId);
}
log.info("AttendanceStatCalc finished " + getSummary());
log.info("AttendanceStatCalc finished {}", getSummary());
log.info(getOverallSummary());
}

Expand Down Expand Up @@ -105,22 +105,21 @@ private void calculateStats(Long id) {
}
} else {
sitesWithNoUsers++;
log.debug("AttendanceSite, id: '" + id +"' has no users or Site, id: '"
+ attendanceSite.getSiteID() +"' no longer exists.");
log.debug("AttendanceSite, id: '{}' has no users or Site, id: '{}' no longer exists.", id, attendanceSite.getSiteID());
}

attendanceSite.setIsSyncing(false);
attendanceLogic.updateAttendanceSite(attendanceSite);

log.debug("AttendanceSite synced with id: " + id);
log.debug("AttendanceSite synced with id: {}", id);
sitesProcessed++;
} else {
log.debug("AttendanceSite not marked as in progress" + id);
log.debug("AttendanceSite not marked as in progress{}", id);
sitesNotMarked++;
}
} catch (Exception e) {
sitesInError++;
log.warn("Error syncing AttendanceSite id: " + id, e);
log.warn("Error syncing AttendanceSite id: {}", id, e);
}
}

Expand Down Expand Up @@ -154,8 +153,7 @@ private void calculateEventStats(AttendanceEvent event, Map<String, int[]> userS

userStats.put(record.getUserID(), array);
} else {
log.debug("AttendanceRecord user no longer present in course, record id: '" + record.getId()
+ "' and userID: " + record.getUserID());
log.debug("AttendanceRecord user no longer present in course, record id: '{}' and userID: {}", record.getId(), record.getUserID());
}
}

Expand All @@ -177,7 +175,7 @@ private String getSummary() {

private String getOverallSummary() {
List<Long> inProgress = dao.getAttendanceSitesInSync();
if(inProgress.size() > 0) {
if(!inProgress.isEmpty()) {
String message = "%d AttendanceSite(s) currently marked in sync. IDs marked in sync: %s";
return String.format(message, inProgress.size(), inProgress);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ public void execute(JobExecutionContext context) {

eventTrackingService.post(eventTrackingService.newEvent("attend.calc.job", safeEventLength(whoAmI.toString()), true));

log.info("Start Job: " + whoAmI.toString());
log.info("Start Job: {}", whoAmI);
attendanceStatCalc.execute();

logoutFromSakai();

}

public void loginToSakai(String whoAs, String jobName, String jobError) {
log.debug(jobName + " loginToSakai()");
log.debug("{} loginToSakai()", jobName);

UsageSession session = usageSessionService.startSession(whoAs, serverName, jobName);
if (session == null) {
Expand All @@ -115,7 +115,7 @@ public void loginToSakai(String whoAs, String jobName, String jobError) {
}

public void logoutFromSakai() {
log.debug(jobName + " Logging out of Sakai on " + serverName);
log.debug(jobName + " Logging out of Sakai on {}", serverName);
eventTrackingService.post(eventTrackingService.newEvent(UsageSessionService.EVENT_LOGOUT, null, true));
usageSessionService.logout(); // safe to logout? what if other jobs are running?
}
Expand Down
23 changes: 9 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<parent>
<groupId>org.sakaiproject</groupId>
<artifactId>master</artifactId>
<version>23-SNAPSHOT</version>
<version>25-SNAPSHOT</version>
</parent>

<developers>
Expand Down Expand Up @@ -78,28 +78,23 @@
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket</artifactId>
<version>6.21.0</version>
<type>pom</type>
<version>9.17.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-spring</artifactId>
<version>6.21.0</version>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-datetime</artifactId>
<version>6.21.0</version>
</dependency>
<version>9.17.0</version>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-extensions</artifactId>
<version>6.21.0</version>
<version>9.17.0</version>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.10</version>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>${sakai.commons.configuration2.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
Expand Down
12 changes: 1 addition & 11 deletions tool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>attendance</artifactId>
<groupId>org.sakaiproject.attendance</groupId>
<version>23-SNAPSHOT</version>
<version>25-SNAPSHOT</version>
</parent>

<name>attendance - Tool</name>
Expand Down Expand Up @@ -58,16 +58,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-datetime</artifactId>
</dependency>
<!-- Joda used by wicket-datetime -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${joda.time.version}</version>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-extensions</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,17 @@ public class Attendance extends WebApplication {
protected void init() {
super.init();

//Configure for Spring injection
// Disable the CSP header (we can handle this in root of application)
getCspSettings().blocking().disabled();

//Configure for Spring injection
getComponentInstantiationListeners().add(new SpringComponentInjector(this));

//Don't throw an exception if we are missing a property, just fallback
getResourceSettings().setThrowExceptionOnMissingResource(false);

//Remove the wicket specific tags from the generated markup
getMarkupSettings().setStripWicketTags(true);

//Don't add any extra tags around a disabled link (default is <em></em>)
getMarkupSettings().setDefaultBeforeDisabledLink(null);
getMarkupSettings().setDefaultAfterDisabledLink(null);

// On Wicket session timeout, redirect to main page
getApplicationSettings().setPageExpiredErrorPage(Overview.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.sakaiproject.attendance.tool.dataproviders;

import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.sakaiproject.attendance.tool.models.DetachableUserModel;
import org.sakaiproject.user.api.User;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public ProfileImage(String id, IModel urlModel)
super( id, urlModel );
}

@Override
protected void onComponentTag(ComponentTag tag)
{
super.onComponentTag( tag );
Expand Down
Loading
Loading