/** * Set the timestamp on which the vertex was created. * * @param timestamp * Creation timestamp */ default void setCreationTimestamp(long timestamp) { property(CREATION_TIMESTAMP_PROPERTY_KEY, timestamp); }
/** * Set the editor and creator references and update the timestamps for created and edited fields. * * @param creator * Creator */ default void setCreated(User creator) { setCreator(creator); setCreationTimestamp(System.currentTimeMillis()); }
/** * Set the creator of the vertex. * * @param user * Creator */ default void setCreator(User user) { setLinkOut(user, HAS_CREATOR); }
/** * Add basic references (creator, editor, created, edited) to the map for the given vertex. * * @param document * JSON document to which basic references will be added * @param vertex * Vertex which will be used to load the basic references */ protected void addBasicReferences(JsonObject document, MeshCoreVertex<?, ?> vertex) { document.put("uuid", vertex.getUuid()); if (vertex instanceof CreatorTrackingVertex) { CreatorTrackingVertex createdVertex = (CreatorTrackingVertex) vertex; addUser(document, "creator", createdVertex.getCreator()); document.put("created", createdVertex.getCreationDate()); } if (vertex instanceof EditorTrackingVertex) { EditorTrackingVertex editedVertex = (EditorTrackingVertex) vertex; addUser(document, "editor", editedVertex.getEditor()); document.put("edited", editedVertex.getLastEditedDate()); } }
public void assertGenericNode(MeshCoreVertex<?, ?> node, AbstractGenericRestResponse model) { assertNotNull(node); assertNotNull(model); assertNotNull("UUID field was not set in the rest response.", model.getUuid()); assertEquals("The uuids should not be different", node.getUuid(), model.getUuid()); assertNotNull("Permissions field was not set in the rest response.", model.getPermissions()); if (node instanceof EditorTrackingVertex) { assertNotNull("Editor field was not set in the rest response.", model.getEditor()); EditorTrackingVertex editedNode = (EditorTrackingVertex) node; assertNotNull("The editor of the graph node was not set.", editedNode.getEditor()); assertEquals(editedNode.getEditor().getFirstname(), model.getEditor()); assertEquals(editedNode.getEditor().getLastname(), model.getEditor().getLastName()); assertEquals(editedNode.getEditor().getUuid(), model.getEditor().getUuid()); } if (node instanceof CreatorTrackingVertex && ((CreatorTrackingVertex) node).getCreator() != null) { assertNotNull("Creator field was not set in the rest response.", model.getCreator()); CreatorTrackingVertex createdNode = (CreatorTrackingVertex) node; assertEquals(createdNode.getCreator().getFirstname(), model.getCreator().getFirstName()); assertEquals(createdNode.getCreator().getLastname(), model.getCreator().getLastName()); assertEquals(createdNode.getCreator().getUuid(), model.getCreator().getUuid()); } } }
/** * Set the creation timestamp using the current time. */ default void setCreationTimestamp() { setCreationTimestamp(System.currentTimeMillis()); }
/** * Return the ISO 8601 formatted creation date. * * @return */ default String getCreationDate() { return DateUtils.toISO8601(getCreationTimestamp(), 0); }
vertex = env.getSource(); return vertex.getCreationDate(); })); vertex = env.getSource(); return gc.requiresPerm(vertex.getCreator(), READ_PERM); }));
public void assertGenericNode(MeshCoreVertex<?, ?> node, AbstractGenericRestResponse model) { assertNotNull(node); assertNotNull(model); assertNotNull("UUID field was not set in the rest response.", model.getUuid()); assertEquals("The uuids should not be different", node.getUuid(), model.getUuid()); assertNotNull("Permissions field was not set in the rest response.", model.getPermissions()); assertNotNull("Creator field was not set in the rest response.", model.getCreator()); assertNotNull("Editor field was not set in the rest response.", model.getEditor()); if (node instanceof EditorTrackingVertex) { EditorTrackingVertex editedNode = (EditorTrackingVertex) node; assertNotNull("The editor of the graph node was not set.", editedNode.getEditor()); assertEquals(editedNode.getEditor().getFirstname(), model.getEditor().getFirstName()); assertEquals(editedNode.getEditor().getLastname(), model.getEditor().getLastName()); assertEquals(editedNode.getEditor().getUuid(), model.getEditor().getUuid()); } if (node instanceof CreatorTrackingVertex) { CreatorTrackingVertex createdNode = (CreatorTrackingVertex) node; assertEquals(createdNode.getCreator().getFirstname(), model.getCreator().getFirstName()); assertEquals(createdNode.getCreator().getLastname(), model.getCreator().getLastName()); assertEquals(createdNode.getCreator().getUuid(), model.getCreator().getUuid()); } } }
/** * Return the timestamp on which the vertex was created. * * @return Creation timestamp */ default Long getCreationTimestamp() { return property(CREATION_TIMESTAMP_PROPERTY_KEY); }