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


Java VersionUtil类代码示例

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


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

示例1: isAVersion

import org.alfresco.repo.version.common.VersionUtil; //导入依赖的package包/类
@Override
@Extend(extensionAPI=VersionServiceExtension.class,traitAPI=VersionServiceTrait.class)
public boolean isAVersion(NodeRef nodeRef)
{
    if (logger.isDebugEnabled())
    {
        logger.debug("Run as user " + AuthenticationUtil.getRunAsUser());
        logger.debug("Fully authenticated " + AuthenticationUtil.getFullyAuthenticatedUser());
    }
    
    NodeRef realNodeRef = nodeRef;
    if(nodeRef.getStoreRef().getProtocol().equals(VersionBaseModel.STORE_PROTOCOL))
    {
        realNodeRef = VersionUtil.convertNodeRef(nodeRef);            
    }
    return this.dbNodeService.hasAspect(realNodeRef, Version2Model.ASPECT_VERSION);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:Version2ServiceImpl.java

示例2: isVersioned

import org.alfresco.repo.version.common.VersionUtil; //导入依赖的package包/类
@Override
@Extend(extensionAPI=VersionServiceExtension.class,traitAPI=VersionServiceTrait.class)
public boolean isVersioned(NodeRef nodeRef)
{
    if (logger.isDebugEnabled())
    {
        logger.debug("Run as user " + AuthenticationUtil.getRunAsUser());
        logger.debug("Fully authenticated " + AuthenticationUtil.getFullyAuthenticatedUser());
    }
    
    NodeRef realNodeRef = nodeRef;
    if(nodeRef.getStoreRef().getProtocol().equals(VersionBaseModel.STORE_PROTOCOL))
    {
        realNodeRef = VersionUtil.convertNodeRef(nodeRef);            
    }
    return this.dbNodeService.hasAspect(realNodeRef, ContentModel.ASPECT_VERSIONABLE);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:Version2ServiceImpl.java

示例3: createVersion

import org.alfresco.repo.version.common.VersionUtil; //导入依赖的package包/类
/**
 * @see VersionService#createVersion(NodeRef, Map)
 */
public Version createVersion(
        NodeRef nodeRef,
        Map<String, Serializable> versionProperties)
        throws ReservedVersionNameException, AspectMissingException
{
    if (logger.isDebugEnabled())
    {
        logger.debug("Run as user " + AuthenticationUtil.getRunAsUser());
        logger.debug("Fully authenticated " + AuthenticationUtil.getFullyAuthenticatedUser());
    }
    
    long startTime = System.currentTimeMillis();
    
    int versionNumber = 0; // deprecated (unused)
    
    // Create the version
    Version version = createVersion(nodeRef, versionProperties, versionNumber);
    
    if (logger.isDebugEnabled())
    {
        logger.debug("created version (" + VersionUtil.convertNodeRef(version.getFrozenStateNodeRef()) + ") in " + (System.currentTimeMillis()-startTime) + " ms");
    }
    
    return version;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:VersionServiceImpl.java

示例4: generateVersioningForVersionableNode

import org.alfresco.repo.version.common.VersionUtil; //导入依赖的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

示例5: isAVersion

import org.alfresco.repo.version.common.VersionUtil; //导入依赖的package包/类
@Override
  @Extend(extensionAPI=VersionServiceExtension.class,traitAPI=VersionServiceTrait.class)
  public boolean isAVersion(NodeRef nodeRef)
  {
      if (logger.isDebugEnabled())
      {
      	logger.debug("Run as user " + AuthenticationUtil.getRunAsUser());
      	logger.debug("Fully authenticated " + AuthenticationUtil.getFullyAuthenticatedUser());
      }
   
NodeRef realNodeRef = nodeRef;
      if(nodeRef.getStoreRef().getProtocol().equals(VersionBaseModel.STORE_PROTOCOL))
      {
      	realNodeRef = VersionUtil.convertNodeRef(nodeRef);        	
      }
      return this.dbNodeService.hasAspect(realNodeRef, Version2Model.ASPECT_VERSION);
  }
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:18,代码来源:Version2ServiceImpl.java

示例6: isVersioned

import org.alfresco.repo.version.common.VersionUtil; //导入依赖的package包/类
@Override
  @Extend(extensionAPI=VersionServiceExtension.class,traitAPI=VersionServiceTrait.class)
  public boolean isVersioned(NodeRef nodeRef)
  {
   if (logger.isDebugEnabled())
      {
      	logger.debug("Run as user " + AuthenticationUtil.getRunAsUser());
      	logger.debug("Fully authenticated " + AuthenticationUtil.getFullyAuthenticatedUser());
      }
   
NodeRef realNodeRef = nodeRef;
      if(nodeRef.getStoreRef().getProtocol().equals(VersionBaseModel.STORE_PROTOCOL))
      {
      	realNodeRef = VersionUtil.convertNodeRef(nodeRef);        	
      }
      return this.dbNodeService.hasAspect(realNodeRef, ContentModel.ASPECT_VERSIONABLE);
  }
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:18,代码来源:Version2ServiceImpl.java

示例7: getProperties

import org.alfresco.repo.version.common.VersionUtil; //导入依赖的package包/类
/**
 * @see org.alfresco.repo.version.Node2ServiceImpl#getProperties(org.alfresco.service.cmr.repository.NodeRef)
 */
@SuppressWarnings("unchecked")
@Override
public Map<QName, Serializable> getProperties(NodeRef nodeRef) throws InvalidNodeRefException
{
    // TODO only supported for Version2

    NodeRef converted = VersionUtil.convertNodeRef(nodeRef);
    if (dbNodeService.hasAspect(converted, ASPECT_RECORDED_VERSION))
    {
        NodeRef record = (NodeRef)dbNodeService.getProperty(converted, PROP_RECORD_NODE_REF);
        if (record != null && dbNodeService.exists(record))
        {
            Map<QName, Serializable> properties =  dbNodeService.getProperties(record);
            return processProperties(converted, properties);
        }
        else
        {
            return (Map<QName, Serializable>)Collections.EMPTY_MAP;
        }
    }
    else
    {
        return super.getProperties(nodeRef);
    }
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:29,代码来源:RecordableVersionNodeServiceImpl.java

示例8: getAspects

import org.alfresco.repo.version.common.VersionUtil; //导入依赖的package包/类
/**
 * @see org.alfresco.repo.version.Node2ServiceImpl#getAspects(org.alfresco.service.cmr.repository.NodeRef)
 */
@SuppressWarnings("unchecked")
@Override
public Set<QName> getAspects(NodeRef nodeRef) throws InvalidNodeRefException
{
    // TODO only supported for Version2
    
    NodeRef converted = VersionUtil.convertNodeRef(nodeRef);
    if (dbNodeService.hasAspect(converted, ASPECT_RECORDED_VERSION))
    {
        NodeRef record = (NodeRef)dbNodeService.getProperty(converted, PROP_RECORD_NODE_REF);
        if (record != null && dbNodeService.exists(record))
        {
            Set<QName> aspects =  dbNodeService.getAspects(record);
            return processAspects(aspects);
        }
        else
        {
            return (Set<QName>)Collections.EMPTY_SET;
        }
    }
    else
    {
        return super.getAspects(nodeRef);
    }
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:29,代码来源:RecordableVersionNodeServiceImpl.java

示例9: createVersion

import org.alfresco.repo.version.common.VersionUtil; //导入依赖的package包/类
@Override
@Extend(extensionAPI=VersionServiceExtension.class,traitAPI=VersionServiceTrait.class)
public Version createVersion(
        NodeRef nodeRef,
        Map<String, Serializable> versionProperties)
        throws ReservedVersionNameException, AspectMissingException
{
    if (logger.isDebugEnabled())
    {
        logger.debug("Run as user " + AuthenticationUtil.getRunAsUser());
        logger.debug("Fully authenticated " + AuthenticationUtil.getFullyAuthenticatedUser());
    }
    
    long startTime = System.currentTimeMillis();
    
    int versionNumber = 0; // deprecated (unused)
    
    // Create the version
    Version version = createVersion(nodeRef, versionProperties, versionNumber);
    
    if (logger.isDebugEnabled())
    {
        logger.debug("created version (" + VersionUtil.convertNodeRef(version.getFrozenStateNodeRef()) + ") in " + (System.currentTimeMillis()-startTime) + " ms");
    }
    
    return version;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:28,代码来源:Version2ServiceImpl.java

示例10: getAspects

import org.alfresco.repo.version.common.VersionUtil; //导入依赖的package包/类
/**
 * Aspects translation for version store
 */
public Set<QName> getAspects(NodeRef nodeRef) throws InvalidNodeRefException
{
    Set<QName> aspects = this.dbNodeService.getAspects(VersionUtil.convertNodeRef(nodeRef));
    aspects.remove(Version2Model.ASPECT_VERSION);
    return aspects;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:10,代码来源:Node2ServiceImpl.java

示例11: getProperties

import org.alfresco.repo.version.common.VersionUtil; //导入依赖的package包/类
/**
 * Properties translation for version store
 */
public Map<QName, Serializable> getProperties(NodeRef nodeRef) throws InvalidNodeRefException
{
    Map<QName, Serializable> props = dbNodeService.getProperties(VersionUtil.convertNodeRef(nodeRef));
    VersionUtil.convertFrozenToOriginalProps(props);
    
    return props;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:11,代码来源:Node2ServiceImpl.java

示例12: getProperty

import org.alfresco.repo.version.common.VersionUtil; //导入依赖的package包/类
/**
 * Property translation for version store
 */
public Serializable getProperty(NodeRef nodeRef, QName qname) throws InvalidNodeRefException
{
    // TODO optimise - get property directly and convert if needed
    Map<QName, Serializable> properties = getProperties(VersionUtil.convertNodeRef(nodeRef));
    return properties.get(qname);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:10,代码来源:Node2ServiceImpl.java

示例13: getChildAssocs

import org.alfresco.repo.version.common.VersionUtil; //导入依赖的package包/类
/**
 * Child Assocs translation for version store
 */
public List<ChildAssociationRef> getChildAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern) throws InvalidNodeRefException
{
    // Get the child assoc references from the version store
    List<ChildAssociationRef> childAssocRefs = this.dbNodeService.getChildAssocs(
            VersionUtil.convertNodeRef(nodeRef),
            typeQNamePattern, qnamePattern);
    
    List<ChildAssociationRef> result = new ArrayList<ChildAssociationRef>(childAssocRefs.size());
    
    for (ChildAssociationRef childAssocRef : childAssocRefs)
    {
        if (! childAssocRef.getTypeQName().equals(Version2Model.CHILD_QNAME_VERSIONED_ASSOCS))
        {
            // Get the child reference
            NodeRef childRef = childAssocRef.getChildRef();
            NodeRef referencedNode = (NodeRef)this.dbNodeService.getProperty(childRef, ContentModel.PROP_REFERENCE);
            
            if (this.dbNodeService.exists(referencedNode))
            {
                // Build a child assoc ref to add to the returned list
                ChildAssociationRef newChildAssocRef = new ChildAssociationRef(
                        childAssocRef.getTypeQName(),
                        childAssocRef.getParentRef(),
                        childAssocRef.getQName(),
                        referencedNode,
                        childAssocRef.isPrimary(),
                        childAssocRef.getNthSibling());
                
                result.add(newChildAssocRef);
            }
        }
    }
    
    // sort the results so that the order appears to be exactly as it was originally
    Collections.sort(result);
    
    return result;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:42,代码来源:Node2ServiceImpl.java

示例14: getTargetAssocs

import org.alfresco.repo.version.common.VersionUtil; //导入依赖的package包/类
/**
 * Assocs translation for version store
 * 
 * @since 3.3 (Ent)
 */
@Override
public List<AssociationRef> getTargetAssocs(NodeRef sourceRef, QNamePattern qnamePattern)
{
    // Get the assoc references from the version store
    List<ChildAssociationRef> childAssocRefs = this.dbNodeService.getChildAssocs(
            VersionUtil.convertNodeRef(sourceRef),
            Version2Model.CHILD_QNAME_VERSIONED_ASSOCS, qnamePattern);
    
    List<AssociationRef> result = new ArrayList<AssociationRef>(childAssocRefs.size());
    
    for (ChildAssociationRef childAssocRef : childAssocRefs)
    {
        // Get the assoc reference
        NodeRef childRef = childAssocRef.getChildRef();
        NodeRef referencedNode = (NodeRef)this.dbNodeService.getProperty(childRef, ContentModel.PROP_REFERENCE);
        
        if (this.dbNodeService.exists(referencedNode))
        {
            Long assocDbId = (Long)this.dbNodeService.getProperty(childRef, Version2Model.PROP_QNAME_ASSOC_DBID);
            
            // Build an assoc ref to add to the returned list
            AssociationRef newAssocRef = new AssociationRef(
                    assocDbId,
                    sourceRef,
                    childAssocRef.getQName(),
                    referencedNode);
            
            result.add(newAssocRef);
            }
    }
    
    return result;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:39,代码来源:Node2ServiceImpl.java

示例15: getAspects

import org.alfresco.repo.version.common.VersionUtil; //导入依赖的package包/类
/**
 * Translation for version store
 */
@SuppressWarnings({ "unchecked", "deprecation" })
public Set<QName> getAspects(NodeRef nodeRef) throws InvalidNodeRefException
{
    return new HashSet<QName>(
            (ArrayList<QName>)this.dbNodeService.getProperty(VersionUtil.convertNodeRef(nodeRef), PROP_QNAME_FROZEN_ASPECTS));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:10,代码来源:NodeServiceImpl.java


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