@Signature public long timestamp() { return getWrappedObject().getTimestamp(); }
@Override public Instant getCurrentTimestamp() throws NoSuchElementException { if (current == null) { throw new NoSuchElementException(); } long time = current.getTimestamp(); time *= 1000L; return new Instant(time); }
/** * Get the time when the document is created, in milliseconds. * @return */ public long getTimestamp() { if(StringUtil.isEmpty(id)){ return -1; } ObjectId oid = new ObjectId(id); return oid.getTimestamp() * 1000L; }
public static void addSpecialProperties(final Representation rep, RequestContext.TYPE type, BsonDocument data) { rep.addProperty("_type", new BsonString(type.name())); Object etag = data.get("_etag"); if (etag != null && etag instanceof ObjectId) { if (data.get("_lastupdated_on") == null) { // add the _lastupdated_on in case the _etag field is present and its value is an ObjectId rep.addProperty("_lastupdated_on", new BsonString(Instant.ofEpochSecond(((ObjectId) etag).getTimestamp()).toString())); } } Object id = data.get("_id"); // generate the _created_on timestamp from the _id if this is an instance of ObjectId if (data.get("_created_on") == null && id != null && id instanceof ObjectId) { rep.addProperty("_created_on", new BsonString(Instant.ofEpochSecond(((ObjectId) id).getTimestamp()).toString())); } }
int ts = id.getTimestamp(); int mid = id.getMachineIdentifier(); short pi = id.getProcessIdentifier();
public static void addSpecialProperties( final Representation rep, RequestContext.TYPE type, BsonDocument data) { rep.addProperty("_type", new BsonString(type.name())); Object etag = data.get("_etag"); if (etag != null && etag instanceof ObjectId) { if (data.get("_lastupdated_on") == null) { // add the _lastupdated_on in case the _etag field is present and its value is an ObjectId rep.addProperty("_lastupdated_on", new BsonString(Instant.ofEpochSecond(((ObjectId) etag) .getTimestamp()).toString())); } } }
public static void addSpecialProperties( final Representation rep, final RequestContext.TYPE type, final BsonDocument data) { rep.addProperty(_TYPE, new BsonString(type.name())); Object etag = data.get(_ETAG); if (etag != null && etag instanceof ObjectId) { if (data.get(_LASTUPDATED_ON) == null) { // add the _lastupdated_on in case the _etag field is present and its value is an ObjectId rep.addProperty(_LASTUPDATED_ON, new BsonString(Instant.ofEpochSecond( ((ObjectId) etag).getTimestamp()).toString())); } } }