mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-15 15:02:20 +00:00
Merged 5.1.N (5.1.1) to HEAD (5.1)
118307 nsmintanca: Merged 5.0.N (5.0.4) to 5.1.N (5.1.1) 118231 aleahu: MNT-14853 : Unable to download zip with non primary child - Added the flag exportSecondaryNodes for the ExporterComponent, and if this is set on true we export the secondary nodes as actual nodes. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@123591 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -92,13 +92,17 @@
|
|||||||
<property name="checkOutCheckInSerivce" ref="checkOutCheckInService"/>
|
<property name="checkOutCheckInSerivce" ref="checkOutCheckInService"/>
|
||||||
<property name="contentServiceHelper" ref="downloadContentServiceHelper" />
|
<property name="contentServiceHelper" ref="downloadContentServiceHelper" />
|
||||||
<property name="downloadStorage" ref="downloadStorage" />
|
<property name="downloadStorage" ref="downloadStorage" />
|
||||||
<property name="exporterService" ref="exporterComponent" />
|
<property name="exporterService" ref="downloadExporterComponent" />
|
||||||
<property name="maximumContentSize" value="${download.maxContentSize}" />
|
<property name="maximumContentSize" value="${download.maxContentSize}" />
|
||||||
<property name="nodeService" ref="nodeService" />
|
<property name="nodeService" ref="nodeService" />
|
||||||
<property name="publicAction" value="false"/>
|
<property name="publicAction" value="false"/>
|
||||||
<property name="transactionHelper" ref="retryingTransactionHelper"/>
|
<property name="transactionHelper" ref="retryingTransactionHelper"/>
|
||||||
<property name="updateService" ref="downloadStatusUpdateService"/>
|
<property name="updateService" ref="downloadStatusUpdateService"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="downloadExporterComponent" parent="exporterComponent">
|
||||||
|
<property name="exportSecondaryNodes" value="true"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<bean id="downloadActionServiceHelper" class="org.alfresco.repo.download.LocalActionServiceHelper">
|
<bean id="downloadActionServiceHelper" class="org.alfresco.repo.download.LocalActionServiceHelper">
|
||||||
<property name="localActionService" ref="actionService"/>
|
<property name="localActionService" ref="actionService"/>
|
||||||
|
@@ -96,6 +96,7 @@ public class ExporterComponent
|
|||||||
|
|
||||||
/** Indent Size */
|
/** Indent Size */
|
||||||
private int indentSize = 2;
|
private int indentSize = 2;
|
||||||
|
private boolean exportSecondaryNodes = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -162,6 +163,14 @@ public class ExporterComponent
|
|||||||
this.permissionService = permissionService;
|
this.permissionService = permissionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param exportSecondaryNodes whether children that do dot have a primary association with their parent are exported as nodes
|
||||||
|
* If false, these nodes will be exported as secondary links.
|
||||||
|
*/
|
||||||
|
public void setExportSecondaryNodes(boolean exportSecondaryNodes)
|
||||||
|
{
|
||||||
|
this.exportSecondaryNodes = exportSecondaryNodes;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.service.cmr.view.ExporterService#exportView(java.io.OutputStream, org.alfresco.service.cmr.view.ExporterCrawlerParameters, org.alfresco.service.cmr.view.Exporter)
|
* @see org.alfresco.service.cmr.view.ExporterService#exportView(java.io.OutputStream, org.alfresco.service.cmr.view.ExporterCrawlerParameters, org.alfresco.service.cmr.view.Exporter)
|
||||||
@@ -524,7 +533,7 @@ public class ExporterComponent
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (childAssoc.isPrimary() == false)
|
if (childAssoc.isPrimary() == false && !exportSecondaryNodes)
|
||||||
{
|
{
|
||||||
context.recordSecondaryLink(nodeRef);
|
context.recordSecondaryLink(nodeRef);
|
||||||
continue;
|
continue;
|
||||||
|
@@ -41,6 +41,7 @@ import org.alfresco.service.cmr.download.DownloadService;
|
|||||||
import org.alfresco.service.cmr.download.DownloadStatus;
|
import org.alfresco.service.cmr.download.DownloadStatus;
|
||||||
import org.alfresco.service.cmr.download.DownloadStatus.Status;
|
import org.alfresco.service.cmr.download.DownloadStatus.Status;
|
||||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
import org.alfresco.service.cmr.repository.AssociationRef;
|
||||||
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.ContentReader;
|
import org.alfresco.service.cmr.repository.ContentReader;
|
||||||
import org.alfresco.service.cmr.repository.ContentService;
|
import org.alfresco.service.cmr.repository.ContentService;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -107,6 +108,7 @@ public class DownloadServiceIntegrationTest
|
|||||||
// Test Content
|
// Test Content
|
||||||
private NodeRef rootFolder;
|
private NodeRef rootFolder;
|
||||||
private NodeRef rootFile;
|
private NodeRef rootFile;
|
||||||
|
private NodeRef secondaryNode;
|
||||||
|
|
||||||
private NodeRef level1Folder1;
|
private NodeRef level1Folder1;
|
||||||
|
|
||||||
@@ -167,7 +169,12 @@ public class DownloadServiceIntegrationTest
|
|||||||
|
|
||||||
testNodes.createNodeWithTextContent(level1Folder2, "level2File.txt", ContentModel.TYPE_CONTENT, AuthenticationUtil.getAdminUserName(), "Level 2 file content");
|
testNodes.createNodeWithTextContent(level1Folder2, "level2File.txt", ContentModel.TYPE_CONTENT, AuthenticationUtil.getAdminUserName(), "Level 2 file content");
|
||||||
allEntries.add("rootFolder/level1Folder2/level2File.txt");
|
allEntries.add("rootFolder/level1Folder2/level2File.txt");
|
||||||
|
|
||||||
|
secondaryNode = testNodes.createNodeWithTextContent(COMPANY_HOME, "secondaryNodeFile.txt", ContentModel.TYPE_CONTENT, AuthenticationUtil.getAdminUserName(), "Secondary node");
|
||||||
|
ChildAssociationRef assoc = NODE_SERVICE.addChild(rootFolder, secondaryNode, ContentModel.ASSOC_CONTAINS, ContentModel.ASSOC_CONTAINS);
|
||||||
|
Assert.assertFalse(assoc.isPrimary());
|
||||||
|
allEntries.add("rootFolder/secondaryNodeFile.txt");
|
||||||
|
|
||||||
fileToCheckout = testNodes.createNodeWithTextContent(level1Folder2, "fileToCheckout.txt", ContentModel.TYPE_CONTENT, AuthenticationUtil.getAdminUserName(), "Level 2 file content");
|
fileToCheckout = testNodes.createNodeWithTextContent(level1Folder2, "fileToCheckout.txt", ContentModel.TYPE_CONTENT, AuthenticationUtil.getAdminUserName(), "Level 2 file content");
|
||||||
// Add the lock and version aspects to the created node
|
// Add the lock and version aspects to the created node
|
||||||
NODE_SERVICE.addAspect(fileToCheckout, ContentModel.ASPECT_VERSIONABLE, null);
|
NODE_SERVICE.addAspect(fileToCheckout, ContentModel.ASPECT_VERSIONABLE, null);
|
||||||
@@ -217,7 +224,7 @@ public class DownloadServiceIntegrationTest
|
|||||||
status = getDownloadStatus(downloadNode);
|
status = getDownloadStatus(downloadNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.assertEquals(5l, status.getTotalFiles());
|
Assert.assertEquals(6l, status.getTotalFiles());
|
||||||
|
|
||||||
long elapsedTime = waitForDownload(downloadNode);
|
long elapsedTime = waitForDownload(downloadNode);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user