Merged V4.1-BUG-FIX to HEAD

39199: Fixed ALF-13252 "Share - Added aspects are not shown in folder properties"
   39235: Merged BRANCHES/DEV/BELARUS/V4.1-BUG-FIX-2012_07_09 to BRANCHES/DEV/V4.1-BUG-FIX:
      38994: ALF-14983 : Upgrade scripts to increase column sizes for Activiti
      39052: ALF-14983 : Upgrade scripts to increase column sizes for Activiti
      (note: reviewed and merged, including required merge ghanges to .sql, .properties, .xml for schema number update 5111 -> 5112)
   39239: ALF-14111 CLONE - 60k sites: Groups are not displayed in all supported browsers when 60k sites and 60 groups in the system
      - Code works on 3.4 as it includes a fix for ALF-7604 (3.4.2).
      - V4.1 should also have this fix (but did not) as there was a clone ALF-7734 (of ALF-7604) applied to Team that
        was merged to HEAD (and hence 4.x). The merge to HEAD failed to include this fix.
      - Putting this code back into 4.1.1 - this should correct this issue (ALF-14111) as the code will no longer have to sort
        240,000 groups when there are 60,000 user created groups. 
   39257: ALF-10730: Fall back on parentType for icons if necessary
   39307: Fix for ALF-14799 - jsonUtils.toJSONString() outputs long values as floating-point numbers
    - Updated to latest Surf libs rev 1101 which fixes this issue
   39310: Merged BRANCHES/DEV/BELARUS/V4.1-BUG-FIX-2012_07_09 to BRANCHES/DEV/V4.1-BUG-FIX
      39071: ALF-13767: User error messages in org.alfresco.repo.web.scripts are all hardcoded and cannot be localised
             Modify Java backed webscripts to return localised messages to model.
   39345: Impl from Shane Frensley to fix ALF-3484 - Alfresco should show meaningful error message when deleted item recovery fails.
   39362: RECORD ONLY MERGE from V3.4-BUG-FIX to V4.1-BUG-FIX
      39360: <<DO NOT MERGE TO V4.1-BUG-FIX>>
      Remove the creation of OSX installers - we will never need them any more since they are neither distributed not trialled
   39416: Fix for ALF-14466 Share Document Library breaks for obscure control character in document title
   39594: Minor formatting tweak for coding standards consistency.
   39622: ALF-9254: Merged V3.4-BUG-FIX (3.4.11) to V4.1-BUG-FIX (4.1.1)
      39605: ALF-15227 3.4 CLONE - Alfresco incapable of previewing text files including non Western European characters without custom configuration 
         - transformer.PdfBox.TextToPdf no longer does txt to pdf transform as OOo/JOD handles non western chars better and are not that
           much slower even for western encodings
           - It still does csv and xml to pdf
           - transformer.complex.Text.Pdf2swf now has a wild card first transformer for text to pdf (rather than transformer.PdfBox.TextToPdf)
             The 2nd transform is still transformer.Pdf2swf. As a result transformer.PdfBox.TextToPdf or the OOo/JOD transformers may be used.
           - transformer.complex.Archive.Pdf2swf now has a wild card first transformer for the same reason.
           - transformer.complex.Text.Image now has a wild card first transformer for the same reason.
         - Allow transformer config element supportedTransformations to wild card source or target mimetype
   39692: ALF-9254: Merged V3.4-BUG-FIX (3.4.11) to V4.1-BUG-FIX (4.1.1)
      39679: ALF-15227 3.4 CLONE - Alfresco incapable of previewing text files including non Western European characters without custom configuration 
         - Fix build failures (not sure about RecordsManagementAuditServiceImplTest)
         - Reset some of the text to pdf / swf limits now OOo or JOD is used rather than PDFBox
   39719: ALF-13037: Ensure that doclist is refreshed when on edit properties triggered folder rule that causes documents to be moved
   39734: Improvements to reduce need to index Surf component XML files - parent config folders already dealt with, but this removes the burden of indexing the XML content. (ALF-10826)
   39740: Merged BRANCHES/V4.1 to BRANCHES/DEV/V4.1-BUG-FIX: (record-only - already present)
      39734: Improvements to reduce need to index Surf component XML files - parent config folders already dealt with, but this removes the burden of indexing the XML content.
   39779: Merged V3.4-BUG-FIX to V4.1-BUG-FIX (RECORD ONLY)
      39774: ALF-15262: Merged V4.0-BUG-FIX to V3.4-BUG-FIX
         35738: Merged HEAD to BRANCHES/DEV/V4.0-BUG-FIX:
            35737: Fix for ALF-11923. Linked rules can't be deleted if source folder was deleted.
         35751: Addendum to fix for ALF-11923. Fixing failing test case by tightening up delete behaviour.
            I also fixed the @since annotations from Odin to 3.4.11
      39777: ALF-15262: Fixed compilation error by re-introducing typo in method name!
   39784: Merged BRANCHES/V4.1 to BRANCHES/DEV/V4.1-BUG-FIX (RECORD ONLY)
      39775: ALF-15271: "Site Content" dashlet shows all documents from all the sites in Alfresco Share
   39831: Merged V3.4-BUG-FIX to V4.1-BUG-FIX (4.1.1)
      39015: Merged in upgrade of truezip to 7.5.5 see ALF-14247
      39361: Added truezip-swing jar.  It seems that Truezip needs Swing :(


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@40265 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2012-08-09 16:37:33 +00:00
parent 2b61b88c4c
commit 0d57d67bec
20 changed files with 245 additions and 69 deletions

View File

@@ -167,6 +167,7 @@
<ref bean="patch.db-V4.0-SolrTracking" />
<ref bean="patch.db-V4.0-AclChangeSet2" />
<ref bean="patch.db-V3.4-remove-redundant-jbpm-indexes" />
<ref bean="patch.db-V4.1-increase-column-size-activiti" />
</list>
</property>
</bean>

View File

@@ -704,11 +704,16 @@
<bean id="transformer.PdfBox.TextToPdf"
class="org.alfresco.repo.content.transform.TextToPdfContentTransformer"
parent="baseContentTransformer" >
<property name="explicitTransformations">
<property name="supportedTransformations">
<list>
<bean class="org.alfresco.repo.content.transform.ExplictTransformationDetails" >
<constructor-arg><value>text/plain</value></constructor-arg>
<constructor-arg><value>application/pdf</value></constructor-arg>
<!-- Using OpenOffice/JOD for text to PDF (slower but better and supports non western fonts) -->
<bean class="org.alfresco.repo.content.transform.SupportedTransformation" >
<property name="sourceMimetype"><value>text/csv</value></property>
<property name="targetMimetype"><value>application/pdf</value></property>
</bean>
<bean class="org.alfresco.repo.content.transform.SupportedTransformation" >
<property name="sourceMimetype"><value>text/xml</value></property>
<property name="targetMimetype"><value>application/pdf</value></property>
</bean>
</list>
</property>
@@ -720,7 +725,7 @@
parent="baseComplexContentTransformer" >
<property name="transformers">
<list>
<ref bean="transformer.PdfBox.TextToPdf" />
<null />
<ref bean="transformer.complex.PDF.Image" />
</list>
</property>
@@ -729,6 +734,19 @@
<value>application/pdf</value>
</list>
</property>
<property name="supportedTransformations">
<list>
<!-- Using OpenOffice/JOD for text to Image (slower but better and supports non western fonts) -->
<bean class="org.alfresco.repo.content.transform.SupportedTransformation" >
<property name="sourceMimetype"><value>text/csv</value></property>
<!-- targetMimetype any -->
</bean>
<bean class="org.alfresco.repo.content.transform.SupportedTransformation" >
<property name="sourceMimetype"><value>text/xml</value></property>
<!-- targetMimetype any -->
</bean>
</list>
</property>
</bean>
<bean id="transformer.TikaAuto"

View File

@@ -243,12 +243,12 @@
<autoincrement>false</autoincrement>
</column>
<column name="OWNER_" order="9">
<type>varchar(64)</type>
<type>varchar(255)</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
<column name="ASSIGNEE_" order="10">
<type>varchar(64)</type>
<type>varchar(255)</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
@@ -662,7 +662,7 @@
<autoincrement>false</autoincrement>
</column>
<column name="GROUP_ID_" order="3">
<type>varchar(64)</type>
<type>varchar(255)</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
@@ -672,7 +672,7 @@
<autoincrement>false</autoincrement>
</column>
<column name="USER_ID_" order="5">
<type>varchar(64)</type>
<type>varchar(255)</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
@@ -858,12 +858,12 @@
<autoincrement>false</autoincrement>
</column>
<column name="OWNER_" order="10">
<type>varchar(64)</type>
<type>varchar(255)</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
<column name="ASSIGNEE_" order="11">
<type>varchar(64)</type>
<type>varchar(255)</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
@@ -1079,7 +1079,7 @@
<autoincrement>false</autoincrement>
</column>
<column name="ASSIGNEE_" order="8">
<type>varchar(64)</type>
<type>varchar(255)</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>

View File

@@ -121,7 +121,7 @@
<autoincrement>false</autoincrement>
</column>
<column name="assignee_" order="8">
<type>varchar(64)</type>
<type>varchar(255)</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
@@ -520,12 +520,12 @@
<autoincrement>false</autoincrement>
</column>
<column name="owner_" order="9">
<type>varchar(64)</type>
<type>varchar(255)</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
<column name="assignee_" order="10">
<type>varchar(64)</type>
<type>varchar(255)</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
@@ -944,7 +944,7 @@
<autoincrement>false</autoincrement>
</column>
<column name="group_id_" order="3">
<type>varchar(64)</type>
<type>varchar(255)</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
@@ -954,7 +954,7 @@
<autoincrement>false</autoincrement>
</column>
<column name="user_id_" order="5">
<type>varchar(64)</type>
<type>varchar(255)</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
@@ -1140,12 +1140,12 @@
<autoincrement>false</autoincrement>
</column>
<column name="owner_" order="10">
<type>varchar(64)</type>
<type>varchar(255)</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>
<column name="assignee_" order="11">
<type>varchar(64)</type>
<type>varchar(255)</type>
<nullable>true</nullable>
<autoincrement>false</autoincrement>
</column>

View File

@@ -0,0 +1,29 @@
--
-- Title: Increase column sizes for Activiti
-- Database: Generic
-- Since: V4.1 Schema 5112
-- Author: Alex Mukha
--
-- Please contact support@alfresco.com if you need assistance with the upgrade.
--
-- ALF-14983 : Upgrade scripts to increase column sizes for Activiti
ALTER TABLE ACT_RU_TASK MODIFY ASSIGNEE_ VARCHAR(255);
ALTER TABLE ACT_RU_TASK MODIFY OWNER_ VARCHAR(255);
ALTER TABLE ACT_RU_IDENTITYLINK MODIFY GROUP_ID_ VARCHAR(255);
ALTER TABLE ACT_RU_IDENTITYLINK MODIFY USER_ID_ VARCHAR(255);
ALTER TABLE ACT_HI_TASKINST MODIFY ASSIGNEE_ VARCHAR(255);
ALTER TABLE ACT_HI_TASKINST MODIFY OWNER_ VARCHAR(255);
ALTER TABLE ACT_HI_ACTINST MODIFY ASSIGNEE_ VARCHAR(255);
--
-- Record script finish
--
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V4.1-increase-column-size-activiti';
INSERT INTO alf_applied_patch
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
VALUES
(
'patch.db-V4.1-increase-column-size-activiti', 'ALF-14983 : Upgrade scripts to increase column sizes for Activiti',
0, 6012, -1, 6013, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'Script completed'
);

View File

@@ -0,0 +1,29 @@
--
-- Title: Increase column sizes for Activiti
-- Database: MySQL
-- Since: V4.1 Schema 5112
-- Author: Alex Mukha
--
-- Please contact support@alfresco.com if you need assistance with the upgrade.
--
-- ALF-14983 : Upgrade scripts to increase column sizes for Activiti
ALTER TABLE ACT_RU_TASK MODIFY ASSIGNEE_ VARCHAR(255);
ALTER TABLE ACT_RU_TASK MODIFY OWNER_ VARCHAR(255);
ALTER TABLE ACT_RU_IDENTITYLINK MODIFY GROUP_ID_ VARCHAR(255);
ALTER TABLE ACT_RU_IDENTITYLINK MODIFY USER_ID_ VARCHAR(255);
ALTER TABLE ACT_HI_TASKINST MODIFY ASSIGNEE_ VARCHAR(255);
ALTER TABLE ACT_HI_TASKINST MODIFY OWNER_ VARCHAR(255);
ALTER TABLE ACT_HI_ACTINST MODIFY ASSIGNEE_ VARCHAR(255);
--
-- Record script finish
--
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V4.1-increase-column-size-activiti';
INSERT INTO alf_applied_patch
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
VALUES
(
'patch.db-V4.1-increase-column-size-activiti', 'ALF-14983 : Upgrade scripts to increase column sizes for Activiti',
0, 6012, -1, 6013, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'Script completed'
);

View File

@@ -0,0 +1,29 @@
--
-- Title: Increase column sizes for Activiti
-- Database: PostgreSQL
-- Since: V4.1 Schema 5112
-- Author: Alex Mukha
--
-- Please contact support@alfresco.com if you need assistance with the upgrade.
--
-- ALF-14983 : Upgrade scripts to increase column sizes for Activiti
ALTER TABLE ACT_RU_TASK ALTER COLUMN ASSIGNEE_ TYPE VARCHAR(255);
ALTER TABLE ACT_RU_TASK ALTER COLUMN OWNER_ TYPE VARCHAR(255);
ALTER TABLE ACT_RU_IDENTITYLINK ALTER COLUMN GROUP_ID_ TYPE VARCHAR(255);
ALTER TABLE ACT_RU_IDENTITYLINK ALTER COLUMN USER_ID_ TYPE VARCHAR(255);
ALTER TABLE ACT_HI_TASKINST ALTER COLUMN ASSIGNEE_ TYPE VARCHAR(255);
ALTER TABLE ACT_HI_TASKINST ALTER COLUMN OWNER_ TYPE VARCHAR(255);
ALTER TABLE ACT_HI_ACTINST ALTER COLUMN ASSIGNEE_ TYPE VARCHAR(255);
--
-- Record script finish
--
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V4.1-increase-column-size-activiti';
INSERT INTO alf_applied_patch
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
VALUES
(
'patch.db-V4.1-increase-column-size-activiti', 'ALF-14983 : Upgrade scripts to increase column sizes for Activiti',
0, 6012, -1, 6013, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'Script completed'
);

View File

@@ -481,3 +481,5 @@ patch.swsdpPatch.missingSurfConfig=surf-config folder is not present in Sample:
patch.redeployParallelActivitiWorkflows.description=Patch that redeploys both parallel activiti workflows, completion-condition now takes into account if minimum approval percentage can still be achived.
patch.show.audit.success=show_audit.ftl was updated successfully
patch.increaseColumnSizeActiviti.description=ALF-14983 : Upgrade scripts to increase column sizes for Activiti

View File

@@ -3254,4 +3254,14 @@
</property>
</bean>
<bean id="patch.db-V4.1-increase-column-size-activiti" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
<property name="id" value="patch.db-V4.1-increase-column-size-activiti" />
<property name="description" value="patch.increaseColumnSizeActiviti.description" />
<property name="fixesFromSchema" value="0" />
<property name="fixesToSchema" value="6012" />
<property name="targetSchema" value="6013" />
<property name="scriptUrl">
<value>classpath:alfresco/dbscripts/upgrade/4.1/${db.script.dialect}/increase-column-size-activiti.sql</value>
</property>
</bean>
</beans>

View File

@@ -620,19 +620,19 @@ content.transformer.default.readLimitKBytes=-1
content.transformer.default.pageLimit=-1
content.transformer.default.maxPages=-1
# text -> pdf using PdfBox (txt=text/*) 10M takes about 12 seconds
# text -> pdf using PdfBox (text/csv, text/xml) 10M takes about 12 seconds
content.transformer.PdfBox.TextToPdf.maxSourceSizeKBytes=10240
# pdf -> swf using Pdf2swf 2M takes about 60 seconds.
content.transformer.Pdf2swf.maxSourceSizeKBytes=2048
# txt -> pdf -> swf 1M (pdf is about the same size as the txt)
# txt -> pdf -> swf 5M (pdf is about the same size as the txt)
# Need this limit as transformer.PdfBox txt -> pdf is allowed up to 10M
content.transformer.complex.Text.Pdf2swf.maxSourceSizeKBytes=1024
content.transformer.complex.Text.Pdf2swf.maxSourceSizeKBytes=5120
# Transforms to PDF
# =================
content.transformer.OpenOffice.mimeTypeLimits.txt.pdf.maxSourceSizeKBytes=1024
content.transformer.OpenOffice.mimeTypeLimits.txt.pdf.maxSourceSizeKBytes=5120
content.transformer.OpenOffice.mimeTypeLimits.doc.pdf.maxSourceSizeKBytes=10240
content.transformer.OpenOffice.mimeTypeLimits.docx.pdf.maxSourceSizeKBytes=768
content.transformer.OpenOffice.mimeTypeLimits.docm.pdf.maxSourceSizeKBytes=768
@@ -658,6 +658,7 @@ content.transformer.OpenOffice.mimeTypeLimits.xlsb.pdf.maxSourceSizeKBytes=1536
# Transforms to SWF
# =================
content.transformer.OpenOffice.Pdf2swf.mimeTypeLimits.txt.swf.maxSourceSizeKBytes=5120
content.transformer.OpenOffice.Pdf2swf.mimeTypeLimits.doc.swf.maxSourceSizeKBytes=1536
content.transformer.OpenOffice.Pdf2swf.mimeTypeLimits.docx.swf.maxSourceSizeKBytes=256
content.transformer.OpenOffice.Pdf2swf.mimeTypeLimits.docm.swf.maxSourceSizeKBytes=256

View File

@@ -52,6 +52,7 @@
<bean id="transformer.complex.OpenOffice.Pdf2swf.mimetypeLimits" class="org.alfresco.service.cmr.repository.TransformationOptionLimitsMap">
<constructor-arg>
<value>
txt swf maxSourceSizeKBytes ${content.transformer.OpenOffice.Pdf2swf.mimeTypeLimits.txt.swf.maxSourceSizeKBytes} ;
doc swf maxSourceSizeKBytes ${content.transformer.OpenOffice.Pdf2swf.mimeTypeLimits.doc.swf.maxSourceSizeKBytes} ;
docx swf maxSourceSizeKBytes ${content.transformer.OpenOffice.Pdf2swf.mimeTypeLimits.docx.swf.maxSourceSizeKBytes} ;
docm swf maxSourceSizeKBytes ${content.transformer.OpenOffice.Pdf2swf.mimeTypeLimits.docm.swf.maxSourceSizeKBytes} ;
@@ -103,7 +104,7 @@
parent="baseComplexContentTransformer" >
<property name="transformers">
<list>
<ref bean="transformer.PdfBox.TextToPdf" />
<null />
<ref bean="transformer.Pdf2swf" />
</list>
</property>
@@ -112,11 +113,22 @@
<value>application/pdf</value>
</list>
</property>
<!-- Note: there are maxSourceSizeKBytes limits on transformer.PdfBox.TextToPdf for txt->pdf
which may cause this transformer not to be selected because it is too slow and another
maxSourceSizeKBytes limit on transformer.Pdf2swf, but what is the point of doing the
first one only to give up on the second when we can guess the pdf size is just a bit
more than the text. -->
<property name="supportedTransformations">
<list>
<bean class="org.alfresco.repo.content.transform.SupportedTransformation" >
<property name="sourceMimetype"><value>text/txt</value></property>
<property name="targetMimetype"><value>application/x-shockwave-flash</value></property>
</bean>
<bean class="org.alfresco.repo.content.transform.SupportedTransformation" >
<property name="sourceMimetype"><value>text/csv</value></property>
<property name="targetMimetype"><value>application/x-shockwave-flash</value></property>
</bean>
<bean class="org.alfresco.repo.content.transform.SupportedTransformation" >
<property name="sourceMimetype"><value>text/xml</value></property>
<property name="targetMimetype"><value>application/x-shockwave-flash</value></property>
</bean>
</list>
</property>
<property name="maxSourceSizeKBytes"><value>${content.transformer.complex.Text.Pdf2swf.maxSourceSizeKBytes}</value></property>
</bean>
@@ -127,7 +139,7 @@
<property name="transformers">
<list>
<ref bean="transformer.Archive" />
<ref bean="transformer.PdfBox.TextToPdf" />
<null />
<ref bean="transformer.Pdf2swf" />
</list>
</property>

View File

@@ -19,4 +19,4 @@ version.build=@build-number@
# Schema number
version.schema=6012
version.schema=6013

View File

@@ -18,18 +18,26 @@
*/
package org.alfresco.cmis.renditions;
import static org.junit.Assert.fail;
import java.io.File;
import java.io.Serializable;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import org.alfresco.cmis.CMISRendition;
import org.alfresco.cmis.mapping.BaseCMISTest;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.content.transform.AbstractContentTransformerTest;
import org.alfresco.repo.content.transform.magick.ImageTransformationOptions;
import org.alfresco.repo.thumbnail.ThumbnailDefinition;
import org.alfresco.service.cmr.repository.ContentReader;
@@ -37,6 +45,8 @@ import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.NoTransformerException;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.TransformationOptions;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
/**
* @author Stas Sokolovsky
@@ -56,7 +66,7 @@ public class CMISRenditionServiceTest extends BaseCMISTest
super.setUp();
String documentName = "TestDocument" + System.currentTimeMillis();
document = createDocument(documentName, "Test Content", MimetypeMap.MIMETYPE_PDF);
document = createPdfDocument(documentName);
documentRenditions = new ArrayList<CMISRendition>();
for (int i = 0; i < THUMBNAIL_NAMES.length; ++i)
@@ -192,38 +202,41 @@ public class CMISRenditionServiceTest extends BaseCMISTest
return rendition;
}
private NodeRef createDocument(String documentName, String documentContent, String mimetype)
private NodeRef createPdfDocument(final String nodeName)
{
NodeRef textDocument = fileFolderService.create(rootNodeRef, "TEXT" + documentName, ContentModel.TYPE_CONTENT).getNodeRef();
ContentWriter contentWriter = fileFolderService.getWriter(textDocument);
contentWriter.setEncoding("UTF-8");
contentWriter.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
contentWriter.setLocale(Locale.ENGLISH);
contentWriter.putContent(documentContent);
ContentReader contentReader = fileFolderService.getReader(textDocument);
// contentReader will not be null as an exception will have been thrown if there was a problem
Map<QName, Serializable> props = new HashMap<QName, Serializable>();
props.put(ContentModel.PROP_NAME, nodeName);
NodeRef result = nodeService.createNode(rootNodeRef,
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, nodeName),
ContentModel.TYPE_CONTENT,
props).getChildRef();
NodeRef document = fileFolderService.create(rootNodeRef, documentName, ContentModel.TYPE_CONTENT).getNodeRef();
contentWriter = fileFolderService.getWriter(document);
contentWriter.setEncoding("UTF-8");
contentWriter.setMimetype(mimetype);
contentWriter.setLocale(Locale.ENGLISH);
File file = loadQuickPdfFile();
TransformationOptions options = new TransformationOptions();
options.setSourceNodeRef(textDocument);
// Set the content
ContentWriter writer = contentService.getWriter(result, ContentModel.PROP_CONTENT, true);
writer.setMimetype(MimetypeMap.MIMETYPE_PDF);
writer.setEncoding("UTF-8");
try
{
contentService.transform(contentReader, contentWriter, options);
}
catch (NoTransformerException e)
{
// ignore
writer.putContent(file);
return result;
}
fileFolderService.delete(textDocument);
return document;
private File loadQuickPdfFile()
{
URL url = AbstractContentTransformerTest.class.getClassLoader().getResource("quick/quick.pdf");
if (url == null)
{
fail("Could not load pdf file");
}
File file = new File(url.getFile());
if (!file.exists())
{
fail("Could not load pdf file");
}
return file;
}
private void assertRendiions(List<CMISRendition> receivedRenditions, List<CMISRendition> expectedRenditions)

View File

@@ -560,6 +560,9 @@ public class AVMToADMRemoteStorePatch extends AbstractPatch
// create new node and perform writer content copy of the content from the AVM to the DM store
FileInfo fileInfo = fileFolderService.create(
parentFolder, avmNode.getName(), ContentModel.TYPE_CONTENT);
Map<QName, Serializable> aspectProperties = new HashMap<QName, Serializable>(1, 1.0f);
aspectProperties.put(ContentModel.PROP_IS_INDEXED, false);
nodeService.addAspect(fileInfo.getNodeRef(), ContentModel.ASPECT_INDEX_CONTROL, aspectProperties);
ContentWriter writer = contentService.getWriter(
fileInfo.getNodeRef(), ContentModel.PROP_CONTENT, true);
writer.guessMimetype(fileInfo.getName());
@@ -575,6 +578,9 @@ public class AVMToADMRemoteStorePatch extends AbstractPatch
// create new node and perform writer content copy of the content from the AVM to the DM store
FileInfo fileInfo = fileFolderService.create(
parentFolder, avmNode.getName(), ContentModel.TYPE_CONTENT);
Map<QName, Serializable> aspectProperties = new HashMap<QName, Serializable>(1, 1.0f);
aspectProperties.put(ContentModel.PROP_IS_INDEXED, false);
nodeService.addAspect(fileInfo.getNodeRef(), ContentModel.ASPECT_INDEX_CONTROL, aspectProperties);
ContentWriter writer = contentService.getWriter(
fileInfo.getNodeRef(), ContentModel.PROP_CONTENT, true);
writer.guessMimetype(fileInfo.getName());

View File

@@ -137,8 +137,10 @@ public class ContentTransformerHelper
result = false;
for (SupportedTransformation suportedTransformation : supportedTransformations)
{
if (sourceMimetype.equals(suportedTransformation.getSourceMimetype()) == true
&& targetMimetype.equals(suportedTransformation.getTargetMimetype()) == true)
String supportedSourceMimetype = suportedTransformation.getSourceMimetype();
String supportedTargetMimetype = suportedTransformation.getTargetMimetype();
if ((supportedSourceMimetype == null || sourceMimetype.equals(supportedSourceMimetype)) &&
(supportedTargetMimetype == null || targetMimetype.equals(supportedTargetMimetype)))
{
result = true;
break;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
* Copyright (C) 2005-2012 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -304,8 +304,8 @@ public class ActionFormProcessorTest
// This is the actionedUponNodeRef. A special parameter with no prop_ prefix
form.addData(AbstractFormProcessor.DESTINATION, testNode.toString());
// transform the node (which is text/plain to pdf in the same folder)
form.addData(FormFieldConstants.PROP_DATA_PREFIX + TransformActionExecuter.PARAM_MIME_TYPE, MimetypeMap.MIMETYPE_PDF);
// transform the node (which is text/plain to xml in the same folder)
form.addData(FormFieldConstants.PROP_DATA_PREFIX + TransformActionExecuter.PARAM_MIME_TYPE, MimetypeMap.MIMETYPE_XML);
form.addData(FormFieldConstants.PROP_DATA_PREFIX + TransformActionExecuter.PARAM_DESTINATION_FOLDER, REPOSITORY_HELPER.getCompanyHome().toString());
form.addData(FormFieldConstants.PROP_DATA_PREFIX + TransformActionExecuter.PARAM_ASSOC_TYPE_QNAME, ContentModel.ASSOC_CONTAINS.toPrefixString(NAMESPACE_SERVICE));
form.addData(FormFieldConstants.PROP_DATA_PREFIX + TransformActionExecuter.PARAM_ASSOC_QNAME, ContentModel.ASSOC_CONTAINS.toPrefixString(NAMESPACE_SERVICE));
@@ -318,7 +318,7 @@ public class ActionFormProcessorTest
}
Serializable cmName = NODE_SERVICE.getProperty(testNode, ContentModel.PROP_NAME);
String transformedNodeName = ((String)cmName).replace(".txt", ".pdf");
String transformedNodeName = ((String)cmName).replace(".txt", ".xml");
NodeRef expectedTransformedNode = NODE_SERVICE.getChildByName(REPOSITORY_HELPER.getCompanyHome(), ContentModel.ASSOC_CONTAINS, transformedNodeName);
assertNotNull("transformed node was missing", expectedTransformedNode);

View File

@@ -37,6 +37,7 @@ import org.alfresco.repo.security.permissions.AccessDeniedException;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.DuplicateChildNodeNameException;
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
@@ -270,6 +271,12 @@ public class NodeArchiveServiceImpl implements NodeArchiveService
report.setStatus(RestoreStatus.FAILURE_OTHER);
}
}
catch (DuplicateChildNodeNameException e)
{
report.setCause(e);
report.setStatus(RestoreStatus.FAILURE_DUPLICATE_CHILD_NODE_NAME);
logger.error(e);
}
catch (AccessDeniedException e)
{
report.setCause(e);

View File

@@ -62,6 +62,10 @@ public class RestoreNodeReport implements Serializable
FAILURE_INTEGRITY
{
},
/** duplicate child name not allowed **/
FAILURE_DUPLICATE_CHILD_NODE_NAME
{
},
/** the problem was not well-recognized */
FAILURE_OTHER
{

View File

@@ -94,6 +94,7 @@ public class TemplateNode extends BasePermissionsNode implements NamespacePrefix
protected NodeRef nodeRef;
private String name;
private QName type;
private QName parentType;
private String path;
private String id;
private QNameMap<String, Serializable> properties;
@@ -200,6 +201,18 @@ public class TemplateNode extends BasePermissionsNode implements NamespacePrefix
return type;
}
/**
* @return Returns the type of the parent
*/
public String getParentTypeShort()
{
if (this.parentType == null)
{
this.parentType = this.services.getDictionaryService().getType(getType()).getParentName();
}
return parentType.toPrefixString(this.services.getNamespaceService());
}
/**
* @return Returns the type in short format.
*/