From c39b3845a11dad205300dc618d394cac6cf5d5e0 Mon Sep 17 00:00:00 2001 From: Kevin Leturc Date: Tue, 20 Dec 2016 16:34:40 +0100 Subject: [PATCH] NXP-21025 NXP-18555: Remove deprecated filename property from file and files schemas --- .../BlobHolderAdapterComponent.java | 14 +++--- .../api/blobholder/DocumentBlobHolder.java | 30 ++----------- .../ecm/core/utils/TestBlobsExtractor.java | 2 - .../src/test/resources/schemas/blobinlist.xsd | 5 --- .../test/resources/schemas/externalfile.xsd | 1 - .../src/test/resources/schemas/file.xsd | 1 - .../core/io/download/TestDownloadService.java | 5 +-- .../io/impl/ComplexDocRepositoryInit.java | 3 +- .../io/impl/TestTypedExportedDocument.java | 4 -- .../TypedExportedDocumentRepositoryInit.java | 1 - .../src/test/resources/archive.zip | Bin 2250 -> 2363 bytes .../src/test/resources/export.zip | Bin 6048 -> 6394 bytes .../src/test/resources/modified_archive.zip | Bin 2417 -> 2392 bytes .../src/test/resources/modified_archive2.zip | Bin 4472 -> 4430 bytes .../src/test/resources/schema/file.xsd | 1 - .../java/org/nuxeo/ecm/core/TestDocument.java | 25 ++++------- .../nuxeo/ecm/core/TestSQLRepositoryAPI.java | 40 +++++------------- .../ecm/core/TestSQLRepositoryDirectBlob.java | 2 +- .../core/TestSQLRepositoryFulltextConfig.java | 2 +- .../core/TestSQLRepositoryFulltextQuery.java | 1 - .../ecm/core/TestSQLRepositoryProperties.java | 7 +-- .../ecm/core/TestSQLRepositoryQuery.java | 15 +++---- .../TestSQLRepositoryQueryNoPathOptim.java | 1 - .../ecm/core/TestSQLRepositoryVersioning.java | 34 +++++++-------- .../api/blobholder/TestDocumentAdapter.java | 10 +---- .../test/virusscan/TestDummyVirusScanner.java | 12 +++--- .../src/main/resources/schema/file.xsd | 1 - .../src/main/resources/schema/files.xsd | 1 - .../contentbrowser/WorkspaceActionsBean.java | 2 - .../DocumentTemplatesActionsBean.java | 2 - .../filemanager/FileManageActionsBean.java | 3 +- .../webapp/note/EditorImageActionsBean.java | 1 - .../automation/core/util/DocumentHelper.java | 5 +-- .../core/test/BlobOperationsTest.java | 2 +- .../core/test/TestComplexTypesMapping.java | 11 +++-- .../operations/services/BlobHolderAttach.java | 1 - .../nuxeo-automation-server/README.txt | 6 +-- .../test/TestElasticSearchQuery.java | 28 ++++++------ ...sticsearch-test-nested-mapping-contrib.xml | 3 -- .../adapter/PictureTilesAdapterFactory.java | 8 +--- .../tiles/service/test/TestAdapters.java | 1 - .../picture/PictureMigrationHandler.java | 4 +- .../picture/operation/CreatePicture.java | 1 - .../core/test/TestPictureRenditions.java | 2 - .../mail/action/TransformMessageAction.java | 2 +- .../mail/adapter/MailMessageBlobHolder.java | 28 ++++++------ .../action/CreateDocumentsAction.java | 1 - .../service/TestRenditionService.java | 2 - .../tests/adapter/TestPreviewAdapter.java | 2 - .../platform/actions/TestActionFilter.java | 2 +- .../jsf/test/TestContentViewState.java | 1 - .../ui/web/restAPI/DownloadFileRestlet.java | 6 +-- .../ui/web/restAPI/UploadFileRestlet.java | 19 ++++++--- .../ui/web/tag/fn/LiveEditConstants.java | 4 ++ .../ui/web/restAPI/TestUploadFileRestlet.java | 18 ++++---- .../web/util/TestDocumentModelFunctions.java | 4 +- .../ecm/webapp/clipboard/ZipUtilsTest.java | 1 - .../src/test/resources/data/test2/export.zip | Bin 6343 -> 6340 bytes .../src/test/resources/schema/file.xsd | 1 - .../dublincore/TestDublinCoreStorage.java | 2 +- .../core/listener/MimetypeIconUpdater.java | 25 ----------- .../src/test/resources/schema/blobinlist.xsd | 9 +--- .../filemanager/TestFileManagerService.java | 39 +++++++++-------- .../rendering/test/TestDocumentTemplate.java | 28 ++---------- .../src/test/resources/testdata/testlists.ftl | 2 +- .../ecm/platform/ws/NuxeoRemotingBean.java | 7 ++- .../org/nuxeo/ecm/core/rest/FileService.java | 18 +------- 67 files changed, 171 insertions(+), 348 deletions(-) diff --git a/nuxeo-core/nuxeo-core-api/src/main/java/org/nuxeo/ecm/core/api/blobholder/BlobHolderAdapterComponent.java b/nuxeo-core/nuxeo-core-api/src/main/java/org/nuxeo/ecm/core/api/blobholder/BlobHolderAdapterComponent.java index 1f3a47f1f310..5aa883c17407 100644 --- a/nuxeo-core/nuxeo-core-api/src/main/java/org/nuxeo/ecm/core/api/blobholder/BlobHolderAdapterComponent.java +++ b/nuxeo-core/nuxeo-core-api/src/main/java/org/nuxeo/ecm/core/api/blobholder/BlobHolderAdapterComponent.java @@ -1,5 +1,5 @@ /* - * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others. + * (C) Copyright 2006-2016 Nuxeo SA (http://nuxeo.com/) and others. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ * * Contributors: * Nuxeo - initial API and implementation - * */ package org.nuxeo.ecm.core.api.blobholder; @@ -51,11 +50,11 @@ public class BlobHolderAdapterComponent extends DefaultComponent implements Blob public static final String EXTERNALBLOB_ADAPTER_EP = "ExternalBlobAdapter"; - protected final Map factories = new HashMap(); + protected final Map factories = new HashMap<>(); - protected Map factoriesByFacets = new HashMap(); + protected Map factoriesByFacets = new HashMap<>(); - protected static final Map externalBlobAdapters = new HashMap(); + protected static final Map externalBlobAdapters = new HashMap<>(); @Override public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) { @@ -94,7 +93,8 @@ public void unregisterContribution(Object contribution, String extensionPoint, C /* for test */ public static Set getFactoryNames() { - return ((BlobHolderAdapterComponent) Framework.getLocalService(BlobHolderAdapterService.class)).factories.keySet(); + return ((BlobHolderAdapterComponent) Framework.getLocalService( + BlobHolderAdapterService.class)).factories.keySet(); } /* Service Interface */ @@ -136,7 +136,7 @@ public BlobHolder getBlobHolderAdapter(DocumentModel doc) { } if (doc.hasSchema("file")) { - return new DocumentBlobHolder(doc, "file:content", "file:filename"); + return new DocumentBlobHolder(doc, "file:content"); } else if (doc.hasSchema("note")) { String mt = null; try { diff --git a/nuxeo-core/nuxeo-core-api/src/main/java/org/nuxeo/ecm/core/api/blobholder/DocumentBlobHolder.java b/nuxeo-core/nuxeo-core-api/src/main/java/org/nuxeo/ecm/core/api/blobholder/DocumentBlobHolder.java index a5c5c4a51948..d274c95c4754 100644 --- a/nuxeo-core/nuxeo-core-api/src/main/java/org/nuxeo/ecm/core/api/blobholder/DocumentBlobHolder.java +++ b/nuxeo-core/nuxeo-core-api/src/main/java/org/nuxeo/ecm/core/api/blobholder/DocumentBlobHolder.java @@ -1,5 +1,5 @@ /* - * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others. + * (C) Copyright 2006-2016 Nuxeo SA (http://nuxeo.com/) and others. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,9 +15,7 @@ * * Contributors: * Nuxeo - initial API and implementation - * */ - package org.nuxeo.ecm.core.api.blobholder; import java.io.Serializable; @@ -41,21 +39,11 @@ public class DocumentBlobHolder extends AbstractBlobHolder { protected final String xPath; - protected String xPathFilename; - protected List blobList = null; - /** - * Constructor with filename property for compatibility (when filename was not stored on blob object) - */ - public DocumentBlobHolder(DocumentModel doc, String xPath, String xPathFilename) { + public DocumentBlobHolder(DocumentModel doc, String xPath) { this.doc = doc; this.xPath = xPath; - this.xPathFilename = xPathFilename; - } - - public DocumentBlobHolder(DocumentModel doc, String xPath) { - this(doc, xPath, null); } @Override @@ -65,24 +53,12 @@ protected String getBasePath() { @Override public Blob getBlob() { - Blob blob = (Blob) doc.getPropertyValue(xPath); - if (blob != null && xPathFilename != null) { - String filename = blob.getFilename(); - if (filename == null || "".equals(filename)) { - // compatibility when filename was not stored on blob - blob.setFilename((String) doc.getPropertyValue(xPathFilename)); - } - } - return blob; + return(Blob) doc.getPropertyValue(xPath); } @Override public void setBlob(Blob blob) { doc.getProperty(xPath).setValue(blob); - if (xPathFilename != null) { - String filename = blob == null ? null : blob.getFilename(); - doc.setPropertyValue(xPathFilename, filename); - } } @Override diff --git a/nuxeo-core/nuxeo-core-api/src/test/java/org/nuxeo/ecm/core/utils/TestBlobsExtractor.java b/nuxeo-core/nuxeo-core-api/src/test/java/org/nuxeo/ecm/core/utils/TestBlobsExtractor.java index 44e8ae8f29c8..961089257049 100644 --- a/nuxeo-core/nuxeo-core-api/src/test/java/org/nuxeo/ecm/core/utils/TestBlobsExtractor.java +++ b/nuxeo-core/nuxeo-core-api/src/test/java/org/nuxeo/ecm/core/utils/TestBlobsExtractor.java @@ -119,10 +119,8 @@ public void testGetBlobsPropertiesBlobList() throws Exception { DocumentModel doc = new DocumentModelImpl("/", "doc", "BlobInListDocument"); Map map1 = new HashMap<>(); map1.put("file", createBlob("test1.pdf")); - map1.put("filename", "test1.pdf"); Map map2 = new HashMap<>(); map2.put("file", createBlob("test2.pdf")); - map2.put("filename", "test2.pdf"); doc.setPropertyValue("bil:files", (Serializable) Arrays.asList(map1, map2)); List blobs; diff --git a/nuxeo-core/nuxeo-core-api/src/test/resources/schemas/blobinlist.xsd b/nuxeo-core/nuxeo-core-api/src/test/resources/schemas/blobinlist.xsd index e17401762545..c17dad7fd717 100644 --- a/nuxeo-core/nuxeo-core-api/src/test/resources/schemas/blobinlist.xsd +++ b/nuxeo-core/nuxeo-core-api/src/test/resources/schemas/blobinlist.xsd @@ -23,12 +23,7 @@ - - - - diff --git a/nuxeo-core/nuxeo-core-api/src/test/resources/schemas/externalfile.xsd b/nuxeo-core/nuxeo-core-api/src/test/resources/schemas/externalfile.xsd index 7991a866cec9..935f280470a8 100644 --- a/nuxeo-core/nuxeo-core-api/src/test/resources/schemas/externalfile.xsd +++ b/nuxeo-core/nuxeo-core-api/src/test/resources/schemas/externalfile.xsd @@ -5,7 +5,6 @@ - diff --git a/nuxeo-core/nuxeo-core-api/src/test/resources/schemas/file.xsd b/nuxeo-core/nuxeo-core-api/src/test/resources/schemas/file.xsd index e5ebf8f9cd12..75eb452f29b2 100644 --- a/nuxeo-core/nuxeo-core-api/src/test/resources/schemas/file.xsd +++ b/nuxeo-core/nuxeo-core-api/src/test/resources/schemas/file.xsd @@ -5,7 +5,6 @@ - diff --git a/nuxeo-core/nuxeo-core-io/src/test/java/org/nuxeo/ecm/core/io/download/TestDownloadService.java b/nuxeo-core/nuxeo-core-io/src/test/java/org/nuxeo/ecm/core/io/download/TestDownloadService.java index d40b851a978b..6bacc2b98639 100644 --- a/nuxeo-core/nuxeo-core-io/src/test/java/org/nuxeo/ecm/core/io/download/TestDownloadService.java +++ b/nuxeo-core/nuxeo-core-io/src/test/java/org/nuxeo/ecm/core/io/download/TestDownloadService.java @@ -325,10 +325,9 @@ public void testResolveBlobFromDownloadUrl() throws IOException { String blobFilename = "synopsis.txt"; blob.setFilename(blobFilename); - Map fileMap = new HashMap(); + Map fileMap = new HashMap<>(); fileMap.put("file", blob); - fileMap.put("filename", blob.getFilename()); - List> docFiles = new ArrayList>(); + List> docFiles = new ArrayList<>(); docFiles.add(fileMap); doc.setProperty("files", "files", docFiles); diff --git a/nuxeo-core/nuxeo-core-io/src/test/java/org/nuxeo/ecm/core/io/impl/ComplexDocRepositoryInit.java b/nuxeo-core/nuxeo-core-io/src/test/java/org/nuxeo/ecm/core/io/impl/ComplexDocRepositoryInit.java index 2b55b6048735..38274136bffd 100644 --- a/nuxeo-core/nuxeo-core-io/src/test/java/org/nuxeo/ecm/core/io/impl/ComplexDocRepositoryInit.java +++ b/nuxeo-core/nuxeo-core-io/src/test/java/org/nuxeo/ecm/core/io/impl/ComplexDocRepositoryInit.java @@ -70,7 +70,6 @@ protected final DocumentModel createTestDoc(CoreSession session) { // ----------------------- // file // ----------------------- - doc.setProperty("file", "filename", "test_file.doc"); Blob blob = Blobs.createBlob("My blob"); blob.setFilename("test_file.doc"); doc.setProperty("file", "content", blob); @@ -83,7 +82,7 @@ protected final DocumentModel createTestDoc(CoreSession session) { doc.setPropertyValue("cs:origin", "Internal"); // segmentVariable - Map segment = new HashMap(); + Map segment = new HashMap<>(); segment.put("name", "MySegment"); segment.put("target", "SomeTarget"); segment.put("variableType", "rawVariable"); diff --git a/nuxeo-core/nuxeo-core-io/src/test/java/org/nuxeo/ecm/core/io/impl/TestTypedExportedDocument.java b/nuxeo-core/nuxeo-core-io/src/test/java/org/nuxeo/ecm/core/io/impl/TestTypedExportedDocument.java index c715db665522..0c9f3bf21bce 100644 --- a/nuxeo-core/nuxeo-core-io/src/test/java/org/nuxeo/ecm/core/io/impl/TestTypedExportedDocument.java +++ b/nuxeo-core/nuxeo-core-io/src/test/java/org/nuxeo/ecm/core/io/impl/TestTypedExportedDocument.java @@ -144,10 +144,6 @@ public void testTypedExportedDocument() throws Exception { schemaNode = (Node) xpath.evaluate("//schema[@name='file']", document, XPathConstants.NODE); assertNotNull(schemaNode); - fieldNode = (Node) xpath.evaluate("//file:filename[@type='string']", document, XPathConstants.NODE); - assertNotNull(fieldNode); - assertEquals("test_file.doc", fieldNode.getTextContent()); - fieldNode = (Node) xpath.evaluate("//file:content[@type='content']", document, XPathConstants.NODE); assertNotNull(fieldNode); diff --git a/nuxeo-core/nuxeo-core-io/src/test/java/org/nuxeo/ecm/core/io/impl/TypedExportedDocumentRepositoryInit.java b/nuxeo-core/nuxeo-core-io/src/test/java/org/nuxeo/ecm/core/io/impl/TypedExportedDocumentRepositoryInit.java index 736c9f2b2917..8c2204073fe8 100644 --- a/nuxeo-core/nuxeo-core-io/src/test/java/org/nuxeo/ecm/core/io/impl/TypedExportedDocumentRepositoryInit.java +++ b/nuxeo-core/nuxeo-core-io/src/test/java/org/nuxeo/ecm/core/io/impl/TypedExportedDocumentRepositoryInit.java @@ -64,7 +64,6 @@ protected final DocumentModel createTestDoc(CoreSession session) { // ----------------------- // file // ----------------------- - doc.setProperty("file", "filename", "test_file.doc"); Blob blob = Blobs.createBlob("My blob"); blob.setFilename("test_file.doc"); doc.setProperty("file", "content", blob); diff --git a/nuxeo-core/nuxeo-core-io/src/test/resources/archive.zip b/nuxeo-core/nuxeo-core-io/src/test/resources/archive.zip index c15063f48b4db5cc6729bcdae9bf846bb1aee474..c8a3a3f69c6eed3b361e7a0f7876eca7a80ee389 100644 G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o0GpBih6&1dE0+k<*O#iR(kwcb6Zo<<3GZMA8>VB~CH1FN> ziyM@MTAXr<&I0og4=^*~&O)5fER>d+lM2d5Or+!^QD{B_YevmXCyPLt>9@AYp3_r= z&3$br8Qm>S8_g-*x~I<#qa z$?V+sm$LXLT>4(Hdu77>iD%hE)=g5`zP421@I~o$YZul$VJf;KTfIf?UBtXMZ11i8 z)4$0b{O%B~rLeWnLL+EtwnC#a&HnQ zYA7vqh><;5z|Pa__x{_a8D=Ya!>3$#5$P~EDZ2ff!1~Fqp1f{Fx4r*d?Y_Hf@pW-k zcIPRdjb^b4)M-9AZUM|f>W*OrkvGc~-pCsky-}4gIdom=X~ny&yqAJ1o_}IAcPDRg zaDVNb1GQ3bLWq9yUuSGn0UNUeZik=br(&JPrh5e zA^TV<`|J;U+QsS z=4pkSdt8TH(X=%aH~m#9*;fa;w9Z$>5& z2GrURR?~rMLsWoTH{#O^stXao4#9W48yk}CC~*?t%?gxbU|<8nB1T|=2#i}Z m23rJB@B=kK6kMHs6&xXr5QQ>51w%apJp%=VDqCJIUM>KB9z78N diff --git a/nuxeo-core/nuxeo-core-io/src/test/resources/export.zip b/nuxeo-core/nuxeo-core-io/src/test/resources/export.zip index d6e406ebb273f3da0dd8c01231c79e66be046c9f..01ca65d696cb05ad8c334b84480e52ea5165939b 100644 GIT binary patch literal 6394 zcma)>2RNH+8^?oKF-lRpMrp-}O|4_ksL`TIb=VY9E2=1}Mr~q`QxddB>^(|tTC253 zsTH*;imES8zwcD5r{|07alKcry5-1~iic5uyt0W|RW`_s$R>>C>)uP@Tg|r zAtBORN1^Bn_i&XM)XwWW^1b46nCn~n7w=8|iR8|DWon>>+`KQkf4?H78y-#QP4Fg~ zj+83gk9IZ`6OOnAi7&H3-x(SlqOQ!s6V~ZV(L-3v=m?DpDYL!kDZO_OStx{Qk+B_&QA>nwguF$T9iLf$vMdx9H?|v?Sd!4RwLe z_ct6Jls9o(oj9S00%3#?>goLv1ZLr_S+(k!0b6|m<(hL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eJK_`^xg>}50|D40|L%LF4-$Sw9i9zI{^(E`0{?MK zNB%)!aw%Ep4kZC1DgVqO4UMAzWE~Q|zgKi1d_RH(bBUGf`(F&dV!(%FRPYCYbme@2 z!F*wb{C4L*zsHZ}d+$2fIq7r%{Dls;&Y$1({7=+@xc+ueq^^2sh58sWc7gxg)8Qf` hb<;y}`v7y$RT<5VC@2qZKuAY6Y2vP7!ql@X{|_<1>tO%@ diff --git a/nuxeo-core/nuxeo-core-io/src/test/resources/modified_archive.zip b/nuxeo-core/nuxeo-core-io/src/test/resources/modified_archive.zip index 03023fb4d05d9d055fa696fc56ffa57ccf1dc153..abddb398ea64f071a8ac25b414b47c18b357f07e 100644 GIT binary patch literal 2392 zcmai#c{rQd9>-qy=K(Ipb0sseOl>-1EFmQ$q$YFn> z04|7Vq4IW6mC6YKNxT3c26C^EO<-g*-(IUP`ASy)Tf!xh; zS(9Z*GmiZ3GNsFgGwDjR1I>&c6@^;rF)nqUKHGaf2A4=Mby=j&ziTCgo)`~Eu`KhE z^S+x_@=AWxccg~;2(Vk1#AwOc!-sx0Y&vOy8*$=QJw_X^=1Ic38YXW{Mr$@6Ps$q| zD`u_Cj2)`w9Jb{s3T-s%Il2XXKE3uV$O20pqbeP>&leNeo`dU4rNxvh_C1B4;wd4T zJV=PuoA?We*YUWFyH=Ue6k>6)>OrlvR|@pDYtVw=n;)Fg)IDS?uQ$5W2Jh?OBW>*@ z9^A|5p++;yqraVu{ve$Nae6Y{83lMMH@22$csz$198qkU{bS~iq#>!1kzS@_%9?;^ur zbZFMDl-`|em(Z~+Z`26n3AWa|iYYX(zOd3F!edsL9e|EXQF_>l+dOu&b?S}s6gR#+ zw#4?8l4;p&C-+Lf{TZwvfw}7KCI*-6H=qbLYL9wYz31_7nGaX_?!@YAg``_sbhkC7 z1-G>0j-zx09W_H%*-}i}Hv8A)P!^PgGT-Q29GeRK4(h0_pC_t}6xJ5#w;YN*T@QGQ9~T;|x{G-HzD$Y-IS7oqJ?@tCVk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%!KQG(bx5D?jann@MIKi7}03hZkiD1idPG$R{0yh zAbRzc(sZw6xytJBo3e{1hFYKXDK*)ZJ9#(v6vPHFlnZyV^x2hjPS2vPH-n**4FXqm z8t#Y2-2YmIy!DPHEM@wR@D5vx-ed7{1e36=b*DOym{*PnvbC{}>=_mVF&I6mBS^uE zV7IQTRuO9CA{7oHog!aL64n{x-(-$qXnJRK>5a1O_c{eZQSl-N?NnLE6`3V7zYh|g zxn99$4|>lvc*ZM=#MW<#){@llHq3{?>g~9VX+;nXj6!gZjbVTBF;D zmnsuO%po-w$4HdG0|I)-5>9QDY%S7FU-LV)PWCg2!-3oi1e!wNd4D{>lvdg&vxN-BpT$wrG3i%Jt?%VNz z2OEcZK|;z)_PbdO^6xQ~U0C$l4ali7iy1K0b>B%aImm_TI%m0)#%`>#7Ce1?Nl z8eoMmr5$SJcZ1n}D+Rx`@@rNE>>M(p?d@jI4sk!c-%c_xmJ)VzNOugN3ElCbTi82% z;^tyMI-g=6`ar7zunDckq3k`kiTjEDY*wJL|Mepf9m^q|#r|U5%5tUGa z4)uEPM2MBTMFn37=Z4;4>03k#8FN6lv3&bT3_&o^pe+`YdIsgCw diff --git a/nuxeo-core/nuxeo-core-schema/src/test/resources/schema/file.xsd b/nuxeo-core/nuxeo-core-schema/src/test/resources/schema/file.xsd index 8ae613c17029..4d322f7abe94 100644 --- a/nuxeo-core/nuxeo-core-schema/src/test/resources/schema/file.xsd +++ b/nuxeo-core/nuxeo-core-schema/src/test/resources/schema/file.xsd @@ -8,7 +8,6 @@ - diff --git a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestDocument.java b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestDocument.java index 176a1abb6fba..cb24b081cf49 100644 --- a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestDocument.java +++ b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestDocument.java @@ -104,14 +104,9 @@ private interface TriConsumer { void accept(T t, U u, V v); } - protected final BiFunction DocumentGetValue = (Document doc, String xpath) -> { - return doc.getValue(xpath); - }; + protected final BiFunction DocumentGetValue = Document::getValue; - protected final TriConsumer DocumentSetValue = (Document doc, String xpath, - Object value) -> { - doc.setValue(xpath, value); - }; + protected final TriConsumer DocumentSetValue = Document::setValue; @Test public void testGetValueErrors() throws Exception { @@ -154,7 +149,7 @@ public void testSetValueErrors2() throws Exception { Document root = session.getRootDocument(); Document doc1 = root.addChild("doc", "TestDocument"); Document doc2 = root.addChild("doc", "File"); - doc1.setValue("tp:complexList", Arrays.asList(Collections.emptyMap())); + doc1.setValue("tp:complexList", Collections.singletonList(Collections.emptyMap())); BiConsumer c1 = (xpath, value) -> DocumentSetValue.accept(doc1, xpath, value); checkSet(c1, "tp:complexList", Long.valueOf(0), @@ -250,15 +245,12 @@ public void testComplex() throws Exception { Object b = doc.getValue("cmpf:attachedFile/vignettes/0/content"); assertTrue(b instanceof Blob); assertEquals(content2, ((Blob) b).getString()); - Map vignette2 = new HashMap<>(); - vignette2.put("width", size1); - vignette2.put("content", blob); // get recursive list item @SuppressWarnings("unchecked") Map v0 = (Map) doc.getValue("cmpf:attachedFile/vignettes/0"); assertEquals(size1, v0.get("width")); - b = (Blob) v0.get("content"); + b = v0.get("content"); assertEquals(content2, ((Blob) b).getString()); Object v1 = doc.getValue("cmpf:attachedFile/vignettes/1"); Map ev1 = new HashMap<>(); @@ -295,8 +287,9 @@ public void testComplexFiles() throws Exception { Document root = session.getRootDocument(); Document doc = root.addChild("doc", "File"); - doc.setValue("files", Arrays.asList(Collections.singletonMap("filename", "f1"))); - assertEquals("f1", doc.getValue("files/0/filename")); + Blob blob = Blobs.createBlob("My content"); + doc.setValue("files", Collections.singletonList(Collections.singletonMap("file", blob))); + assertEquals(blob, doc.getValue("files/0/file")); } @Test @@ -308,7 +301,7 @@ public void testBlobList() throws Exception { assertTrue(list instanceof List); assertEquals(0, ((List) list).size()); - doc.setValue("tp:fileList", Arrays.asList(Blobs.createBlob("My content"))); + doc.setValue("tp:fileList", Collections.singletonList(Blobs.createBlob("My content"))); list = doc.getValue("tp:fileList"); assertTrue(list instanceof List); @@ -428,7 +421,7 @@ public void testBlobsVisitorWithOldFacet() throws Exception { Blob blob = Blobs.createBlob("content1", "text/plain"); doc.setValue("cmpf:attachedFile", - Collections.singletonMap("vignettes", Arrays.asList(Collections.singletonMap("content", blob)))); + Collections.singletonMap("vignettes", Collections.singletonList(Collections.singletonMap("content", blob)))); // simulate an obsolete Aged facet present on the document but not in the schema manager Map facets = getSchemaManagerFacets(); diff --git a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryAPI.java b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryAPI.java index f2847a61525b..b6e919a4ce40 100644 --- a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryAPI.java +++ b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryAPI.java @@ -1049,7 +1049,6 @@ public void testGetDocumentDocumentRefStringArray() { session.save(); - childFile.setProperty("file", "filename", "second name"); childFile.setProperty("dublincore", "title", "f1"); childFile.setProperty("dublincore", "description", "desc 1"); @@ -1075,7 +1074,6 @@ public void testGetDocumentDocumentRefStringArray() { assertEquals("f1", returnedDocument.getProperty("dublincore", "title")); assertEquals("desc 1", returnedDocument.getProperty("dublincore", "description")); - assertNull(returnedDocument.getProperty("file", "filename")); returnedDocument = session.getDocument(childFile.getRef()); @@ -1095,7 +1093,6 @@ public void testGetDocumentDocumentRefStringArray() { assertEquals("f1", returnedDocument.getProperty("dublincore", "title")); assertEquals("desc 1", returnedDocument.getProperty("dublincore", "description")); - assertEquals("second name", returnedDocument.getProperty("file", "filename")); } @Test @@ -1431,8 +1428,8 @@ public void TODOtestQuery() { List returnedChildDocs = createChildDocuments(childDocs); - returnedChildDocs.get(1).setProperty("file", "filename", "f1"); - returnedChildDocs.get(2).setProperty("file", "filename", "f2"); + returnedChildDocs.get(1).setProperty("file", "content", Blobs.createBlob("blob1", "text/plain", "UTF-8", "f1")); + returnedChildDocs.get(2).setProperty("file", "content", Blobs.createBlob("blob1", "text/plain", "UTF-8", "f2")); session.saveDocuments(returnedChildDocs.toArray(new DocumentModel[0])); session.save(); @@ -1449,7 +1446,7 @@ public void TODOtestQuery() { // if we select filename, the returned docModel // should have both schemas "file" and "common" - list = session.query("SELECT filename FROM File"); + list = session.query("SELECT content/filename FROM File"); assertEquals(1, list.size()); docModel = list.get(0); schemas = Arrays.asList(docModel.getSchemas()); @@ -1511,10 +1508,9 @@ public void TODOtestQueryAfterEdit() { assertEquals(1, returnedChildDocs.size()); childFile1 = returnedChildDocs.get(0); - childFile1.setProperty("file", "filename", "f1"); // add a blob - Blob blob = Blobs.createBlob("La la la!", "text/html"); + Blob blob = Blobs.createBlob("La la la!", "text/html", "UTF-8", "f1"); childFile1.setProperty("file", "content", blob); session.saveDocument(childFile1); @@ -1776,11 +1772,10 @@ public void testSaveFile() { DocumentModel childFile = new DocumentModelImpl(root.getPathAsString(), name, "File"); childFile.setProperty("dublincore", "title", "f1"); childFile.setProperty("dublincore", "description", "desc 1"); - childFile.setProperty("file", "filename", "filename1"); childFile = createChildDocument(childFile); - Property p = childFile.getProperty("/file:/filename"); + Property p = childFile.getProperty("/dublincore:/description"); // System.out.println(p.getPath()); // TODO NXP-2514: this should be tested across sessions - when it can be done @@ -1790,7 +1785,6 @@ public void testSaveFile() { assertEquals("f1", retrievedFile.getProperty("dublincore", "title")); assertEquals("desc 1", retrievedFile.getProperty("dublincore", "description")); - assertEquals("filename1", retrievedFile.getProperty("file", "filename")); } @Test @@ -1824,9 +1818,9 @@ public void testGetDataModel() { session.save(); - childFile.setProperty("file", "filename", "second name"); childFile.setProperty("dublincore", "title", "f1"); childFile.setProperty("dublincore", "description", "desc 1"); + childFile.setProperty("file", "content", Blobs.createBlob("b1", "text/plain", "UTF-8", "second name")); session.saveDocument(childFile); @@ -1847,7 +1841,7 @@ public void testGetDataModel() { assertNotNull(dm.getMap()); assertNotNull(dm.getSchema()); assertEquals("file", dm.getSchema()); - assertEquals("second name", dm.getData("filename")); + assertEquals("second name", ((Blob) dm.getData("content")).getFilename()); } @Test @@ -2657,7 +2651,6 @@ public void testBlob() throws Exception { long length = blob.getLength(); byte[] content = blob.getByteArray(); - childFile.setProperty("file", "filename", "deprectaed filename"); childFile.setProperty("dublincore", "title", "Blob test"); childFile.setProperty("dublincore", "description", "this is a test"); childFile.setProperty("file", "content", blob); @@ -2872,13 +2865,8 @@ public void testCopyContent() throws Exception { doc.setProperty("dublincore", "title", "t"); doc.setProperty("dublincore", "description", "d"); doc.setProperty("dublincore", "subjects", new String[] { "a", "b" }); - doc.setProperty("file", "filename", "f"); - List files = new ArrayList<>(2); + List files = new ArrayList<>(1); Map f = new HashMap<>(); - f.put("filename", "f1"); - files.add(f); - f = new HashMap<>(); - f.put("filename", "f2"); f.put("file", Blobs.createBlob("myfile", "text/test", "UTF-8")); files.add(f); doc.setProperty("files", "files", files); @@ -2896,14 +2884,11 @@ public void testCopyContent() throws Exception { assertEquals("t", copy.getProperty("dublincore", "title")); assertEquals("d", copy.getProperty("dublincore", "description")); assertEquals(Arrays.asList("a", "b"), Arrays.asList((String[]) copy.getProperty("dublincore", "subjects"))); - assertEquals("f", copy.getProperty("file", "filename")); Object fileso = copy.getProperty("files", "files"); assertNotNull(fileso); List> newfiles = (List>) fileso; - assertEquals(2, newfiles.size()); - assertEquals("f1", newfiles.get(0).get("filename")); - assertEquals("f2", newfiles.get(1).get("filename")); - Blob bb = (Blob) newfiles.get(1).get("file"); + assertEquals(1, newfiles.size()); + Blob bb = (Blob) newfiles.get(0).get("file"); assertNotNull(bb); assertEquals("text/test", bb.getMimeType()); assertEquals("UTF-8", bb.getEncoding()); @@ -3065,11 +3050,8 @@ public void testPropertyXPath() throws Exception { DocumentModel doc = new DocumentModelImpl(parent.getPathAsString(), "theDoc", "File"); doc.setProperty("dublincore", "title", "my title"); + assertEquals("my title", doc.getPropertyValue("title")); assertEquals("my title", doc.getPropertyValue("dc:title")); - - doc.setProperty("file", "filename", "the file name"); - assertEquals("the file name", doc.getPropertyValue("filename")); - assertEquals("the file name", doc.getPropertyValue("file:filename")); } @SuppressWarnings("rawtypes") diff --git a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryDirectBlob.java b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryDirectBlob.java index 5b5d113d9686..b7deceb6f5e5 100644 --- a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryDirectBlob.java +++ b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryDirectBlob.java @@ -116,9 +116,9 @@ public void testDirectBlob() throws Exception { String filename = "doc.txt"; long length = binary.getFile().length(); Blob blob = new BinaryBlob(binary, digest, filename, "text/plain", "utf-8", digest, length); + blob.setFilename(filename); assertEquals("MD5", blob.getDigestAlgorithm()); assertEquals(digest, blob.getDigest()); - file.setProperty("file", "filename", filename); file.setProperty("file", "content", blob); session.saveDocument(file); session.save(); diff --git a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryFulltextConfig.java b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryFulltextConfig.java index 575f456b51ee..1f0eca45821c 100644 --- a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryFulltextConfig.java +++ b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryFulltextConfig.java @@ -121,8 +121,8 @@ protected void createDocs() throws Exception { String content = "Some caf\u00e9 in a restaurant.\nDrink!.\n"; String filename = "testfile.txt"; Blob blob1 = Blobs.createBlob(content); + blob1.setFilename(filename); file1.setPropertyValue("content", (Serializable) blob1); - file1.setPropertyValue("filename", filename); Calendar cal1 = getCalendar(2007, 3, 1, 12, 0, 0); file1.setPropertyValue("dc:created", cal1); file1.setPropertyValue("dc:coverage", "football"); diff --git a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryFulltextQuery.java b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryFulltextQuery.java index 1b0e75adf959..e3e26905a42c 100644 --- a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryFulltextQuery.java +++ b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryFulltextQuery.java @@ -210,7 +210,6 @@ protected void createDocs() throws Exception { Blob blob1 = Blobs.createBlob(content); blob1.setFilename(filename); file1.setPropertyValue("content", (Serializable) blob1); - file1.setPropertyValue("filename", filename); Calendar cal1 = getCalendar(2007, 3, 1, 12, 0, 0); file1.setPropertyValue("dc:created", cal1); file1.setPropertyValue("dc:coverage", "football"); diff --git a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryProperties.java b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryProperties.java index d8e90a82fe84..43283a062ee4 100644 --- a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryProperties.java +++ b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryProperties.java @@ -887,11 +887,12 @@ public void testXPath1() throws Exception { DocumentModel doc = new DocumentModelImpl("/", "doc", "File"); List files = new ArrayList<>(2); Map f = new HashMap<>(); - f.put("filename", "f1"); + Blob blob = Blobs.createBlob("blob1"); + f.put("file", blob); files.add(f); doc.setProperty("files", "files", files); - assertEquals("f1", doc.getPropertyValue("files/0/filename")); - assertEquals("f1", doc.getPropertyValue("files/item[0]/filename")); + assertEquals(blob, doc.getPropertyValue("files/0/file")); + assertEquals(blob, doc.getPropertyValue("files/item[0]/file")); } // other complex list diff --git a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryQuery.java b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryQuery.java index 65d2b32f6f32..1e5fc4680dcc 100644 --- a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryQuery.java +++ b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryQuery.java @@ -228,7 +228,6 @@ protected void createDocs() throws Exception { Blob blob1 = Blobs.createBlob(content); blob1.setFilename(filename); file1.setPropertyValue("content", (Serializable) blob1); - file1.setPropertyValue("filename", filename); Calendar cal1 = getCalendar(2007, 3, 1, 12, 0, 0); file1.setPropertyValue("dc:created", cal1); file1.setPropertyValue("dc:coverage", "football"); @@ -333,7 +332,7 @@ public void testQueryBasic() throws Exception { dml = session.query("SELECT * FROM File WHERE dc:title = 'testfolder1_Title'"); assertEquals(0, dml.size()); - dml = session.query("SELECT * FROM File WHERE filename = 'testfile.txt'"); + dml = session.query("SELECT * FROM File WHERE content/name = 'testfile.txt'"); assertEquals(1, dml.size()); dml = session.query("SELECT * FROM Note WHERE dc:title = 'testfile3_Title'"); @@ -351,10 +350,10 @@ public void testQueryBasic() throws Exception { assertEquals(1, dml.size()); // this needs an actual LEFT OUTER JOIN - dml = session.query("SELECT * FROM Document WHERE filename = 'testfile.txt' OR dc:title = 'testfile3_Title'"); + dml = session.query("SELECT * FROM Document WHERE content/name = 'testfile.txt' OR dc:title = 'testfile3_Title'"); assertEquals(2, dml.size()); - dml = session.query("SELECT * FROM Document WHERE filename = 'testfile.txt' OR dc:contributors = 'bob'"); + dml = session.query("SELECT * FROM Document WHERE content/name = 'testfile.txt' OR dc:contributors = 'bob'"); assertEquals(3, dml.size()); // early detection of conflicting types for VCS @@ -539,11 +538,11 @@ public void testQueryAfterEdit() throws Exception { assertEquals(1, returnedChildDocs.length); childFile1 = returnedChildDocs[0]; - childFile1.setProperty("file", "filename", "f1"); // add a blob String s = "La la la!"; Blob blob = Blobs.createBlob(s, "text/html"); + blob.setFilename("f1"); childFile1.setProperty("file", "content", blob); session.saveDocument(childFile1); @@ -2122,9 +2121,9 @@ public void testQueryIterableWithTransformer() throws Exception { @Test public void testQueryComplexTypeFiles() throws Exception { DocumentModel doc = new DocumentModelImpl("/", "myfile", "File"); - List files = new LinkedList(); - Map f = new HashMap(); - f.put("filename", "f1"); + List files = new LinkedList<>(); + Map f = new HashMap<>(); + f.put("file", Blobs.createBlob("b1", "text/plain", "UTF-8", "f1")); files.add(f); doc.setProperty("files", "files", files); doc = session.createDocument(doc); diff --git a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryQueryNoPathOptim.java b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryQueryNoPathOptim.java index 2fd3038a82bd..38dd374d0b88 100644 --- a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryQueryNoPathOptim.java +++ b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryQueryNoPathOptim.java @@ -155,7 +155,6 @@ protected void createDocs() throws Exception { Blob blob1 = Blobs.createBlob(content); blob1.setFilename(filename); file1.setPropertyValue("content", (Serializable) blob1); - file1.setPropertyValue("filename", filename); Calendar cal1 = getCalendar(2007, 3, 1, 12, 0, 0); file1.setPropertyValue("dc:created", cal1); file1.setPropertyValue("dc:coverage", "football"); diff --git a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryVersioning.java b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryVersioning.java index 5d506c195201..a196d704f4e0 100644 --- a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryVersioning.java +++ b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/TestSQLRepositoryVersioning.java @@ -27,6 +27,7 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import java.io.Serializable; import java.util.Arrays; import java.util.Collection; import java.util.LinkedList; @@ -41,6 +42,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.nuxeo.common.collections.ScopeType; +import org.nuxeo.ecm.core.api.Blobs; import org.nuxeo.ecm.core.api.CoreInstance; import org.nuxeo.ecm.core.api.CoreSession; import org.nuxeo.ecm.core.api.DocumentModel; @@ -51,6 +53,7 @@ import org.nuxeo.ecm.core.api.VersionModel; import org.nuxeo.ecm.core.api.VersioningOption; import org.nuxeo.ecm.core.api.impl.DocumentModelImpl; +import org.nuxeo.ecm.core.api.impl.blob.StringBlob; import org.nuxeo.ecm.core.api.security.ACE; import org.nuxeo.ecm.core.api.security.ACL; import org.nuxeo.ecm.core.api.security.ACP; @@ -129,7 +132,7 @@ public void testRemoveSingleDocVersion() throws Exception { checkVersions(file); - file.setPropertyValue("file:filename", "A"); + file.setPropertyValue("file:content", (Serializable) Blobs.createBlob("B", "text/plain", "UTF-8", "A")); file = session.saveDocument(file); file.checkIn(VersioningOption.MINOR, null); file.checkOut(); // to allow deleting last version @@ -210,7 +213,7 @@ public void testRemoveLastDocVersion() throws Exception { private void createTrioVersions(DocumentModel file) throws Exception { // create a first version - file.setProperty("file", "filename", "A"); + file.setProperty("file", "content", new StringBlob("A")); file = session.saveDocument(file); file.checkIn(VersioningOption.MINOR, null); @@ -218,7 +221,7 @@ private void createTrioVersions(DocumentModel file) throws Exception { // create a second version // make it dirty so it will be saved - file.setProperty("file", "filename", "B"); + file.setProperty("file", "content", new StringBlob("B")); maybeSleepToNextSecond(); file = session.saveDocument(file); file.checkIn(VersioningOption.MINOR, null); @@ -226,7 +229,7 @@ private void createTrioVersions(DocumentModel file) throws Exception { checkVersions(file, "0.1", "0.2"); // create a third version - file.setProperty("file", "filename", "C"); + file.setProperty("file", "content", new StringBlob("C")); maybeSleepToNextSecond(); file = session.saveDocument(file); file.checkIn(VersioningOption.MINOR, null); @@ -331,9 +334,8 @@ public void testRestoreToVersion() throws Exception { session.checkOut(docRef); assertTrue(session.isCheckedOut(docRef)); - doc.setProperty("file", "filename", "second name"); - doc.setProperty("dc", "title", "f1"); - doc.setProperty("dc", "description", "desc 1"); + doc.setProperty("dublincore", "title", "f1"); + doc.setProperty("dublincore", "description", "desc 1"); session.saveDocument(doc); session.save(); @@ -344,7 +346,7 @@ public void testRestoreToVersion() throws Exception { DocumentModel newDoc = session.getDocument(docRef); assertNotNull(newDoc); assertNotNull(newDoc.getRef()); - assertEquals("second name", newDoc.getProperty("file", "filename")); + assertEquals("desc 1", newDoc.getProperty("dublincore", "description")); waitForFulltextIndexing(); maybeSleepToNextSecond(); @@ -352,7 +354,7 @@ public void testRestoreToVersion() throws Exception { assertNotNull(restoredDoc); assertNotNull(restoredDoc.getRef()); - assertNull(restoredDoc.getProperty("file", "filename")); + assertNull(restoredDoc.getProperty("dublincore", "description")); waitForFulltextIndexing(); maybeSleepToNextSecond(); @@ -360,8 +362,7 @@ public void testRestoreToVersion() throws Exception { assertNotNull(restoredDoc); assertNotNull(restoredDoc.getRef()); - String pr = (String) restoredDoc.getProperty("file", "filename"); - assertEquals("second name", pr); + assertEquals("desc 1", restoredDoc.getProperty("dublincore", "description")); } @Test @@ -457,9 +458,8 @@ public void testGetDocumentWithVersion() throws Exception { DocumentRef v1Ref = session.checkIn(childFile.getRef(), null, null); session.checkOut(childFile.getRef()); - childFile.setProperty("file", "filename", "second name"); - childFile.setProperty("dc", "title", "f1"); - childFile.setProperty("dc", "description", "desc 1"); + childFile.setProperty("dublincore", "title", "f1"); + childFile.setProperty("dublincore", "description", "desc 1"); session.saveDocument(childFile); session.save(); maybeSleepToNextSecond(); @@ -468,7 +468,7 @@ public void testGetDocumentWithVersion() throws Exception { DocumentModel newDoc = session.getDocument(childFile.getRef()); assertNotNull(newDoc); assertNotNull(newDoc.getRef()); - assertEquals("second name", newDoc.getProperty("file", "filename")); + assertEquals("desc 1", newDoc.getProperty("dublincore", "description")); // restore, no snapshot as already pristine waitForFulltextIndexing(); @@ -477,13 +477,13 @@ public void testGetDocumentWithVersion() throws Exception { assertNotNull(restoredDoc); assertNotNull(restoredDoc.getRef()); - assertNull(restoredDoc.getProperty("file", "filename")); + assertNull(restoredDoc.getProperty("dublincore", "description")); DocumentModel last = session.getLastDocumentVersion(childFile.getRef()); assertNotNull(last); assertNotNull(last.getRef()); assertEquals(v2Ref.reference(), last.getId()); - assertEquals("second name", last.getProperty("file", "filename")); + assertEquals("desc 1", last.getProperty("dublincore", "description")); } // security on versions, see TestLocalAPIWithCustomVersioning diff --git a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/api/blobholder/TestDocumentAdapter.java b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/api/blobholder/TestDocumentAdapter.java index cf173e37a50b..c5634c1e4a50 100644 --- a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/api/blobholder/TestDocumentAdapter.java +++ b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/api/blobholder/TestDocumentAdapter.java @@ -63,7 +63,6 @@ public void testFileAdapters() throws Exception { blob.setFilename("TestFile.txt"); file.setProperty("dublincore", "title", "TestFile"); file.setProperty("file", "content", blob); - file.setProperty("file", "filename", "TestFile-fn.txt"); file = session.createDocument(file); session.save(); @@ -90,8 +89,6 @@ public void testFileAdapters() throws Exception { assertEquals("other.txt", b.getFilename()); assertEquals("text/html", b.getMimeType()); assertEquals("OtherContent", b.getString()); - // check filename property updated as well - assertEquals("other.txt", file.getPropertyValue("file:filename")); // test set null blob bh.setBlob(null); @@ -99,7 +96,6 @@ public void testFileAdapters() throws Exception { session.save(); b = bh.getBlob(); assertNull(b); - assertNull(file.getPropertyValue("file:filename")); } @Test @@ -164,17 +160,15 @@ public void testMultiFileAdapters() throws Exception { blob.setFilename("TestFile.txt"); file.setProperty("dublincore", "title", "TestDoc"); file.setProperty("file", "content", blob); - file.setProperty("file", "filename", "TestFile-fn.txt"); - List> blobs = new ArrayList>(); + List> blobs = new ArrayList<>(); for (int i = 1; i <= 5; i++) { String name = "TestFile" + i + ".txt"; Blob nblob = Blobs.createBlob("BlobContent" + i); nblob.setFilename(name); - Map filesEntry = new HashMap(); + Map filesEntry = new HashMap<>(); filesEntry.put("file", (Serializable) nblob); - filesEntry.put("filename", name); blobs.add(filesEntry); } file.setPropertyValue("files:files", (Serializable) blobs); diff --git a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/event/test/virusscan/TestDummyVirusScanner.java b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/event/test/virusscan/TestDummyVirusScanner.java index 4b3a67aa860a..10c78707a7f2 100644 --- a/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/event/test/virusscan/TestDummyVirusScanner.java +++ b/nuxeo-core/nuxeo-core-test/src/test/java/org/nuxeo/ecm/core/event/test/virusscan/TestDummyVirusScanner.java @@ -124,12 +124,11 @@ public void testScanner() throws Exception { TransactionHelper.startTransaction(); try { - List> files = new ArrayList>(); + List> files = new ArrayList<>(); for (int i = 0; i < 5; i++) { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("file", (Serializable) getFakeBlob(100, "Test4-" + i + ".txt")); - map.put("filename", "Test4-" + i + ".txt"); files.add(map); } @@ -144,9 +143,8 @@ public void testScanner() throws Exception { List> files = (List>) file4.getPropertyValue("files:files"); - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("file", (Serializable) getFakeBlob(100, "Test4-b.txt")); - map.put("filename", "Test4-b.txt"); files.add(map); file4.setPropertyValue("files:files", (Serializable) files); file4 = session.saveDocument(file4); @@ -163,7 +161,7 @@ public void testScanner() throws Exception { // System.out.println(DummyVirusScanner.getProcessedFiles()); - assertEquals(new HashSet(Arrays.asList( // + assertEquals(new HashSet<>(Arrays.asList( // "Test1.txt", // "Test2.txt", // "Test3doFail.txt", // @@ -173,7 +171,7 @@ public void testScanner() throws Exception { "Test4-2.txt", // "Test4-3.txt", // "Test4-4.txt", // - "Test4-b.txt")), new HashSet(scannedFiles)); + "Test4-b.txt")), new HashSet<>(scannedFiles)); file = session.getDocument(file.getRef()); file2 = session.getDocument(file2.getRef()); diff --git a/nuxeo-core/nuxeo-core/src/main/resources/schema/file.xsd b/nuxeo-core/nuxeo-core/src/main/resources/schema/file.xsd index cc5fe4418211..9b009975c6c7 100644 --- a/nuxeo-core/nuxeo-core/src/main/resources/schema/file.xsd +++ b/nuxeo-core/nuxeo-core/src/main/resources/schema/file.xsd @@ -6,7 +6,6 @@ - diff --git a/nuxeo-core/nuxeo-core/src/main/resources/schema/files.xsd b/nuxeo-core/nuxeo-core/src/main/resources/schema/files.xsd index f458fc086971..6ced0bbb9ba4 100644 --- a/nuxeo-core/nuxeo-core/src/main/resources/schema/files.xsd +++ b/nuxeo-core/nuxeo-core/src/main/resources/schema/files.xsd @@ -18,7 +18,6 @@ - diff --git a/nuxeo-dm/nuxeo-platform-webapp-core/src/main/java/org/nuxeo/ecm/webapp/contentbrowser/WorkspaceActionsBean.java b/nuxeo-dm/nuxeo-platform-webapp-core/src/main/java/org/nuxeo/ecm/webapp/contentbrowser/WorkspaceActionsBean.java index 9121ffd55d3c..49c4dbbae206 100644 --- a/nuxeo-dm/nuxeo-platform-webapp-core/src/main/java/org/nuxeo/ecm/webapp/contentbrowser/WorkspaceActionsBean.java +++ b/nuxeo-dm/nuxeo-platform-webapp-core/src/main/java/org/nuxeo/ecm/webapp/contentbrowser/WorkspaceActionsBean.java @@ -280,8 +280,6 @@ public String createWorkspaceOld() { Blob blob = (Blob) tmpWorkspace.getProperty("file", "content"); if (blob != null) { created.setProperty("file", "content", blob); - String fname = (String) tmpWorkspace.getProperty("file", "filename"); - created.setProperty("file", "filename", fname); } created = documentManager.saveDocument(created); diff --git a/nuxeo-dm/nuxeo-platform-webapp-core/src/main/java/org/nuxeo/ecm/webapp/documenttemplates/DocumentTemplatesActionsBean.java b/nuxeo-dm/nuxeo-platform-webapp-core/src/main/java/org/nuxeo/ecm/webapp/documenttemplates/DocumentTemplatesActionsBean.java index 4bc15c464e52..f5f7bff3e0ab 100644 --- a/nuxeo-dm/nuxeo-platform-webapp-core/src/main/java/org/nuxeo/ecm/webapp/documenttemplates/DocumentTemplatesActionsBean.java +++ b/nuxeo-dm/nuxeo-platform-webapp-core/src/main/java/org/nuxeo/ecm/webapp/documenttemplates/DocumentTemplatesActionsBean.java @@ -178,8 +178,6 @@ public String createDocumentFromTemplate(DocumentModel doc) { Blob blob = (Blob) doc.getProperty("file", "content"); if (blob != null) { created.setProperty("file", "content", blob); - String fname = (String) doc.getProperty("file", "filename"); - created.setProperty("file", "filename", fname); } created = documentManager.saveDocument(created); diff --git a/nuxeo-dm/nuxeo-platform-webapp-core/src/main/java/org/nuxeo/ecm/webapp/filemanager/FileManageActionsBean.java b/nuxeo-dm/nuxeo-platform-webapp-core/src/main/java/org/nuxeo/ecm/webapp/filemanager/FileManageActionsBean.java index 5a524af697e9..e6b9eeaa028b 100644 --- a/nuxeo-dm/nuxeo-platform-webapp-core/src/main/java/org/nuxeo/ecm/webapp/filemanager/FileManageActionsBean.java +++ b/nuxeo-dm/nuxeo-platform-webapp-core/src/main/java/org/nuxeo/ecm/webapp/filemanager/FileManageActionsBean.java @@ -563,9 +563,8 @@ public void validateMultipleUploadForDocument(DocumentModel current) throws File for (NxUploadedFile uploadItem : nxuploadFiles) { Blob blob = uploadItem.getBlob(); FileUtils.configureFileBlob(blob); - HashMap fileMap = new HashMap(2); + HashMap fileMap = new HashMap(1); fileMap.put("file", blob); - fileMap.put("filename", blob.getFilename()); if (!files.contains(fileMap)) { files.add(fileMap); } diff --git a/nuxeo-dm/nuxeo-platform-webapp-core/src/main/java/org/nuxeo/ecm/webapp/note/EditorImageActionsBean.java b/nuxeo-dm/nuxeo-platform-webapp-core/src/main/java/org/nuxeo/ecm/webapp/note/EditorImageActionsBean.java index d4aae1f8d430..71501abb7046 100644 --- a/nuxeo-dm/nuxeo-platform-webapp-core/src/main/java/org/nuxeo/ecm/webapp/note/EditorImageActionsBean.java +++ b/nuxeo-dm/nuxeo-platform-webapp-core/src/main/java/org/nuxeo/ecm/webapp/note/EditorImageActionsBean.java @@ -185,7 +185,6 @@ public String uploadImage() { } catch (IOException e) { throw new NuxeoException(e); } - props.put("filename", blob.getFilename()); props.put("file", blob); ListDiff listDiff = new ListDiff(); listDiff.add(props); diff --git a/nuxeo-features/nuxeo-automation/nuxeo-automation-core/src/main/java/org/nuxeo/ecm/automation/core/util/DocumentHelper.java b/nuxeo-features/nuxeo-automation/nuxeo-automation-core/src/main/java/org/nuxeo/ecm/automation/core/util/DocumentHelper.java index ec960520bb22..94695c47f2de 100644 --- a/nuxeo-features/nuxeo-automation/nuxeo-automation-core/src/main/java/org/nuxeo/ecm/automation/core/util/DocumentHelper.java +++ b/nuxeo-features/nuxeo-automation/nuxeo-automation-core/src/main/java/org/nuxeo/ecm/automation/core/util/DocumentHelper.java @@ -95,7 +95,7 @@ public static void addBlob(Property p, Blob blob) throws PropertyException { // detect if a list of simple blobs or a list of files (blob // holder) Type ft = ((ListProperty) p).getType().getFieldType(); - if (ft.isComplexType() && ((ComplexType) ft).getFieldsCount() == 2) { + if (ft.isComplexType() && ((ComplexType) ft).getFieldsCount() == 1) { p.addValue(createBlobHolderMap(blob)); } else { p.addValue(blob); @@ -106,9 +106,8 @@ public static void addBlob(Property p, Blob blob) throws PropertyException { } public static HashMap createBlobHolderMap(Blob blob) { - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); map.put("file", (Serializable) blob); - map.put("filename", blob.getFilename()); return map; } diff --git a/nuxeo-features/nuxeo-automation/nuxeo-automation-core/src/test/java/org/nuxeo/ecm/automation/core/test/BlobOperationsTest.java b/nuxeo-features/nuxeo-automation/nuxeo-automation-core/src/test/java/org/nuxeo/ecm/automation/core/test/BlobOperationsTest.java index a3d359c0ddd8..19b77364470f 100644 --- a/nuxeo-features/nuxeo-automation/nuxeo-automation-core/src/test/java/org/nuxeo/ecm/automation/core/test/BlobOperationsTest.java +++ b/nuxeo-features/nuxeo-automation/nuxeo-automation-core/src/test/java/org/nuxeo/ecm/automation/core/test/BlobOperationsTest.java @@ -311,9 +311,9 @@ public void testGetAllDocumentBlobsOperation() throws Exception { File tmpFile = Framework.createTempFile("test", ".txt"); FileUtils.writeFile(tmpFile, "Content"); Blob blob = Blobs.createBlob(tmpFile); + blob.setFilename("initial_name.txt"); Framework.trackFile(tmpFile, blob); file.put("file", (Serializable) blob); - file.put("filename", "initial_name.txt"); files.add(file); // Create document DocumentModel docFile = session.createDocumentModel(src.getPathAsString(), "blobWithName", "File"); diff --git a/nuxeo-features/nuxeo-automation/nuxeo-automation-core/src/test/java/org/nuxeo/ecm/automation/core/test/TestComplexTypesMapping.java b/nuxeo-features/nuxeo-automation/nuxeo-automation-core/src/test/java/org/nuxeo/ecm/automation/core/test/TestComplexTypesMapping.java index 9345afc0f36c..1886445bf484 100644 --- a/nuxeo-features/nuxeo-automation/nuxeo-automation-core/src/test/java/org/nuxeo/ecm/automation/core/test/TestComplexTypesMapping.java +++ b/nuxeo-features/nuxeo-automation/nuxeo-automation-core/src/test/java/org/nuxeo/ecm/automation/core/test/TestComplexTypesMapping.java @@ -67,14 +67,13 @@ public void initRepo() throws Exception { blob.setFilename("Yo.txt"); doc.setPropertyValue("file:content", (Serializable) blob); - List> blobs = new ArrayList>(); + List> blobs = new ArrayList<>(); for (int i = 0; i < 5; i++) { Blob subblob = Blobs.createBlob("Yo" + i); subblob.setFilename("File" + i + ".txt"); - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("file", subblob); - map.put("filename", "File" + i + ".txt"); blobs.add(map); } doc.setPropertyValue("files:files", (Serializable) blobs); @@ -83,15 +82,15 @@ public void initRepo() throws Exception { doc.addFacet("Addresses"); - Map address = new HashMap(); + Map address = new HashMap<>(); address.put("streetNumber", "1bis"); address.put("streetName", "whatever"); address.put("zipCode", 75020); doc.setPropertyValue("addr:addressSingle", (Serializable) address); - List> addresses = new ArrayList>(); + List> addresses = new ArrayList<>(); for (int i = 0; i < 5; i++) { - Map add = new HashMap(); + Map add = new HashMap<>(); add.put("streetNumber", "" + i); add.put("streetName", "whatever"); add.put("zipCode", 75000 + i); diff --git a/nuxeo-features/nuxeo-automation/nuxeo-automation-features/src/main/java/org/nuxeo/ecm/automation/core/operations/services/BlobHolderAttach.java b/nuxeo-features/nuxeo-automation/nuxeo-automation-features/src/main/java/org/nuxeo/ecm/automation/core/operations/services/BlobHolderAttach.java index f59a249194b8..c830241eec11 100644 --- a/nuxeo-features/nuxeo-automation/nuxeo-automation-features/src/main/java/org/nuxeo/ecm/automation/core/operations/services/BlobHolderAttach.java +++ b/nuxeo-features/nuxeo-automation/nuxeo-automation-features/src/main/java/org/nuxeo/ecm/automation/core/operations/services/BlobHolderAttach.java @@ -93,7 +93,6 @@ public DocumentModel run(BlobList blobs) throws OperationException { for (Blob blob : blobs) { Map map = new HashMap<>(); map.put("file", blob); - map.put("filename", blob.getFilename()); existingBlobs.add(map); } currentDocument.setPropertyValue("files:files", (Serializable) existingBlobs); diff --git a/nuxeo-features/nuxeo-automation/nuxeo-automation-server/README.txt b/nuxeo-features/nuxeo-automation/nuxeo-automation-server/README.txt index 5c84316cc46b..70f0f2a0b8ba 100644 --- a/nuxeo-features/nuxeo-automation/nuxeo-automation-server/README.txt +++ b/nuxeo-features/nuxeo-automation/nuxeo-automation-server/README.txt @@ -273,8 +273,7 @@ Example of a JSON document entry "digest": null, "length": "290096", "data": "files/96bfb9cb-a13d-48a2-9bbd-9341fcf24801?path=%2Fcontent" - }, - "file:filename": null + } } The top level properties "title" and "lastModified" have the same value as the corresponding embedded properties "dc:title" and "dc:modified". @@ -637,8 +636,7 @@ Content-Length: 1121 "digest": null, "length": "290096", "data": "files/96bfb9cb-a13d-48a2-9bbd-9341fcf24801?path=%2Fcontent" - }, - "file:filename": null + } } 4. Download the content of the blob we set at step 2. diff --git a/nuxeo-features/nuxeo-elasticsearch/nuxeo-elasticsearch-core/src/test/java/org/nuxeo/elasticsearch/test/TestElasticSearchQuery.java b/nuxeo-features/nuxeo-elasticsearch/nuxeo-elasticsearch-core/src/test/java/org/nuxeo/elasticsearch/test/TestElasticSearchQuery.java index deb0e76cdd06..af4cd3e3ebdd 100644 --- a/nuxeo-features/nuxeo-elasticsearch/nuxeo-elasticsearch-core/src/test/java/org/nuxeo/elasticsearch/test/TestElasticSearchQuery.java +++ b/nuxeo-features/nuxeo-elasticsearch/nuxeo-elasticsearch-core/src/test/java/org/nuxeo/elasticsearch/test/TestElasticSearchQuery.java @@ -19,6 +19,15 @@ package org.nuxeo.elasticsearch.test; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import javax.inject.Inject; + import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilders; import org.junit.Assert; @@ -44,15 +53,6 @@ import org.nuxeo.runtime.test.runner.LocalDeploy; import org.nuxeo.runtime.transaction.TransactionHelper; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import javax.inject.Inject; - /** * Test for native ES queries */ @@ -121,14 +121,13 @@ public void searchWithNestedQuery() throws Exception { startTransaction(); DocumentModel doc = session.createDocumentModel("/", "myFile", "File"); // create doc with a list of blob attachement textfile1.txt length=1,textfile2.txt length=2, ... - List> blobs = new ArrayList>(); + List> blobs = new ArrayList<>(); for (int i = 1; i <= 5; i++) { String name = "testfile" + i + ".txt"; Blob nblob = Blobs.createBlob(new String(new char[i]).replace('\0', 'a')); nblob.setFilename(name); - Map filesEntry = new HashMap(); + Map filesEntry = new HashMap<>(); filesEntry.put("file", (Serializable) nblob); - filesEntry.put("filename", name); blobs.add(filesEntry); } doc.setPropertyValue("files:files", (Serializable) blobs); @@ -185,14 +184,11 @@ public void testSecurity() throws Exception { Assert.assertEquals(1, ret.totalSize()); // no match for unknown user - CoreSession restrictedSession = getRestrictedSession("bob"); - try { + try (CoreSession restrictedSession = getRestrictedSession("bob")) { ret = ess.query(new NxQueryBuilder(restrictedSession).nxql("SELECT * FROM Document")); Assert.assertEquals(0, ret.totalSize()); ret = ess.query(new NxQueryBuilder(restrictedSession).esQuery(qb)); Assert.assertEquals(0, ret.totalSize()); - } finally { - restrictedSession.close(); } } diff --git a/nuxeo-features/nuxeo-elasticsearch/nuxeo-elasticsearch-core/src/test/resources/elasticsearch-test-nested-mapping-contrib.xml b/nuxeo-features/nuxeo-elasticsearch/nuxeo-elasticsearch-core/src/test/resources/elasticsearch-test-nested-mapping-contrib.xml index 7bc262036a61..537e8216206d 100644 --- a/nuxeo-features/nuxeo-elasticsearch/nuxeo-elasticsearch-core/src/test/resources/elasticsearch-test-nested-mapping-contrib.xml +++ b/nuxeo-features/nuxeo-elasticsearch/nuxeo-elasticsearch-core/src/test/resources/elasticsearch-test-nested-mapping-contrib.xml @@ -132,9 +132,6 @@ }, "files:files": { "properties": { - "filename": { - "type": "string" - }, "file": { "type" : "nested", "include_in_parent": true, diff --git a/nuxeo-features/nuxeo-platform-imaging-tiling/nuxeo-platform-imaging-tiling/src/main/java/org/nuxeo/ecm/platform/pictures/tiles/api/adapter/PictureTilesAdapterFactory.java b/nuxeo-features/nuxeo-platform-imaging-tiling/nuxeo-platform-imaging-tiling/src/main/java/org/nuxeo/ecm/platform/pictures/tiles/api/adapter/PictureTilesAdapterFactory.java index da03626ccaac..bb8150277fd4 100644 --- a/nuxeo-features/nuxeo-platform-imaging-tiling/nuxeo-platform-imaging-tiling/src/main/java/org/nuxeo/ecm/platform/pictures/tiles/api/adapter/PictureTilesAdapterFactory.java +++ b/nuxeo-features/nuxeo-platform-imaging-tiling/nuxeo-platform-imaging-tiling/src/main/java/org/nuxeo/ecm/platform/pictures/tiles/api/adapter/PictureTilesAdapterFactory.java @@ -55,9 +55,7 @@ public Object getAdapter(DocumentModel doc, Class itf) { if (blob == null) { return null; } - PictureTilesAdapter adapter = new PictureTilesAdapterImpl(doc, "file:content"); - adapter.setFileName((String) doc.getProperty("file", "filename")); - return adapter; + return new PictureTilesAdapterImpl(doc, "file:content"); } else { return new PictureTilesAdapterImpl(doc); } @@ -87,9 +85,7 @@ private PictureTilesAdapter getPictureTilesAdapterForPicture(DocumentModel doc) private PictureTilesAdapter getPictureTilesAdapter(DocumentModel doc, String blobProperty) { Blob blob = (Blob) doc.getPropertyValue(blobProperty); if (blob != null) { - PictureTilesAdapter adapter = new PictureTilesAdapterImpl(doc, blobProperty); - adapter.setFileName(blob.getFilename()); - return adapter; + return new PictureTilesAdapterImpl(doc, blobProperty); } return null; } diff --git a/nuxeo-features/nuxeo-platform-imaging-tiling/nuxeo-platform-imaging-tiling/src/test/java/org/nuxeo/ecm/platform/pictures/tiles/service/test/TestAdapters.java b/nuxeo-features/nuxeo-platform-imaging-tiling/nuxeo-platform-imaging-tiling/src/test/java/org/nuxeo/ecm/platform/pictures/tiles/service/test/TestAdapters.java index 829fca088218..a991086dbb1f 100644 --- a/nuxeo-features/nuxeo-platform-imaging-tiling/nuxeo-platform-imaging-tiling/src/test/java/org/nuxeo/ecm/platform/pictures/tiles/service/test/TestAdapters.java +++ b/nuxeo-features/nuxeo-platform-imaging-tiling/nuxeo-platform-imaging-tiling/src/test/java/org/nuxeo/ecm/platform/pictures/tiles/service/test/TestAdapters.java @@ -80,7 +80,6 @@ public void testAdapter() throws Exception { File file = FileUtils.getResourceFileFromContext("test.jpg"); Blob image = Blobs.createBlob(file); doc.setProperty("file", "content", image); - doc.setProperty("file", "filename", "test.jpg"); doc = session.createDocument(doc); session.save(); diff --git a/nuxeo-features/nuxeo-platform-imaging/nuxeo-platform-imaging-core/src/main/java/org/nuxeo/ecm/platform/picture/PictureMigrationHandler.java b/nuxeo-features/nuxeo-platform-imaging/nuxeo-platform-imaging-core/src/main/java/org/nuxeo/ecm/platform/picture/PictureMigrationHandler.java index dad0333368b7..909352775be7 100644 --- a/nuxeo-features/nuxeo-platform-imaging/nuxeo-platform-imaging-core/src/main/java/org/nuxeo/ecm/platform/picture/PictureMigrationHandler.java +++ b/nuxeo-features/nuxeo-platform-imaging/nuxeo-platform-imaging-core/src/main/java/org/nuxeo/ecm/platform/picture/PictureMigrationHandler.java @@ -16,6 +16,7 @@ * Contributors: * Thomas Roger */ + package org.nuxeo.ecm.platform.picture; import static org.apache.commons.logging.LogFactory.getLog; @@ -63,8 +64,6 @@ public class PictureMigrationHandler extends RepositoryInitializationHandler { public static final String FILE_CONTENT_PROPERTY = "file:content"; - public static final String FILE_FILENAME_PROPERTY = "file:filename"; - public static final int BATCH_SIZE = 50; public static final String DISABLE_QUOTA_CHECK_LISTENER = "disableQuotaListener"; @@ -163,7 +162,6 @@ protected boolean migratePicture(CoreSession session, String docId) { filename = StringUtils.defaultString(filename).replaceAll("^Original_", ""); blob.setFilename(filename); picture.setPropertyValue(FILE_CONTENT_PROPERTY, (Serializable) blob); - picture.setPropertyValue(FILE_FILENAME_PROPERTY, filename); multiviewPicture.removeView(ORIGINAL_VIEW_TITLE); if (picture.isVersion()) { picture.putContextData(ALLOW_VERSION_WRITE, Boolean.TRUE); diff --git a/nuxeo-features/nuxeo-platform-imaging/nuxeo-platform-imaging-core/src/main/java/org/nuxeo/ecm/platform/picture/operation/CreatePicture.java b/nuxeo-features/nuxeo-platform-imaging/nuxeo-platform-imaging-core/src/main/java/org/nuxeo/ecm/platform/picture/operation/CreatePicture.java index 00d8476519f9..898a0160d580 100644 --- a/nuxeo-features/nuxeo-platform-imaging/nuxeo-platform-imaging-core/src/main/java/org/nuxeo/ecm/platform/picture/operation/CreatePicture.java +++ b/nuxeo-features/nuxeo-platform-imaging/nuxeo-platform-imaging-core/src/main/java/org/nuxeo/ecm/platform/picture/operation/CreatePicture.java @@ -128,7 +128,6 @@ public DocumentModel run(DocumentModel doc) throws IOException { log.warn("Unable to read Blob from properties"); } else { picture.setPropertyValue("file:content", (Serializable) blob); - picture.setPropertyValue("file:filename", blob.getFilename()); PictureResourceAdapter adapter = picture.getAdapter(PictureResourceAdapter.class); adapter.fillPictureViews(blob, blob.getFilename(), picture.getTitle(), templates); picture = session.saveDocument(picture); diff --git a/nuxeo-features/nuxeo-platform-imaging/nuxeo-platform-imaging-core/src/test/java/org/nuxeo/ecm/platform/picture/core/test/TestPictureRenditions.java b/nuxeo-features/nuxeo-platform-imaging/nuxeo-platform-imaging-core/src/test/java/org/nuxeo/ecm/platform/picture/core/test/TestPictureRenditions.java index 9ee215598cc8..85027bb5e3b6 100644 --- a/nuxeo-features/nuxeo-platform-imaging/nuxeo-platform-imaging-core/src/test/java/org/nuxeo/ecm/platform/picture/core/test/TestPictureRenditions.java +++ b/nuxeo-features/nuxeo-platform-imaging/nuxeo-platform-imaging-core/src/test/java/org/nuxeo/ecm/platform/picture/core/test/TestPictureRenditions.java @@ -33,7 +33,6 @@ import org.junit.runner.RunWith; import org.nuxeo.common.utils.FileUtils; import org.nuxeo.ecm.automation.AutomationService; -import org.nuxeo.ecm.automation.OperationContext; import org.nuxeo.ecm.core.api.Blob; import org.nuxeo.ecm.core.api.Blobs; import org.nuxeo.ecm.core.api.CoreSession; @@ -144,7 +143,6 @@ public void shouldDeclareRenditionDefinitionImageToPDF() { public void shouldMakeRenditionAvailableImageToPDF() throws Exception { Blob source = Blobs.createBlob(FileUtils.getResourceFileFromContext("images/test.jpg")); DocumentModel doc = session.createDocumentModel("/", "picture", "Picture"); - doc.setProperty("file", "filename", source.getFilename()); doc.setProperty("file", "content", source); Rendition imageToPDFRendition = renditionService.getRendition(doc, "imageToPDF"); diff --git a/nuxeo-features/nuxeo-platform-mail/nuxeo-platform-mail-core/src/main/java/org/nuxeo/ecm/platform/mail/action/TransformMessageAction.java b/nuxeo-features/nuxeo-platform-mail/nuxeo-platform-mail-core/src/main/java/org/nuxeo/ecm/platform/mail/action/TransformMessageAction.java index cbebca9343b1..b5cdaa5f6823 100644 --- a/nuxeo-features/nuxeo-platform-mail/nuxeo-platform-mail-core/src/main/java/org/nuxeo/ecm/platform/mail/action/TransformMessageAction.java +++ b/nuxeo-features/nuxeo-platform-mail/nuxeo-platform-mail-core/src/main/java/org/nuxeo/ecm/platform/mail/action/TransformMessageAction.java @@ -234,8 +234,8 @@ private void setFile(String fileName, InputStream inputStream) throws IOExceptio log.debug("* adding attachment: " + fileName); Map map = new HashMap(); Blob fileBlob = Blobs.createBlob(inputStream); + fileBlob.setFilename(fileName); map.put("file", fileBlob); - map.put("filename", fileName); files.add(map); } diff --git a/nuxeo-features/nuxeo-platform-mail/nuxeo-platform-mail-core/src/main/java/org/nuxeo/ecm/platform/mail/adapter/MailMessageBlobHolder.java b/nuxeo-features/nuxeo-platform-mail/nuxeo-platform-mail-core/src/main/java/org/nuxeo/ecm/platform/mail/adapter/MailMessageBlobHolder.java index 6e9f684484db..888353804543 100644 --- a/nuxeo-features/nuxeo-platform-mail/nuxeo-platform-mail-core/src/main/java/org/nuxeo/ecm/platform/mail/adapter/MailMessageBlobHolder.java +++ b/nuxeo-features/nuxeo-platform-mail/nuxeo-platform-mail-core/src/main/java/org/nuxeo/ecm/platform/mail/adapter/MailMessageBlobHolder.java @@ -1,5 +1,5 @@ /* - * (C) Copyright 2013 Nuxeo SA (http://nuxeo.com/) and others. + * (C) Copyright 2013-2016 Nuxeo SA (http://nuxeo.com/) and others. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,8 +14,7 @@ * limitations under the License. * * Contributors: - * Nuxeo - initial API and implementation - * + * Nuxeo - initial API and implementation */ package org.nuxeo.ecm.platform.mail.adapter; @@ -36,18 +35,21 @@ */ public class MailMessageBlobHolder extends DocumentBlobHolder { - protected Pattern isHtmlPattern = Pattern.compile("(.*)<(html|head|body)>(.*)", Pattern.CASE_INSENSITIVE - | Pattern.DOTALL); + protected Pattern isHtmlPattern = Pattern.compile("(.*)<(html|head|body)>(.*)", + Pattern.CASE_INSENSITIVE | Pattern.DOTALL); + + private final String filename; - public MailMessageBlobHolder(DocumentModel doc, String xPath, String xPathFilename) { - super(doc, xPath, xPathFilename); + public MailMessageBlobHolder(DocumentModel doc, String xPath, String filename) { + super(doc, xPath); + this.filename = filename; } @Override public Blob getBlob() { String htmlTextProperty = (String) doc.getPropertyValue(xPath); - Blob blob = null; - if (htmlTextProperty != null && xPathFilename != null && htmlTextProperty.length() != 0) { + Blob blob; + if (htmlTextProperty != null && filename != null && htmlTextProperty.length() != 0) { blob = Blobs.createBlob(htmlTextProperty); Matcher m = isHtmlPattern.matcher(htmlTextProperty); if (m.matches()) { @@ -60,11 +62,9 @@ public Blob getBlob() { } blob = Blobs.createBlob(txt); } - if (blob != null) { - blob.setFilename(xPathFilename); - // set dummy digest to avoid comparison error - blob.setDigest("notInBinaryStore"); - } + blob.setFilename(filename); + // set dummy digest to avoid comparison error + blob.setDigest("notInBinaryStore"); return blob; } } diff --git a/nuxeo-features/nuxeo-platform-mail/nuxeo-platform-mail-core/src/main/java/org/nuxeo/ecm/platform/mail/listener/action/CreateDocumentsAction.java b/nuxeo-features/nuxeo-platform-mail/nuxeo-platform-mail-core/src/main/java/org/nuxeo/ecm/platform/mail/listener/action/CreateDocumentsAction.java index d3f9e12ee77c..0eeb602c3a07 100644 --- a/nuxeo-features/nuxeo-platform-mail/nuxeo-platform-mail-core/src/main/java/org/nuxeo/ecm/platform/mail/listener/action/CreateDocumentsAction.java +++ b/nuxeo-features/nuxeo-platform-mail/nuxeo-platform-mail-core/src/main/java/org/nuxeo/ecm/platform/mail/listener/action/CreateDocumentsAction.java @@ -108,7 +108,6 @@ public boolean execute(ExecutionContext context) { if (currentFileBlob != null) { Map file = new HashMap<>(); file.put("file", currentFileBlob); - file.put("filename", currentFileBlob.getFilename()); files.add(file); } } diff --git a/nuxeo-features/nuxeo-platform-rendition/nuxeo-platform-rendition-core/src/test/java/org/nuxeo/ecm/platform/rendition/service/TestRenditionService.java b/nuxeo-features/nuxeo-platform-rendition/nuxeo-platform-rendition-core/src/test/java/org/nuxeo/ecm/platform/rendition/service/TestRenditionService.java index 3de1cf2bb101..7c0fc3d78fd4 100644 --- a/nuxeo-features/nuxeo-platform-rendition/nuxeo-platform-rendition-core/src/test/java/org/nuxeo/ecm/platform/rendition/service/TestRenditionService.java +++ b/nuxeo-features/nuxeo-platform-rendition/nuxeo-platform-rendition-core/src/test/java/org/nuxeo/ecm/platform/rendition/service/TestRenditionService.java @@ -669,11 +669,9 @@ public void shouldRemoveFilesBlobsOnARendition() { List> files = new ArrayList<>(); Map file = new HashMap<>(); file.put("file", (Serializable) firstAttachedBlob); - file.put("filename", firstAttachedBlob.getFilename()); files.add(file); file = new HashMap<>(); file.put("file", (Serializable) secondAttachedBlob); - file.put("filename", secondAttachedBlob.getFilename()); files.add(file); fileDocument.setPropertyValue(FILES_FILES_PROPERTY, (Serializable) files); diff --git a/nuxeo-features/preview/nuxeo-preview-core/src/test/java/org/nuxeo/ecm/platform/preview/tests/adapter/TestPreviewAdapter.java b/nuxeo-features/preview/nuxeo-preview-core/src/test/java/org/nuxeo/ecm/platform/preview/tests/adapter/TestPreviewAdapter.java index 38e8bb376328..338181a237f6 100644 --- a/nuxeo-features/preview/nuxeo-preview-core/src/test/java/org/nuxeo/ecm/platform/preview/tests/adapter/TestPreviewAdapter.java +++ b/nuxeo-features/preview/nuxeo-preview-core/src/test/java/org/nuxeo/ecm/platform/preview/tests/adapter/TestPreviewAdapter.java @@ -63,7 +63,6 @@ public void testFileDocument() { Map file = new HashMap<>(); // Attach one file to the list file.put("file", (Serializable) blob); - file.put("filename", "test.txt"); document.setPropertyValue("file:content", (Serializable) blob); assertEquals(true, adapter.hasBlobToPreview()); } @@ -79,7 +78,6 @@ public void testCustomDocumentWithFilesSchema() { Map file = new HashMap<>(); // Attach one file to the list file.put("file", (Serializable) blob); - file.put("filename", "test.txt"); ArrayList> files = new ArrayList<>(); files.add(file); document.setPropertyValue("files:files", files); diff --git a/nuxeo-jsf/nuxeo-platform-actions-jsf/src/test/java/org/nuxeo/ecm/platform/actions/TestActionFilter.java b/nuxeo-jsf/nuxeo-platform-actions-jsf/src/test/java/org/nuxeo/ecm/platform/actions/TestActionFilter.java index f2560ff2a7c9..6902dd37fcfe 100644 --- a/nuxeo-jsf/nuxeo-platform-actions-jsf/src/test/java/org/nuxeo/ecm/platform/actions/TestActionFilter.java +++ b/nuxeo-jsf/nuxeo-platform-actions-jsf/src/test/java/org/nuxeo/ecm/platform/actions/TestActionFilter.java @@ -71,7 +71,7 @@ protected boolean filterAccept(DocumentModel doc, ActionFilter filter) { } private ActionFilter getFilter(String name) { - return as.getFilterRegistry().getFilter(name); + return as.getFilter(name); } @Test diff --git a/nuxeo-jsf/nuxeo-platform-contentview-jsf/src/test/java/org/nuxeo/ecm/platform/contentview/jsf/test/TestContentViewState.java b/nuxeo-jsf/nuxeo-platform-contentview-jsf/src/test/java/org/nuxeo/ecm/platform/contentview/jsf/test/TestContentViewState.java index cac985d607c7..e9a04fcfd8c6 100644 --- a/nuxeo-jsf/nuxeo-platform-contentview-jsf/src/test/java/org/nuxeo/ecm/platform/contentview/jsf/test/TestContentViewState.java +++ b/nuxeo-jsf/nuxeo-platform-contentview-jsf/src/test/java/org/nuxeo/ecm/platform/contentview/jsf/test/TestContentViewState.java @@ -514,7 +514,6 @@ public void testSaveJSONContentViewWithSearchDoc() throws Exception { FileUtils.writeFile(tmpFile, "Content"); Blob blob = Blobs.createBlob(tmpFile); file.put("file", (Serializable) blob); - file.put("filename", "initial_name.txt"); files.add(file); searchDocument.setPropertyValue("files:files", files); diff --git a/nuxeo-jsf/nuxeo-platform-ui-web/src/main/java/org/nuxeo/ecm/platform/ui/web/restAPI/DownloadFileRestlet.java b/nuxeo-jsf/nuxeo-platform-ui-web/src/main/java/org/nuxeo/ecm/platform/ui/web/restAPI/DownloadFileRestlet.java index 4432229e8cc4..9d59806986c1 100644 --- a/nuxeo-jsf/nuxeo-platform-ui-web/src/main/java/org/nuxeo/ecm/platform/ui/web/restAPI/DownloadFileRestlet.java +++ b/nuxeo-jsf/nuxeo-platform-ui-web/src/main/java/org/nuxeo/ecm/platform/ui/web/restAPI/DownloadFileRestlet.java @@ -101,13 +101,9 @@ public void handle(Request req, Response res) { } else { String schemaName = getQueryParamValue(req, SCHEMA, DEFAULT_SCHEMA); String blobFieldName = getQueryParamValue(req, BLOB_FIELD, DEFAULT_BLOB_FIELD); - String filenameFieldName = getQueryParamValue(req, FILENAME_FIELD, DEFAULT_FILENAME_FIELD); - filename = (String) dm.getProperty(schemaName, filenameFieldName); blob = (Blob) dm.getProperty(schemaName, blobFieldName); - xpath = schemaName + ':' + blobFieldName; - } - if (StringUtils.isBlank(filename)) { filename = StringUtils.defaultIfBlank(blob.getFilename(), "file"); + xpath = schemaName + ':' + blobFieldName; } // trigger download diff --git a/nuxeo-jsf/nuxeo-platform-ui-web/src/main/java/org/nuxeo/ecm/platform/ui/web/restAPI/UploadFileRestlet.java b/nuxeo-jsf/nuxeo-platform-ui-web/src/main/java/org/nuxeo/ecm/platform/ui/web/restAPI/UploadFileRestlet.java index 32e9749c2067..7ccbc074ea35 100644 --- a/nuxeo-jsf/nuxeo-platform-ui-web/src/main/java/org/nuxeo/ecm/platform/ui/web/restAPI/UploadFileRestlet.java +++ b/nuxeo-jsf/nuxeo-platform-ui-web/src/main/java/org/nuxeo/ecm/platform/ui/web/restAPI/UploadFileRestlet.java @@ -101,21 +101,18 @@ public void handle(Request req, Response res) { try { String blobPropertyName = getQueryParamValue(req, BLOB_PROPERTY_NAME, null); - String filenamePropertyName = getQueryParamValue(req, FILENAME_PROPERTY_NAME, null); - if (blobPropertyName == null || filenamePropertyName == null) { + if (blobPropertyName == null) { // find the names of the fields from the optional request // parameters with fallback to defaults if none is provided String schemaName = getQueryParamValue(req, SCHEMA, DEFAULT_SCHEMA); String blobFieldName = getQueryParamValue(req, BLOB_FIELD, DEFAULT_BLOB_FIELD); - String filenameFieldName = getQueryParamValue(req, FILENAME_FIELD, DEFAULT_FILENAME_FIELD); blobPropertyName = schemaName + ":" + blobFieldName; - filenamePropertyName = schemaName + ":" + filenameFieldName; } InputStream is = req.getEntity().getStream(); - saveFileToDocument(filename, dm, blobPropertyName, filenamePropertyName, is); + saveFileToDocument(filename, dm, blobPropertyName, is); } catch (NuxeoException | IOException e) { handleError(res, e); } @@ -127,9 +124,20 @@ protected CoreSession getDocumentManager() { /** * Save the file into the document. + * + * @deprecated since 9.1 filename is now stored in blob */ + @Deprecated protected void saveFileToDocument(String filename, DocumentModel dm, String blobPropertyName, String filenamePropertyName, InputStream is) throws IOException, PropertyException { + saveFileToDocument(filename, dm, blobPropertyName, is); + } + + /** + * Save the file into the document. + */ + protected void saveFileToDocument(String filename, DocumentModel dm, String blobPropertyName, + InputStream is) throws IOException, PropertyException { // persisting the blob makes it possible to read the binary content // of the request stream several times (mimetype sniffing, digest // computation, core binary storage) @@ -137,7 +145,6 @@ protected void saveFileToDocument(String filename, DocumentModel dm, String blob blob.setFilename(filename); dm.setPropertyValue(blobPropertyName, (Serializable) blob); - dm.setPropertyValue(filenamePropertyName, filename); getDocumentManager().saveDocument(dm); // autoversioning see https://jira.nuxeo.org/browse/NXP-5849 for more diff --git a/nuxeo-jsf/nuxeo-platform-ui-web/src/main/java/org/nuxeo/ecm/platform/ui/web/tag/fn/LiveEditConstants.java b/nuxeo-jsf/nuxeo-platform-ui-web/src/main/java/org/nuxeo/ecm/platform/ui/web/tag/fn/LiveEditConstants.java index 9c44b2cf0814..5744a216bbb7 100644 --- a/nuxeo-jsf/nuxeo-platform-ui-web/src/main/java/org/nuxeo/ecm/platform/ui/web/tag/fn/LiveEditConstants.java +++ b/nuxeo-jsf/nuxeo-platform-ui-web/src/main/java/org/nuxeo/ecm/platform/ui/web/tag/fn/LiveEditConstants.java @@ -78,6 +78,10 @@ public interface LiveEditConstants { String DEFAULT_DOCTYPE = "File"; // to be deprecated once all filenames are stored in the blob itself + /** + * @deprecated since 9.1 filename is now stored in the blob itself + */ + @Deprecated String DEFAULT_FILENAME_FIELD = "filename"; String DEFAULT_BLOB_FIELD = "content"; diff --git a/nuxeo-jsf/nuxeo-platform-ui-web/src/test/java/org/nuxeo/ecm/platform/ui/web/restAPI/TestUploadFileRestlet.java b/nuxeo-jsf/nuxeo-platform-ui-web/src/test/java/org/nuxeo/ecm/platform/ui/web/restAPI/TestUploadFileRestlet.java index dfaadf9b206a..337102fc820f 100644 --- a/nuxeo-jsf/nuxeo-platform-ui-web/src/test/java/org/nuxeo/ecm/platform/ui/web/restAPI/TestUploadFileRestlet.java +++ b/nuxeo-jsf/nuxeo-platform-ui-web/src/test/java/org/nuxeo/ecm/platform/ui/web/restAPI/TestUploadFileRestlet.java @@ -81,15 +81,14 @@ protected CoreSession getDocumentManager() { }; String expectedFileName = "myfile.txt"; String blobPropertyName = DEFAULT_SCHEMA + ":" + DEFAULT_BLOB_FIELD; - String filenamePropertyName = DEFAULT_SCHEMA + ":" + DEFAULT_FILENAME_FIELD; - restlet.saveFileToDocument(expectedFileName, doc, blobPropertyName, filenamePropertyName, + restlet.saveFileToDocument(expectedFileName, doc, blobPropertyName, new ByteArrayInputStream("Content of the file.".getBytes("UTF-8"))); // check that the upload has been done correctly doc = session.getDocument(doc.getRef()); - assertEquals("The file name is", expectedFileName, doc.getProperty(DEFAULT_SCHEMA, DEFAULT_FILENAME_FIELD)); - assertEquals("The content of the file is", "Content of the file.", - ((Blob) doc.getProperty(DEFAULT_SCHEMA, DEFAULT_BLOB_FIELD)).getString()); + Blob blob = (Blob) doc.getProperty(DEFAULT_SCHEMA, DEFAULT_BLOB_FIELD); + assertEquals("The file name is", expectedFileName, blob.getFilename()); + assertEquals("The content of the file is", "Content of the file.", blob.getString()); // checking that no version has been created List versions = session.getVersions(doc.getRef()); @@ -131,15 +130,14 @@ protected CoreSession getDocumentManager() { }; String expectedFileName = "myfile.txt"; String blobPropertyName = DEFAULT_SCHEMA + ":" + DEFAULT_BLOB_FIELD; - String filenamePropertyName = DEFAULT_SCHEMA + ":" + DEFAULT_FILENAME_FIELD; - restlet.saveFileToDocument(expectedFileName, doc, blobPropertyName, filenamePropertyName, + restlet.saveFileToDocument(expectedFileName, doc, blobPropertyName, new ByteArrayInputStream("Content of the file.".getBytes("UTF-8"))); // check that the upload has been done correctly doc = session.getDocument(doc.getRef()); - assertEquals("The file name is", expectedFileName, doc.getProperty(DEFAULT_SCHEMA, DEFAULT_FILENAME_FIELD)); - assertEquals("The content of the file is", "Content of the file.", - ((Blob) doc.getProperty(DEFAULT_SCHEMA, DEFAULT_BLOB_FIELD)).getString()); + Blob blob = (Blob) doc.getProperty(DEFAULT_SCHEMA, DEFAULT_BLOB_FIELD); + assertEquals("The file name is", expectedFileName, blob.getFilename()); + assertEquals("The content of the file is", "Content of the file.", blob.getString()); // checking that version has been created and incremented List versions = session.getVersions(doc.getRef()); diff --git a/nuxeo-jsf/nuxeo-platform-ui-web/src/test/java/org/nuxeo/ecm/platform/ui/web/util/TestDocumentModelFunctions.java b/nuxeo-jsf/nuxeo-platform-ui-web/src/test/java/org/nuxeo/ecm/platform/ui/web/util/TestDocumentModelFunctions.java index 75fcf077d857..806b011a8362 100644 --- a/nuxeo-jsf/nuxeo-platform-ui-web/src/test/java/org/nuxeo/ecm/platform/ui/web/util/TestDocumentModelFunctions.java +++ b/nuxeo-jsf/nuxeo-platform-ui-web/src/test/java/org/nuxeo/ecm/platform/ui/web/util/TestDocumentModelFunctions.java @@ -50,11 +50,9 @@ public void testDefaultValue() throws Exception { Object blobVal = DocumentModelFunctions.defaultValue("files:files"); assertTrue(blobVal instanceof HashMap); HashMap blobValMap = (HashMap) blobVal; - assertEquals(2, blobValMap.size()); + assertEquals(1, blobValMap.size()); assertTrue(blobValMap.containsKey("file")); assertNull(blobValMap.get("file")); - assertTrue(blobValMap.containsKey("filename")); - assertNull(blobValMap.get("filename")); Object stringListItemVal = DocumentModelFunctions.defaultValue("lds:listOfLists/stringListItem"); assertTrue(stringListItemVal instanceof String); diff --git a/nuxeo-jsf/nuxeo-platform-webapp-base/src/test/java/org/nuxeo/ecm/webapp/clipboard/ZipUtilsTest.java b/nuxeo-jsf/nuxeo-platform-webapp-base/src/test/java/org/nuxeo/ecm/webapp/clipboard/ZipUtilsTest.java index c8b37d3214c6..fcb239b97265 100644 --- a/nuxeo-jsf/nuxeo-platform-webapp-base/src/test/java/org/nuxeo/ecm/webapp/clipboard/ZipUtilsTest.java +++ b/nuxeo-jsf/nuxeo-platform-webapp-base/src/test/java/org/nuxeo/ecm/webapp/clipboard/ZipUtilsTest.java @@ -78,7 +78,6 @@ protected DocumentModel createHeavyFile() { HashMap blob = new HashMap(); blob.put("file", (Serializable) blob2); - blob.put("filename", blob2.getFilename()); ArrayList> blobs = new ArrayList>(); blobs.add(blob); diff --git a/nuxeo-services/nuxeo-platform-content-template-manager/src/test/resources/data/test2/export.zip b/nuxeo-services/nuxeo-platform-content-template-manager/src/test/resources/data/test2/export.zip index ad407a4e7aa24a505a748b884e3bd26bcf734d38..beef6dd48acf6f5e49d6baa3a09344ba473e2c43 100644 GIT binary patch delta 1050 zcmX?Zc*Jl*5R*aU#1K{1HJ*_XXC^Nc5t%%Ji(}#}bH?(nmR z2$!#tiTK|AT7GTVv4_GO3n%SL|Msv^vx4`F6YG*|g6vbxUP-Rd{*e1%+PbL^z6AA} z9{FQvq@ysUX{%=FB}rAb4ehQOmvbczAKZU`?Vi$7pBE~exOgwu8)JFz!};0T zAHEiGdHY|Obi~@_7V~0NE6e5l68rbm1GWNJtuDh_p z|KN*8DUN!p5bjVe8P~K`p>r2DEZ(XZUH8W3^tsTF6F#5K`;%q#=iROivsKm^cfWOJ zIG`qgf#Cz`EnbQR3n3{KQ zX4&}ecIb_Ay)V-Y^-J$?u6VR=-ob+%dzasnC@gz;2f1eSkMJ3l}hbGcZ_#vI4_oA1-ay zgGd?0lX3s%TU^}CjPQK5nThWL6B75mKn*i6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git a/nuxeo-services/nuxeo-platform-content-template-manager/src/test/resources/schema/file.xsd b/nuxeo-services/nuxeo-platform-content-template-manager/src/test/resources/schema/file.xsd index fa53e98b082a..d6c9e5fe93ce 100644 --- a/nuxeo-services/nuxeo-platform-content-template-manager/src/test/resources/schema/file.xsd +++ b/nuxeo-services/nuxeo-platform-content-template-manager/src/test/resources/schema/file.xsd @@ -8,7 +8,6 @@ - diff --git a/nuxeo-services/nuxeo-platform-dublincore/src/test/java/org/nuxeo/ecm/platform/dublincore/TestDublinCoreStorage.java b/nuxeo-services/nuxeo-platform-dublincore/src/test/java/org/nuxeo/ecm/platform/dublincore/TestDublinCoreStorage.java index 081dd64a658f..3be0115f960c 100644 --- a/nuxeo-services/nuxeo-platform-dublincore/src/test/java/org/nuxeo/ecm/platform/dublincore/TestDublinCoreStorage.java +++ b/nuxeo-services/nuxeo-platform-dublincore/src/test/java/org/nuxeo/ecm/platform/dublincore/TestDublinCoreStorage.java @@ -291,7 +291,7 @@ public void testProxySchemasWithComplex() { // read part of a non-initialized complex prop // should not mark it dirty which would cause problems on save - proxy.getPropertyValue("file:filename"); + proxy.getPropertyValue("file:content"); // write a modifiable proxy schema proxy.setPropertyValue("info:info", "proxyinfo"); proxy = session.saveDocument(proxy); diff --git a/nuxeo-services/nuxeo-platform-filemanager-core-listener/src/main/java/org/nuxeo/ecm/platform/filemanager/core/listener/MimetypeIconUpdater.java b/nuxeo-services/nuxeo-platform-filemanager-core-listener/src/main/java/org/nuxeo/ecm/platform/filemanager/core/listener/MimetypeIconUpdater.java index 1da1b3656e5f..f63de2ba661d 100644 --- a/nuxeo-services/nuxeo-platform-filemanager-core-listener/src/main/java/org/nuxeo/ecm/platform/filemanager/core/listener/MimetypeIconUpdater.java +++ b/nuxeo-services/nuxeo-platform-filemanager-core-listener/src/main/java/org/nuxeo/ecm/platform/filemanager/core/listener/MimetypeIconUpdater.java @@ -58,10 +58,6 @@ public class MimetypeIconUpdater implements EventListener { public static final String MAIN_BLOB_SCHEMA = "file"; - @Deprecated - // the filename should now be stored inside the main blob - public static final String MAIN_EXTERNAL_FILENAME_FIELD = "file:filename"; - protected static final String OCTET_STREAM_MT = "application/octet-stream"; public final BlobsExtractor blobExtractor = new BlobsExtractor(); @@ -89,9 +85,6 @@ public void handleEvent(Event event) { return; } - // BBB: handle old filename scheme - updateFilename(doc); - try { // ensure the document main icon is not null setDefaultIcon(doc); @@ -147,24 +140,6 @@ private void updateIconAndSizeFields(DocumentModel doc, MimetypeRegistry mimetyp } } - /** - * Backward compatibility for external filename field: if edited, it might affect the main blob mimetype - */ - public void updateFilename(DocumentModel doc) throws PropertyException { - - if (doc.hasSchema(MAIN_BLOB_FIELD.split(":")[0])) { - Property filenameProperty = doc.getProperty(MAIN_EXTERNAL_FILENAME_FIELD); - if (filenameProperty.isDirty()) { - String filename = filenameProperty.getValue(String.class); - if (doc.getProperty(MAIN_BLOB_FIELD).getValue() != null) { - Blob blob = doc.getProperty(MAIN_BLOB_FIELD).getValue(Blob.class); - blob.setFilename(filename); - doc.setPropertyValue(MAIN_BLOB_FIELD, (Serializable) blob); - } - } - } - } - /** * If the icon field is empty, initialize it to the document type icon */ diff --git a/nuxeo-services/nuxeo-platform-filemanager-core-listener/src/test/resources/schema/blobinlist.xsd b/nuxeo-services/nuxeo-platform-filemanager-core-listener/src/test/resources/schema/blobinlist.xsd index 401d147528bc..c31628f95612 100644 --- a/nuxeo-services/nuxeo-platform-filemanager-core-listener/src/test/resources/schema/blobinlist.xsd +++ b/nuxeo-services/nuxeo-platform-filemanager-core-listener/src/test/resources/schema/blobinlist.xsd @@ -17,14 +17,7 @@ - - - - - + diff --git a/nuxeo-services/nuxeo-platform-filemanager-core/src/test/java/org/nuxeo/ecm/platform/filemanager/TestFileManagerService.java b/nuxeo-services/nuxeo-platform-filemanager-core/src/test/java/org/nuxeo/ecm/platform/filemanager/TestFileManagerService.java index 3614cdea2f52..b86650f6a59b 100644 --- a/nuxeo-services/nuxeo-platform-filemanager-core/src/test/java/org/nuxeo/ecm/platform/filemanager/TestFileManagerService.java +++ b/nuxeo-services/nuxeo-platform-filemanager-core/src/test/java/org/nuxeo/ecm/platform/filemanager/TestFileManagerService.java @@ -107,10 +107,10 @@ public void testDefaultCreateFromBlob() throws Exception { "test-data/hello.doc"); assertNotNull(doc); assertEquals("hello.doc", doc.getProperty("dublincore", "title")); - assertEquals("hello.doc", doc.getProperty("file", "filename")); assertNotNull(doc.getProperty("file", "content")); BinaryBlob blob = (BinaryBlob) doc.getProperty("file", "content"); assertEquals("application/msword", blob.getMimeType()); + assertEquals("hello.doc", blob.getFilename()); // let's make the same test but this time without mime-type checking // because the blob already carries a mime-type that matches the file name @@ -119,10 +119,10 @@ public void testDefaultCreateFromBlob() throws Exception { "test-data/hello2.doc", true); assertNotNull(doc); assertEquals("hello2.doc", doc.getProperty("dublincore", "title")); - assertEquals("hello2.doc", doc.getProperty("file", "filename")); assertNotNull(doc.getProperty("file", "content")); blob = (BinaryBlob) doc.getProperty("file", "content"); assertEquals("application/msword", blob.getMimeType()); + assertEquals("hello2.doc", blob.getFilename()); } @Test @@ -136,20 +136,20 @@ public void testCreateFromBlobWithMimeTypeCheck() throws IOException { "test-data/hello3.doc"); assertNotNull(doc); assertEquals("hello3.doc", doc.getProperty("dublincore", "title")); - assertEquals("hello3.doc", doc.getProperty("file", "filename")); assertNotNull(doc.getProperty("file", "content")); BinaryBlob blob = (BinaryBlob) doc.getProperty("file", "content"); assertEquals("application/msword", blob.getMimeType()); + assertEquals("hello3.doc", blob.getFilename()); input = Blobs.createBlob(file, "application/sometype"); doc = service.createDocumentFromBlob(coreSession, input, workspace.getPathAsString(), true, "test-data/hello3.doc", true); assertNotNull(doc); assertEquals("hello3.doc", doc.getProperty("dublincore", "title")); - assertEquals("hello3.doc", doc.getProperty("file", "filename")); assertNotNull(doc.getProperty("file", "content")); blob = (BinaryBlob) doc.getProperty("file", "content"); assertEquals("application/sometype", blob.getMimeType()); + assertEquals("hello3.doc", blob.getFilename()); } @Test @@ -164,8 +164,9 @@ public void testDefaultCreateTwiceFromSameBlob() throws Exception { assertNotNull(doc); assertEquals("hello.doc", doc.getProperty("dublincore", "title")); - assertEquals("hello.doc", doc.getProperty("file", "filename")); - assertNotNull(doc.getProperty("file", "content")); + Blob blob = (Blob) doc.getProperty("file", "content"); + assertNotNull(blob); + assertEquals("hello.doc", blob.getFilename()); List versions = coreSession.getVersions(docRef); assertEquals(0, versions.size()); @@ -178,8 +179,9 @@ public void testDefaultCreateTwiceFromSameBlob() throws Exception { DocumentRef newDocRef = doc.getRef(); assertEquals(docRef, newDocRef); assertEquals("hello.doc", doc.getProperty("dublincore", "title")); - assertEquals("hello.doc", doc.getProperty("file", "filename")); - assertNotNull(doc.getProperty("file", "content")); + blob = (Blob) doc.getProperty("file", "content"); + assertNotNull(blob); + assertEquals("hello.doc", blob.getFilename()); versions = coreSession.getVersions(docRef); assertEquals(1, versions.size()); @@ -197,8 +199,9 @@ public void testDefaultUpdateFromBlob() throws Exception { assertNotNull(doc); assertEquals("hello.doc", doc.getProperty("dublincore", "title")); - assertEquals("hello.doc", doc.getProperty("file", "filename")); - assertNotNull(doc.getProperty("file", "content")); + Blob blob = (Blob) doc.getProperty("file", "content"); + assertNotNull(blob); + assertEquals("hello.doc", blob.getFilename()); // update it with another file with same name doc = service.updateDocumentFromBlob(coreSession, input, workspace.getPathAsString(), @@ -208,8 +211,9 @@ public void testDefaultUpdateFromBlob() throws Exception { DocumentRef newDocRef = doc.getRef(); assertEquals(docRef, newDocRef); assertEquals("hello.doc", doc.getProperty("dublincore", "title")); - assertEquals("hello.doc", doc.getProperty("file", "filename")); - assertNotNull(doc.getProperty("file", "content")); + blob = (Blob) doc.getProperty("file", "content"); + assertNotNull(blob); + assertEquals("hello.doc", blob.getFilename()); } protected static final String SEPARATOR = "\n"; @@ -400,7 +404,6 @@ public void testUpdateFileDocWithPlainTextFile() throws Exception { DocumentModel doc = coreSession.createDocumentModel(workspace.getPathAsString(), "hello.html", "File"); doc.setPropertyValue("dc:title", "hello.html"); doc.setPropertyValue("file:content", (Serializable) input); - doc.setPropertyValue("file:filename", "hello.html"); // create doc doc = coreSession.createDocument(doc); @@ -409,8 +412,9 @@ public void testUpdateFileDocWithPlainTextFile() throws Exception { assertNotNull(doc); assertEquals("hello.html", doc.getProperty("dublincore", "title")); - assertEquals("hello.html", doc.getProperty("file", "filename")); - assertNotNull(doc.getProperty("file", "content")); + Blob blob = (Blob) doc.getProperty("file", "content"); + assertNotNull(blob); + assertEquals("hello.html", blob.getFilename()); assertTrue(extractText(doc).contains("RTF")); assertEquals("text/rtf", getMimeType(doc)); @@ -426,8 +430,9 @@ public void testUpdateFileDocWithPlainTextFile() throws Exception { DocumentRef newDocRef = doc.getRef(); assertEquals(docRef, newDocRef); - assertEquals("hello.html", doc.getProperty("file", "filename")); - assertNotNull(doc.getProperty("file", "content")); + blob = (Blob) doc.getProperty("file", "content"); + assertNotNull(blob); + assertEquals("hello.html", blob.getFilename()); assertTrue(extractText(doc).contains("HTML")); assertEquals("text/html", getMimeType(doc)); diff --git a/nuxeo-services/nuxeo-platform-rendering/src/test/java/org/nuxeo/ecm/platform/rendering/test/TestDocumentTemplate.java b/nuxeo-services/nuxeo-platform-rendering/src/test/java/org/nuxeo/ecm/platform/rendering/test/TestDocumentTemplate.java index 42c99616f3f7..c0a46838dfda 100644 --- a/nuxeo-services/nuxeo-platform-rendering/src/test/java/org/nuxeo/ecm/platform/rendering/test/TestDocumentTemplate.java +++ b/nuxeo-services/nuxeo-platform-rendering/src/test/java/org/nuxeo/ecm/platform/rendering/test/TestDocumentTemplate.java @@ -1,5 +1,5 @@ /* - * (C) Copyright 2013 Nuxeo SA (http://nuxeo.com/) and others. + * (C) Copyright 2013-2016 Nuxeo SA (http://nuxeo.com/) and others. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,31 +26,8 @@ import java.util.List; import java.util.Map; - import javax.inject.Inject; -/* - * Copyright (c) 2006-2013 Nuxeo SA (http://nuxeo.com/) and others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Contributors: - * Nuxeo - * - * $Id$ - */ -import junit.framework.Assert; - import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -68,6 +45,8 @@ import org.nuxeo.runtime.test.runner.Features; import org.nuxeo.runtime.test.runner.FeaturesRunner; +import junit.framework.Assert; + /** * @author Tiry * @since 5.7 @@ -106,7 +85,6 @@ public void setUp() throws Exception { Blob blob = Blobs.createBlob("something", "application/something", null, "file" + i + ".something"); Map blobEntry = new HashMap<>(); blobEntry.put("file", (Serializable) blob); - blobEntry.put("filename", blob.getFilename()); blobs.add(blobEntry); } doc.setPropertyValue("files:files", (Serializable) blobs); diff --git a/nuxeo-services/nuxeo-platform-rendering/src/test/resources/testdata/testlists.ftl b/nuxeo-services/nuxeo-platform-rendering/src/test/resources/testdata/testlists.ftl index f4f09de3fffc..e9dd94e8f8b9 100644 --- a/nuxeo-services/nuxeo-platform-rendering/src/test/resources/testdata/testlists.ftl +++ b/nuxeo-services/nuxeo-platform-rendering/src/test/resources/testdata/testlists.ftl @@ -21,5 +21,5 @@ ${doc.dublincore.issued?datetime} <#list doc.dublincore.subjects as subject>${subject}| <#list doc.files.files as file> -${file.filename} ${file.file.length} +${file.file.filename} ${file.file.length} diff --git a/nuxeo-services/nuxeo-platform-ws/src/main/java/org/nuxeo/ecm/platform/ws/NuxeoRemotingBean.java b/nuxeo-services/nuxeo-platform-ws/src/main/java/org/nuxeo/ecm/platform/ws/NuxeoRemotingBean.java index a609591de585..9c6e8125e799 100644 --- a/nuxeo-services/nuxeo-platform-ws/src/main/java/org/nuxeo/ecm/platform/ws/NuxeoRemotingBean.java +++ b/nuxeo-services/nuxeo-platform-ws/src/main/java/org/nuxeo/ecm/platform/ws/NuxeoRemotingBean.java @@ -545,8 +545,7 @@ public String uploadDocument(@WebParam(name = "sessionId") String sid, document.setProperty("dublincore", "description", dublincoreMap.get("description")); document.setProperty("dublincore", "title", dublincoreMap.get("title")); - String filname = (String) fileMap.get("filename"); - document.setProperty("file", "filename", filname); + String filename = (String) fileMap.get("filename"); final byte[] contentData = Base64.decodeBase64((String) contentMap.get("data")); // String contentType = (String) contentMap.get("mime-type") ; Blob blob = Blobs.createBlob(contentData); @@ -555,9 +554,9 @@ public String uploadDocument(@WebParam(name = "sessionId") String sid, String mimetype; try { - mimetype = mimeService.getMimetypeFromFilenameAndBlobWithDefault(filname, blob, ""); + mimetype = mimeService.getMimetypeFromFilenameAndBlobWithDefault(filename, blob, ""); } catch (MimetypeDetectionException e) { - log.error(String.format("error during mimetype detection for %s: %s", filname, e.getMessage())); + log.error(String.format("error during mimetype detection for %s: %s", filename, e.getMessage())); mimetype = ""; } diff --git a/nuxeo-webengine/nuxeo-webengine-base/src/main/java/org/nuxeo/ecm/core/rest/FileService.java b/nuxeo-webengine/nuxeo-webengine-base/src/main/java/org/nuxeo/ecm/core/rest/FileService.java index f5874029bc34..9afcd94ec17b 100644 --- a/nuxeo-webengine/nuxeo-webengine-base/src/main/java/org/nuxeo/ecm/core/rest/FileService.java +++ b/nuxeo-webengine/nuxeo-webengine-base/src/main/java/org/nuxeo/ecm/core/rest/FileService.java @@ -39,7 +39,6 @@ import org.nuxeo.ecm.core.api.CoreSession; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.NuxeoException; -import org.nuxeo.ecm.core.api.PropertyException; import org.nuxeo.ecm.core.api.model.Property; import org.nuxeo.ecm.core.versioning.VersioningService; import org.nuxeo.ecm.platform.web.common.ServletHelper; @@ -86,15 +85,7 @@ public Response doGet(@Context Request request) { String fileName = blob.getFilename(); if (fileName == null) { - p = p.getParent(); - if (p.isComplex()) { // special handling for file and files - // schema - try { - fileName = (String) p.getValue("filename"); - } catch (PropertyException e) { - fileName = "Unknown"; - } - } + fileName = "Unknown"; } String digest = blob.getDigest(); @@ -150,19 +141,12 @@ public Response doPost() { // files schema // separately Map map = new HashMap(); - map.put("filename", blob.getFilename()); map.put("file", (Serializable) blob); p.addValue(map); } else { p.addValue(blob); } } else { - if ("file".equals(p.getSchema().getName())) { // for - // compatibility - // with deprecated - // filename - p.getParent().get("filename").setValue(blob.getFilename()); - } p.setValue(blob); } // make snapshot