got rid of slug idea, as its functionality can be implemented without an additional db field
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -20,7 +20,6 @@ public class BaseAppointment implements Appointment {
|
||||
private long id;
|
||||
private final String title, description;
|
||||
private final LocalDateTime end, start;
|
||||
private final String slug;
|
||||
private Coords coords = null;
|
||||
private final Set<Attachment> attachments = new HashSet<>();
|
||||
private final Set<String> tags = new HashSet<>();
|
||||
@@ -36,10 +35,9 @@ public class BaseAppointment implements Appointment {
|
||||
* @param end set the end date
|
||||
* @param location set the location
|
||||
*/
|
||||
public BaseAppointment(long id, String title, String description, LocalDateTime start, LocalDateTime end, String location, String slug) {
|
||||
public BaseAppointment(long id, String title, String description, LocalDateTime start, LocalDateTime end, String location) {
|
||||
this.description = description;
|
||||
this.end = end;
|
||||
this.slug = slug;
|
||||
this.id = id;
|
||||
this.location = location;
|
||||
this.start = start;
|
||||
@@ -103,7 +101,7 @@ public class BaseAppointment implements Appointment {
|
||||
|
||||
@Override
|
||||
public Appointment clone(long newId) {
|
||||
return new BaseAppointment(newId, title, description, start, end, location, slug) //
|
||||
return new BaseAppointment(newId, title, description, start, end, location) //
|
||||
.coords(coords)
|
||||
.addLinks(links)
|
||||
.add(attachments)
|
||||
@@ -139,7 +137,6 @@ public class BaseAppointment implements Appointment {
|
||||
json.put("end", end().map(end -> end.format(DATE_TIME)).orElse(null));
|
||||
json.put("id", id());
|
||||
json.put("location", location());
|
||||
json.put("slug", slug());
|
||||
json.put("start", start().format(DATE_TIME));
|
||||
json.put("tags", tags());
|
||||
json.put("title", title());
|
||||
@@ -153,13 +150,6 @@ public class BaseAppointment implements Appointment {
|
||||
return location;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String slug() {
|
||||
return slug;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public LocalDateTime start() {
|
||||
return start;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
package de.srsoftware.cal;
|
||||
|
||||
import static de.srsoftware.tools.Result.transform;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import de.srsoftware.cal.api.*;
|
||||
import de.srsoftware.tools.*;
|
||||
@@ -101,9 +100,7 @@ public abstract class BaseImporter implements Importer {
|
||||
if (locationResult.optional().isEmpty()) return transform(locationResult);
|
||||
var location = locationResult.optional().get();
|
||||
|
||||
var hash = hash("%s@%s".formatted(start, location));
|
||||
|
||||
var event = new BaseAppointment(id, title, description, start, end, location, hash) //
|
||||
var event = new BaseAppointment(id, title, description, start, end, location) //
|
||||
.add(extractAttachments(eventTag))
|
||||
.addLinks(extractLinks(eventTag))
|
||||
.tags(extractTags(eventTag));
|
||||
@@ -204,15 +201,6 @@ public abstract class BaseImporter implements Importer {
|
||||
.flatMap(result -> result.optional().stream());
|
||||
}
|
||||
|
||||
/**
|
||||
* create a hash from a text
|
||||
* @param plain the plain text
|
||||
* @return the hash of the plain text
|
||||
*/
|
||||
protected String hash(String plain){
|
||||
return Strings.hex(digest.digest(plain.getBytes(UTF_8)));
|
||||
}
|
||||
|
||||
protected static <T> Result<T> invalidParameter(Result<?> result) {
|
||||
return Error.format("Invalid parameter: %s", result.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user