added url to json
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -52,9 +52,10 @@ public interface Appointment {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* get a json representation of this Appointment
|
* get a json representation of this Appointment
|
||||||
|
* @param urlTemplate the url to put into the ical, with "{}" being replaced by the appointment id
|
||||||
* @return a JSON Object
|
* @return a JSON Object
|
||||||
*/
|
*/
|
||||||
JSONObject json();
|
JSONObject json(String urlTemplate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set of Links that point to related information
|
* set of Links that point to related information
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ public class BaseAppointment implements Appointment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject json() {
|
public JSONObject json(String urlTemplate) {
|
||||||
var json = new JSONObject();
|
var json = new JSONObject();
|
||||||
json.put("attachments", attachments.stream().map(Attachment::json).toList());
|
json.put("attachments", attachments.stream().map(Attachment::json).toList());
|
||||||
json.put("coords", nullable(coords).map(Coords::json).orElse(null));
|
json.put("coords", nullable(coords).map(Coords::json).orElse(null));
|
||||||
@@ -162,7 +162,7 @@ public class BaseAppointment implements Appointment {
|
|||||||
json.put("tags", tags());
|
json.put("tags", tags());
|
||||||
json.put("title", title());
|
json.put("title", title());
|
||||||
json.put("links", links().stream().map(Link::json).toList());
|
json.put("links", links().stream().map(Link::json).toList());
|
||||||
|
json.put("url",urlTemplate.replace("{}",""+id()));
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user