diff --git a/config/alfresco/bootstrap-context.xml b/config/alfresco/bootstrap-context.xml index 624183c079..79ab278a96 100644 --- a/config/alfresco/bootstrap-context.xml +++ b/config/alfresco/bootstrap-context.xml @@ -167,6 +167,7 @@ + diff --git a/config/alfresco/content-services-context.xml b/config/alfresco/content-services-context.xml index c8153d8536..aaa359f097 100644 --- a/config/alfresco/content-services-context.xml +++ b/config/alfresco/content-services-context.xml @@ -704,11 +704,16 @@ - + - - text/plain - application/pdf + + + text/csv + application/pdf + + + text/xml + application/pdf @@ -720,7 +725,7 @@ parent="baseComplexContentTransformer" > - + @@ -729,6 +734,19 @@ application/pdf + + + + + text/csv + + + + text/xml + + + + false - varchar(64) + varchar(255) true false - varchar(64) + varchar(255) true false @@ -662,7 +662,7 @@ false - varchar(64) + varchar(255) true false @@ -672,7 +672,7 @@ false - varchar(64) + varchar(255) true false @@ -858,12 +858,12 @@ false - varchar(64) + varchar(255) true false - varchar(64) + varchar(255) true false @@ -1079,7 +1079,7 @@ false - varchar(64) + varchar(255) true false diff --git a/config/alfresco/dbscripts/create/org.hibernate.dialect.PostgreSQLDialect/Schema-Reference-ACT.xml b/config/alfresco/dbscripts/create/org.hibernate.dialect.PostgreSQLDialect/Schema-Reference-ACT.xml index c7f9129bd2..1cf720996b 100644 --- a/config/alfresco/dbscripts/create/org.hibernate.dialect.PostgreSQLDialect/Schema-Reference-ACT.xml +++ b/config/alfresco/dbscripts/create/org.hibernate.dialect.PostgreSQLDialect/Schema-Reference-ACT.xml @@ -121,7 +121,7 @@ false - varchar(64) + varchar(255) true false @@ -520,12 +520,12 @@ false - varchar(64) + varchar(255) true false - varchar(64) + varchar(255) true false @@ -944,7 +944,7 @@ false - varchar(64) + varchar(255) true false @@ -954,7 +954,7 @@ false - varchar(64) + varchar(255) true false @@ -1140,12 +1140,12 @@ false - varchar(64) + varchar(255) true false - varchar(64) + varchar(255) true false diff --git a/config/alfresco/dbscripts/upgrade/4.1/org.hibernate.dialect.Dialect/increase-column-size-activiti.sql b/config/alfresco/dbscripts/upgrade/4.1/org.hibernate.dialect.Dialect/increase-column-size-activiti.sql new file mode 100644 index 0000000000..10e4df6bd5 --- /dev/null +++ b/config/alfresco/dbscripts/upgrade/4.1/org.hibernate.dialect.Dialect/increase-column-size-activiti.sql @@ -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' + ); \ No newline at end of file diff --git a/config/alfresco/dbscripts/upgrade/4.1/org.hibernate.dialect.MySQLInnoDBDialect/increase-column-size-activiti.sql b/config/alfresco/dbscripts/upgrade/4.1/org.hibernate.dialect.MySQLInnoDBDialect/increase-column-size-activiti.sql new file mode 100644 index 0000000000..aa1397a932 --- /dev/null +++ b/config/alfresco/dbscripts/upgrade/4.1/org.hibernate.dialect.MySQLInnoDBDialect/increase-column-size-activiti.sql @@ -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' + ); \ No newline at end of file diff --git a/config/alfresco/dbscripts/upgrade/4.1/org.hibernate.dialect.PostgreSQLDialect/increase-column-size-activiti.sql b/config/alfresco/dbscripts/upgrade/4.1/org.hibernate.dialect.PostgreSQLDialect/increase-column-size-activiti.sql new file mode 100644 index 0000000000..52c9ddf719 --- /dev/null +++ b/config/alfresco/dbscripts/upgrade/4.1/org.hibernate.dialect.PostgreSQLDialect/increase-column-size-activiti.sql @@ -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' + ); \ No newline at end of file diff --git a/config/alfresco/messages/patch-service.properties b/config/alfresco/messages/patch-service.properties index 941b06c12f..f18c357885 100644 --- a/config/alfresco/messages/patch-service.properties +++ b/config/alfresco/messages/patch-service.properties @@ -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 \ No newline at end of file diff --git a/config/alfresco/patch/patch-services-context.xml b/config/alfresco/patch/patch-services-context.xml index cdc14fbb55..8b9f67c03d 100644 --- a/config/alfresco/patch/patch-services-context.xml +++ b/config/alfresco/patch/patch-services-context.xml @@ -3254,4 +3254,14 @@ + + + + + + + + classpath:alfresco/dbscripts/upgrade/4.1/${db.script.dialect}/increase-column-size-activiti.sql + + diff --git a/config/alfresco/repository.properties b/config/alfresco/repository.properties index b0754a0d16..717fcd29d5 100644 --- a/config/alfresco/repository.properties +++ b/config/alfresco/repository.properties @@ -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 diff --git a/config/alfresco/swf-transform-context.xml b/config/alfresco/swf-transform-context.xml index 2097bcb09a..f777ee7f8f 100644 --- a/config/alfresco/swf-transform-context.xml +++ b/config/alfresco/swf-transform-context.xml @@ -52,6 +52,7 @@ + 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" > - + @@ -112,11 +113,22 @@ application/pdf - + + + + text/txt + application/x-shockwave-flash + + + text/csv + application/x-shockwave-flash + + + text/xml + application/x-shockwave-flash + + + ${content.transformer.complex.Text.Pdf2swf.maxSourceSizeKBytes} @@ -127,7 +139,7 @@ - + diff --git a/config/alfresco/version.properties b/config/alfresco/version.properties index 7d636c166b..2d8bee1c2e 100644 --- a/config/alfresco/version.properties +++ b/config/alfresco/version.properties @@ -19,4 +19,4 @@ version.build=@build-number@ # Schema number -version.schema=6012 +version.schema=6013 diff --git a/source/java/org/alfresco/cmis/renditions/CMISRenditionServiceTest.java b/source/java/org/alfresco/cmis/renditions/CMISRenditionServiceTest.java index bac3447020..7ca0bc9d5a 100644 --- a/source/java/org/alfresco/cmis/renditions/CMISRenditionServiceTest.java +++ b/source/java/org/alfresco/cmis/renditions/CMISRenditionServiceTest.java @@ -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(); for (int i = 0; i < THUMBNAIL_NAMES.length; ++i) @@ -192,40 +202,43 @@ 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 props = new HashMap(); + 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(); + + File file = loadQuickPdfFile(); - 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); - - TransformationOptions options = new TransformationOptions(); - options.setSourceNodeRef(textDocument); - - try - { - contentService.transform(contentReader, contentWriter, options); - } - catch (NoTransformerException e) - { - // ignore - } - - fileFolderService.delete(textDocument); - - return document; + // Set the content + ContentWriter writer = contentService.getWriter(result, ContentModel.PROP_CONTENT, true); + writer.setMimetype(MimetypeMap.MIMETYPE_PDF); + writer.setEncoding("UTF-8"); + + writer.putContent(file); + + return result; } + 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 receivedRenditions, List expectedRenditions) { assertNotNull(receivedRenditions); diff --git a/source/java/org/alfresco/repo/admin/patch/impl/AVMToADMRemoteStorePatch.java b/source/java/org/alfresco/repo/admin/patch/impl/AVMToADMRemoteStorePatch.java index f4ac9efc6d..b6973b3e5e 100644 --- a/source/java/org/alfresco/repo/admin/patch/impl/AVMToADMRemoteStorePatch.java +++ b/source/java/org/alfresco/repo/admin/patch/impl/AVMToADMRemoteStorePatch.java @@ -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 aspectProperties = new HashMap(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 aspectProperties = new HashMap(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()); diff --git a/source/java/org/alfresco/repo/content/transform/ContentTransformerHelper.java b/source/java/org/alfresco/repo/content/transform/ContentTransformerHelper.java index 793fabde51..08a2a4ba38 100644 --- a/source/java/org/alfresco/repo/content/transform/ContentTransformerHelper.java +++ b/source/java/org/alfresco/repo/content/transform/ContentTransformerHelper.java @@ -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; diff --git a/source/java/org/alfresco/repo/domain/hibernate/dialect/AlfrescoOracle9Dialect.java b/source/java/org/alfresco/repo/domain/hibernate/dialect/AlfrescoOracle9Dialect.java index 6cd4f46c09..5faa754533 100644 --- a/source/java/org/alfresco/repo/domain/hibernate/dialect/AlfrescoOracle9Dialect.java +++ b/source/java/org/alfresco/repo/domain/hibernate/dialect/AlfrescoOracle9Dialect.java @@ -36,6 +36,6 @@ public class AlfrescoOracle9Dialect extends Oracle9Dialect public AlfrescoOracle9Dialect() { super(); - registerColumnType( Types.VARBINARY, "blob" ); + registerColumnType(Types.VARBINARY, "blob"); } } diff --git a/source/java/org/alfresco/repo/forms/processor/action/ActionFormProcessorTest.java b/source/java/org/alfresco/repo/forms/processor/action/ActionFormProcessorTest.java index 488259d81e..3e29998c6f 100644 --- a/source/java/org/alfresco/repo/forms/processor/action/ActionFormProcessorTest.java +++ b/source/java/org/alfresco/repo/forms/processor/action/ActionFormProcessorTest.java @@ -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); diff --git a/source/java/org/alfresco/repo/node/archive/NodeArchiveServiceImpl.java b/source/java/org/alfresco/repo/node/archive/NodeArchiveServiceImpl.java index d976a756a0..e698174043 100644 --- a/source/java/org/alfresco/repo/node/archive/NodeArchiveServiceImpl.java +++ b/source/java/org/alfresco/repo/node/archive/NodeArchiveServiceImpl.java @@ -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); diff --git a/source/java/org/alfresco/repo/node/archive/RestoreNodeReport.java b/source/java/org/alfresco/repo/node/archive/RestoreNodeReport.java index b5c251678b..cd59ab1b83 100644 --- a/source/java/org/alfresco/repo/node/archive/RestoreNodeReport.java +++ b/source/java/org/alfresco/repo/node/archive/RestoreNodeReport.java @@ -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 { diff --git a/source/java/org/alfresco/repo/template/TemplateNode.java b/source/java/org/alfresco/repo/template/TemplateNode.java index c1ef5cc4b9..9ae2caaea3 100644 --- a/source/java/org/alfresco/repo/template/TemplateNode.java +++ b/source/java/org/alfresco/repo/template/TemplateNode.java @@ -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 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. */