diff --git a/config/alfresco/action-services-context.xml b/config/alfresco/action-services-context.xml index 6ae0233d68..053bf1a317 100644 --- a/config/alfresco/action-services-context.xml +++ b/config/alfresco/action-services-context.xml @@ -438,6 +438,7 @@ + diff --git a/config/alfresco/messages/bootstrap-spaces_de.properties b/config/alfresco/messages/bootstrap-spaces_de.properties index fa2b763dc5..e09367c32c 100755 --- a/config/alfresco/messages/bootstrap-spaces_de.properties +++ b/config/alfresco/messages/bootstrap-spaces_de.properties @@ -9,6 +9,9 @@ spaces.dictionary.description=Benutzerdefinierte Definitionen spaces.imap_attachments.name=IMAP-Anlagen spaces.imap_attachments.description=IMAP-Anlagen +spaces.imap_home.name=IMAP-Startseite +spaces.imap_home.description=IMAP-Startseite + spaces.imapConfig.name=Imap Configs spaces.imapConfig.description=Imap Configs diff --git a/config/alfresco/messages/bootstrap-spaces_es.properties b/config/alfresco/messages/bootstrap-spaces_es.properties index d1e4da0830..3144a22598 100755 --- a/config/alfresco/messages/bootstrap-spaces_es.properties +++ b/config/alfresco/messages/bootstrap-spaces_es.properties @@ -9,6 +9,9 @@ spaces.dictionary.description=Definiciones gestionadas por usuario spaces.imap_attachments.name=Adjuntos IMAP spaces.imap_attachments.description=Adjuntos IMAP +spaces.imap_home.name=Inicio IMAP +spaces.imap_home.description=Inicio IMAP + spaces.imapConfig.name=Configuraciones IMAP spaces.imapConfig.description=Configuraciones IMAP diff --git a/config/alfresco/messages/bootstrap-spaces_fr.properties b/config/alfresco/messages/bootstrap-spaces_fr.properties index bde0cf43ba..9ada948d95 100755 --- a/config/alfresco/messages/bootstrap-spaces_fr.properties +++ b/config/alfresco/messages/bootstrap-spaces_fr.properties @@ -9,6 +9,9 @@ spaces.dictionary.description=D\u00e9finitions personnalis\u00e9es spaces.imap_attachments.name=Pi\u00e8ces jointes IMAP spaces.imap_attachments.description=Pi\u00e8ces jointes IMAP +spaces.imap_home.name=Racine IMAP +spaces.imap_home.description=Racine IMAP + spaces.imapConfig.name=Configurations IMAP spaces.imapConfig.description=Configurations IMAP diff --git a/config/alfresco/messages/bootstrap-spaces_it.properties b/config/alfresco/messages/bootstrap-spaces_it.properties index e940271eda..c228735019 100755 --- a/config/alfresco/messages/bootstrap-spaces_it.properties +++ b/config/alfresco/messages/bootstrap-spaces_it.properties @@ -9,6 +9,9 @@ spaces.dictionary.description=Definizioni gestite dall'utente spaces.imap_attachments.name=Allegato Imap spaces.imap_attachments.description=Allegato Imap +spaces.imap_home.name=Homepage IMAP +spaces.imap_home.description=Homepage IMAP + spaces.imapConfig.name=Configurazioni IMAP spaces.imapConfig.description=Configurazioni IMAP diff --git a/config/alfresco/messages/bootstrap-spaces_ja.properties b/config/alfresco/messages/bootstrap-spaces_ja.properties index 07d42f5ac0..4e36e9c258 100755 --- a/config/alfresco/messages/bootstrap-spaces_ja.properties +++ b/config/alfresco/messages/bootstrap-spaces_ja.properties @@ -9,6 +9,9 @@ spaces.dictionary.description=\u30e6\u30fc\u30b6\u30fc\u7ba1\u7406\u306e\u5b9a\u spaces.imap_attachments.name=IMAP\u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb spaces.imap_attachments.description=IMAP\u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb +spaces.imap_home.name=IMAP\u30db\u30fc\u30e0 +spaces.imap_home.description=IMAP\u30db\u30fc\u30e0 + spaces.imapConfig.name=IMAP\u306e\u69cb\u6210 spaces.imapConfig.description=IMAP\u306e\u69cb\u6210 diff --git a/config/alfresco/messages/bootstrap-spaces_nb_NO.properties b/config/alfresco/messages/bootstrap-spaces_nb_NO.properties index b20860347a..23330863ac 100755 --- a/config/alfresco/messages/bootstrap-spaces_nb_NO.properties +++ b/config/alfresco/messages/bootstrap-spaces_nb_NO.properties @@ -9,6 +9,9 @@ spaces.dictionary.description=Brukeradministrerte definisjoner spaces.imap_attachments.name=IMAP-vedlegg spaces.imap_attachments.description=IMAP-vedlegg +spaces.imap_home.name=IMAP-hjem +spaces.imap_home.description=IMAP-hjem + spaces.imapConfig.name=Imap-konfigurasjoner spaces.imapConfig.description=Imap-konfigurasjoner diff --git a/config/alfresco/messages/bootstrap-spaces_nl.properties b/config/alfresco/messages/bootstrap-spaces_nl.properties index 933c47f0bf..6396ba3ee9 100755 --- a/config/alfresco/messages/bootstrap-spaces_nl.properties +++ b/config/alfresco/messages/bootstrap-spaces_nl.properties @@ -9,6 +9,9 @@ spaces.dictionary.description=Door gebruiker beheerde definities spaces.imap_attachments.name=Imap-bijlagen spaces.imap_attachments.description=Imap-bijlagen +spaces.imap_home.name=IMAP-startpagina +spaces.imap_home.description=IMAP-startpagina + spaces.imapConfig.name=Imap-configuraties spaces.imapConfig.description=Imap-configuraties diff --git a/config/alfresco/messages/bootstrap-spaces_ru.properties b/config/alfresco/messages/bootstrap-spaces_ru.properties index 0b0322d435..59cd6a328c 100755 --- a/config/alfresco/messages/bootstrap-spaces_ru.properties +++ b/config/alfresco/messages/bootstrap-spaces_ru.properties @@ -9,6 +9,9 @@ spaces.dictionary.description=\u0423\u043F\u0440\u0430\u0432\u043B\u044F\u0435\u spaces.imap_attachments.name=\u0412\u043B\u043E\u0436\u0435\u043D\u0438\u044F IMAP spaces.imap_attachments.description=\u0412\u043B\u043E\u0436\u0435\u043D\u0438\u044F IMAP +spaces.imap_home.name=\u0414\u043e\u043c\u0430\u0448\u043d\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e IMAP +spaces.imap_home.description=\u0414\u043e\u043c\u0430\u0448\u043d\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e IMAP + spaces.imapConfig.name=\u041A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 Imap spaces.imapConfig.description=\u041A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 Imap diff --git a/config/alfresco/messages/bootstrap-spaces_zh_CN.properties b/config/alfresco/messages/bootstrap-spaces_zh_CN.properties index ab2e76b332..4e628483c0 100755 --- a/config/alfresco/messages/bootstrap-spaces_zh_CN.properties +++ b/config/alfresco/messages/bootstrap-spaces_zh_CN.properties @@ -9,6 +9,9 @@ spaces.dictionary.description=\u7528\u6237\u7ba1\u7406\u7684\u5b9a\u4e49 spaces.imap_attachments.name=Imap \u7684\u9644\u4ef6 spaces.imap_attachments.description=Imap \u7684\u9644\u4ef6 +spaces.imap_home.name=IMAP \u4e3b\u7a7a\u95f4 +spaces.imap_home.description=IMAP \u4e3b\u7a7a\u95f4 + spaces.imapConfig.name=IMAP \u914d\u7f6e spaces.imapConfig.description=IMAP \u914d\u7f6e diff --git a/config/alfresco/model/modelSchema.xsd b/config/alfresco/model/modelSchema.xsd index 6802f72748..114501baab 100644 --- a/config/alfresco/model/modelSchema.xsd +++ b/config/alfresco/model/modelSchema.xsd @@ -277,8 +277,6 @@ maxOccurs="1" minOccurs="0" /> - diff --git a/config/alfresco/opencmis-context.xml b/config/alfresco/opencmis-context.xml index 2bf702902e..aab15f62bb 100644 --- a/config/alfresco/opencmis-context.xml +++ b/config/alfresco/opencmis-context.xml @@ -40,7 +40,7 @@ - + @@ -66,7 +66,9 @@ - + + + diff --git a/source/java/org/alfresco/cmis/mapping/CMISPropertyServiceTest.java b/source/java/org/alfresco/cmis/mapping/CMISPropertyServiceTest.java index c7311c8a44..afbbfab2cf 100644 --- a/source/java/org/alfresco/cmis/mapping/CMISPropertyServiceTest.java +++ b/source/java/org/alfresco/cmis/mapping/CMISPropertyServiceTest.java @@ -26,6 +26,7 @@ import java.util.Map; import org.alfresco.cmis.CMISDictionaryModel; import org.alfresco.cmis.CMISInvalidArgumentException; import org.alfresco.model.ContentModel; +import org.alfresco.repo.content.MimetypeMap; import org.alfresco.repo.version.VersionModel; import org.alfresco.service.cmr.lock.LockType; import org.alfresco.service.cmr.repository.ContentData; @@ -33,6 +34,8 @@ import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.version.Version; import org.alfresco.service.cmr.version.VersionType; +import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl; +import org.springframework.extensions.webscripts.GUID; public class CMISPropertyServiceTest extends BaseCMISTest { @@ -751,4 +754,24 @@ public class CMISPropertyServiceTest extends BaseCMISTest assertEquals(cmisService.getProperty(folder, CMISDictionaryModel.PROP_NAME.toUpperCase()), "BaseFolder"); assertEquals(cmisService.getProperty(folder, CMISDictionaryModel.PROP_NAME.toLowerCase()), "BaseFolder"); } + + public void testContentMimeTypeDetection() throws Exception + { + // create simple text plain content + NodeRef content = fileFolderService.create(rootNodeRef, "textFile" + GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); + ContentWriter writer = serviceRegistry.getContentService().getWriter(content, ContentModel.PROP_CONTENT, true); + writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); + writer.setEncoding("UTF-8"); + writer.putContent("Simple text plain document"); + + // create content stream with undefined mimetype and file name + ContentStreamImpl contentStreamHTML = new ContentStreamImpl(null, null, " Hello

