implemented ical exports
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -33,7 +33,7 @@ public class MariaDB implements Database {
|
||||
private static final String URLS = "urls";
|
||||
private static final String APPOINTMENT_ATTACHMENTS = "appointment_attachments";
|
||||
private static final String TAGS = "tags";
|
||||
private static Connection connection;
|
||||
private Connection connection;
|
||||
|
||||
private MariaDB(Connection conn) throws SQLException {
|
||||
connection = conn;
|
||||
@@ -180,7 +180,7 @@ public class MariaDB implements Database {
|
||||
public Result<Appointment> loadEvent(long id) {
|
||||
try {
|
||||
var rs = select(ALL).from(APPOINTMENTS).where(AID, equal(id)).exec(connection);
|
||||
Result<Appointment> result = rs.next() ? createAppointmentOf(rs).map(MariaDB::loadExtra) : NotFound.of("Failed to find appointment with id %s", id);
|
||||
Result<Appointment> result = rs.next() ? createAppointmentOf(rs).map(this::loadExtra) : NotFound.of("Failed to find appointment with id %s", id);
|
||||
rs.close();
|
||||
return result;
|
||||
} catch (SQLException e) {
|
||||
@@ -192,7 +192,7 @@ public class MariaDB implements Database {
|
||||
public Result<Appointment> loadEvent(String location, LocalDateTime start) {
|
||||
try {
|
||||
var rs = select(ALL).from(APPOINTMENTS).where(LOCATION, equal(location)).where(START, equal(Timestamp.valueOf(start))).exec(connection);
|
||||
Result<Appointment> result = rs.next() ? createAppointmentOf(rs).map(MariaDB::loadExtra) : error("Failed to find appointment starting %s @ %s", start, location);
|
||||
Result<Appointment> result = rs.next() ? createAppointmentOf(rs).map(this::loadExtra) : error("Failed to find appointment starting %s @ %s", start, location);
|
||||
rs.close();
|
||||
return result;
|
||||
} catch (SQLException e) {
|
||||
@@ -200,11 +200,11 @@ public class MariaDB implements Database {
|
||||
}
|
||||
}
|
||||
|
||||
private static Result<Appointment> loadExtra(Result<BaseAppointment> res) {
|
||||
return loadTags(res).map(MariaDB::loadLinks).map(MariaDB::loadAttachments);
|
||||
private Result<Appointment> loadExtra(Result<BaseAppointment> res) {
|
||||
return loadTags(res).map(this::loadLinks).map(this::loadAttachments);
|
||||
}
|
||||
|
||||
private static Result<BaseAppointment> loadTags(Result<BaseAppointment> res) {
|
||||
private Result<BaseAppointment> loadTags(Result<BaseAppointment> res) {
|
||||
if (res.optional().isEmpty()) return transform(res);
|
||||
BaseAppointment event = res.optional().get();
|
||||
var id = event.id();
|
||||
@@ -218,7 +218,7 @@ public class MariaDB implements Database {
|
||||
}
|
||||
}
|
||||
|
||||
private static Result<BaseAppointment> loadLinks(Result<BaseAppointment> res) {
|
||||
private Result<BaseAppointment> loadLinks(Result<BaseAppointment> res) {
|
||||
if (res.optional().isEmpty()) return transform(res);
|
||||
BaseAppointment event = res.optional().get();
|
||||
var id = event.id();
|
||||
@@ -241,7 +241,7 @@ public class MariaDB implements Database {
|
||||
}
|
||||
}
|
||||
|
||||
private static Result<Appointment> loadAttachments(Result<BaseAppointment> res) {
|
||||
private Result<Appointment> loadAttachments(Result<BaseAppointment> res) {
|
||||
if (res.optional().isEmpty()) return transform(res);
|
||||
BaseAppointment event = res.optional().get();
|
||||
var id = event.id();
|
||||
|
||||
Reference in New Issue
Block a user