javax.jcr.version.Version.getCreated()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中javax.jcr.version.Version.getCreated()方法的一些代码示例,展示了Version.getCreated()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.getCreated()方法的具体详情如下:
包路径:javax.jcr.version.Version
类名称:Version
方法名:getCreated

Version.getCreated介绍

[英]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.
[中]返回创建此版本的日期。这对应于nt:version节点中代表此版本的jcr:created属性的值。

代码示例

代码示例来源:origin: info.magnolia/magnolia-core

/**
 * Get creation date of this version.
 *
 * @return creation date as calendar
 */
public Calendar getCreated() throws RepositoryException {
  return this.state.getCreated();
}

代码示例来源:origin: org.onehippo.cms7/hippo-repository-connector

/**
 * @inheritDoc
 */
public Calendar getCreated() throws RepositoryException {
  return version.getCreated();
}

代码示例来源:origin: info.magnolia/magnolia-core

@Override
public Calendar getCreated() throws RepositoryException {
  return version.getCreated();
}

代码示例来源:origin: net.adamcin.oakpal/oakpal-core

@Override
public Calendar getCreated() throws RepositoryException {
  return delegate.getCreated();
}

代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons

@Override
public Date getVersionDate() {
  try {
    return version.getCreated().getTime();
  } catch (RepositoryException e) {
    log.warn("Could not get created date from version", e);
  }
  return null;
}

代码示例来源:origin: com.adobe.acs/acs-aem-commons-bundle

@Override
public Date getVersionDate() {
  try {
    return version.getCreated().getTime();
  } catch (RepositoryException e) {
    log.warn("Could not get created date from version", e);
  }
  return null;
}

代码示例来源:origin: com.adobe.acs/acs-aem-commons-bundle

public int compare(Version v1, Version v2) {
    try {
      return v2.getCreated().compareTo(v1.getCreated());
    } catch (RepositoryException e) {
      return 0;
    }
  }
});

代码示例来源:origin: apache/jackrabbit

/** {@inheritDoc} */
public Calendar getCreated() throws RepositoryException {
  try {
    return version.getCreated();
  } catch (RepositoryException ex) {
    throw getRepositoryException(ex);
  }
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-ocm

public Calendar getCreated()
{
  try
  {
    return version.getCreated();
  }
  catch (RepositoryException e)
  {
    throw new VersionException("Error while retrieving the version creation date", e);
  }
}

代码示例来源:origin: org.apache/jackrabbit-ocm

public Calendar getCreated()
{
  try
  {
    return version.getCreated();
  }
  catch (RepositoryException e)
  {
    throw new VersionException("Error while retrieving the version creation date", e);
  }
}

代码示例来源:origin: info.magnolia/magnolia-core

@Override
public Calendar getCreated() throws RepositoryException {
  return getWrappedVersion().getCreated();
}

代码示例来源:origin: brix-cms/brix-cms

public Calendar execute() throws Exception {
    return getDelegate().getCreated();
  }
});

代码示例来源:origin: brix-cms/brix-cms

public Calendar getCreated() throws RepositoryException {
  return getDelegate().getCreated();
}

代码示例来源:origin: info.magnolia/magnolia-core

/**
 * 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());
  }
}

代码示例来源:origin: apache/jackrabbit

/**
 * 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));
}

代码示例来源:origin: info.magnolia/magnolia-core

/**
 * 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;
}

代码示例来源:origin: org.onehippo.cms7/hippo-repository-workflow

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;
  }
}

代码示例来源:origin: apache/jackrabbit

@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();
  }
}

代码示例来源:origin: info.magnolia/magnolia-core

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;
  }
}

代码示例来源:origin: apache/jackrabbit

/**
 * 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);
}

相关文章