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


Java DownloadModel类代码示例

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


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

示例1: createDownloadTypeNode

import org.alfresco.repo.download.DownloadModel; //导入依赖的package包/类
/**
 * Creates node with a type {@link DownloadModel#TYPE_DOWNLOAD} within the
 * download container (see
 * {@link DownloadStorage#getOrCreateDowloadContainer()} )
 * <p>
 * Also, the {@code IndexControlAspect} is applied to the created node.
 *
 * @param name the node name
 * @return the created nodeRef
 */
private NodeRef createDownloadTypeNode(final String name)
{
    final NodeRef newNodeRef = nodeService.createNode(
                downloadStorage.getOrCreateDowloadContainer(),
                ContentModel.ASSOC_CHILDREN,
                ContentModel.ASSOC_CHILDREN,
                DownloadModel.TYPE_DOWNLOAD,
                Collections.<QName, Serializable> singletonMap(ContentModel.PROP_NAME, name)).getChildRef();

    Map<QName, Serializable> aspectProperties = new HashMap<>(2);
    aspectProperties.put(ContentModel.PROP_IS_INDEXED, Boolean.FALSE);
    aspectProperties.put(ContentModel.PROP_IS_CONTENT_INDEXED, Boolean.FALSE);
    nodeService.addAspect(newNodeRef, ContentModel.ASPECT_INDEX_CONTROL, aspectProperties);

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

示例2: getDownloadsCannedQuery

import org.alfresco.repo.download.DownloadModel; //导入依赖的package包/类
public CannedQuery<DownloadEntity> getDownloadsCannedQuery(NodeRef containerNode, Date before)
{
    ParameterCheck.mandatory("before", before);
    
    GetDownloadsCannedQueryParams parameterBean = new GetDownloadsCannedQueryParams
                (
                            getNodeId(containerNode),
                            getQNameId(ContentModel.PROP_NAME),
                            getQNameId(DownloadModel.TYPE_DOWNLOAD),
                            before
                );
    CannedQueryParameters params = new CannedQueryParameters(parameterBean);

    final GetDownloadsCannedQuery cq = new GetDownloadsCannedQuery(
          cannedQueryDAO, methodSecurity, params
    );
    
    return cq;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:GetDownloadsCannedQueryFactory.java

示例3: createAssociation

import org.alfresco.repo.download.DownloadModel; //导入依赖的package包/类
@Override
public AssociationRef createAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName)
{
	Reference targetReference = Reference.fromNodeRef(targetRef);
    if (targetReference != null
                && getTrait().getType(materializeIfPossible(sourceRef)).equals(DownloadModel.TYPE_DOWNLOAD))
    {
        // NOTE : this is enables downloads of virtual structures
        createDownloadAssociation(sourceRef,
                                  targetRef);

        AssociationRef assocRef = new AssociationRef(sourceRef,
                                                     assocTypeQName,
                                                     targetRef);
        return assocRef;
    }
    else
    {
        return getTrait().createAssociation(materializeIfPossible(sourceRef),
                                            materializeIfPossible(targetRef),
                                            assocTypeQName);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:VirtualNodeServiceExtension.java

示例4: createAssociation

import org.alfresco.repo.download.DownloadModel; //导入依赖的package包/类
@Override
public AssociationRef createAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName)
{
    if (Reference.isReference(targetRef)
                && getTrait().getType(materializeIfPossible(sourceRef)).equals(DownloadModel.TYPE_DOWNLOAD))
    {
        // NOTE : this is enables downloads of virtual structures
        createDownloadAssociation(sourceRef,
                                  targetRef);

        AssociationRef assocRef = new AssociationRef(sourceRef,
                                                     assocTypeQName,
                                                     targetRef);
        return assocRef;
    }
    else
    {
        return getTrait().createAssociation(materializeIfPossible(sourceRef),
                                            materializeIfPossible(targetRef),
                                            assocTypeQName);
    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:23,代码来源:VirtualNodeServiceExtension.java

示例5: getDownloadTargetAssocs

import org.alfresco.repo.download.DownloadModel; //导入依赖的package包/类
private List<AssociationRef> getDownloadTargetAssocs(NodeRef sourceNodeRef)
{
    try
    {
        List<AssociationRef> result = new ArrayList<AssociationRef>();

        NodeRef tempFolderNodeRef = downloadAssociationsFolder.resolve();
        if (tempFolderNodeRef == null)
        {
            return result;
        }

        String tempFileName = sourceNodeRef.getId();

        NodeRef tempFileNodeRef = environment.getChildByName(tempFolderNodeRef,
                                                             ContentModel.ASSOC_CONTAINS,
                                                             tempFileName);
        if (tempFileNodeRef == null)
        {
            return result;
        }
        List<String> readLines = IOUtils.readLines(environment.openContentStream(tempFileNodeRef),
                                                   StandardCharsets.UTF_8);
        for (String line : readLines)
        {
            NodeRef targetRef = new NodeRef(line);
            AssociationRef assocRef = new AssociationRef(sourceNodeRef,
                                                         DownloadModel.ASSOC_REQUESTED_NODES,
                                                         targetRef);
            result.add(assocRef);
        }

        return result;
    }
    catch (IOException e)
    {
        throw new VirtualizationException(e);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:40,代码来源:VirtualNodeServiceExtension.java

示例6: deleteNode

import org.alfresco.repo.download.DownloadModel; //导入依赖的package包/类
@Override
public void deleteNode(NodeRef nodeRef) throws InvalidNodeRefException
{
    NodeServiceTrait theTrait = getTrait();
    NodeRef materialNode = smartStore.materializeIfPossible(nodeRef);
    boolean isDownload = DownloadModel.TYPE_DOWNLOAD.equals(theTrait.getType(materialNode));
    theTrait.deleteNode(materialNode);
    if (isDownload)
    {
        cleanUpDownloadTargetAssocs(nodeRef);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:13,代码来源:VirtualNodeServiceExtension.java

示例7: testCreateAssociation

import org.alfresco.repo.download.DownloadModel; //导入依赖的package包/类
@Test
public void testCreateAssociation() throws Exception
{
    NodeRef createDownloadNode = createDownloadNode();
    NodeRef node2 = nodeService.getChildByName(virtualFolder1NodeRef,
                                               ContentModel.ASSOC_CONTAINS,
                                               "Node2");
    nodeService.createAssociation(createDownloadNode,
                                  node2,
                                  DownloadModel.ASSOC_REQUESTED_NODES);

}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:13,代码来源:VirtualNodeServiceExtensionTest.java

示例8: testGetSourceAssocs_download

import org.alfresco.repo.download.DownloadModel; //导入依赖的package包/类
@Test
public void testGetSourceAssocs_download() throws Exception
{
    NodeRef node2 = nodeService.getChildByName(virtualFolder1NodeRef,
                                               ContentModel.ASSOC_CONTAINS,
                                               "Node2");

    List<AssociationRef> sourceAssocs = null;
    sourceAssocs = nodeService.getSourceAssocs(node2,
                                               RegexQNamePattern.MATCH_ALL);
    assertEquals(0,
                 sourceAssocs.size());

    sourceAssocs = nodeService.getSourceAssocs(node2,
                                               DownloadModel.ASSOC_REQUESTED_NODES);
    assertEquals(0,
                 sourceAssocs.size());

    // one virtual noderef
    NodeRef createDownloadNode = createDownloadNode();
    nodeService.createAssociation(createDownloadNode,
                                  node2,
                                  DownloadModel.ASSOC_REQUESTED_NODES);
    sourceAssocs = nodeService.getSourceAssocs(node2,
                                               DownloadModel.ASSOC_REQUESTED_NODES);

    // sources are deliberately not virtualized due to performance and
    // complexity issues
    assertEquals(0,
                 sourceAssocs.size());

}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:33,代码来源:VirtualNodeServiceExtensionTest.java

示例9: checkIsDownloadNodeType

import org.alfresco.repo.download.DownloadModel; //导入依赖的package包/类
protected void checkIsDownloadNodeType(NodeRef downloadNodeRef)
{
    QName nodeIdType = this.nodeService.getType(downloadNodeRef);
    
    if(!nodeIdType.equals(DownloadModel.TYPE_DOWNLOAD)){ 
        throw new InvalidArgumentException("Please specify the nodeId of a download node."); 
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:9,代码来源:DownloadsImpl.java

示例10: getTargetAssocs

import org.alfresco.repo.download.DownloadModel; //导入依赖的package包/类
@Override
public List<AssociationRef> getTargetAssocs(NodeRef sourceRef, QNamePattern qnamePattern)
{
    NodeServiceTrait theTrait = getTrait();
    List<AssociationRef> targetAssocs = null;

    Reference reference = Reference.fromNodeRef(sourceRef);
    if (reference != null)
    {
        if (smartStore.canMaterialize(reference))
        {
            NodeRef materializedReferece = smartStore.materialize(reference);
            targetAssocs = theTrait.getTargetAssocs(materializedReferece,
                                                    qnamePattern);
        }
        else
        {
            targetAssocs = new LinkedList<>();
        }
    }
    else
    {
        targetAssocs = theTrait.getTargetAssocs(sourceRef,
                                                qnamePattern);
    }

    List<AssociationRef> virtualizedIfNeededTargetAssocs = null;

    Reference sourceReference = Reference.fromNodeRef(sourceRef);
    if (sourceReference != null)
    {
        virtualizedIfNeededTargetAssocs = new LinkedList<>();

        for (AssociationRef associationRef : targetAssocs)
        {
            NodeRef targetNodeRef = associationRef.getTargetRef();
            Reference targetReference = NodeProtocol.newReference(targetNodeRef,
                                                                  sourceReference
                                                                              .execute(new GetParentReferenceMethod()));
            AssociationRef virtualAssocRef = new AssociationRef(associationRef.getId(),
                                                                sourceRef,
                                                                associationRef.getTypeQName(),
                                                                targetReference.toNodeRef(targetNodeRef
                                                                            .getStoreRef()));
            virtualizedIfNeededTargetAssocs.add(virtualAssocRef);
        }

    }
    else
    {
        virtualizedIfNeededTargetAssocs = targetAssocs;

        if (DownloadModel.TYPE_DOWNLOAD.equals(environment.getType(sourceRef)))
        {
            if (qnamePattern.isMatch(DownloadModel.ASSOC_REQUESTED_NODES))
            {
                List<AssociationRef> virtualTargetAssocs = getDownloadTargetAssocs(sourceRef);
                virtualizedIfNeededTargetAssocs.addAll(virtualTargetAssocs);
            }
        }
    }

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

示例11: testGetTargetAssocs_download

import org.alfresco.repo.download.DownloadModel; //导入依赖的package包/类
@Test
public void testGetTargetAssocs_download() throws Exception
{

    NodeRef node2 = nodeService.getChildByName(virtualFolder1NodeRef,
                                               ContentModel.ASSOC_CONTAINS,
                                               "Node2");

    List<AssociationRef> targetAssocs = nodeService.getTargetAssocs(node2,
                                                                    DownloadModel.ASSOC_REQUESTED_NODES);
    assertEquals(0,
                 targetAssocs.size());

    // one virtual noderef
    NodeRef createDownloadNode = createDownloadNode();
    nodeService.createAssociation(createDownloadNode,
                                  node2,
                                  DownloadModel.ASSOC_REQUESTED_NODES);
    targetAssocs = nodeService.getTargetAssocs(createDownloadNode,
                                               ContentModel.ASSOC_CONTAINS);
    assertEquals(0,
                 targetAssocs.size());
    targetAssocs = nodeService.getTargetAssocs(createDownloadNode,
                                               DownloadModel.ASSOC_REQUESTED_NODES);
    assertEquals(1,
                 targetAssocs.size());

    // 2 virtual node ref ...associations have to be created again since
    // they are removed after they are obtained in
    // order to cleanup temp node refs from repository.
    NodeRef node2_1 = nodeService.getChildByName(node2,
                                                 ContentModel.ASSOC_CONTAINS,
                                                 "Node2_1");
    nodeService.createAssociation(createDownloadNode,
                                  node2,
                                  DownloadModel.ASSOC_REQUESTED_NODES);
    nodeService.createAssociation(createDownloadNode,
                                  node2_1,
                                  DownloadModel.ASSOC_REQUESTED_NODES);
    targetAssocs = nodeService.getTargetAssocs(createDownloadNode,
                                               ContentModel.ASSOC_CONTAINS);
    assertEquals(0,
                 targetAssocs.size());
    for (int i = 0; i < 2; i++)
    {
        targetAssocs = nodeService.getTargetAssocs(createDownloadNode,
                                                   DownloadModel.ASSOC_REQUESTED_NODES);
        assertEquals("Try # " + (i + 1),
                     2,
                     targetAssocs.size());
    }

    List<NodeRef> targets = new LinkedList<>();
    for (AssociationRef assocs : targetAssocs)
    {
        targets.add(assocs.getTargetRef());
    }

    assertTrue(targets.contains(node2));

    assertTrue(targets.contains(node2_1));

    NodeRefExpression downloadAsocsFolderExpr = virtualizationConfigTestBootstrap.getDownloadAssocaiationsFolder();
    NodeRef downloadAssocsFolder = downloadAsocsFolderExpr.resolve();

    NodeRef tempDownloadSourceAssocs = nodeService.getChildByName(downloadAssocsFolder,
                                                                  ContentModel.ASSOC_CONTAINS,
                                                                  createDownloadNode.getId());

    assertNotNull(tempDownloadSourceAssocs);

    downloadStorage.delete(createDownloadNode);

    assertFalse("Association information was not removed when removing the source.",
                nodeService.exists(tempDownloadSourceAssocs));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:77,代码来源:VirtualNodeServiceExtensionTest.java

示例12: getTargetAssocs

import org.alfresco.repo.download.DownloadModel; //导入依赖的package包/类
@Override
public List<AssociationRef> getTargetAssocs(NodeRef sourceRef, QNamePattern qnamePattern)
{
    NodeServiceTrait theTrait = getTrait();
    List<AssociationRef> targetAssocs = null;

    if (Reference.isReference(sourceRef))
    {
        Reference reference = Reference.fromNodeRef(sourceRef);
        if (smartStore.canMaterialize(reference))
        {
            NodeRef materializedReferece = smartStore.materialize(reference);
            targetAssocs = theTrait.getTargetAssocs(materializedReferece,
                                                    qnamePattern);
        }
        else
        {
            targetAssocs = new LinkedList<>();
        }
    }
    else
    {
        targetAssocs = theTrait.getTargetAssocs(sourceRef,
                                                qnamePattern);
    }

    List<AssociationRef> virtualizedIfNeededTargetAssocs = null;

    if (Reference.isReference(sourceRef))
    {
        virtualizedIfNeededTargetAssocs = new LinkedList<>();

        Reference sourceReference = Reference.fromNodeRef(sourceRef);

        for (AssociationRef associationRef : targetAssocs)
        {
            NodeRef targetNodeRef = associationRef.getTargetRef();
            Reference targetReference = NodeProtocol.newReference(targetNodeRef,
                                                                  sourceReference
                                                                              .execute(new GetParentReferenceMethod()));
            AssociationRef virtualAssocRef = new AssociationRef(associationRef.getId(),
                                                                sourceRef,
                                                                associationRef.getTypeQName(),
                                                                targetReference.toNodeRef(targetNodeRef
                                                                            .getStoreRef()));
            virtualizedIfNeededTargetAssocs.add(virtualAssocRef);
        }

    }
    else
    {
        virtualizedIfNeededTargetAssocs = targetAssocs;

        if (DownloadModel.TYPE_DOWNLOAD.equals(environment.getType(sourceRef)))
        {
            if (qnamePattern.isMatch(DownloadModel.ASSOC_REQUESTED_NODES))
            {
                List<AssociationRef> virtualTargetAssocs = getDownloadTargetAssocs(sourceRef);
                virtualizedIfNeededTargetAssocs.addAll(virtualTargetAssocs);
            }
        }
    }

    return virtualizedIfNeededTargetAssocs;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:66,代码来源:VirtualNodeServiceExtension.java


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