本文整理汇总了Java中org.alfresco.service.cmr.model.FileNotFoundException类的典型用法代码示例。如果您正苦于以下问题:Java FileNotFoundException类的具体用法?Java FileNotFoundException怎么用?Java FileNotFoundException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileNotFoundException类属于org.alfresco.service.cmr.model包,在下文中一共展示了FileNotFoundException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createMimeMessageInFolder
import org.alfresco.service.cmr.model.FileNotFoundException; //导入依赖的package包/类
/**
* Creates the EML message in the specified folder.
*
* @param folderFileInfo The folder to create message in.
* @param message The original MimeMessage.
* @return ID of the new message created
* @throws FileNotFoundException
* @throws FileExistsException
* @throws MessagingException
* @throws IOException
*/
private long createMimeMessageInFolder(
FileInfo folderFileInfo,
MimeMessage message,
Flags flags)
throws FileExistsException, FileNotFoundException, IOException, MessagingException
{
String name = AlfrescoImapConst.MESSAGE_PREFIX + GUID.generate();
FileFolderService fileFolderService = serviceRegistry.getFileFolderService();
FileInfo messageFile = fileFolderService.create(folderFileInfo.getNodeRef(), name, ContentModel.TYPE_CONTENT);
final long newMessageUid = (Long) messageFile.getProperties().get(ContentModel.PROP_NODE_DBID);
name = AlfrescoImapConst.MESSAGE_PREFIX + newMessageUid + AlfrescoImapConst.EML_EXTENSION;
fileFolderService.rename(messageFile.getNodeRef(), name);
Flags newFlags = new Flags(flags);
newFlags.add(Flag.RECENT);
imapService.setFlags(messageFile, newFlags, true);
if (extractAttachmentsEnabled)
{
imapService.extractAttachments(messageFile.getNodeRef(), message);
}
// Force persistence of the message to the repository
new IncomingImapMessage(messageFile, serviceRegistry, message);
return newMessageUid;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:36,代码来源:AlfrescoImapFolder.java
示例2: modifyHomeFolderNameIfItExists
import org.alfresco.service.cmr.model.FileNotFoundException; //导入依赖的package包/类
/**
* Modifies (if required) the leaf folder name in the {@code homeFolderPath} by
* appending {@code "-N"} (where N is an integer starting with 1), so that a
* new folder will be created.
* @param root folder.
* @param homeFolderPath the full path. Only the final element is used.
*/
public void modifyHomeFolderNameIfItExists(NodeRef root, List<String> homeFolderPath)
{
int n = 0;
int last = homeFolderPath.size()-1;
String name = homeFolderPath.get(last);
String homeFolderName = name;
try
{
do
{
if (n > 0)
{
homeFolderName = name+'-'+n;
homeFolderPath.set(last, homeFolderName);
}
n++;
} while (fileFolderService.resolveNamePath(root, homeFolderPath, false) != null);
}
catch (FileNotFoundException e)
{
// Should not be thrown as call to resolveNamePath passes in false
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:PortableHomeFolderManager.java
示例3: getContainer
import org.alfresco.service.cmr.model.FileNotFoundException; //导入依赖的package包/类
/**
* @see org.alfresco.service.cmr.site.SiteService#getContainer(java.lang.String, String)
*/
public NodeRef getContainer(String shortName, String componentId)
{
ParameterCheck.mandatoryString("componentId", componentId);
// retrieve site
NodeRef siteNodeRef = getSiteNodeRef(shortName);
if (siteNodeRef == null)
{
throw new SiteDoesNotExistException(shortName);
}
// retrieve component folder within site
// NOTE: component id is used for folder name
NodeRef containerNodeRef = null;
try
{
containerNodeRef = findContainer(siteNodeRef, componentId);
}
catch (FileNotFoundException e)
{
//NOOP
}
return containerNodeRef;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:SiteServiceImpl.java
示例4: appendMessageInternal
import org.alfresco.service.cmr.model.FileNotFoundException; //导入依赖的package包/类
/**
* Appends message to the folder.
*
* @param message - message.
* @param flags - message flags.
* @param internalDate - not used. Current date used instead.
*/
@Override
protected long appendMessageInternal(
MimeMessage message,
Flags flags,
Date internalDate)
throws FileExistsException, FileNotFoundException, IOException, MessagingException
{
long uid;
NodeRef sourceNodeRef = extractNodeRef(message);
if (sourceNodeRef != null)
{
uid = copyOrMoveNode(this.folderInfo, message, flags, sourceNodeRef, false);
}
else
{
uid = createMimeMessageInFolder(this.folderInfo, message, flags);
}
// Invalidate current folder status
this.folderStatus = null;
return uid;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:AlfrescoImapFolder.java
示例5: copyOrMoveNode
import org.alfresco.service.cmr.model.FileNotFoundException; //导入依赖的package包/类
/**
* Moves the node <code>sourceNodeRef</code> extracted from the message id.
* A part of a complex move operation.
*
* @param folderInfo FileInfo
* @param message MimeMessage
* @param flags Flags
* @param sourceNodeRef NodeRef
* @return UUID of the moved node
* @throws FileExistsException
* @throws FileNotFoundException
*/
@SuppressWarnings("deprecation")
private long copyOrMoveNode(FileInfo folderInfo, MimeMessage message, Flags flags, NodeRef sourceNodeRef, boolean move)
throws FileExistsException, FileNotFoundException
{
FileFolderService fileFolderService = serviceRegistry.getFileFolderService();
FileFilterMode.setClient(FileFilterMode.Client.imap);
FileInfo messageFile = null;
if (move)
{
fileFolderService.setHidden(sourceNodeRef, false);
messageFile = fileFolderService.move(sourceNodeRef, folderInfo.getNodeRef(), null);
}
else
{
NodeRef newNodeRef = serviceRegistry.getCopyService().copyAndRename(sourceNodeRef, folderInfo.getNodeRef(), ContentModel.ASSOC_CONTAINS, null, false);
fileFolderService.setHidden(newNodeRef, false);
messageFile = fileFolderService.getFileInfo(newNodeRef);
}
final long newMessageUid = (Long) messageFile.getProperties().get(ContentModel.PROP_NODE_DBID);
imapService.persistMessageHeaders(messageFile.getNodeRef(), message);
Flags newFlags = new Flags(flags);
newFlags.add(Flag.RECENT);
imapService.setFlags(messageFile, newFlags, true);
imapService.setFlag(messageFile, Flag.DELETED, false);
return newMessageUid;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:43,代码来源:AlfrescoImapFolder.java
示例6: copyMessageInternal
import org.alfresco.service.cmr.model.FileNotFoundException; //导入依赖的package包/类
/**
* Copies message with the given UID to the specified {@link MailFolder}.
*
* @param uid - UID of the message
* @param toFolder - reference to the destination folder.
* @throws MessagingException
* @throws IOException
* @throws FileNotFoundException
* @throws FileExistsException
*/
@Override
protected long copyMessageInternal(
long uid, MailFolder toFolder)
throws MessagingException, FileExistsException, FileNotFoundException, IOException
{
AlfrescoImapFolder toImapMailFolder = (AlfrescoImapFolder) toFolder;
NodeRef destFolderNodeRef = toImapMailFolder.getFolderInfo().getNodeRef();
FileInfo sourceMessageFileInfo = searchMails().get(uid);
if (serviceRegistry.getNodeService().hasAspect(sourceMessageFileInfo.getNodeRef(), ImapModel.ASPECT_IMAP_CONTENT))
{
//Generate body of message
MimeMessage newMessage = new ImapModelMessage(sourceMessageFileInfo, serviceRegistry, true);
return toImapMailFolder.appendMessageInternal(newMessage, imapService.getFlags(sourceMessageFileInfo), new Date());
}
else
{
String fileName = (String) serviceRegistry.getNodeService().getProperty(sourceMessageFileInfo.getNodeRef(), ContentModel.PROP_NAME);
String newFileName = imapService.generateUniqueFilename(destFolderNodeRef, fileName);
FileInfo messageFileInfo = serviceRegistry.getFileFolderService().copy(sourceMessageFileInfo.getNodeRef(), destFolderNodeRef, newFileName);
return (Long)messageFileInfo.getProperties().get(ContentModel.PROP_NODE_DBID);
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:36,代码来源:AlfrescoImapFolder.java
示例7: getPath
import org.alfresco.service.cmr.model.FileNotFoundException; //导入依赖的package包/类
/**
* @param nodeRef NodeRef
* @return String
*/
private String getPath(NodeRef nodeRef)
{
StringBuilder sb = new StringBuilder();
try
{
List<FileInfo> parentFileInfoList = fileFolderService.getNamePath(null, nodeRef);
for (FileInfo fileInfo : parentFileInfoList)
{
sb.append('/');
sb.append(fileInfo.getName());
}
}
catch (FileNotFoundException ex)
{
log.info("Unexpected problem: error while calculating path to node " + nodeRef, ex);
}
String path = sb.toString();
return path;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:XSLTRenderingEngine.java
示例8: setName
import org.alfresco.service.cmr.model.FileNotFoundException; //导入依赖的package包/类
/**
* Helper to set the 'name' property for the node.
*
* @param name Name to set
*/
public void setName(String name)
{
if (name != null)
{
QName typeQName = getQNameType();
if ((services.getDictionaryService().isSubClass(typeQName, ContentModel.TYPE_FOLDER) &&
!services.getDictionaryService().isSubClass(typeQName, ContentModel.TYPE_SYSTEM_FOLDER)) ||
services.getDictionaryService().isSubClass(typeQName, ContentModel.TYPE_CONTENT))
{
try
{
this.services.getFileFolderService().rename(this.nodeRef, name);
}
catch (FileNotFoundException e)
{
throw new AlfrescoRuntimeException("Failed to rename node " + nodeRef + " to " + name, e);
}
}
this.getProperties().put(ContentModel.PROP_NAME.toString(), name.toString());
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:ScriptNode.java
示例9: rename
import org.alfresco.service.cmr.model.FileNotFoundException; //导入依赖的package包/类
public void rename(NodeRef base, String src, String dst)
{
NodeRef srcRef = lookup(base, src).getFirst();
if (srcRef == null)
{
throw new AlfrescoRuntimeException("Not Found: " + src);
}
Pair<NodeRef, String> parentChild = getParentChildRelative(base, dst);
try
{
fFileFolderService.move(srcRef, parentChild.getFirst(), parentChild.getSecond());
}
catch (FileNotFoundException e)
{
throw new AlfrescoRuntimeException("Parent Not Found: " + dst, e);
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:RepoRemoteService.java
示例10: assertMailboxInUserImapHomeDirectory
import org.alfresco.service.cmr.model.FileNotFoundException; //导入依赖的package包/类
/**
* @param root - {@link NodeRef} instance, which determines <code>Alfresco IMAP</code> root node
* @param actualNode - {@link NodeRef} instance, which determines mailbox in actual state
* @throws FileNotFoundException
*/
private void assertMailboxInUserImapHomeDirectory(NodeRef root, NodeRef actualNode) throws FileNotFoundException
{
List<String> path = fileFolderService.getNameOnlyPath(root, actualNode);
int satisfactionFlag = 0;
for (String element : path)
{
if (TEST_IMAP_FOLDER_NAME.equals(element) || USER_NAME.equals(element))
{
satisfactionFlag++;
}
if (satisfactionFlag > 1)
{
break;
}
}
assertTrue(satisfactionFlag > 1);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:ImapServiceImplTest.java
示例11: testFolderMissing
import org.alfresco.service.cmr.model.FileNotFoundException; //导入依赖的package包/类
@Test
public void testFolderMissing() throws Exception
{
try
{
AuthenticationUtil.pushAuthentication();
AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
fileFolderLoader.createFiles(
sharedHomePath + "/Missing",
0, 256, 1024L, 1024L, Long.MAX_VALUE, false,
10, 256L);
fail("Folder does not exist");
}
catch (AlfrescoRuntimeException e)
{
// Expected
assertTrue(e.getCause() instanceof FileNotFoundException);
}
finally
{
AuthenticationUtil.popAuthentication();
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:FileFolderLoaderTest.java
示例12: findNodeRef
import org.alfresco.service.cmr.model.FileNotFoundException; //导入依赖的package包/类
/**
* Gets the node ref for the specified path within this repo store
*
* @param documentPath String
* @return node ref
*/
protected NodeRef findNodeRef(String documentPath)
{
NodeRef node = null;
try
{
String[] pathElements = documentPath.split("/");
List<String> pathElementsList = Arrays.asList(pathElements);
FileInfo file = fileService.resolveNamePath(getBaseNodeRef(), pathElementsList);
node = file.getNodeRef();
}
catch (FileNotFoundException e)
{
// NOTE: return null
}
return node;
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:23,代码来源:RepoStore.java
示例13: testCopy
import org.alfresco.service.cmr.model.FileNotFoundException; //导入依赖的package包/类
/**
* This test verifies that copying a shared node does not across the shared aspect and it's associated properties.
* @throws IOException
* @throws UnsupportedEncodingException
* @throws JSONException
* @throws FileNotFoundException
* @throws FileExistsException
*/
public void testCopy() throws UnsupportedEncodingException, IOException, JSONException, FileExistsException, FileNotFoundException
{
final int expectedStatusOK = 200;
String testNodeRef = testNode.toString().replace("://", "/");
// As user one ...
// share
Response rsp = sendRequest(new PostRequest(SHARE_URL.replace("{node_ref_3}", testNodeRef), "", APPLICATION_JSON), expectedStatusOK, USER_ONE);
JSONObject jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString()));
String sharedId = jsonRsp.getString("sharedId");
assertNotNull(sharedId);
assertEquals(22, sharedId.length()); // note: we may have to adjust/remove this check if we change length of id (or it becomes variable length)
AuthenticationUtil.setFullyAuthenticatedUser(USER_ONE);
FileInfo copyFileInfo = fileFolderService.copy(testNode, userOneHome, "Copied node");
NodeRef copyNodeRef = copyFileInfo.getNodeRef();
assertFalse(nodeService.hasAspect(copyNodeRef, QuickShareModel.ASPECT_QSHARE));
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:30,代码来源:QuickShareRestApiTest.java
示例14: cannotGetNodeForPathWithIncorrectCase
import org.alfresco.service.cmr.model.FileNotFoundException; //导入依赖的package包/类
@Test
public void cannotGetNodeForPathWithIncorrectCase() throws FileNotFoundException
{
FileInfo folderInfo = fileFolderService.create(rootFolder, "my_folder", ContentModel.TYPE_FOLDER);
fileFolderService.create(folderInfo.getNodeRef(), "my_file.txt", ContentModel.TYPE_CONTENT);
try
{
webDAVHelper.getNodeForPath(rootFolder, "My_Folder/My_File.txt");
fail("FileNotFoundException should have been thrown.");
}
catch (FileNotFoundException e)
{
// Got here, good.
}
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:17,代码来源:WebDAVHelperIntegrationTest.java
示例15: cannotGetNodeForFolderPathWithIncorrectCase
import org.alfresco.service.cmr.model.FileNotFoundException; //导入依赖的package包/类
@Test
public void cannotGetNodeForFolderPathWithIncorrectCase() throws FileNotFoundException
{
FileInfo folderInfo = fileFolderService.create(rootFolder, "my_folder", ContentModel.TYPE_FOLDER);
fileFolderService.create(folderInfo.getNodeRef(), "my_file.txt", ContentModel.TYPE_CONTENT);
try
{
webDAVHelper.getNodeForPath(rootFolder, "My_Folder");
fail("FileNotFoundException should have been thrown.");
}
catch (FileNotFoundException e)
{
// Got here, good.
}
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:17,代码来源:WebDAVHelperIntegrationTest.java
示例16: executeVersionAction
import org.alfresco.service.cmr.model.FileNotFoundException; //导入依赖的package包/类
@Override
protected List<DocumentVersionBean> executeVersionAction(
VtiSoapRequest soapRequest, String dws, String fileName, Element fileVersion) throws Exception
{
// Delete all versions of given file
List<DocumentVersionBean> versions;
try {
versions = handler.deleteAllVersions(dws + "/" + fileName);
}
catch(FileNotFoundException e)
{
// The specification defines the exact code that must be
// returned in case of a file not being found
long code = 0x81070906l;
String message = "File not found: " + e.getMessage();
throw new VtiSoapException(message, code, e);
}
return versions;
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:21,代码来源:DeleteAllVersionsEndpoint.java
示例17: testCopyFolderInFilePlanInRmSite
import org.alfresco.service.cmr.model.FileNotFoundException; //导入依赖的package包/类
public void testCopyFolderInFilePlanInRmSite()
{
doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user)
{
private NodeRef folder1;
public void given()
{
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
}
public void when() throws FileExistsException, FileNotFoundException
{
fileFolderService.copy(folder1, filePlan, GUID.generate());
}
});
}
开发者ID:Alfresco,项目名称:records-management-old,代码行数:18,代码来源:RM978Test.java
示例18: resolvePathFileInfo
import org.alfresco.service.cmr.model.FileNotFoundException; //导入依赖的package包/类
/**
* Resolves file info for file with URL path in parent directory with file info
*
* @param parentFileInfo file info for parent directory ({@link FileInfo})
* @param childName url path relative to parent directory
* @return FileInfo resolved file info for childName or null, if it doesn't exist
*/
public FileInfo resolvePathFileInfo(FileInfo parentFileInfo, String childName)
{
FileInfo childFileInfo = null;
if(!parentFileInfo.isFolder())
{
//Alternate path was used and provided parentFileInfo is file that we are editing
return parentFileInfo;
}
try
{
childFileInfo = fileFolderService.resolveNamePath(parentFileInfo.getNodeRef(), Collections.singletonList(childName));
}
catch (FileNotFoundException e)
{
}
return childFileInfo;
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:28,代码来源:VtiPathHelper.java
示例19: getTargetNodeRef
import org.alfresco.service.cmr.model.FileNotFoundException; //导入依赖的package包/类
protected NodeRef getTargetNodeRef(String targetNodeRefStr, String targetPath) throws FileNotFoundException
{
NodeRef targetNodeRef;
if (targetNodeRefStr == null || targetNodeRefStr.trim().length() == 0)
{
if (targetPath == null || targetPath.trim().length() == 0)
{
throw new WebScriptException("Error: neither parameter '" + PARAMETER_TARGET_NODEREF +
"' nor parameter '" + PARAMETER_TARGET_PATH +
"' was provided, but at least one is required !");
}
targetNodeRef = convertPathToNodeRef(targetPath.trim());
}
else
{
targetNodeRef = new NodeRef(targetNodeRefStr.trim());
}
return targetNodeRef;
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:22,代码来源:AbstractBulkFileSystemImportWebScript.java
示例20: testMoveDocumentInFilePlanInRmSite
import org.alfresco.service.cmr.model.FileNotFoundException; //导入依赖的package包/类
public void testMoveDocumentInFilePlanInRmSite()
{
doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user)
{
private NodeRef folder1;
private NodeRef document1;
public void given()
{
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
document1 = fileFolderService.create(folder1, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef();
}
public void when() throws FileExistsException, FileNotFoundException
{
fileFolderService.move(document1, filePlan, GUID.generate());
}
});
}
开发者ID:Alfresco,项目名称:records-management-old,代码行数:20,代码来源:RM978Test.java
注:本文中的org.alfresco.service.cmr.model.FileNotFoundException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论