Test html

"); + String objectId = (String) cmisService.getProperty(content, CMISDictionaryModel.PROP_OBJECT_ID); + + cmisService.setContentStream(objectId, null, true, contentStreamHTML.getStream(), null); + + // check mimetype + String mimetype = (String) cmisService.getProperty(content, CMISDictionaryModel.PROP_CONTENT_STREAM_MIME_TYPE); + assertTrue("Mimetype is not defined correctly.", mimetype.equals(MimetypeMap.MIMETYPE_HTML)); + } } diff --git a/source/java/org/alfresco/cmis/mapping/CMISServicesImpl.java b/source/java/org/alfresco/cmis/mapping/CMISServicesImpl.java index 0095f8bb40..d1d101a9df 100644 --- a/source/java/org/alfresco/cmis/mapping/CMISServicesImpl.java +++ b/source/java/org/alfresco/cmis/mapping/CMISServicesImpl.java @@ -1971,8 +1971,9 @@ public class CMISServicesImpl implements CMISServices, ApplicationContextAware, throw new CMISContentAlreadyExistsException(); } - ContentWriter writer = contentService.getWriter(nodeRef, propertyQName, true); + final ContentWriter writer = contentService.getWriter(nodeRef, propertyQName, true); writer.guessEncoding(); + writer.guessMimetype(null); writer.setMimetype(mimeType); writer.putContent(contentStream); diff --git a/source/java/org/alfresco/opencmis/AlfrescoCmisStreamInterceptor.java b/source/java/org/alfresco/opencmis/AlfrescoCmisStreamInterceptor.java index 9378130445..a289cb3250 100644 --- a/source/java/org/alfresco/opencmis/AlfrescoCmisStreamInterceptor.java +++ b/source/java/org/alfresco/opencmis/AlfrescoCmisStreamInterceptor.java @@ -26,6 +26,8 @@ import java.util.ArrayList; import java.util.List; import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.repo.content.filestore.FileContentReader; +import org.alfresco.service.cmr.repository.MimetypeService; import org.alfresco.util.TempFileProvider; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; @@ -42,6 +44,16 @@ import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl; */ public class AlfrescoCmisStreamInterceptor implements MethodInterceptor { + private MimetypeService mimetypeService; + + /** + * @param mimetypeService service for helping with mimetypes + */ + public void setMimetypeService(MimetypeService mimetypeService) + { + this.mimetypeService = mimetypeService; + } + public Object invoke(MethodInvocation mi) throws Throwable { List reusableContentStreams = null; @@ -61,6 +73,14 @@ public class AlfrescoCmisStreamInterceptor implements MethodInterceptor reusableContentStreams = new ArrayList(); } ReusableContentStream reuableContentStream = new ReusableContentStream(contentStream); + + // ALF-18006 +// if (contentStream.getMimeType() == null) +// { +// String mimeType = mimetypeService.guessMimetype(reuableContentStream.getFileName(), new FileContentReader(reuableContentStream.file)); +// reuableContentStream.setMimeType(mimeType); +// } + reusableContentStreams.add(reuableContentStream); // It is possible to just change the arguments. No need to call a setter. diff --git a/source/java/org/alfresco/opencmis/CMISTest.java b/source/java/org/alfresco/opencmis/CMISTest.java index 7ab41627c6..0237738454 100644 --- a/source/java/org/alfresco/opencmis/CMISTest.java +++ b/source/java/org/alfresco/opencmis/CMISTest.java @@ -13,6 +13,8 @@ import java.util.List; import java.util.Map; import org.alfresco.model.ContentModel; +import org.alfresco.model.WCMModel; +import org.alfresco.repo.content.MimetypeMap; import org.alfresco.repo.model.Repository; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; @@ -20,6 +22,8 @@ import org.alfresco.service.cmr.model.FileFolderService; import org.alfresco.service.cmr.model.FileInfo; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; import org.alfresco.service.transaction.TransactionService; import org.alfresco.util.ApplicationContextHelper; import org.apache.chemistry.opencmis.commons.PropertyIds; @@ -29,7 +33,12 @@ import org.apache.chemistry.opencmis.commons.data.PropertyData; import org.apache.chemistry.opencmis.commons.data.RepositoryInfo; import org.apache.chemistry.opencmis.commons.enums.Action; import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships; +import org.apache.chemistry.opencmis.commons.enums.VersioningState; import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException; +import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl; +import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl; +import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIdImpl; +import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringImpl; import org.apache.chemistry.opencmis.commons.impl.server.AbstractServiceFactory; import org.apache.chemistry.opencmis.commons.server.CallContext; import org.apache.chemistry.opencmis.commons.server.CmisService; @@ -166,6 +175,52 @@ public class CMISTest this.context = new SimpleCallContext("admin", "admin"); } + /** + * ALF-18006 Test content mimetype auto-detection into CmisStreamInterceptor when "Content-Type" is not defined. + */ + @Test + public void testContentMimeTypeDetection() + { + String repositoryId = null; + + CmisService cmisService = factory.getService(context); + try + { + // get repository id + List repositories = cmisService.getRepositoryInfos(null); + assertTrue(repositories.size() > 0); + RepositoryInfo repo = repositories.get(0); + repositoryId = repo.getId(); + + // create content properties + PropertiesImpl properties = new PropertiesImpl(); + String objectTypeId = "cmis:document"; + properties.addProperty(new PropertyIdImpl(PropertyIds.OBJECT_TYPE_ID, objectTypeId)); + String fileName = "textFile" + GUID.generate(); + properties.addProperty(new PropertyStringImpl(PropertyIds.NAME, fileName)); + + // create content stream + ContentStreamImpl contentStream = new ContentStreamImpl(fileName, MimetypeMap.MIMETYPE_TEXT_PLAIN, "Simple text plain document"); + + // create simple text plain content + String objectId = cmisService.create(repositoryId, properties, repositoryHelper.getCompanyHome().toString(), contentStream, VersioningState.MAJOR, null, null); + + Holder objectIdHolder = new Holder(objectId); + + // create content stream with undefined mimetype and file name + ContentStreamImpl contentStreamHTML = new ContentStreamImpl(null, null, " Hello

