use of org.opencastproject.util.Jsons.Obj in project opencast by opencast.
the class MessageSignature method toJson.
public Obj toJson() {
Obj replyJson = Jsons.ZERO_OBJ;
if (replyTo.isSome())
replyJson = replyTo.get().toJson();
Obj creatorObj = Jsons.obj(Jsons.p("name", creator.getName()), Jsons.p("username", creator.getUsername()), Jsons.p("email", creator.getEmail()));
return Jsons.obj(Jsons.p("id", id), Jsons.p("name", name), Jsons.p("creationDate", creationDate), Jsons.p("creator", creatorObj), Jsons.p("signature", signature), Jsons.p("sender", sender.toJson()), Jsons.p("replyTo", replyJson));
}
use of org.opencastproject.util.Jsons.Obj in project opencast by opencast.
the class EventComment method toJson.
public Obj toJson() {
Obj authorObj = Jsons.obj(Jsons.p("name", author.getName()), Jsons.p("username", author.getUsername()), Jsons.p("email", author.getEmail()));
List<Val> replyArr = new ArrayList<Val>();
for (EventCommentReply reply : replies) {
replyArr.add(reply.toJson());
}
Val idValue = Jsons.ZERO_VAL;
if (id.isSome())
idValue = Jsons.v(id.get());
return Jsons.obj(Jsons.p("id", idValue), Jsons.p("text", text), Jsons.p("creationDate", DateTimeSupport.toUTC(creationDate.getTime())), Jsons.p("modificationDate", DateTimeSupport.toUTC(modificationDate.getTime())), Jsons.p("author", authorObj), Jsons.p("reason", reason), Jsons.p("resolvedStatus", resolvedStatus), Jsons.p("replies", Jsons.arr(replyArr)));
}
use of org.opencastproject.util.Jsons.Obj in project opencast by opencast.
the class EventCommentReply method toJson.
public Obj toJson() {
Obj authorObj = Jsons.obj(Jsons.p("name", author.getName()), Jsons.p("username", author.getUsername()), Jsons.p("email", author.getEmail()));
Val idValue = Jsons.ZERO_VAL;
if (id.isSome())
idValue = Jsons.v(id.get());
return Jsons.obj(Jsons.p("id", idValue), Jsons.p("text", text), Jsons.p("author", authorObj), Jsons.p("creationDate", DateTimeSupport.toUTC(creationDate.getTime())), Jsons.p("modificationDate", DateTimeSupport.toUTC(modificationDate.getTime())));
}
use of org.opencastproject.util.Jsons.Obj in project opencast by opencast.
the class Blacklist method toJson.
public List<Obj> toJson(Option<Long> periodId) {
List<Jsons.Obj> objArr = new ArrayList<>();
Jsons.Obj b;
if (Person.TYPE.equals(type)) {
b = ((Person) blacklisted).toJson();
} else if (Room.TYPE.equals(type)) {
b = ((Room) blacklisted).toJson();
} else {
b = Jsons.ZERO_OBJ;
}
for (Period p : periods) {
if (periodId.isSome() && !periodId.equals(p.getId()))
continue;
String id = "";
if (p.getId().isSome()) {
id = Long.toString(p.getId().get());
}
String purpose = p.getPurpose().getOrElse("");
String comment = p.getComment().getOrElse("");
objArr.add(Jsons.obj(Jsons.p("id", id), Jsons.p("resourceType", type), Jsons.p("resource", b), Jsons.p("start", DateTimeSupport.toUTC(p.getStart().getTime())), Jsons.p("end", DateTimeSupport.toUTC(p.getEnd().getTime())), Jsons.p("purpose", purpose), Jsons.p("comment", comment)));
}
return objArr;
}