-2

I would like to export several file in conserving absolutely their UUID to import them into another GED Alfresco.

I use Alfresco 4.2.f, how can I do this?

bidolp
  • 1

2 Answers2

3

You have to create your own Alfresco Content Package (ACP) using the Export tool in the Alfresco Explorer application. In this way you will export in a acp (zip) file all your contents preserving also UUID, properties, associations, permissions and roles.

Then for importing contents in your Alfresco target instance, preserving UUID, you have to define a new Spring bean in your extension classpath or inside your AMP Spring context that extends the Alfresco Importer Module component, as the following snippet:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
    <bean id="yourModule.bootstrapSpaces" class="org.alfresco.repo.module.ImporterModuleComponent" parent="module.baseComponent">
      <property name="moduleId" value="yourModule" />
      <property name="name" value="yourModule.bootstrapSpaces" />
      <property name="description" value="Initial data requirements" />
      <property name="sinceVersion" value="1.0" />
      <property name="appliesFromVersion" value="1.0" />

        <!-- Data properties -->
        <property name="importer" ref="spacesBootstrap" />
        <property name="bootstrapViews">
            <list>
                <props>
                    **<prop key="uuidBinding">REPLACE_EXISTING</prop>**
                    <prop key="path">/${spaces.company_home.childname}</prop>
                    <prop key="location">alfresco/extension/bootstrap/yourExportedContents.acp</prop>
                </props>
            </list>
        </property>
    </bean>
</beans>

The magic is done by the REPLACE_EXISTING value that is saying to Alfresco to replace the UUID with the existent one that you have exported from the previews Alfresco instance.

For each ACP file you have to define a new props XML element in the snippet.

Notice also that your exported ACP can be installed outside your Alfresco installation, you can copy ACP files in the shared classloader of your installation, for example considering Tomcat the location where you can put ACP files can be the following:

tomcat/shared/classes/alfresco/extension/bootstrap

Hope this helps :)

0

In addition to the answer from Piergiorgio Lucidi, here is another step by step approach that is tested in Alfresco 4.2.f:

  1. Lookup the node to which you want to import the files with the Node explorer. You get a path like this: /{http://www.alfresco.org/model/application/1.0}company_home/{http://www.alfresco.org/model/site/1.0}sites/{http://www.alfresco.org/model/content/1.0}myportal/{http://www.alfresco.org/model/content/1.0}documentLibrary/{http://www.alfresco.org/model/content/1.0}production

  2. Convert the path and replace the namespaces with their prefix according to this table. The path should be like this: /app:company_home/st:sites/cm:myportal/cm:documentLibrary/cm:production

  3. Edit the file tomcat/webapps/alfresco/WEB-INF/classes/alfresco/bootstrap-context.xml and add this to the bottom just before the closing </beans>. Replace the path with the url from step 2 and the path to the actual acp file:

    <bean id="yourModule.bootstrapSpaces" class="org.alfresco.repo.module.ImporterModuleComponent" parent="module.baseComponent">
      <property name="moduleId" value="org.alfresco.integrations.google.docs" />
      <property name="name" value="yourModule.bootstrapSpaces" />
      <property name="description" value="Initial data requirements" />
      <property name="sinceVersion" value="1.0" />
      <property name="appliesFromVersion" value="1.0" />
    
      <property name="importer" ref="spacesBootstrap" />
      <property name="bootstrapViews">
          <list>
              <props>
                  <prop key="uuidBinding">REPLACE_EXISTING</prop>
                  <prop key="path">/app:company_home/st:sites/cm:myportal/cm:documentLibrary/cm:production</prop>
                  <prop key="location">/home/ec2-user/alfresco-top-export-20201209.acp</prop>
              </props>
          </list>
      </property>
    </bean>
    
  4. Restart alfresco wait for the import

  5. Remove the bean definition again

It works by extending an existing module so you don't need to define a module yourself.

sihaya
  • 1,357
  • 9
  • 12