Test html

"); + cmisService.setContentStream(repositoryId, objectIdHolder, true, null, contentStreamHTML, null); + + // check mimetype + boolean mimetypeHTML = cmisService.getObjectInfo(repositoryId, objectId).getContentType().equals(MimetypeMap.MIMETYPE_HTML); + assertTrue("Mimetype is not defined correctly.", mimetypeHTML); + } + finally + { + cmisService.close(); + } + } + /** * Test for ALF-16310. * diff --git a/source/java/org/alfresco/repo/action/executer/MoveActionExecuter.java b/source/java/org/alfresco/repo/action/executer/MoveActionExecuter.java index 79d2333ec2..7742118565 100644 --- a/source/java/org/alfresco/repo/action/executer/MoveActionExecuter.java +++ b/source/java/org/alfresco/repo/action/executer/MoveActionExecuter.java @@ -20,6 +20,7 @@ package org.alfresco.repo.action.executer; import java.util.List; +import org.alfresco.model.ContentModel; import org.alfresco.repo.action.ParameterDefinitionImpl; import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.action.ParameterDefinition; @@ -27,11 +28,12 @@ import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.model.FileFolderService; import org.alfresco.service.cmr.model.FileNotFoundException; import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; /** - * Copy action executor. + * Move action executor. *

