/** * @inheritDoc */ public Calendar getDate() throws ValueFormatException, RepositoryException { return property.getDate(); }
public Object jsGet_date() { try { return property.getDate(); } catch (RepositoryException re) { return Undefined.instance; } }
/** * Returns the date when the node was last activated or null if no activation date has been stored on the node. */ public static Calendar getLastActivated(Node node) throws RepositoryException { return node.hasProperty(LAST_ACTIVATED) ? node.getProperty(LAST_ACTIVATED).getDate() : null; }
/** * Returns the latest activated version creation time or null if the version creation time isn't set. */ public static Calendar getLastActivatedVersionCreated(Node node) throws RepositoryException { return node.hasProperty(LAST_ACTIVATED_VERSION_CREATED) ? node.getProperty(LAST_ACTIVATED_VERSION_CREATED).getDate() : null; }
/** * Returns the date when the node was deleted or null if no deletion date has been stored on the node. */ public static Calendar getDeleted(Node node) throws RepositoryException { return node.hasProperty(DELETED) ? node.getProperty(DELETED).getDate() : null; }
/** * Returns the creation date of a node or null if creation date isn't set. */ public static Calendar getCreated(Node node) throws RepositoryException { return node.hasProperty(CREATED) ? node.getProperty(CREATED).getDate() : null; }
/** * @return the lastModification or null it it was not set in JCR. * @deprecated since 5.0 use {@link info.magnolia.jcr.util.NodeTypes.LastModified#getLastModified(javax.jcr.Node)}. */ public static Calendar getLastModification(Node node) throws PathNotFoundException, RepositoryException, ValueFormatException { Node meta = node.getNode(MetaData.DEFAULT_META_NODE); String lastMod = RepositoryConstants.NAMESPACE_PREFIX + ":" + MetaData.LAST_MODIFIED; return (meta.hasProperty(lastMod)) ? meta.getProperty(lastMod).getDate() : null; }
/** * {@inheritDoc} */ public long getLastModified() { try { return content.getProperty(JcrConstants.JCR_LASTMODIFIED).getDate().getTimeInMillis(); } catch (RepositoryException e) { log.error("Error while retrieving last modified of " + content, e); return 0; } }
private long getVersionStamp(final Node node) throws RepositoryException { final long versionStamp; if (node.hasProperty(HstNodeTypes.GENERAL_PROPERTY_LAST_MODIFIED)) { versionStamp = node.getProperty(HstNodeTypes.GENERAL_PROPERTY_LAST_MODIFIED).getDate().getTimeInMillis(); } else { versionStamp = 0; } return versionStamp; }
/** * Returns the date when this node was last modified. If the no modification date has been stored on the node this * method return the creation date if set, otherwise null is returned. */ public static Calendar getLastModified(Node node) throws RepositoryException { return node.hasProperty(LAST_MODIFIED) ? node.getProperty(LAST_MODIFIED).getDate() : Created.getCreated(node); }
@Override public void leaving(final Node node, int level) throws RepositoryException { if (node.hasNode("defaultcontent_1_6:date")) { Node dateNode = node.getNode("defaultcontent_1_6:date"); Calendar value = dateNode.getProperty("hippostd:date").getDate(); dateNode.remove(); node.setProperty("defaultcontent_1_6:date", value); } } });
public JcrVersion(Node node) throws RepositoryException { // frozen node initVersion(node); Node parent = node.getParent(); if (parent.hasProperty("jcr:created")) { lastModified = parent.getProperty("jcr:created").getDate().getTime(); } }
public Calendar getDateProperty(String name) { try { final Property property = getJCRProperty(name); if (property != null) { return property.getDate(); } } catch (RepositoryException re) { log.error(re.getMessage(), re); } return null; }
@Override public Calendar getDate() { if (isExist()) { try { return getJCRProperty().getDate(); } catch (RepositoryException e) { throw new RuntimeException("Can't read value of nodedata " + toString(), e); } } return null; }
public JcrVersion(Version version) throws RepositoryException { // storing node's properties into variables to reduce 'throws' for // getters Node frozen = version.getNode(JcrNT.FROZEN_NODE); initVersion(frozen); lastModified = version.getProperty("jcr:created").getDate().getTime(); }
public Object doInJcr( final Session session ) throws RepositoryException { Item item = session.getItem( absPath ); Assert.isTrue( !item.isNode() ); return ( (Property) item ).getDate().getTime(); } } );
@Test public void testSetCreation() throws RepositoryException { // GIVEN final String userName = "Junit"; // WHEN NodeTypes.Created.set(first, userName, Calendar.getInstance()); // THEN assertTrue("Created should just have been set", (Calendar.getInstance().getTimeInMillis() - first.getProperty(NodeTypes.Created.CREATED).getDate().getTimeInMillis()) < 1000); assertEquals(first.getProperty(NodeTypes.Created.CREATED).getString(), first.getProperty(NodeTypes.LastModified.LAST_MODIFIED).getString()); assertEquals(userName, first.getProperty(NodeTypes.Created.CREATED_BY).getString()); assertEquals(userName, first.getProperty(NodeTypes.LastModified.LAST_MODIFIED_BY).getString()); }
@Test public void setPropertyToDate() throws Exception { // GIVEN final Object value = new Date(); PropertyUtil.setProperty(root, PROPERTY_NAME, value); // WHEN Calendar res = root.getProperty(PROPERTY_NAME).getDate(); // THEN assertEquals(value, res.getTime()); }
@Test public void setPropertyToCalendar() throws Exception { // GIVEN final Object value = Calendar.getInstance(); PropertyUtil.setProperty(root, PROPERTY_NAME, value); // WHEN Calendar res = root.getProperty(PROPERTY_NAME).getDate(); // THEN assertEquals(value, res); }
@Test public void shouldAccessCreationDatePropertyForDocument() throws Exception { Node node = getSession().getNode("/cmis/My_Folder-0-0/My_Document-1-0"); Calendar date = node.getProperty("jcr:created").getDate(); assertTrue(date != null); }