• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Version类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.alfresco.service.cmr.version.Version的典型用法代码示例。如果您正苦于以下问题:Java Version类的具体用法?Java Version怎么用?Java Version使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Version类属于org.alfresco.service.cmr.version包,在下文中一共展示了Version类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getHeadVersion

import org.alfresco.service.cmr.version.Version; //导入依赖的package包/类
/**
 * Get the head version given a node reference
 *
 * @param nodeRef   the node reference
 * @return          the 'head' version
 */
private Version getHeadVersion(NodeRef nodeRef)
{
    NodeRef versionHistoryNodeRef = getVersionHistoryNodeRef(nodeRef);
    
    Version headVersion = null;
    if (versionHistoryNodeRef != null)
    {
        VersionHistory versionHistory = buildVersionHistory(versionHistoryNodeRef, nodeRef);
        if (versionHistory != null)
        {
            headVersion = versionHistory.getHeadVersion();
        }
    }
    return headVersion;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:Version2ServiceImpl.java


示例2: checkFirstVersion

import org.alfresco.service.cmr.version.Version; //导入依赖的package包/类
private void checkFirstVersion(NodeRef mlContainerNodeRef)
{
    // get the edition list of edition
    VersionHistory editionHistory = editionService.getEditions(mlContainerNodeRef);

    // Ensure that the first edition of the mlContainer is created
    assertNotNull("The edition history can't be null", editionHistory);
    // Ensure that it contains only one version
    assertTrue("The edition history must contain only one edition", editionHistory.getAllVersions().size() == 1);

    // get the edition
    Version currentEdition = editionHistory.getAllVersions().iterator().next();

    // Ensure that this version is the edition of the mlContainer
    assertTrue("The versioned mlContainer noderef of the editon must be the noderef of the created mlContainer", currentEdition.getVersionedNodeRef().equals(mlContainerNodeRef));

    // get the list of translations
    List<VersionHistory> translations = editionService.getVersionedTranslations(currentEdition);

    // Ensure that the get versioned translations is empty
    assertNotNull("The translations list of the current edition can't be null", translations);
    // Ensure that the list is empty
    assertTrue("The translations list of the current edition would be empty", translations.size() == 0);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:EditionServiceImplTest.java


示例3: testGetVersion

import org.alfresco.service.cmr.version.Version; //导入依赖的package包/类
/**
 * Test getVersion
 */
public void testGetVersion()
{
    VersionHistoryImpl vh = testAddVersionImpl();
   
    Version version1 = vh.getVersion("1");
    assertEquals(version1.getVersionLabel(), this.rootVersion.getVersionLabel());
    
    Version version2 = vh.getVersion("2");
    assertEquals(version2.getVersionLabel(), this.childVersion1.getVersionLabel());
    
    Version version3 = vh.getVersion("3");
    assertEquals(version3.getVersionLabel(), this.childVersion2.getVersionLabel());
    
    try
    {
        vh.getVersion("invalidLabel");
        fail("An exception should have been thrown if the version can not be retrieved.");
    }
    catch (VersionDoesNotExistException exception)
    {
        System.out.println("Error message: " + exception.getMessage());
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:VersionHistoryImplTest.java


示例4: getCurrentVersion

import org.alfresco.service.cmr.version.Version; //导入依赖的package包/类
/**
 * @see VersionService#getCurrentVersion(NodeRef)
 */
public Version getCurrentVersion(NodeRef nodeRef)
{
    if (logger.isDebugEnabled())
    {
        logger.debug("Run as user " + AuthenticationUtil.getRunAsUser());
        logger.debug("Fully authenticated " + AuthenticationUtil.getFullyAuthenticatedUser());
    }
    
    Version version = null;

    if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE) == true)
    {
        VersionHistory versionHistory = getVersionHistory(nodeRef);
        if (versionHistory != null)
        {
            String versionLabel = (String)this.nodeService.getProperty(nodeRef, ContentModel.PROP_VERSION_LABEL);
            version = versionHistory.getVersion(versionLabel);
        }
    }

    return version;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:VersionServiceImpl.java


示例5: testGetAspects

import org.alfresco.service.cmr.version.Version; //导入依赖的package包/类
/**
 * Test getAspects
 */
public void testGetAspects() 
{
    // Create a new versionable node
    NodeRef versionableNode = createNewVersionableNode();
    Set<QName> origAspects = this.dbNodeService.getAspects(versionableNode);
    
    // Create a new version
    Version version = createVersion(versionableNode, this.versionProperties);
    
    Set<QName> aspects = this.versionStoreNodeService.getAspects(version.getFrozenStateNodeRef());
    assertEquals(origAspects.size(), aspects.size());
    
    for (QName origAspect : origAspects)
    { 
        assertTrue(origAspect+"",aspects.contains(origAspect));
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:NodeServiceImplTest.java


示例6: mapVersionInfo

import org.alfresco.service.cmr.version.Version; //导入依赖的package包/类
public void mapVersionInfo(Version v, Node aNode, NodeRef nodeRef)
{
    aNode.setNodeRef(nodeRef);
    aNode.setVersionComment(v.getDescription());

    Map<String, Object> props = aNode.getProperties();
    if (props != null)
    {
        // special case (as per Version2Service)
        props.put("cm:"+Version2Model.PROP_VERSION_TYPE, v.getVersionProperty(Version2Model.PROP_VERSION_TYPE));
    }

    //Don't show parentId, createdAt, createdByUser
    aNode.setParentId(null);
    aNode.setCreated(null);
    aNode.setCreatedByUser(null);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:18,代码来源:NodeVersionsRelation.java


示例7: testGetAssociationTargets

import org.alfresco.service.cmr.version.Version; //导入依赖的package包/类
/**
 * Test getAssociationTargets
 */
public void testGetAssociationTargets()
{
    // Create a new versionable node
    NodeRef versionableNode = createNewVersionableNode();
    
    // Store the current details of the target associations
    List<AssociationRef> origAssocs = this.dbNodeService.getTargetAssocs(
            versionableNode,
            RegexQNamePattern.MATCH_ALL);
    
    // Create a new version
    Version version = createVersion(versionableNode, this.versionProperties);
    
    List<AssociationRef> assocs = this.versionStoreNodeService.getTargetAssocs(
            version.getFrozenStateNodeRef(), 
            RegexQNamePattern.MATCH_ALL);
    assertNotNull(assocs);
    assertEquals(origAssocs.size(), assocs.size());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:NodeServiceImplTest.java


示例8: testGetParentAssocs

import org.alfresco.service.cmr.version.Version; //导入依赖的package包/类
/**
 * Test getParentAssocs
 */
public void testGetParentAssocs()
{
    // Create a new versionable node
    NodeRef versionableNode = createNewVersionableNode();
    
    // Create a new version
    Version version = createVersion(versionableNode, this.versionProperties);
    NodeRef nodeRef = version.getFrozenStateNodeRef();
    
    List<ChildAssociationRef> results = this.versionStoreNodeService.getParentAssocs(nodeRef);
    assertNotNull(results);
    assertEquals(1, results.size());
    ChildAssociationRef childAssoc = results.get(0);
    assertEquals(nodeRef, childAssoc.getChildRef());
    NodeRef versionStoreRoot = this.dbNodeService.getRootNode(this.versionService.getVersionStoreReference());
    assertEquals(versionStoreRoot, childAssoc.getParentRef());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:NodeServiceImplTest.java


示例9: getVersion

import org.alfresco.service.cmr.version.Version; //导入依赖的package包/类
/**
 * Gets a version with a specified version label.  The version label is guaranteed 
 * unique within the version history.
 * 
 * @param versionLabel                   the version label
 * @return                               the version object
 * @throws VersionDoesNotExistException  indicates requested version does not exist
 */
public Version getVersion(String versionLabel)
{
    Version result = null;
    if (versionLabel != null)
    {
        result = this.versionsByLabel.get(versionLabel);
        
        if (result == null)
        {
            // Throw exception indicating that the version does not exit
            throw new VersionDoesNotExistException(versionLabel);
        }
    }
    return result;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:VersionHistoryImpl.java


示例10: dumpFrozenMetaData

import org.alfresco.service.cmr.version.Version; //导入依赖的package包/类
private void dumpFrozenMetaData(Version editionVersion)
{
    System.out.println("---------------------------------------------------");
    //Get current version label
    System.out.println("Version Label: " + editionVersion.getVersionLabel());
    System.out.println("---------------------------------------------------");
    //Map<QName,Serializable> mapOfFrozenProps = editionService.getVersionedMetadatas(editionVersion);
    Map<String,Serializable> mapOfFrozenProps = editionVersion.getVersionProperties();
    if(mapOfFrozenProps == null )
    {
        System.out.println("Nul... ");
        return;
    }

    for(String  q: mapOfFrozenProps.keySet())
    {
        String val = mapOfFrozenProps.get(q)==null?"null":mapOfFrozenProps.get(q).toString();
        System.out.println("QName:" + q + ":" +  val);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:EditionServiceImplTest.java


示例11: createVersion

import org.alfresco.service.cmr.version.Version; //导入依赖的package包/类
@Override
public Collection<Version> createVersion(NodeRef nodeRef, Map<String, Serializable> versionProperties,
            boolean versionChildren) throws ReservedVersionNameException, AspectMissingException
{
    VersionServiceTrait theTrait = getTrait();
    Reference reference = Reference.fromNodeRef(nodeRef);
    if (reference == null)
    {
        return theTrait.createVersion(nodeRef,
                                      versionProperties,
                                      versionChildren);
    }
    else
    {
        NodeRef materialNode = smartStore.materializeIfPossible(nodeRef);
        Collection<Version> actualVersions = theTrait.createVersion(materialNode,
                                                                    versionProperties,
                                                                    versionChildren);

        return virtualizeVersions(reference,
                                  actualVersions);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:VirtualVersionServiceExtension.java


示例12: getCurrentVersion

import org.alfresco.service.cmr.version.Version; //导入依赖的package包/类
@Override
public Version getCurrentVersion(NodeRef nodeRef)
{
    VersionServiceTrait theTrait = getTrait();
    Reference reference = Reference.fromNodeRef(nodeRef);
    if (reference == null)
    {
        return theTrait.getCurrentVersion(nodeRef);
    }
    else
    {
        NodeRef materialNode = smartStore.materialize(reference);
        Reference versionedReference = Reference.fromNodeRef(nodeRef);
        Version actualVersion = theTrait.getCurrentVersion(materialNode);
        return virtualizeVersion(versionedReference,
                                 actualVersion);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:VirtualVersionServiceExtension.java


示例13: revert

import org.alfresco.service.cmr.version.Version; //导入依赖的package包/类
@Override
public void revert(NodeRef nodeRef, Version version)
{

    VersionServiceTrait theTrait = getTrait();
    Reference reference = Reference.fromNodeRef(nodeRef);
    if (reference == null)
    {
        theTrait.revert(nodeRef,
                        version);
    }
    else
    {
        NodeRef materialNode = smartStore.materialize(reference);
        Version actualVersion = VirtualVersionServiceExtension.this.materializeVersionIfReference(version);
        theTrait.revert(materialNode,
                        actualVersion);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:VirtualVersionServiceExtension.java


示例14: testVersioningManyNodes

import org.alfresco.service.cmr.version.Version; //导入依赖的package包/类
/**
 * Test versioning many nodes in one go
 */
public void testVersioningManyNodes()
{
    NodeRef versionableNode = createNewVersionableNode();
    
    // Snap shot data
    String expectedVersionLabel = peekNextVersionLabel(versionableNode, versionProperties);  
    
    // Snap-shot the node created date-time
    long beforeVersionTime = ((Date)nodeService.getProperty(versionableNode, ContentModel.PROP_CREATED)).getTime();
    
    // Version the list of nodes created
    Collection<Version> versions = this.versionService.createVersion(
            this.versionableNodes.values(),
            this.versionProperties);
    
    // Check the returned versions are correct
    CheckVersionCollection(expectedVersionLabel, beforeVersionTime, versions);
    
    // TODO check the version histories
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:VersionServiceImplTest.java


示例15: generateVersioningForVersionableNode

import org.alfresco.service.cmr.version.Version; //导入依赖的package包/类
/**
 * Fixes things up for versionable nodes after importing.
 * Because version information is stored in a different store,
 *  the past versions are not included in the ACP. 
 * However, because the node has the versionable aspect applied to 
 *  it, we still need it to have a single version in the version store.
 * This method arranges for that. 
 */
private void generateVersioningForVersionableNode(final NodeRef nodeRef)
{
    // Is versioning already turned on?
    if(versionService.getVersionHistory(nodeRef) != null)
    {
        // There is already version history, so we don't need to do anything
        return;
    }
    
    // Take a copy of the version label, as it'll be reset when
    //  we request that versioning occurs
    final String label = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_VERSION_LABEL);
    
    // Have versioning enabled
    Version version = versionService.createVersion(nodeRef, null);
    final NodeRef versionNodeRef = VersionUtil.convertNodeRef(version.getFrozenStateNodeRef());
    
    // Put the version label back how it should be on the main node
    dbNodeService.setProperty(nodeRef, ContentModel.PROP_VERSION_LABEL, label);
    
    // Fix up the versioned version node to be what it should be
    // (The previous version label should be off, and the current label is the new one)
    dbNodeService.setProperty(versionNodeRef, ContentModel.PROP_VERSION_LABEL, null);
    dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_VERSION_LABEL, label);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:34,代码来源:ImporterComponent.java


示例16: testHasAspect

import org.alfresco.service.cmr.version.Version; //导入依赖的package包/类
/**
 * Test hasAspect
 */
public void testHasAspect()
{
    // Create a new versionable node
    NodeRef versionableNode = createNewVersionableNode();
    
    // Create a new version
    Version version = createVersion(versionableNode, this.versionProperties);
    
    boolean test1 = this.versionStoreNodeService.hasAspect(
            version.getFrozenStateNodeRef(), 
            ApplicationModel.ASPECT_UIFACETS);
    assertFalse(test1);
    
    boolean test2 = this.versionStoreNodeService.hasAspect(
            version.getFrozenStateNodeRef(),
            ContentModel.ASPECT_VERSIONABLE);
    assertTrue(test2);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:NodeServiceImplTest.java


示例17: isMajorVersion

import org.alfresco.service.cmr.version.Version; //导入依赖的package包/类
public boolean isMajorVersion()
{
    if (isPWC())
    {
        return false;
    }
    if (CMISConnector.UNVERSIONED_VERSION_LABEL.equals(versionLabel))
    {
        return true;
    }

    Version version = getVersion();
    if (version == null)
    {
        return true;
    }

    return version.getVersionType() == VersionType.MAJOR;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:CMISNodeInfoImpl.java


示例18: testCanCheckInWhenOriginalHasUndeletableAspect

import org.alfresco.service.cmr.version.Version; //导入依赖的package包/类
public void testCanCheckInWhenOriginalHasUndeletableAspect()
{
    nodeService.addAspect(nodeRef, ContentModel.ASPECT_UNDELETABLE, null);
    // Pre-condition of test, original must have sys:undeletable
    assertTrue(nodeService.hasAspect(nodeRef, ContentModel.ASPECT_UNDELETABLE));

    // Check-out nodeRef
    NodeRef workingCopy = this.cociService.checkout(
            this.nodeRef,
            this.rootNodeRef,
            ContentModel.ASSOC_CHILDREN,
            QName.createQName("workingCopy"));
    assertNotNull(workingCopy);

    // Check that the working copy does not have the sys:undeletable aspect
    assertFalse(nodeService.hasAspect(workingCopy, ContentModel.ASPECT_UNDELETABLE));

    // Check-in: must work despite original having the sys:undeletable aspect (MNT-18546)
    Map<String, Serializable> versionProperties = new HashMap<String, Serializable>();
    versionProperties.put(Version.PROP_DESCRIPTION, "This is a test version");
    cociService.checkin(workingCopy, versionProperties);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:CheckOutCheckInServiceImplTest.java


示例19: getVersion

import org.alfresco.service.cmr.version.Version; //导入依赖的package包/类
protected Version getVersion()
{
    if (version == null && isDocument())
    {
        try
        {
            VersionHistory versionHistory = getVersionHistory();
            if (versionHistory == null)         // Avoid unnecessary NPE
            {
                return null;
            }
            version = versionHistory.getVersion(versionLabel);
        } catch (Exception e)
        {
        }
    }

    return version;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:CMISNodeInfoImpl.java


示例20: testGetSuccessors

import org.alfresco.service.cmr.version.Version; //导入依赖的package包/类
/**
 * Test getSuccessors
 */
public void testGetSuccessors()
{
    VersionHistoryImpl vh = testAddVersionImpl();
    
    Collection<Version> versions1 = vh.getSuccessors(this.rootVersion);
    assertNotNull(versions1);
    assertEquals(versions1.size(), 2);
    
    for (Version version : versions1)
    {
        String versionLabel = version.getVersionLabel();
        if (!(versionLabel == "2" || versionLabel == "3"))
        {
            fail("There is a version in this collection that should not be here.");
        }
    }
    
    Collection<Version> versions2 = vh.getSuccessors(this.childVersion1);
    assertNotNull(versions2);
    assertTrue(versions2.isEmpty());
    
    Collection<Version> versions3 = vh.getSuccessors(this.childVersion2);
    assertNotNull(versions3);
    assertTrue(versions3.isEmpty());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:VersionHistoryImplTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MimeMailMessage类代码示例发布时间:2022-05-23
下一篇:
Java ViewRegistrations类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap