Beispiel #1
0
 public Map<String, Object> write(Element element) {
   Map<String, Object> entity = new HashMap<String, Object>();
   entity.put(Dictionary.FIELD_RESEND, 0);
   entity.put(Dictionary.FIELD_ACTIVATE, true);
   entity.put(Dictionary.FIELD_PID, element.getId());
   entity.put(Dictionary.FIELD_TYPE, element.getType());
   entity.put(Dictionary.FIELD_TIMESTAMP, System.currentTimeMillis());
   entity.put(Dictionary.FIELD_DELAY, this.format.format(new Date()));
   entity.put(Dictionary.FIELD_CLASS, element.getClass().getSimpleName());
   JID to = this.jidBuilder.build(element.getTo());
   JID from = this.jidBuilder.build(element.getFrom());
   entity.put(Dictionary.FIELD_TO, this.bare ? to.asStringWithBare() : to.asString());
   entity.put(Dictionary.FIELD_FROM, this.bare ? from.asStringWithBare() : from.asString());
   return entity;
 }
Beispiel #2
0
 /*
  * {"id":Xxx}
  *
  * @see com.sissi.persistent.PersistentElement#query(com.sissi.protocol.Element)
  */
 public Map<String, Object> query(Element element) {
   return MongoUtils.asMap(
       BasicDBObjectBuilder.start(Dictionary.FIELD_PID, element.getId()).get());
 }