Skip to content

Commit

Permalink
singleton without concurrent access prevents listing Nextcloud calend…
Browse files Browse the repository at this point in the history
…ars. close #2539
  • Loading branch information
j-dimension committed Aug 12, 2024
1 parent 236f395 commit 51d279c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ public interface CalendarServiceRemote {
CalendarSetup addCalendarSetup(CalendarSetup cs);

List listCalendars(String host, boolean ssl, int port, String user, String password, String path) throws Exception;

CalendarSetup updateCalendarSetup(CalendarSetup cs);

void removeCalendarSetup(CalendarSetup cs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,8 @@
import javax.jms.JMSContext;
import javax.jms.ObjectMessage;
import org.apache.log4j.Logger;
import org.jlawyer.cloud.NextcloudCalendarConnector;
import org.jlawyer.cloud.calendar.CloudCalendar;
import org.jlawyer.notification.OutgoingMailRequest;

/**
Expand Down Expand Up @@ -1550,9 +1552,13 @@ public List<ArchiveFileReviewsBean> getConflictingEvents(int eventType, Date fro
@Override
@RolesAllowed({"loginRole"})
public List listCalendars(String host, boolean ssl, int port, String user, String password, String path) throws Exception {
return this.calendarSync.listCalendars(host, ssl, port, user, password, path);
// need to bypass CalendarSyncService because it is a singleton
NextcloudCalendarConnector nc = new NextcloudCalendarConnector(host, ssl, port, user, password);
if(!ServerStringUtils.isEmpty(path))
nc.setSubpathPrefix(path);
return nc.getAllCalendars();
}

@Override
@PermitAll
public void sendDailyAgenda() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -815,15 +815,6 @@ public void eventUpdated(ArchiveFileBean caseContext, ArchiveFileReviewsBean eve
}
}

@Override
@RolesAllowed({"loginRole"})
public List<CloudCalendar> listCalendars(String host, boolean ssl, int port, String user, String password, String path) throws Exception {
NextcloudCalendarConnector nc = new NextcloudCalendarConnector(host, ssl, port, user, password);
if(!ServerStringUtils.isEmpty(path))
nc.setSubpathPrefix(path);
return nc.getAllCalendars();
}

@Override
@RolesAllowed({"loginRole"})
@Asynchronous
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,9 +665,7 @@ You should also get your employer (if you work as a programmer) or school,

import com.jdimension.jlawyer.persistence.ArchiveFileBean;
import com.jdimension.jlawyer.persistence.ArchiveFileReviewsBean;
import java.util.List;
import javax.ejb.Local;
import org.jlawyer.cloud.calendar.CloudCalendar;

/**
*
Expand All @@ -686,6 +684,5 @@ public interface CalendarSyncServiceLocal {

void eventDeleted(ArchiveFileReviewsBean event);

List<CloudCalendar> listCalendars(String host, boolean ssl, int port, String user, String password, String path) throws Exception;

}

0 comments on commit 51d279c

Please sign in to comment.