当前位置: 首页>>代码示例>>Java>>正文


Java VersionIterator.nextVersion方法代码示例

本文整理汇总了Java中javax.jcr.version.VersionIterator.nextVersion方法的典型用法代码示例。如果您正苦于以下问题:Java VersionIterator.nextVersion方法的具体用法?Java VersionIterator.nextVersion怎么用?Java VersionIterator.nextVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.jcr.version.VersionIterator的用法示例。


在下文中一共展示了VersionIterator.nextVersion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getVersionList

import javax.jcr.version.VersionIterator; //导入方法依赖的package包/类
protected List<T> getVersionList(Node node, NodeFilter nodeFilter) {
    try {
        List<T> versionList = new ArrayList<T>();
        //VersionHistory versionHistory = node.getVersionHistory();
        VersionHistory versionHistory = JcrUtils.getVersionManager(node.getSession()).getVersionHistory(node.getPath());
        VersionIterator versionIterator = versionHistory.getAllVersions();
        versionIterator.skip(1);
        while (versionIterator.hasNext()) {
            Version version = versionIterator.nextVersion();
            NodeIterator nodeIterator = version.getNodes();
            while (nodeIterator.hasNext()) {
                T entityVersion = getJcrom().fromNode(getEntityClass(), nodeIterator.nextNode(), nodeFilter);
                //Version baseVersion = node.getBaseVersion();
                Version baseVersion = JcrUtils.getVersionManager(node.getSession()).getBaseVersion(node.getPath());
                getJcrom().setBaseVersionInfo(entityVersion, baseVersion.getName(), baseVersion.getCreated());
                versionList.add(entityVersion);
            }
        }
        return versionList;
    } catch (RepositoryException e) {
        throw new JcrMappingException("Could not get version list", e);
    }
}
 
开发者ID:dooApp,项目名称:jcromfx,代码行数:24,代码来源:AbstractJcrDAO.java

示例2: initialize

import javax.jcr.version.VersionIterator; //导入方法依赖的package包/类
private void initialize() throws RepositoryException {
    if (versionName.equals("latest")) {
        populate(resource, resource.getPath(), 0);
        versionDate = Properties.lastModified(resource);
    }

    VersionManager versionManager = resource.getResourceResolver().adaptTo(Session.class).getWorkspace().getVersionManager();
    try {
        VersionHistory history = versionManager.getVersionHistory(this.resource.getPath());
        VersionIterator versionIterator = history.getAllVersions();
        while (versionIterator.hasNext()) {
            Version next = versionIterator.nextVersion();
            versionSelection.add(new VersionSelectionImpl(next.getName(), next.getCreated().getTime()));
            if (next.getName().equalsIgnoreCase(versionName)) {
                String versionPath = next.getFrozenNode().getPath();
                Resource versionResource = resource.getResourceResolver().resolve(versionPath);
                populate(versionResource, versionPath, 0);
                versionDate = next.getCreated().getTime();
            }
        }
    } catch (javax.jcr.UnsupportedRepositoryOperationException e) {
        log.debug(String.format("node %s not versionable", this.resource.getPath()));
    }
    versionSelection.add(new VersionSelectionImpl("latest", Properties.lastModified(resource)));
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:26,代码来源:PageCompareDataImpl.java

示例3: getVersionFiles

import javax.jcr.version.VersionIterator; //导入方法依赖的package包/类
@Override
public List<VersionFile> getVersionFiles(String path) throws Exception{
	path = processPath(path);
	Node rootNode=getRootNode();
	if (!rootNode.hasNode(path)) {
		throw new RuleException("File [" + path + "] not exist.");
	}
	List<VersionFile> files = new ArrayList<VersionFile>();
	Node fileNode = rootNode.getNode(path);
	VersionHistory versionHistory = versionManager.getVersionHistory(fileNode.getPath());
	VersionIterator iterator = versionHistory.getAllVersions();
	while (iterator.hasNext()) {
		Version version = iterator.nextVersion();
		String versionName = version.getName();
		if (versionName.startsWith("jcr:")) {
			continue; // skip root version
		}
		Node fnode = version.getFrozenNode();
		VersionFile file = new VersionFile();
		file.setName(version.getName());
		file.setPath(fileNode.getPath());
		Property prop = fnode.getProperty(CRATE_USER);
		file.setCreateUser(prop.getString());
		prop = fnode.getProperty(CRATE_DATE);
		file.setCreateDate(prop.getDate().getTime());
		if(fnode.hasProperty(VERSION_COMMENT)){
			prop=fnode.getProperty(VERSION_COMMENT);
			file.setComment(prop.getString());
		}
		files.add(file);
	}
	return files;
}
 
开发者ID:youseries,项目名称:urule,代码行数:34,代码来源:BaseRepositoryService.java

示例4: getVersionInfos

import javax.jcr.version.VersionIterator; //导入方法依赖的package包/类
public VersionInfo[] getVersionInfos(String id) throws NotFoundException {
	// checkPath(path);

	Node node = getNodeById(id);
	if (!isVersionable(node)) {
		// TODO throws an custom exception
		return new VersionInfo[0];
	}

	List<VersionInfo> versionInfos = new ArrayList<VersionInfo>();
	try {
		VersionHistory versionHistory = getSession().getWorkspace().getVersionManager()
				.getVersionHistory(node.getPath());
		Version baseVersion = getSession().getWorkspace().getVersionManager().getBaseVersion(node.getPath());
		VersionIterator versions = versionHistory.getAllVersions();
		versions.skip(1);
		while (versions.hasNext()) {
			Version version = versions.nextVersion();
			NodeIterator nodes = version.getNodes();
			while (nodes.hasNext()) {
				VersionInfo versionInfo = new VersionInfo();
				versionInfo.setName(version.getName());
				try {
					Entity entity = getEntity(nodes.nextNode());
					// after StorageUpdate20 when com.asf.nextserver package
					// was renamed with ro.nextreports.server
					// all version nodes remained with older className (they
					// cannot be changed because they are protected)
					// so they cannot be accessed anymore!
					if (entity == null) {
						continue;
					}
					String createdBy = entity.getLastUpdatedBy();
					if (createdBy == null) {
						createdBy = entity.getCreatedBy();
					}
					versionInfo.setCreatedBy(createdBy);
					versionInfo.setCreatedDate(version.getCreated().getTime());
					versionInfo.setBaseVersion(baseVersion.getName().equals(version.getName()));
					versionInfos.add(versionInfo);
				} catch (JcrMappingException ex) {
					// getEntity version is not found???
					// @todo why?
				}
			}
		}
	} catch (RepositoryException e) {
		throw convertJcrAccessException(e);
	}

	return versionInfos.toArray(new VersionInfo[versionInfos.size()]);
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:53,代码来源:JcrStorageDao.java


注:本文中的javax.jcr.version.VersionIterator.nextVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。