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


Java FileInfo.getName方法代码示例

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


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

示例1: postFileFolderActivity

import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
private void postFileFolderActivity(
            String activityType,
            String siteId,
            String tenantDomain,
            String path,
            NodeRef parentNodeRef,
            FileInfo contentNodeInfo) throws WebDAVServerException
{
    String fileName = contentNodeInfo.getName();
    NodeRef nodeRef = contentNodeInfo.getNodeRef();
    
    try
    {
        poster.postFileFolderActivity(activityType, path, tenantDomain, siteId,
                               parentNodeRef, nodeRef, fileName,
                               appTool, Client.asType(ClientType.webdav),contentNodeInfo);
    }
    catch (AlfrescoRuntimeException are)
    {
        logger.error("Failed to post activity.", are);
        throw new WebDAVServerException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:24,代码来源:ActivityPosterImpl.java

示例2: getWriter

import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
@Override
public ContentWriter getWriter(NodeRef nodeRef)
{
    FileInfo fileInfo = toFileInfo(nodeRef, false);
    if (fileInfo.isFolder())
    {
        throw new InvalidTypeException("Unable to get a content writer for a folder: " + fileInfo);
    }
    final ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
    // Ensure that a mimetype is set based on the filename (ALF-6560)
    // This has been removed from the create code in 3.4 to prevent insert-update behaviour
    // of the ContentData.
    if (writer.getMimetype() == null)
    {
        final String name = fileInfo.getName();
        writer.guessMimetype(name);
    }
    // Done
    return writer;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:FileFolderServiceImpl.java

示例3: getContentDispositionHeader

import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
protected String getContentDispositionHeader(FileInfo nodeInfo)
{
    String filename = nodeInfo.getName();
    StringBuilder sb = new StringBuilder();
    sb.append("attachment; filename=\"");
    for(int i = 0; i < filename.length(); i++)
    {
        char c = filename.charAt(i);
        if(isValidQuotedStringHeaderParamChar(c))
        {
            sb.append(c);
        }
        else
        {
            sb.append(" ");
        }
    }
    sb.append("\"; filename*=UTF-8''");
    sb.append(URLEncoder.encode(filename));
    return sb.toString();
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:22,代码来源:GetMethod.java

示例4: findContainer

import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
/**
 * Locate site "container" folder for component
 * 
 * @param siteNodeRef
 *            site
 * @param componentId
 *            component id
 * @return "container" node ref, if it exists
 * @throws FileNotFoundException
 */
private NodeRef findContainer(NodeRef siteNodeRef, String componentId)
        throws FileNotFoundException
{
    List<String> paths = new ArrayList<String>(1);
    paths.add(componentId);
    FileInfo fileInfo = fileFolderService.resolveNamePath(siteNodeRef,
            paths);
    if (!fileInfo.isFolder())
    {
        throw new SiteServiceException(MSG_SITE_CONTAINER_NOT_FOLDER, new Object[]{fileInfo.getName()});
    }
    return fileInfo.getNodeRef();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:SiteServiceImpl.java

示例5: ActivityInfo

import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
public ActivityInfo(String parentPath, NodeRef parentNodeRef, String siteId, FileInfo fileInfo)
{
    super();
    this.nodeRef = fileInfo.getNodeRef();
    this.parentPath = parentPath;
    this.parentNodeRef = parentNodeRef;
    this.siteId = siteId;
    this.fileName = fileInfo.getName();
    this.isFolder = fileInfo.isFolder();
    this.fileInfo = fileInfo;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:ActivityInfo.java

示例6: getActivityInfo

import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
public ActivityInfo getActivityInfo(NodeRef nodeRef)
{
    SiteInfo siteInfo = siteService.getSite(nodeRef);
    String siteId = (siteInfo != null ? siteInfo.getShortName() : null);
    if(siteId != null && !siteId.equals(""))
    {
        NodeRef parentNodeRef = nodeService.getPrimaryParent(nodeRef).getParentRef();
        FileInfo fileInfo = fileFolderService.getFileInfo(nodeRef);
        String name = fileInfo.getName();
        boolean isFolder = fileInfo.isFolder();
            
        NodeRef documentLibrary = siteService.getContainer(siteId, SiteService.DOCUMENT_LIBRARY);
        String parentPath = "/";
        try
        {
            parentPath = getPathFromNode(documentLibrary, parentNodeRef);
        }
        catch (FileNotFoundException error)
        {
            if (logger.isDebugEnabled())
            {
                logger.debug("No " + SiteService.DOCUMENT_LIBRARY + " container found.");
            }
        }
        
        return new ActivityInfo(nodeRef, parentPath, parentNodeRef, siteId, name, isFolder);
    }
    else
    {
        return null;
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:33,代码来源:ActivityPosterImpl.java

示例7: addFolder

import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
private NodeRef addFolder(NodeRef parentNodeRef, String foldername, int depth)
{
    System.out.println(makeTabs(depth) + "Creating folder " + foldername + " in parent " + parentNodeRef);
    FileInfo info = fileFolderService.create(parentNodeRef, foldername, ContentModel.TYPE_FOLDER);
    String name = info.getName();
    if (!name.equals(foldername))
    {
        String msg = "A foldername '" + foldername + "' was not persisted: " + info;
        logger.error(msg);
        rollbackMessages.add(msg);
    }
    return info.getNodeRef();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:LargeArchiveAndRestoreTest.java

示例8: addFile

import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
private NodeRef addFile(NodeRef parentNodeRef, String filename, int depth)
{
    System.out.println(makeTabs(depth) + "Creating file " + filename + " in parent " + parentNodeRef);
    FileInfo info = fileFolderService.create(parentNodeRef, filename, ContentModel.TYPE_CONTENT);
    String name = info.getName();
    if (!name.equals(filename))
    {
        String msg = "A filename '" + filename + "' was not persisted: " + info;
        logger.error(msg);
        rollbackMessages.add(msg);
    }
    return info.getNodeRef();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:LargeArchiveAndRestoreTest.java

示例9: AlfrescoImapFolder

import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
/**
 * Constructs {@link AlfrescoImapFolder} object.
 * 
 * @param folderInfo - reference to the {@link FileInfo} object representing the folder.
 * @param userName - name of the user (e.g. "admin" for admin user).
 * @param folderName - name of the folder.
 * @param folderPath - path of the folder.
 * @param viewMode - defines view mode. Can be one of the following: {@link ImapViewMode#ARCHIVE} or {@link ImapViewMode#VIRTUAL}.
 * @param imapService - the IMAP service.
 * @param serviceRegistry ServiceRegistry
 * @param selectable - defines whether the folder is selectable or not.
 * @param extractAttachmentsEnabled boolean
 * @param mountPointId int
 */
public AlfrescoImapFolder(
        FileInfo folderInfo,
        String userName,
        String folderName,
        String folderPath,
        ImapViewMode viewMode,
        ImapService imapService,
        ServiceRegistry serviceRegistry,
        Boolean selectable,
        boolean extractAttachmentsEnabled,
        int mountPointId)
{
    super(serviceRegistry);
    this.folderInfo = folderInfo;
    this.userName = userName;
    this.folderName = folderName != null ? folderName : (folderInfo != null ? folderInfo.getName() : null);
    this.folderPath = folderPath;
    this.viewMode = viewMode != null ? viewMode : ImapViewMode.ARCHIVE;
    this.extractAttachmentsEnabled = extractAttachmentsEnabled;
    this.imapService = imapService;
    
    // MailFolder object can be null if it is used to obtain hierarchy delimiter by LIST command:
    // Example:
    // C: 2 list "" ""
    // S: * LIST () "." ""
    // S: 2 OK LIST completed.
    if (folderInfo != null)
    {
        if (selectable == null)
        {
            // isSelectable();
            Boolean storedSelectable = !serviceRegistry.getNodeService().hasAspect(folderInfo.getNodeRef(), ImapModel.ASPECT_IMAP_FOLDER_NONSELECTABLE);
            if (storedSelectable == null)
            {
                this.selectable = true;
            }
            else
            {
                this.selectable = storedSelectable;
            }
        }
        else
        {
            this.selectable = selectable;
        }
    }
    else
    {
        this.selectable = false;
    }
    
    this.mountPointId = mountPointId;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:68,代码来源:AlfrescoImapFolder.java

示例10: checkPages

import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
private void checkPages(NodeRef parentRef, int pageSize, int totalItems, boolean hideCheckedOut, int checkedOutChildIdx)
{
    Set<QName> ignoreQNameTypes = null;
    if (hideCheckedOut)
    {
        ignoreQNameTypes = new HashSet<QName>(1);
        ignoreQNameTypes.add(ContentModel.ASPECT_CHECKED_OUT);
    }
    else
    {
        if (checkedOutChildIdx > -1)
        {
            totalItems++;
        }
    }
    
    List<Pair<QName, Boolean>> sortProps = new ArrayList<Pair<QName, Boolean>>(1);
    sortProps.add(new Pair<QName, Boolean>(ContentModel.PROP_NAME, true));
    
    int pageCount = (totalItems / pageSize) + 1;
    
    for (int i = 1; i <= pageCount; i++)
    {
        int offset = (i-1)*pageSize;
        
        PagingRequest pagingRequest = new PagingRequest(offset, pageSize);
        pagingRequest.setRequestTotalCountMax(10000); // need this so that total count is set
        
        PagingResults<FileInfo> results = fileFolderService.list(parentRef, true, true, ignoreQNameTypes, sortProps, pagingRequest);
        
        Pair<Integer, Integer> totalResultCount = results.getTotalResultCount();
        assertNotNull(totalResultCount.getFirst());
        assertEquals(totalItems, totalResultCount.getFirst().intValue());
        assertNotNull(totalResultCount.getSecond());
        assertEquals(totalItems, totalResultCount.getSecond().intValue());
        
        assertEquals((i != pageCount ? pageSize : (totalItems - ((pageCount-1)*pageSize))), results.getPage().size());
        
        int j = offset;
        for (FileInfo fileInfo : results.getPage())
        {
            String suffix = String.format("%05d", j);
            if (checkedOutChildIdx > -1)
            {
                if (! hideCheckedOut)
                {
                    if (j == checkedOutChildIdx+1)
                    {
                        suffix = String.format("%05d", j-1) + " (Working Copy)";
                    }
                    else if (j > checkedOutChildIdx+1)
                    {
                        suffix = String.format("%05d", j-1);
                    }
                }
                else
                {
                    if (j == checkedOutChildIdx)
                    {
                        suffix = String.format("%05d", j) + " (Working Copy)";
                    }
                }
            }
            
            String actual = fileInfo.getName();
            String expected = "child-"+suffix;
            assertTrue("Expected: "+expected+", Actual: "+actual+" (j="+j+")", expected.equals(actual));
            j++;
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:72,代码来源:FileFolderServiceImplTest.java

示例11: getNodeForPath

import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
/**
 * Get the file info for the given paths
 * 
 * @param rootNodeRef       the acting webdav root
 * @param path              the path to search for
 * @return                  Return the file info for the path
 * @throws FileNotFoundException
 *                          if the path doesn't refer to a valid node
 */
public FileInfo getNodeForPath(NodeRef rootNodeRef, String path) throws FileNotFoundException
{
    if (rootNodeRef == null)
    {
        throw new IllegalArgumentException("Root node may not be null");
    }
    else if (path == null)
    {
        throw new IllegalArgumentException("Path may not be null");
    }
    
    FileFolderService fileFolderService = getFileFolderService();
    // Check for the root path
    if ( path.length() == 0 || path.equals(PathSeperator))
    {
        return fileFolderService.getFileInfo(rootNodeRef);
    }
    
    // split the paths up
    List<String> splitPath = splitAllPaths(path);
    
    // find it
    FileInfo fileInfo = m_fileFolderService.resolveNamePath(rootNodeRef, splitPath);
    
    String fileName = splitPath.get(splitPath.size() - 1);
    if (!fileInfo.getName().equals(fileName))
    {
        throw new FileNotFoundException("Requested filename " + fileName +
                    " does not match case of " + fileInfo.getName());
    }
    
    // done
    if (logger.isDebugEnabled())
    {
        logger.debug("Fetched node for path: \n" +
                "   root: " + rootNodeRef + "\n" +
                "   path: " + path + "\n" +
                "   result: " + fileInfo);
    }
    return fileInfo;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:51,代码来源:WebDAVHelper.java


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