@Test public void toJSONOutputsAllInfo() { Calendar c = Calendar.getInstance(); AuditEvent e = new AuditEvent(this.user, "127.0.0.1", "view", "extra", this.doc, c); JSONObject result = e.toJSON(); Assert.assertEquals("wiki:XWiki.user", result.get("user")); Assert.assertEquals("127.0.0.1", result.get("ip")); Assert.assertEquals("view", result.get("action")); Assert.assertEquals("extra", result.get("extra")); Assert.assertEquals("wiki:Space.Page", result.get("entity")); Assert.assertEquals(DateTimeFormatter.ISO_INSTANT.format(c.toInstant()), result.get("time")); }
public JSONObject toJSON() { JSONObject event = new JSONObject(); event.put("user", this.user == null ? null : this.user.getId()); event.put("ip", this.ip); event.put("action", this.action); event.put("extra", this.extra); event.put("entity", this.entity == null ? null : this.entity.toString()); event.put("time", this.time == null ? null : this.time.toInstant().toString()); return event; }
AuditEvent { public JSONObject toJSON() { JSONObject event = new JSONObject(); event.put("user", this.user == null ? null : this.user.getId()); event.put("ip", this.ip); event.put("action", this.action); event.put("extra", this.extra); event.put("entity", this.entity == null ? null : this.entity.toString()); event.put("time", this.time == null ? null : this.time.toInstant().toString()); return event; } }
AuditEvent { public JSONObject toJSON() { JSONObject event = new JSONObject(); event.put("user", this.user == null ? null : this.user.getId()); event.put("ip", this.ip); event.put("action", this.action); event.put("extra", this.extra); event.put("entity", this.entity == null ? null : this.entity.toString()); event.put("time", this.time == null ? null : this.time.toInstant().toString()); return event; } AuditEvent();  AuditEvent(final User user, final String ip,
        final String action, final String extra,
        final DocumentReference entity,
        final Calendar time); }
AuditEvent { public JSONObject toJSON() { JSONObject event = new JSONObject(); event.put("user", this.user == null ? null : this.user.getId()); event.put("ip", this.ip); event.put("action", this.action); event.put("extra", this.extra); event.put("entity", this.entity == null ? null : this.entity.toString()); event.put("time", this.time == null ? null : this.time.toInstant().toString()); return event; } AuditEvent();  AuditEvent(final User user, final String ip,
        final String action, final String extra,
        final DocumentReference entity,
        final Calendar time); @Nullable User getUser(); @Nullable String getIp(); @Nonnull String getAction(); @Nullable String getExtraInformation(); @Nullable DocumentReference getEntity(); @Nonnull Calendar getTime(); @Override String toString(); @Override boolean equals(Object other); @Override int hashCode(); JSONObject toJSON(); }
AuditEvent { public JSONObject toJSON() { JSONObject event = new JSONObject(); event.put("user", this.user == null ? null : this.user.getId()); event.put("ip", this.ip); event.put("action", this.action); event.put("extra", this.extra); event.put("entity", this.entity == null ? null : this.entity.toString()); event.put("time", this.time == null ? null : this.time.toInstant().toString()); return event; } AuditEvent();  AuditEvent(final User user, final String ip,
        final String action, final String extra,
        final DocumentReference entity,
        final Calendar time); @Nullable User getUser(); @Nullable String getIp(); @Nonnull String getAction(); @Nullable String getExtraInformation(); @Nullable DocumentReference getEntity(); @Nonnull Calendar getTime(); @Override String toString(); @Override boolean equals(Object other); @Override int hashCode(); JSONObject toJSON();  }