Datareign

ACPGeneratr is a project contributed by the Deloitte PIER team. Its stated purpose is to provide a tool for bulk uploading into an Alfresco repository.

Components

The download explodes into the following structure…

 ACPGeneratr
   |
    --acpGeneratr        # The .java and .class files that make up the application.
   |
    --content            # Place the files to be imported here.
   |
    --definition_files   # Should contain a .tsv category tree definition and a .csv metadata definition file
   |
    --doc                # HTML format documentation of the java classes
   |
    --testDestDir        # The directory in which the compressed archive will be generated.
   |
    --tools              # Excel format spreadsheet defining classes
   |
   Common errors.txt
   README v.2.2.txt

File Changes

headerxml.xml

This provides the basic definition of the import and is rigged to look like an Alfresco export definition. As a result, we need to supply the following metadata…

  • exportBy an Alfresco user. This probably needs to be a user present in the target repository. 'admin' is a safe bet.
  • exportDate The format is YYYY-HH-DDThh:mm:ss.uuu+hh:mm. Others may work but it's best to stick to this, just making sure that it resolves to a valid date-time.
  • exporterVersion In the sample, this is 1.4.0 (build-105), which you may wish to change if it causes problems with your version of Alfresco.
  • exportOf defines the space that was, supposedly, exported.

ACPGeneratr.java

It appears that you must change the routine createXML to define any file types that you wish to import, which do not match to the definitions already in this file.

However before making any changes, decide if you can simply live with the existing definitions or, perhaps, make minor changes to the property names.

ContentProvided.java

The getValue routine parses and returns the properties list for each document. You probably need to change some of these to meet your own requirements.

Creating the Content Definition

This is the .csv file in definition_files. The name of the file is irrelevant, as you define it to the programme at run-time.

The first line consists of the properties list, and the second line consists of the values to satisfy those properties.

  • cm:text is a content management directive, such as cm:title, which defines the document title, or cm:removeAfter, which specifies when the document should die.
  • dm:txt is a document management directive, such as dm:owner, which specifies the person who owns the document or dm:Date_On_Document that specifies the internal date of the document and not the filesystem date.
  • cat: entries are category properties and can have any value. However, you need to make sure that similar entries appear in the same column for each row.

Creating the Category Tree

This is the .tsv file in definition_files. Entries may be as complex as required so long as there is a category entry for each cat: item you defined in the .csv file.

Each entry consists of the category to which the value maps, followed by one or more possible mappings that may appear in the .csv file.

Running the Generator

As it stands, you have to invoke the generator from the command line. Assuming you are in the base directory, as described above, the command line is…

 java acpGenerator.ACPGenerator <Model> <Source> <Output> <Content> <Properties> <DateType> <Categories>

Using the sample data supplied, the values might be…

  • Model: ”..\ACPGeneratr\definition_files\sample_model.xml”
  • Source: ”..\ACPGeneratr\content”
  • Output: ”..\ACPGeneratr\testDestDir”
  • Content: dm:Proposal
  • Properties: ”..\ACPGeneratr\definition_files\sample_metadata.csv”
  • DateType: dd/mm/yyyy
  • Categories: ”..\ACPGeneratr\definition_files\sample_category_tree.tsv”

Oops!

The command line example, as provided in the file README v.2.2.txt, doesn't work because it doesn't specify the class name. The version shown above will work, given valid parameters.

You Don't Need an ACP

You can use any zip utility to create the archive; 7zip works well on Windows. Create a .zip that contains the importXML.xml file and the importContent folder. You could simply change the extension from .zip to .acp but, in version 3.0, Alfresco will happily import from a .zip.

Importing to Alfresco

Go to the parent space that you wish to import into, select import and provide the name of the .acp or .zip file.

Last modified: 2009/02/19 13:41