[MAGNOLIA-477] import mode can be selected from servlet Created: 15/Jul/05  Updated: 26/Jul/05  Resolved: 26/Jul/05

Status: Closed
Project: Magnolia
Component/s: admininterface
Affects Version/s: None
Fix Version/s: 2.1 Final

Type: Improvement Priority: Major
Reporter: Nicolas Modrzyk Assignee: Fabrizio Giustina
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Any (OSX 10.4.2, Jetty , Java 1.4)


Attachments: Text File patch.txt    
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

Would like to be able to select the import mode when using the Import/Export servlet.

int importMode = ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW;

is no more static but is actually a parameter in the post request.

It is possible to have the fix included in SVN ?
Also, at the same time, if the html in both the import and export could be CSSized, that would be great.

Patch (without CSS) is here:
Index: /Users/niko/Documents/workspace/Magnolia/src/main/info/magnolia/cms/servlets/ImportExportServlet.java
===================================================================
— /Users/niko/Documents/workspace/Magnolia/src/main/info/magnolia/cms/servlets/ImportExportServlet.java (revision 1128)
+++ /Users/niko/Documents/workspace/Magnolia/src/main/info/magnolia/cms/servlets/ImportExportServlet.java (working copy)
@@ -61,6 +61,11 @@

  • request parameter: keep versions.
    */
    private static final String PARAM_KEEPVERSIONS = "mgnlKeepVersions"; //$NON-NLS-1$
    +
    + /**
    + * request parameter: override
    + */
    + private static final String PARAM_OVERRIDE = "mgnlOverride"; //$NON-NLS-1$

/**

  • request parameter: imported file.
    @@ -172,6 +177,7 @@
    writeRepositoryField(request, out, repository);
    writeBasePathField(request, out, basepath);
    writeKeepVersionField(request, out);
    + writeOverwriteField(request,out);
    out.println(MessagesManager.get(request, "importexport.file") //$NON-NLS-1$
    + " <input type=\"file\" name=\"" + PARAM_FILE + "\" /><br/>"); //$NON-NLS-1$//$NON-NLS-2$

@@ -202,6 +208,15 @@
+ " <input name=\"" //$NON-NLS-1$
+ PARAM_KEEPVERSIONS + "\" value=\"true\" type=\"checkbox\"/><br/>"); //$NON-NLS-1$
}
+
+ /**
+ * @param out
+ */
+ private void writeOverrideField(HttpServletRequest request, PrintWriter out)

{ + out.println(MessagesManager.get(request, "importexport.override") //$NON-NLS-1$ + + " <input name=\"" //$NON-NLS-1$ + + PARAM_OVERRIDE + "\" value=\"true\" type=\"checkbox\"/><br/>"); //$NON-NLS-1$ + }

/**

  • @param out
    @@ -244,6 +259,8 @@
    }

boolean keepVersionHistory = BooleanUtils.toBoolean(form.getParameter(PARAM_KEEPVERSIONS));
+
+ boolean override = BooleanUtils.toBoolean(form.getParameter(PARAM_OVERRIDE));

String repository = form.getParameter(PARAM_REPOSITORY);
Document xmlFile = form.getDocument(PARAM_FILE);
@@ -251,7 +268,7 @@
throw new RuntimeException("Wrong parameters"); //$NON-NLS-1$
}

  • executeImport(basepath, repository, xmlFile, keepVersionHistory);
    + executeImport(basepath, repository, xmlFile, keepVersionHistory,override);

String redirectPage = form.getParameter(PARAM_REDIRECT);
if (StringUtils.isNotBlank(redirectPage)) {
@@ -346,8 +363,9 @@

  • @param basepath base path in repository
  • @param xmlFile uploaded file
  • @param keepVersionHistory if <code>false</code> version info will be stripped before importing the document
    + * @param override if <code>true</code> set import mode to <code>ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW</code>
    */
  • private void executeImport(String basepath, String repository, Document xmlFile, boolean keepVersionHistory) {
    + private void executeImport(String basepath, String repository, Document xmlFile, boolean keepVersionHistory,boolean override) {
    HierarchyManager hr = ContentRepository.getHierarchyManager(repository);
    Workspace ws = hr.getWorkspace();

@@ -365,6 +383,9 @@
if ("website".equals(repository))

{ //$NON-NLS-1$ importMode = ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING; }

+
+ if(override)
+ importMode = ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING;

try {
if (keepVersionHistory) {



 Comments   
Comment by Nicolas Modrzyk [ 15/Jul/05 ]

the first patch was not the right one ... I am now uploading the proper file.
Note that the language key: importexport.override should also be added to the property files.

Comment by Fabrizio Giustina [ 21/Jul/05 ]

committed to svn (note that the parameter has a different name and other uuid behaviors are supported)

Comment by Boris Kraft [ 26/Jul/05 ]

reassigned to RC3

Generated at Mon Feb 12 03:17:49 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.