View Javadoc
1   /**
2    * This file Copyright (c) 2012-2015 Magnolia International
3    * Ltd.  (http://www.magnolia-cms.com). All rights reserved.
4    *
5    *
6    * This file is dual-licensed under both the Magnolia
7    * Network Agreement and the GNU General Public License.
8    * You may elect to use one or the other of these licenses.
9    *
10   * This file is distributed in the hope that it will be
11   * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
12   * implied warranty of MERCHANTABILITY or FITNESS FOR A
13   * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
14   * Redistribution, except as permitted by whichever of the GPL
15   * or MNA you select, is prohibited.
16   *
17   * 1. For the GPL license (GPL), you can redistribute and/or
18   * modify this file under the terms of the GNU General
19   * Public License, Version 3, as published by the Free Software
20   * Foundation.  You should have received a copy of the GNU
21   * General Public License, Version 3 along with this program;
22   * if not, write to the Free Software Foundation, Inc., 51
23   * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24   *
25   * 2. For the Magnolia Network Agreement (MNA), this file
26   * and the accompanying materials are made available under the
27   * terms of the MNA which accompanies this distribution, and
28   * is available at http://www.magnolia-cms.com/mna.html
29   *
30   * Any modifications to this file must keep this entire header
31   * intact.
32   *
33   */
34  package info.magnolia.dam.app.setup.migration;
35  
36  import info.magnolia.module.InstallContext;
37  import info.magnolia.module.delta.TaskExecutionException;
38  
39  import java.util.List;
40  
41  /**
42   * This task copy uploaded documents stored in the content repository (for
43   * example website) into the DAM repository.<br>
44   * 
45   * <pre>
46   * Steps:
47   *  Iterate the list of contentPathsList,
48   *   Perform a JCR query that search for properties containing 'upload' and return the related node.
49   *   Iterate the query result list
50   *   For every Node,
51   *    Node has a Binary child node
52   *     Copy and transform the binary node into an Asset node in the DAM workspace.
53   *     Copy the value of the newly created identifier into index (image)
54   *     Remove the related binary node from the content workspace.
55   *    No Binary child node found
56   *     Remove the index property.
57   * 
58   * <b>Normal handling</b>:
59   * Move from:
60   *  property sv:name="teaserImg" sv:type="String"
61   *  value = upload
62   *   node sv:name="teaserImgBinary"
63   *   property sv:name="jcr:primaryType" sv:type="Name"
64   *   value = mgnl:resource
65   * To:
66   *  property sv:name="teaserImg" sv:type="String"
67   *  value = 4c291aa5-9807-4bbe-b372-ce523f82e600
68   * 
69   * <b>Specific handling:</b>
70   * In case of No Binary child node found, remove properties.
71   * In any case if a property named index+DmsUUID (like imageDmsUUID) found remove it.
72   * </pre>
73   * 
74   * @deprecated since 5.1.1 use {@link MoveContentToDamMigrationTask} instead.
75   **/
76  @Deprecated
77  public class MoveUploadedContentToDamMigrationTask extends MoveContentToDamMigrationTask {
78  
79  
80      /**
81       * Default constructor.
82       *
83       * @param contentPathsList
84       *            list on content path to handle like "/demo-project"
85       * @param targetSubPath
86       *            Sub path of the DAM repository used to store the Data. If a uploaded data is found under
87       *            (websiterepo)/demo-project/about/subsection-articles/article/content/01 and damUploadSubroot = uploaded
88       *            the data will be stored under
89       *            (damrepo)/uploaded/demo-project/about/subsection-articles/article/content/01
90       */
91      public MoveUploadedContentToDamMigrationTask(String taskName, String taskDescription, String contentRepository, List<String> contentPathsList, String targetSubPath) {
92          super(taskName, taskDescription, contentRepository, contentPathsList, targetSubPath, "upload");
93      }
94  
95      @Override
96      public void doExecute(InstallContext ctx) throws TaskExecutionException {
97          super.doExecute(ctx);
98      }
99  
100 }