本文整理汇总了Java中org.alfresco.service.cmr.model.FileInfo.isFolder方法的典型用法代码示例。如果您正苦于以下问题:Java FileInfo.isFolder方法的具体用法?Java FileInfo.isFolder怎么用?Java FileInfo.isFolder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.model.FileInfo
的用法示例。
在下文中一共展示了FileInfo.isFolder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyContentOnly
import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
private void copyContentOnly(FileInfo sourceFileInfo, FileInfo destFileInfo, FileFolderService fileFolderService) throws WebDAVServerException
{
ContentService contentService = getContentService();
ContentReader reader = contentService.getReader(sourceFileInfo.getNodeRef(), ContentModel.PROP_CONTENT);
if (reader == null)
{
// There is no content for the node if it is a folder
if (!sourceFileInfo.isFolder())
{
// Non-folders should have content available.
logger.error("Unable to get ContentReader for source node " + sourceFileInfo.getNodeRef());
throw new WebDAVServerException(HttpServletResponse.SC_NOT_FOUND);
}
}
else
{
ContentWriter contentWriter = contentService.getWriter(destFileInfo.getNodeRef(), ContentModel.PROP_CONTENT, true);
contentWriter.putContent(reader);
}
}
示例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;
}
示例3: 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();
}
示例4: export
import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
public RepositoryExportHandle[] export(NodeRef repositoryDestination, String packageName)
{
ParameterCheck.mandatory("repositoryDestination", repositoryDestination);
FileInfo destInfo = fileFolderService.getFileInfo(repositoryDestination);
if (destInfo == null || !destInfo.isFolder())
{
throw new ExporterException("Repository destination " + repositoryDestination + " is not a folder.");
}
List<FileExportHandle> exportHandles = exportStores(exportStores, packageName, new TempFileExporter());
Map<String, String> mimetypeExtensions = mimetypeService.getExtensionsByMimetype();
List<RepositoryExportHandle> repoExportHandles = new ArrayList<RepositoryExportHandle>(exportHandles.size());
for (FileExportHandle exportHandle : exportHandles)
{
String name = exportHandle.packageName + "." + mimetypeExtensions.get(exportHandle.mimeType);
String title = exportHandle.packageName;
String description;
if (exportHandle.storeRef != null)
{
description = I18NUtil.getMessage("export.store.package.description", new Object[] { exportHandle.storeRef.toString() });
}
else
{
description = I18NUtil.getMessage("export.generic.package.description");
}
NodeRef repoExportFile = addExportFile(repositoryDestination, name, title, description, exportHandle.mimeType, exportHandle.exportFile);
RepositoryExportHandle handle = new RepositoryExportHandle();
handle.storeRef = exportHandle.storeRef;
handle.packageName = exportHandle.packageName;
handle.mimeType = exportHandle.mimeType;
handle.exportFile = repoExportFile;
repoExportHandles.add(handle);
// delete temporary export file
exportHandle.exportFile.delete();
}
return repoExportHandles.toArray(new RepositoryExportHandle[repoExportHandles.size()]);
}
示例5: getReader
import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
@Override
public ContentReader getReader(NodeRef nodeRef)
{
FileInfo fileInfo = toFileInfo(nodeRef, false);
if (fileInfo.isFolder())
{
throw new InvalidTypeException("Unable to get a content reader for a folder: " + fileInfo);
}
return contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);
}
示例6: getTranslatedFileInfo
import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
/**
* Converts the file info where an alternative translation should be used.
*
* @param fileInfo the basic file or folder info
* @return Returns a replacement if required
*/
private FileInfo getTranslatedFileInfo(FileInfo fileInfo)
{
// Ignore null
if (fileInfo == null)
{
return null;
}
// Ignore folders
if (fileInfo.isFolder())
{
return fileInfo;
}
NodeRef nodeRef = fileInfo.getNodeRef();
// Get the best translation for the node
NodeRef translatedNodeRef = getTranslatedNodeRef(nodeRef);
// Convert to FileInfo, if required
FileInfo translatedFileInfo = null;
if (nodeRef.equals(translatedNodeRef))
{
// No need to do any more work
translatedFileInfo = fileInfo;
}
else
{
// Get the FileInfo
translatedFileInfo = fileFolderService.getFileInfo(translatedNodeRef);
}
return translatedFileInfo;
}
示例7: parseXMLDocuments
import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
public Map<String, Document> parseXMLDocuments(final String typeName, NodeRef rootNode, String repoPath)
throws IOException, SAXException
{
final Map<String, Document> result = new TreeMap<String, Document>();
String[] pathElements = breakDownPath(repoPath);
try
{
FileInfo file = fileService.resolveNamePath(rootNode, Arrays.asList(pathElements));
if (file.isFolder())
{
QName typeQName = QName.createQName(typeName, namespaceService);
Set<QName> types = new HashSet<QName>(dictionaryService.getSubTypes(typeQName, true));
types.add(typeQName);
List<ChildAssociationRef> children = nodeService.getChildAssocs(file.getNodeRef(), types);
for (ChildAssociationRef child : children)
{
String name = (String) nodeService.getProperty(child.getChildRef(), ContentModel.PROP_NAME);
Document doc = XMLUtil.parse(child.getChildRef(), contentService);
result.put(name, doc);
}
}
}
catch (Exception ex)
{
log.warn("Unexpected exception caught in call to parseXMLDocuments", ex);
}
return result;
}
示例8: getActivityInfo
import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
protected ActivityInfo getActivityInfo(NodeRef parentNodeRef, NodeRef nodeRef)
{
// runAs system, eg. user may not have permission see one or more parents (irrespective of whether in a site context of not)
SiteInfo siteInfo = AuthenticationUtil.runAs(new RunAsWork<SiteInfo>()
{
@Override
public SiteInfo doWork() throws Exception
{
return siteService.getSite(nodeRef);
}
}, AuthenticationUtil.getSystemUserName());
String siteId = (siteInfo != null ? siteInfo.getShortName() : null);
if(siteId != null && !siteId.equals(""))
{
FileInfo fileInfo = fileFolderService.getFileInfo(nodeRef);
if (fileInfo != null)
{
boolean isContent = isSubClass(fileInfo.getType(), ContentModel.TYPE_CONTENT);
if (fileInfo.isFolder() || isContent)
{
return new ActivityInfo(null, parentNodeRef, siteId, fileInfo);
}
}
}
else
{
if (logger.isDebugEnabled())
{
logger.debug("Non-site activity, so ignored " + nodeRef);
}
}
return null;
}
示例9: 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;
}
示例10: getFolderPathImpl
import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
private NodeRef getFolderPathImpl(
NamespaceService namespaceService,
NodeService nodeService,
SearchService searchService,
FileFolderService fileFolderService,
boolean throwException)
{
NodeRef pathStartNodeRef = super.resolveNodePath(namespaceService, nodeService, searchService);
if (pathStartNodeRef == null)
{
return getNullOrThrowAlfrescoRuntimeExcpetion(
"Folder path resolution requires an existing base path. \n" +
" Base path: " + getRootPath(), throwException);
}
// Just choose the root path if the folder path is empty
if (folderPath.length() == 0)
{
return pathStartNodeRef;
}
else
{
List<NodeRef> nodeRefs = searchService.selectNodes(pathStartNodeRef, folderPath, null, namespaceService, true);
if (nodeRefs.size() == 0)
{
return getNullOrThrowAlfrescoRuntimeExcpetion("Folder not found: " + this, throwException);
}
else
{
NodeRef nodeRef = nodeRefs.get(0);
FileInfo folderInfo = fileFolderService.getFileInfo(nodeRef);
if (!folderInfo.isFolder())
{
return getNullOrThrowAlfrescoRuntimeExcpetion("Not a folder: " + this, throwException);
}
return nodeRef;
}
}
// Done
}
示例11: 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;
}
}
示例12: checkFileList
import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
/**
* Checks that the names and numbers of files and folders in the provided list is correct
*
* @param files the list of files
* @param expectedFileCount the number of uniquely named files expected
* @param expectedFolderCount the number of uniquely named folders expected
* @param expectedNames the names of the files and folders expected
*/
private void checkFileList(
List<FileInfo> files,
int expectedFileCount,
int expectedFolderCount,
String[] expectedNames)
{
int fileCount = 0;
int folderCount = 0;
List<String> check = new ArrayList<String>(8);
for (String filename : expectedNames)
{
check.add(filename);
}
for (FileInfo file : files)
{
if (file.isFolder())
{
folderCount++;
}
else
{
fileCount++;
}
check.remove(file.getName());
}
assertTrue("Name list was not exact - remaining: " + check, check.size() == 0);
assertEquals("Incorrect number of files", expectedFileCount, fileCount);
assertEquals("Incorrect number of folders", expectedFolderCount, folderCount);
}
示例13: postFileFolderUpdated
import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void postFileFolderUpdated(
String siteId,
String tenantDomain,
FileInfo nodeInfo) throws WebDAVServerException
{
if (! nodeInfo.isFolder())
{
postFileFolderActivity(ActivityType.FILE_UPDATED, siteId, tenantDomain, null, null, nodeInfo);
}
}
示例14: generateResponseForNode
import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
/**
* Generates the required response XML for the current node
*
* @param xml XMLWriter
* @param nodeInfo FileInfo
* @param path String
*/
protected void generateResponseForNode(XMLWriter xml, FileInfo nodeInfo, String path) throws Exception
{
boolean isFolder = nodeInfo.isFolder();
// Output the response block for the current node
xml.startElement(
WebDAV.DAV_NS,
WebDAV.XML_RESPONSE,
WebDAV.XML_NS_RESPONSE,
getDAVHelper().getNullAttributes());
// Build the href string for the current node
String strHRef = getURLForPath(m_request, path, isFolder);
xml.startElement(WebDAV.DAV_NS, WebDAV.XML_HREF, WebDAV.XML_NS_HREF, getDAVHelper().getNullAttributes());
xml.write(strHRef);
xml.endElement(WebDAV.DAV_NS, WebDAV.XML_HREF, WebDAV.XML_NS_HREF);
switch (m_mode)
{
case GET_NAMED_PROPS:
generateNamedPropertiesResponse(xml, nodeInfo, isFolder);
break;
case GET_ALL_PROPS:
generateAllPropertiesResponse(xml, nodeInfo, isFolder);
break;
case FIND_PROPS:
generateFindPropertiesResponse(xml, nodeInfo, isFolder);
break;
}
// Close off the response element
xml.endElement(WebDAV.DAV_NS, WebDAV.XML_RESPONSE, WebDAV.XML_NS_RESPONSE);
}
示例15: executeImpl
import org.alfresco.service.cmr.model.FileInfo; //导入方法依赖的package包/类
@Override
protected void executeImpl() throws WebDAVServerException, Exception
{
FileInfo pathNodeInfo = null;
try
{
// Check that the path exists
pathNodeInfo = getNodeForPath(getRootNodeRef(), m_strPath);
}
catch (FileNotFoundException e)
{
// The path is not valid - send a 404 error back to the client
throw new WebDAVServerException(HttpServletResponse.SC_NOT_FOUND);
}
checkNode(pathNodeInfo);
// Create the path for the current location in the tree
StringBuilder baseBuild = new StringBuilder(256);
baseBuild.append(getPath());
if (baseBuild.length() == 0 || baseBuild.charAt(baseBuild.length() - 1) != WebDAVHelper.PathSeperatorChar)
{
baseBuild.append(WebDAVHelper.PathSeperatorChar);
}
basePath = baseBuild.toString();
// Build the href string for the current node
boolean isFolder = pathNodeInfo.isFolder();
strHRef = getURLForPath(m_request, basePath, isFolder);
// Do the real work: patch the properties
patchProperties(pathNodeInfo, basePath);
}