- * Copies the actioned upon node to a specified location. + * Moves the actioned upon node to a specified location. * * @author Roy Wetherall */ @@ -44,12 +46,25 @@ public class MoveActionExecuter extends ActionExecuterAbstractBase * FileFolder service */ private FileFolderService fileFolderService; + + /** + * The node service + */ + private NodeService nodeService; public void setFileFolderService(FileFolderService fileFolderService) { this.fileFolderService = fileFolderService; } + /** + * Sets the node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + @Override protected void addParameterDefinitions(List paramList) { @@ -61,14 +76,19 @@ public class MoveActionExecuter extends ActionExecuterAbstractBase */ public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef) { - NodeRef destinationParent = (NodeRef)ruleAction.getParameterValue(PARAM_DESTINATION_FOLDER); - try + // ALF-17635: A move action should not fire on a working copy - wait until check in + if (this.nodeService.exists(actionedUponNodeRef) + && !this.nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY)) { - fileFolderService.move(actionedUponNodeRef, destinationParent, null); - } - catch (FileNotFoundException e) - { - // Do nothing + NodeRef destinationParent = (NodeRef) ruleAction.getParameterValue(PARAM_DESTINATION_FOLDER); + try + { + fileFolderService.move(actionedUponNodeRef, destinationParent, null); + } + catch (FileNotFoundException e) + { + // Do nothing + } } } diff --git a/source/java/org/alfresco/repo/calendar/CalendarServiceImplTest.java b/source/java/org/alfresco/repo/calendar/CalendarServiceImplTest.java index 36161b39b6..fee933cbab 100644 --- a/source/java/org/alfresco/repo/calendar/CalendarServiceImplTest.java +++ b/source/java/org/alfresco/repo/calendar/CalendarServiceImplTest.java @@ -117,7 +117,7 @@ public class CalendarServiceImplTest PERSON_SERVICE = (PersonService)testContext.getBean("personService"); TRANSACTION_HELPER = (RetryingTransactionHelper)testContext.getBean("retryingTransactionHelper"); PERMISSION_SERVICE = (PermissionService)testContext.getBean("permissionService"); - SITE_SERVICE = (SiteService)testContext.getBean("siteService"); + SITE_SERVICE = (SiteService)testContext.getBean("SiteService"); TAGGING_SERVICE = (TaggingService)testContext.getBean("TaggingService"); // Get the canned query registry, and from that the factory diff --git a/source/java/org/alfresco/repo/discussion/DiscussionServiceImplTest.java b/source/java/org/alfresco/repo/discussion/DiscussionServiceImplTest.java index 434b35e019..e582226450 100644 --- a/source/java/org/alfresco/repo/discussion/DiscussionServiceImplTest.java +++ b/source/java/org/alfresco/repo/discussion/DiscussionServiceImplTest.java @@ -123,7 +123,7 @@ public class DiscussionServiceImplTest PERSON_SERVICE = (PersonService)testContext.getBean("personService"); TRANSACTION_HELPER = (RetryingTransactionHelper)testContext.getBean("retryingTransactionHelper"); PERMISSION_SERVICE = (PermissionService)testContext.getBean("permissionService"); - SITE_SERVICE = (SiteService)testContext.getBean("siteService"); + SITE_SERVICE = (SiteService)testContext.getBean("SiteService"); TAGGING_SERVICE = (TaggingService)testContext.getBean("TaggingService"); TENANT_ADMIN_SERVICE = testContext.getBean("tenantAdminService", TenantAdminService.class); diff --git a/source/java/org/alfresco/repo/importer/ImporterComponent.java b/source/java/org/alfresco/repo/importer/ImporterComponent.java index 9478fab33d..cf0458da95 100644 --- a/source/java/org/alfresco/repo/importer/ImporterComponent.java +++ b/source/java/org/alfresco/repo/importer/ImporterComponent.java @@ -937,7 +937,8 @@ public class ImporterComponent { childName = bindPlaceHolder(childName, binding); // - if (ContentModel.TYPE_PERSON.equals(context.getTypeDefinition().getName())) + if (ContentModel.TYPE_PERSON.equals(context.getTypeDefinition().getName()) + && assocType.equals(ContentModel.ASSOC_CHILDREN)) { childName = childName.toLowerCase(); }