mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
MNT-17703: Allow Bulk Import versioning without appending a version number to docs
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@136971 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -95,7 +95,16 @@
|
||||
<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>
|
||||
<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>Existing file mode:</label></td>
|
||||
<td>
|
||||
<br /><br />
|
||||
When a file being imported already exists in the repository<br />
|
||||
<label><input type="radio" name="existingFileMode" value="SKIP" checked/> skip (don't import) the file</label><br />
|
||||
<label><input type="radio" name="existingFileMode" value="REPLACE" unchecked/> replace the file in the repository with the imported file</label><br />
|
||||
<label><input type="radio" name="existingFileMode" value="ADD_VERSION" unchecked/> create a new version of the file with the imported content</label><br />
|
||||
<br />
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Batch Size:</td>
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.web.scripts.bulkimport;
|
||||
|
||||
@@ -59,6 +59,7 @@ public class AbstractBulkFileSystemImportWebScript extends DeclarativeWebScript
|
||||
|
||||
// Web scripts parameters (common)
|
||||
protected static final String PARAMETER_REPLACE_EXISTING = "replaceExisting";
|
||||
protected static final String PARAMETER_EXISTING_FILE_MODE = "existingFileMode";
|
||||
protected static final String PARAMETER_VALUE_REPLACE_EXISTING = "replaceExisting";
|
||||
protected static final String PARAMETER_SOURCE_DIRECTORY = "sourceDirectory";
|
||||
protected static final String PARAMETER_DISABLE_RULES = "disableRules";
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.web.scripts.bulkimport.copy;
|
||||
|
||||
@@ -73,7 +73,8 @@ public class BulkFilesystemImportWebScript extends AbstractBulkFileSystemImportW
|
||||
String targetNodeRefStr = null;
|
||||
String targetPath = null;
|
||||
String sourceDirectoryStr = null;
|
||||
String replaceExistingStr = null;
|
||||
@Deprecated String replaceExistingStr = null;
|
||||
String existingFileModeStr = null;
|
||||
String batchSizeStr = null;
|
||||
String numThreadsStr = null;
|
||||
String disableRulesStr = null;
|
||||
@@ -87,6 +88,7 @@ public class BulkFilesystemImportWebScript extends AbstractBulkFileSystemImportW
|
||||
NodeRef targetNodeRef = null;
|
||||
File sourceDirectory = null;
|
||||
boolean replaceExisting = false;
|
||||
BulkImportParameters.ExistingFileMode existingFileMode = null;
|
||||
int batchSize = bulkImporter.getDefaultBatchSize();
|
||||
int numThreads = bulkImporter.getDefaultNumThreads();
|
||||
boolean disableRules = false;
|
||||
@@ -96,6 +98,8 @@ public class BulkFilesystemImportWebScript extends AbstractBulkFileSystemImportW
|
||||
targetPath = request.getParameter(PARAMETER_TARGET_PATH);
|
||||
sourceDirectoryStr = request.getParameter(PARAMETER_SOURCE_DIRECTORY);
|
||||
replaceExistingStr = request.getParameter(PARAMETER_REPLACE_EXISTING);
|
||||
existingFileModeStr = request.getParameter(PARAMETER_EXISTING_FILE_MODE);
|
||||
|
||||
batchSizeStr = request.getParameter(PARAMETER_BATCH_SIZE);
|
||||
numThreadsStr = request.getParameter(PARAMETER_NUM_THREADS);
|
||||
disableRulesStr = request.getParameter(PARAMETER_DISABLE_RULES);
|
||||
@@ -108,12 +112,27 @@ public class BulkFilesystemImportWebScript extends AbstractBulkFileSystemImportW
|
||||
}
|
||||
|
||||
sourceDirectory = new File(sourceDirectoryStr.trim());
|
||||
|
||||
|
||||
if (replaceExistingStr != null && existingFileModeStr != null)
|
||||
{
|
||||
// Check that we haven't had both the deprecated and new (existingFileMode)
|
||||
// parameters supplied.
|
||||
throw new IllegalStateException(
|
||||
String.format("Only one of these parameters may be used, not both: %s, %s",
|
||||
PARAMETER_REPLACE_EXISTING,
|
||||
PARAMETER_EXISTING_FILE_MODE));
|
||||
}
|
||||
|
||||
if (replaceExistingStr != null && replaceExistingStr.trim().length() > 0)
|
||||
{
|
||||
replaceExisting = PARAMETER_VALUE_REPLACE_EXISTING.equals(replaceExistingStr);
|
||||
}
|
||||
|
||||
if (existingFileModeStr != null && existingFileModeStr.trim().length() > 0)
|
||||
{
|
||||
existingFileMode = BulkImportParameters.ExistingFileMode.valueOf(existingFileModeStr);
|
||||
}
|
||||
|
||||
if (disableRulesStr != null && disableRulesStr.trim().length() > 0)
|
||||
{
|
||||
disableRules = PARAMETER_VALUE_DISABLE_RULES.equals(disableRulesStr);
|
||||
@@ -157,7 +176,16 @@ public class BulkFilesystemImportWebScript extends AbstractBulkFileSystemImportW
|
||||
}
|
||||
}
|
||||
|
||||
bulkImportParameters.setReplaceExisting(replaceExisting);
|
||||
if (existingFileMode != null)
|
||||
{
|
||||
bulkImportParameters.setExistingFileMode(existingFileMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fall back to the old/deprecated way.
|
||||
bulkImportParameters.setReplaceExisting(replaceExisting);
|
||||
}
|
||||
|
||||
bulkImportParameters.setTarget(targetNodeRef);
|
||||
bulkImportParameters.setDisableRulesService(disableRules);
|
||||
|
||||
|
Reference in New Issue
Block a user