本文整理汇总了Java中org.alfresco.service.cmr.model.FileExistsException类的典型用法代码示例。如果您正苦于以下问题:Java FileExistsException类的具体用法?Java FileExistsException怎么用?Java FileExistsException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileExistsException类属于org.alfresco.service.cmr.model包,在下文中一共展示了FileExistsException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createMimeMessageInFolder
import org.alfresco.service.cmr.model.FileExistsException; //导入依赖的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: appendMessageInternal
import org.alfresco.service.cmr.model.FileExistsException; //导入依赖的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
示例3: copyOrMoveNode
import org.alfresco.service.cmr.model.FileExistsException; //导入依赖的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
示例4: copyMessageInternal
import org.alfresco.service.cmr.model.FileExistsException; //导入依赖的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
示例5: testRenameDuplicate
import org.alfresco.service.cmr.model.FileExistsException; //导入依赖的package包/类
public void testRenameDuplicate() throws Exception
{
FileInfo folderInfo = getByName(NAME_L0_FOLDER_A, true);
assertNotNull(folderInfo);
// rename duplicate. A file with that name already exists
String newName = NAME_L0_FILE_A;
try
{
folderInfo = fileFolderService.rename(folderInfo.getNodeRef(), newName);
fail("Existing file not detected");
}
catch (FileExistsException e)
{
// expected
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:FileFolderServiceImplTest.java
示例6: testCopy
import org.alfresco.service.cmr.model.FileExistsException; //导入依赖的package包/类
public void testCopy() throws Exception
{
FileInfo folderToCopyInfo = getByName(NAME_L1_FOLDER_A, true);
assertNotNull(folderToCopyInfo);
NodeRef folderToCopyRef = folderToCopyInfo.getNodeRef();
// copy it to the root
folderToCopyInfo = fileFolderService.copy(folderToCopyRef, workingRootNodeRef, null);
folderToCopyRef = folderToCopyInfo.getNodeRef();
// make sure that it is an immediate child of the root
List<FileInfo> checkFileInfos = fileFolderService.search(workingRootNodeRef, NAME_L1_FOLDER_A, false);
assertEquals("Folder not copied to root", 1, checkFileInfos.size());
// copy properly
FileInfo checkFileInfo = fileFolderService.copy(folderToCopyRef, null, "new name");
checkFileInfos = fileFolderService.search(workingRootNodeRef, checkFileInfo.getName(), false);
assertEquals("Folder not renamed in root", 1, checkFileInfos.size());
// attempt illegal copy (existing)
try
{
fileFolderService.copy(folderToCopyRef, null, NAME_L0_FOLDER_A);
fail("Existing folder not detected");
}
catch (FileExistsException e)
{
// expected
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:FileFolderServiceImplTest.java
示例7: createNothingToDoScript
import org.alfresco.service.cmr.model.FileExistsException; //导入依赖的package包/类
private void createNothingToDoScript(String scriptName)
{
NodeRef storeRootNodeRef = nodeService.getRootNode(new StoreRef("workspace://SpacesStore"));
NodeRef scriptFolderRef = searchService.selectNodes(storeRootNodeRef, "/app:company_home/app:dictionary/app:scripts", null, namespaceService, false).get(0);
try
{
FileInfo fileInfo = fileFolderService.create(scriptFolderRef, scriptName, ContentModel.TYPE_CONTENT);
ContentWriter writer = fileFolderService.getWriter(fileInfo.getNodeRef());
assertNotNull("Writer is null", writer);
// write some content
String content = "function main(){}\nmain();";
writer.putContent(content);
}
catch (FileExistsException exc)
{
// file was created before
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:RuleServiceImplTest.java
示例8: createDocument
import org.alfresco.service.cmr.model.FileExistsException; //导入依赖的package包/类
/**
* Creates a document.
* <p>
* Create methods are user authenticated, so the creation of site config must be
* allowed for the current user.
*
* @param path document path
* @param content content of the document to write
*/
@Override
protected void createDocument(final WebScriptResponse res, final String store, final String path, final InputStream content)
{
try
{
writeDocument(path, content);
}
catch (AccessDeniedException ae)
{
res.setStatus(Status.STATUS_UNAUTHORIZED);
throw ae;
}
catch (FileExistsException feeErr)
{
res.setStatus(Status.STATUS_CONFLICT);
throw feeErr;
}
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:28,代码来源:ADMRemoteStore.java
示例9: testCopy
import org.alfresco.service.cmr.model.FileExistsException; //导入依赖的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
示例10: createOnlyLastFolder
import org.alfresco.service.cmr.model.FileExistsException; //导入依赖的package包/类
/**
* Creates only last folder in path
*
* @param path path
* @return FileInfo object for last folder in path if it was created, else returns null
*/
private FileInfo createOnlyLastFolder(String path)
{
Pair<String, String> parentChildPaths = VtiPathHelper.splitPathParentChild(path);
String parentPath = parentChildPaths.getFirst();
String lastFolderName = parentChildPaths.getSecond();
FileInfo parentFileInfo = getPathHelper().resolvePathFileInfo(parentPath);
FileInfo lastFolderFileInfo = null;
if (parentFileInfo != null && parentFileInfo.isFolder() && lastFolderName.length() != 0)
{
try
{
lastFolderFileInfo = getFileFolderService().create(parentFileInfo.getNodeRef(), lastFolderName, ContentModel.TYPE_FOLDER);
}
catch (FileExistsException e)
{
}
}
return lastFolderFileInfo;
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:29,代码来源:AbstractAlfrescoMethodHandler.java
示例11: formatErrorMessage
import org.alfresco.service.cmr.model.FileExistsException; //导入依赖的package包/类
/**
* Formats the error message to display if an error occurs during finish processing
*
* @param exception The exception
* @return The formatted message
*/
@Override
protected String formatErrorMessage(Throwable exception)
{
if (exception instanceof FileExistsException)
{
return MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_EXISTS),
((FileExistsException)exception).getName());
}
else
{
return MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), "error_space"),
exception.getMessage());
}
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:23,代码来源:CreateSpaceWizard.java
示例12: formatErrorMessage
import org.alfresco.service.cmr.model.FileExistsException; //导入依赖的package包/类
@Override
protected String formatErrorMessage(Throwable exception)
{
if (exception instanceof FileExistsException)
{
return MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_EXISTS),
((FileExistsException)exception).getName());
}
else
{
return MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), "error_content"),
exception.getMessage());
}
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:17,代码来源:AddContentDialog.java
示例13: testMoveDocumentInFilePlanInRmSite
import org.alfresco.service.cmr.model.FileExistsException; //导入依赖的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
示例14: testMoveFolderInFilePlanInRmSite
import org.alfresco.service.cmr.model.FileExistsException; //导入依赖的package包/类
public void testMoveFolderInFilePlanInRmSite()
{
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.move(folder1, filePlan, GUID.generate());
}
});
}
开发者ID:Alfresco,项目名称:records-management-old,代码行数:18,代码来源:RM978Test.java
示例15: testCopyDocumentInFilePlanInRmSite
import org.alfresco.service.cmr.model.FileExistsException; //导入依赖的package包/类
public void testCopyDocumentInFilePlanInRmSite()
{
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.copy(document1, filePlan, GUID.generate());
}
});
}
开发者ID:Alfresco,项目名称:records-management-old,代码行数:20,代码来源:RM978Test.java
示例16: testCopyFolderInFilePlanInRmSite
import org.alfresco.service.cmr.model.FileExistsException; //导入依赖的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
示例17: processNamePropertyPersist
import org.alfresco.service.cmr.model.FileExistsException; //导入依赖的package包/类
/**
* Persists the given field data as the name property
*
* @param nodeRef The NodeRef to update the name for
* @param fieldData The data representing the new name value
* @param propsToPersist Map of properties to be persisted
*/
protected void processNamePropertyPersist(NodeRef nodeRef, FieldData fieldData,
Map<QName, Serializable> propsToPersist)
{
// determine whether the file folder service can handle the current node
FileInfo fileInfo = this.fileFolderService.getFileInfo(nodeRef);
if (fileInfo != null)
{
try
{
// if the name property changes the rename method of the file folder
// service should be called rather than updating the property directly
this.fileFolderService.rename(nodeRef, (String) fieldData.getValue());
}
catch (FileExistsException fee)
{
// ALF-6739: Notification should be more user friendly on editing with duplicated name.
// throwing FormException is not informative, therefore, for now we
// throw the captured runtime exception back, as it gives us better information.
//throw new FormException("Failed to persist field '" + fieldData.getName() + "'", fee);
throw fee;
}
catch (FileNotFoundException fnne)
{
throw new FormException("Failed to persist field '" + fieldData.getName() + "'", fnne);
}
}
else
{
// as the file folder service can not be used just set the name property,
// the node service will deal with the details of renaming.
propsToPersist.put(ContentModel.PROP_NAME, (Serializable)fieldData.getValue());
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:42,代码来源:ContentModelFormProcessor.java
示例18: rename
import org.alfresco.service.cmr.model.FileExistsException; //导入依赖的package包/类
/**
* @see #move(NodeRef, NodeRef, String)
*/
@Override
@Extend(traitAPI=FileFolderServiceTrait.class,extensionAPI=FileFolderServiceExtension.class)
public FileInfo rename(NodeRef sourceNodeRef, String newName) throws FileExistsException, FileNotFoundException
{
return moveOrCopy(sourceNodeRef, null, null, newName, true);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:10,代码来源:FileFolderServiceImpl.java
示例19: create
import org.alfresco.service.cmr.model.FileExistsException; //导入依赖的package包/类
@Override
public FileInfo create(NodeRef parentNodeRef, String name, QName typeQName) throws FileExistsException
{
return apiFacet.getFileFolderService().create(parentNodeRef,
name,
typeQName);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:8,代码来源:AlfrescoEnviroment.java
示例20: move
import org.alfresco.service.cmr.model.FileExistsException; //导入依赖的package包/类
/**
* Move this Node from specified parent to a new parent destination.
*
* Beware: Any unsaved property changes will be lost when this is called. To preserve property changes call {@link #save()} first.
*
* @param source Node
* @param destination Node
* @return true on successful move, false on failure to move.
*/
public boolean move(ScriptNode source, ScriptNode destination)
{
ParameterCheck.mandatory("Destination Node", destination);
if (source == null)
{
return move(destination);
}
else
{
try
{
this.services.getFileFolderService().moveFrom(this.nodeRef, source.getNodeRef(), destination.getNodeRef(), null);
}
//MNT-7514 Uninformational error message on move when file name conflicts
catch (FileExistsException ex)
{
throw ex;
}
catch (Exception e)
{
throw new ScriptException("Can't move node", e);
}
}
// reset cached values
reset();
return true;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:40,代码来源:ScriptNode.java
注:本文中的org.alfresco.service.cmr.model.FileExistsException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论