/** * Get creation date of this version. * * @return creation date as calendar */ public Calendar getCreated() throws RepositoryException { return this.state.getCreated(); }
/** * @inheritDoc */ public Calendar getCreated() throws RepositoryException { return version.getCreated(); }
@Override public Calendar getCreated() throws RepositoryException { return version.getCreated(); }
@Override public Calendar getCreated() throws RepositoryException { return delegate.getCreated(); }
@Override public Date getVersionDate() { try { return version.getCreated().getTime(); } catch (RepositoryException e) { log.warn("Could not get created date from version", e); } return null; }
@Override public Date getVersionDate() { try { return version.getCreated().getTime(); } catch (RepositoryException e) { log.warn("Could not get created date from version", e); } return null; }
public int compare(Version v1, Version v2) { try { return v2.getCreated().compareTo(v1.getCreated()); } catch (RepositoryException e) { return 0; } } });
/** {@inheritDoc} */ public Calendar getCreated() throws RepositoryException { try { return version.getCreated(); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
public Calendar getCreated() { try { return version.getCreated(); } catch (RepositoryException e) { throw new VersionException("Error while retrieving the version creation date", e); } }
public Calendar getCreated() { try { return version.getCreated(); } catch (RepositoryException e) { throw new VersionException("Error while retrieving the version creation date", e); } }
@Override public Calendar getCreated() throws RepositoryException { return getWrappedVersion().getCreated(); }
public Calendar execute() throws Exception { return getDelegate().getCreated(); } });
public Calendar getCreated() throws RepositoryException { return getDelegate().getCreated(); }
/** * Sets the name of the user that performed the most recent activation as well as to current time, last activated version name and last activated version creation time. */ public static void update(Node node, String userName, boolean isActivated, Version version) throws RepositoryException { checkNodeType(node, Activatable.NAME, LAST_ACTIVATED, LAST_ACTIVATED_BY, ACTIVATION_STATUS, LAST_ACTIVATED_VERSION); node.setProperty(LAST_ACTIVATED, getCurrentCalendar()); node.setProperty(LAST_ACTIVATED_BY, userName); node.setProperty(ACTIVATION_STATUS, isActivated); if (version != null) { node.setProperty(LAST_ACTIVATED_VERSION, version.getName()); node.setProperty(LAST_ACTIVATED_VERSION_CREATED, version.getCreated()); } }
/** * Returns the date this version was created. */ public void testGetCreated() throws RepositoryException { // create version versionableNode.checkout(); Version version = versionableNode.checkin(); Calendar now = GregorianCalendar.getInstance(); now.add(Calendar.SECOND, 1); assertTrue("Method getCreated() should return a creation date before current date.", version.getCreated().before(now)); }
/** * Returns the current base version of given node. */ public Version getBaseVersion(Node node) throws UnsupportedOperationException, RepositoryException { VersionIterator versionIterator = getAllVersions(node); Version baseVersion = null; if (versionIterator != null) { while (versionIterator.hasNext()) { Version version = versionIterator.nextVersion(); if (baseVersion == null) { baseVersion = version; } else if (baseVersion.getCreated().compareTo(version.getCreated()) < 0) { baseVersion = version; } } } if (baseVersion == null) { throw new RepositoryException("Node " + node.getPath() + " was never versioned"); } return baseVersion; }
protected Version lookupVersion(Node variant, Calendar historic) throws RepositoryException { VersionHistory versionHistory = variant.getVersionHistory(); for (VersionIterator iter = versionHistory.getAllVersions(); iter.hasNext(); ) { Version version = iter.nextVersion(); if (version.getCreated().equals(historic)) { return version; } } return null; } }
@Override protected String getCreationDate() { if (exists()) { Version v = (Version) item; try { return HttpDateFormat.creationDateFormat().format(v.getCreated().getTime()); } catch (RepositoryException e) { log.error(e.getMessage()); } } // fallback return super.getCreationDate(); } }
private Node prepareVersionedNode() throws Exception { Session session = MgnlContext.getJCRSession(RepositoryConstants.WEBSITE); Node node = session.getRootNode().addNode("test", NodeTypes.Content.NAME); Version version = Components.newInstance(VersionManager.class).addVersion(node); versionCreationTime.setTime(version.getCreated().getTime()); activationTime.add(Calendar.HOUR, 10); node.setProperty(NodeTypes.Activatable.LAST_ACTIVATED, activationTime); node.setProperty(NodeTypes.Activatable.LAST_ACTIVATED_VERSION, version.getName()); node.setProperty(NodeTypes.Activatable.LAST_ACTIVATED_VERSION_CREATED, versionCreationTime); node.setProperty(NodeTypes.Activatable.ACTIVATION_STATUS, true); return node; } }
/** * Returns the date this version was created. This corresponds to the value * of the jcr:created property in the nt:version node that represents this * version. */ public void testGetCreatedCheckAgainstProperty() throws RepositoryException { // create version versionableNode.checkout(); Version version = versionableNode.checkin(); Calendar calGetCreated = version.getCreated(); Calendar calCreatedProp = version.getProperty(jcrCreated).getValue().getDate(); assertEquals("Method getCreated() should return value of the jcr:created property.", calGetCreated, calCreatedProp); }