From: <ap...@vh...> - 2006-05-19 15:25:55
|
Author: apevec Date: 2006-05-19 17:22:14 +0200 (Fri, 19 May 2006) New Revision: 1141 Modified: trunk/ccm-ldn-exporter/bin/export-cats.sh trunk/ccm-ldn-exporter/bin/export-items.sh trunk/ccm-ldn-exporter/src/com/arsdigita/london/exporter/CategoryExportTool.java trunk/ccm-ldn-exporter/src/com/arsdigita/london/exporter/CategoryExporter.java Log: enable term domain export only Modified: trunk/ccm-ldn-exporter/bin/export-cats.sh =================================================================== --- trunk/ccm-ldn-exporter/bin/export-cats.sh 2006-05-19 11:33:22 UTC (rev 1140) +++ trunk/ccm-ldn-exporter/bin/export-cats.sh 2006-05-19 15:22:14 UTC (rev 1141) @@ -1,10 +1,13 @@ +#!/bin/bash -if [ -z $6 ]; then - echo "syntax: export.sh [purpose] [cat dir] [key] [url] [title] [versioon]" +if [ -z "$7" ]; then + echo "syntax: export-cats.sh [app URL] [context] [export dir] [key] [url] [title] [version]" + echo " e.g. export-cats.sh /navigation/ DEFAULT export APLAWS-NAV http://www.aplaws.org.uk/standards/nav/1.02/termslist.xml 'APLAWS Navigation List' 1.02" + exit 1; fi set -e -./ccm-run.sh com.arsdigita.london.exporter.CategoryExportTool "$*" +ccm-run com.arsdigita.london.exporter.CategoryExportTool "$@" Modified: trunk/ccm-ldn-exporter/bin/export-items.sh =================================================================== --- trunk/ccm-ldn-exporter/bin/export-items.sh 2006-05-19 11:33:22 UTC (rev 1140) +++ trunk/ccm-ldn-exporter/bin/export-items.sh 2006-05-19 15:22:14 UTC (rev 1141) @@ -1,9 +1,10 @@ +#!/bin/sh -if [ -z $3 ]; then - echo "syntax: export.sh [item dir] [asset dir] [content section]" +if [ -z "$3" ]; then + echo "syntax: export-items.sh [item dir] [asset dir] [content section]" exit 1; fi set -e -ccm-run.sh com.arsdigita.london.exporter.ItemExportTool "$@" +ccm-run com.arsdigita.london.exporter.ItemExportTool "$@" Modified: trunk/ccm-ldn-exporter/src/com/arsdigita/london/exporter/CategoryExportTool.java =================================================================== --- trunk/ccm-ldn-exporter/src/com/arsdigita/london/exporter/CategoryExportTool.java 2006-05-19 11:33:22 UTC (rev 1140) +++ trunk/ccm-ldn-exporter/src/com/arsdigita/london/exporter/CategoryExportTool.java 2006-05-19 15:22:14 UTC (rev 1141) @@ -20,6 +20,7 @@ import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.OptionBuilder; import com.arsdigita.categorization.Category; import com.arsdigita.util.UncheckedWrapperException; @@ -35,18 +36,28 @@ public class CategoryExportTool extends Program { + boolean exportItems = false; + public CategoryExportTool() { super("Category Export Tool", - "1.0.0", - "[app] [context] [cat dir] [key] [url] [title] [version]"); + "1.0.1", + "[app URL] [context] [export dir] [key] [url] [title] [version]"); + getOptions().addOption + (OptionBuilder + .hasArg(false) + .withLongOpt("items") + .withDescription("Export items/terms mappings") + .create('i')); } public void doRun(CommandLine cmdLine) { + if (cmdLine.hasOption('i')) { + exportItems = true; + } String[] args = cmdLine.getArgs(); if (args.length != 7) { - System.out.println("ARgs" + args.length); for (int i = 0 ; i < args.length ; i++) { - System.out.println("Arg " + args[i]); + System.out.print("arg"+i+"='" + args[i]+"' "); } help(System.err); System.exit(1); @@ -67,7 +78,12 @@ Transaction txn = new Transaction() { public void doRun() { Application appl = Application.retrieveApplicationForPath(app); - Category root = Category.getRootForObject(appl, context); + Category root; + if ("DEFAULT".equals(context)) { + root = Category.getRootForObject(appl, null); + } else { + root = Category.getRootForObject(appl, context); + } CategoryExporter catExporter = new CategoryExporter(catDir); try { @@ -77,7 +93,8 @@ title, null, version, - new Date()); + new Date(), + exportItems); } catch (MalformedURLException ex) { throw new UncheckedWrapperException("Cannot parse url " + url, ex); } Modified: trunk/ccm-ldn-exporter/src/com/arsdigita/london/exporter/CategoryExporter.java =================================================================== --- trunk/ccm-ldn-exporter/src/com/arsdigita/london/exporter/CategoryExporter.java 2006-05-19 11:33:22 UTC (rev 1140) +++ trunk/ccm-ldn-exporter/src/com/arsdigita/london/exporter/CategoryExporter.java 2006-05-19 15:22:14 UTC (rev 1141) @@ -60,6 +60,23 @@ m_idMaps = new HashMap(); } + public void export(Category root, + String key, + URL url, + String title, + String description, + String version, + Date released) { + + export(root, + key, + url, + title, + description, + version, + released, + true); + } public void export(Category root, String key, @@ -67,10 +84,13 @@ String title, String description, String version, - Date released) { + Date released, + boolean exportItems) { exportDomain(root, key, url, title, description, version, released); exportHierarchy(root, key, url); - exportItems(root, key, url); + if (exportItems) { + exportItems(root, key, url); + } } @@ -251,5 +271,5 @@ } catch (IOException ex) { throw new UncheckedWrapperException("cannot write file", ex); } + } } -} |