minor tweak to Wotufa importer, added AtParty importer

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-01-02 19:29:52 +01:00
parent 87c67f4aee
commit c561be4b9c
6 changed files with 256 additions and 9 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ dependencies {
implementation("de.srsoftware:configuration.json:1.0.0")
implementation("de.srsoftware:tools.http:1.2.2")
implementation("de.srsoftware:tools.logging:1.0.3")
implementation("de.srsoftware:tools.logging:1.0.5")
implementation("de.srsoftware:tools.plugin:1.0.1")
implementation("de.srsoftware:tools.util:1.3.0")
implementation("de.srsoftware:tools.web:1.3.14")
@@ -52,7 +52,9 @@ public class Application {
*/
public static void main(String[] args) throws IOException, SQLException {
LOG.log(INFO, "Starting application…");
if (LOG instanceof ColorLogger colorLogger) colorLogger.setLogLevel(DEBUG);
ColorLogger.setRootLogLevel(DEBUG);
ColorLogger.setLogLevel("jdk.event.security",INFO);
ColorLogger.setLogLevel("sun.net.www.protocol.http.HttpURLConnection",INFO);
JsonConfig jsonConfig = new JsonConfig("OpenCloudCal");
Optional<String> staticPath = jsonConfig.get("opencloudcal.static");
var db = connect(jsonConfig);
@@ -209,7 +209,7 @@ public class AutoImporter implements Runnable, ClassListener {
if (lastImport == null || Duration.between(lastImport,now).minusHours(6).isPositive()) {
for (var importer : importers) {
try {
importer.fetch().map(AutoImporter::autoAddTags).forEach(this::saveOrUpdate);
importer.fetch().map(AutoImporter::autoAddTags).forEach(event -> saveOrUpdate(event,importer));
} catch (IOException e) {
LOG.log(WARNING, "{0}.fetch() failed", importer, e);
}
@@ -251,7 +251,7 @@ public class AutoImporter implements Runnable, ClassListener {
return baseAppointment;
}
private void saveOrUpdate(Appointment appointment) {
private void saveOrUpdate(Appointment appointment, Importer importer) {
var location = appointment.location();
if (location.isEmpty()){
LOG.log(WARNING,"Skipping %s, since this event has no location!");
@@ -267,12 +267,12 @@ public class AutoImporter implements Runnable, ClassListener {
var saved = res.optional();
if (saved.isPresent()){
if (loaded.isPresent()) {
LOG.log(INFO, "UPDATED: {0}.", saved.get());
LOG.log(INFO, "UPDATED: {0} from {1}.", saved.get(),importer.getClass().getSimpleName());
} else {
LOG.log(INFO, "CREATED: {0}.", saved.get());
LOG.log(INFO, "CREATED: {0} from {1}.", saved.get(),importer.getClass().getSimpleName());
}
} else {
LOG.log(WARNING,"Failed to save {0}!",appointment);
LOG.log(WARNING,"Failed to save {0} from {1}!",appointment,importer.getClass().getSimpleName());
}
}