mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
ALF-10419:
o performance improvements: disable/enable auditing behaviour per-transaction rather than per-node o add "disable rules" checkbox to GUI and support disabling of rules during import git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31243 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -81,6 +81,9 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td colspan="3"> </td>
|
<td colspan="3"> </td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><label for="disableRules">Disable rules:</label></td><td><input type="checkbox" id="disableRules" name="disableRules" value="disableRules" unchecked/> (unchecked means rules are enabled during the import)</td><td></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><label for="replaceExisting">Replace existing files:</label></td><td><input type="checkbox" id="replaceExisting" name="replaceExisting" value="replaceExisting" unchecked/> (unchecked means skip files that already exist in the repository)</td><td></td>
|
<td><label for="replaceExisting">Replace existing files:</label></td><td><input type="checkbox" id="replaceExisting" name="replaceExisting" value="replaceExisting" unchecked/> (unchecked means skip files that already exist in the repository)</td><td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@@ -30,11 +30,14 @@ import java.net.UnknownHostException;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import org.alfresco.repo.bulkimport.BulkFilesystemImporter;
|
||||||
import org.alfresco.repo.model.Repository;
|
import org.alfresco.repo.model.Repository;
|
||||||
import org.alfresco.service.cmr.model.FileFolderService;
|
import org.alfresco.service.cmr.model.FileFolderService;
|
||||||
import org.alfresco.service.cmr.model.FileInfo;
|
import org.alfresco.service.cmr.model.FileInfo;
|
||||||
import org.alfresco.service.cmr.model.FileNotFoundException;
|
import org.alfresco.service.cmr.model.FileNotFoundException;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.extensions.webscripts.DeclarativeWebScript;
|
import org.springframework.extensions.webscripts.DeclarativeWebScript;
|
||||||
import org.springframework.extensions.webscripts.WebScriptException;
|
import org.springframework.extensions.webscripts.WebScriptException;
|
||||||
|
|
||||||
@@ -43,6 +46,8 @@ import org.springframework.extensions.webscripts.WebScriptException;
|
|||||||
*/
|
*/
|
||||||
public class AbstractBulkFileSystemImportWebScript extends DeclarativeWebScript
|
public class AbstractBulkFileSystemImportWebScript extends DeclarativeWebScript
|
||||||
{
|
{
|
||||||
|
protected static final Log logger = LogFactory.getLog(BulkFilesystemImporter.class);
|
||||||
|
|
||||||
protected static final String WEB_SCRIPT_URI_BULK_FILESYSTEM_IMPORT_STATUS = "/bulk/import/filesystem/status";
|
protected static final String WEB_SCRIPT_URI_BULK_FILESYSTEM_IMPORT_STATUS = "/bulk/import/filesystem/status";
|
||||||
|
|
||||||
protected static final String PARAMETER_TARGET_NODEREF = "targetNodeRef";
|
protected static final String PARAMETER_TARGET_NODEREF = "targetNodeRef";
|
||||||
@@ -55,13 +60,15 @@ public class AbstractBulkFileSystemImportWebScript extends DeclarativeWebScript
|
|||||||
protected static final String PARAMETER_REPLACE_EXISTING = "replaceExisting";
|
protected static final String PARAMETER_REPLACE_EXISTING = "replaceExisting";
|
||||||
protected static final String PARAMETER_VALUE_REPLACE_EXISTING = "replaceExisting";
|
protected static final String PARAMETER_VALUE_REPLACE_EXISTING = "replaceExisting";
|
||||||
protected static final String PARAMETER_SOURCE_DIRECTORY = "sourceDirectory";
|
protected static final String PARAMETER_SOURCE_DIRECTORY = "sourceDirectory";
|
||||||
|
protected static final String PARAMETER_DISABLE_RULES = "disableRules";
|
||||||
|
protected static final String PARAMETER_VALUE_DISABLE_RULES = "disableRules";
|
||||||
|
|
||||||
protected static final String IMPORT_ALREADY_IN_PROGRESS_MODEL_KEY = "importInProgress";
|
protected static final String IMPORT_ALREADY_IN_PROGRESS_MODEL_KEY = "importInProgress";
|
||||||
protected static final String IMPORT_ALREADY_IN_PROGRESS_ERROR_KEY ="bfsit.error.importAlreadyInProgress";
|
protected static final String IMPORT_ALREADY_IN_PROGRESS_ERROR_KEY ="bfsit.error.importAlreadyInProgress";
|
||||||
|
|
||||||
protected static final String PARAMETER_BATCH_SIZE = "batchSize";
|
protected static final String PARAMETER_BATCH_SIZE = "batchSize";
|
||||||
protected static final String PARAMETER_NUM_THREADS = "numThreads";
|
protected static final String PARAMETER_NUM_THREADS = "numThreads";
|
||||||
|
|
||||||
protected FileFolderService fileFolderService;
|
protected FileFolderService fileFolderService;
|
||||||
protected Repository repository;
|
protected Repository repository;
|
||||||
|
|
||||||
|
@@ -36,8 +36,6 @@ import org.alfresco.repo.bulkimport.impl.StreamingNodeImporterFactory;
|
|||||||
import org.alfresco.repo.web.scripts.bulkimport.AbstractBulkFileSystemImportWebScript;
|
import org.alfresco.repo.web.scripts.bulkimport.AbstractBulkFileSystemImportWebScript;
|
||||||
import org.alfresco.service.cmr.model.FileNotFoundException;
|
import org.alfresco.service.cmr.model.FileNotFoundException;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.springframework.extensions.surf.util.I18NUtil;
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
import org.springframework.extensions.webscripts.Cache;
|
import org.springframework.extensions.webscripts.Cache;
|
||||||
import org.springframework.extensions.webscripts.Status;
|
import org.springframework.extensions.webscripts.Status;
|
||||||
@@ -51,8 +49,6 @@ import org.springframework.extensions.webscripts.WebScriptRequest;
|
|||||||
*/
|
*/
|
||||||
public class BulkFilesystemImportWebScript extends AbstractBulkFileSystemImportWebScript
|
public class BulkFilesystemImportWebScript extends AbstractBulkFileSystemImportWebScript
|
||||||
{
|
{
|
||||||
private final static Log logger = LogFactory.getLog(BulkFilesystemImportWebScript.class);
|
|
||||||
|
|
||||||
private MultiThreadedBulkFilesystemImporter bulkImporter;
|
private MultiThreadedBulkFilesystemImporter bulkImporter;
|
||||||
private StreamingNodeImporterFactory nodeImporterFactory;
|
private StreamingNodeImporterFactory nodeImporterFactory;
|
||||||
|
|
||||||
@@ -79,6 +75,7 @@ public class BulkFilesystemImportWebScript extends AbstractBulkFileSystemImportW
|
|||||||
String replaceExistingStr = null;
|
String replaceExistingStr = null;
|
||||||
String batchSizeStr = null;
|
String batchSizeStr = null;
|
||||||
String numThreadsStr = null;
|
String numThreadsStr = null;
|
||||||
|
String disableRulesStr = null;
|
||||||
|
|
||||||
cache.setNeverCache(true);
|
cache.setNeverCache(true);
|
||||||
|
|
||||||
@@ -91,6 +88,7 @@ public class BulkFilesystemImportWebScript extends AbstractBulkFileSystemImportW
|
|||||||
boolean replaceExisting = false;
|
boolean replaceExisting = false;
|
||||||
int batchSize = bulkImporter.getDefaultBatchSize();
|
int batchSize = bulkImporter.getDefaultBatchSize();
|
||||||
int numThreads = bulkImporter.getDefaultNumThreads();
|
int numThreads = bulkImporter.getDefaultNumThreads();
|
||||||
|
boolean disableRules = false;
|
||||||
|
|
||||||
// Retrieve, validate and convert parameters
|
// Retrieve, validate and convert parameters
|
||||||
targetNodeRefStr = request.getParameter(PARAMETER_TARGET_NODEREF);
|
targetNodeRefStr = request.getParameter(PARAMETER_TARGET_NODEREF);
|
||||||
@@ -99,6 +97,7 @@ public class BulkFilesystemImportWebScript extends AbstractBulkFileSystemImportW
|
|||||||
replaceExistingStr = request.getParameter(PARAMETER_REPLACE_EXISTING);
|
replaceExistingStr = request.getParameter(PARAMETER_REPLACE_EXISTING);
|
||||||
batchSizeStr = request.getParameter(PARAMETER_BATCH_SIZE);
|
batchSizeStr = request.getParameter(PARAMETER_BATCH_SIZE);
|
||||||
numThreadsStr = request.getParameter(PARAMETER_NUM_THREADS);
|
numThreadsStr = request.getParameter(PARAMETER_NUM_THREADS);
|
||||||
|
disableRulesStr = request.getParameter(PARAMETER_DISABLE_RULES);
|
||||||
|
|
||||||
targetNodeRef = getTargetNodeRef(targetNodeRefStr, targetPath);
|
targetNodeRef = getTargetNodeRef(targetNodeRefStr, targetPath);
|
||||||
|
|
||||||
@@ -114,9 +113,13 @@ public class BulkFilesystemImportWebScript extends AbstractBulkFileSystemImportW
|
|||||||
replaceExisting = PARAMETER_VALUE_REPLACE_EXISTING.equals(replaceExistingStr);
|
replaceExisting = PARAMETER_VALUE_REPLACE_EXISTING.equals(replaceExistingStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (disableRulesStr != null && disableRulesStr.trim().length() > 0)
|
||||||
|
{
|
||||||
|
disableRules = PARAMETER_VALUE_DISABLE_RULES.equals(disableRulesStr);
|
||||||
|
}
|
||||||
|
|
||||||
// Initiate the import
|
// Initiate the import
|
||||||
NodeImporter nodeImporter = nodeImporterFactory.getNodeImporter(sourceDirectory);
|
NodeImporter nodeImporter = nodeImporterFactory.getNodeImporter(sourceDirectory);
|
||||||
//bulkImporter.asyncBulkImport(targetNodeRef, nodeImporter, replaceExisting);
|
|
||||||
BulkImportParameters bulkImportParameters = new BulkImportParameters();
|
BulkImportParameters bulkImportParameters = new BulkImportParameters();
|
||||||
|
|
||||||
if (numThreadsStr != null && numThreadsStr.trim().length() > 0)
|
if (numThreadsStr != null && numThreadsStr.trim().length() > 0)
|
||||||
@@ -155,6 +158,7 @@ public class BulkFilesystemImportWebScript extends AbstractBulkFileSystemImportW
|
|||||||
|
|
||||||
bulkImportParameters.setReplaceExisting(replaceExisting);
|
bulkImportParameters.setReplaceExisting(replaceExisting);
|
||||||
bulkImportParameters.setTarget(targetNodeRef);
|
bulkImportParameters.setTarget(targetNodeRef);
|
||||||
|
bulkImportParameters.setDisableRulesService(disableRules);
|
||||||
|
|
||||||
bulkImporter.asyncBulkImport(bulkImportParameters, nodeImporter);
|
bulkImporter.asyncBulkImport(bulkImportParameters, nodeImporter);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user