# HG changeset patch # User Ingo Weinzierl # Date 1299668605 0 # Node ID 6370369412e9cd5e9a484f1bdce27758ddb5e801 # Parent 94654cbf8db2779ceb4d413e5be8c7b533ca4dca Parse the collection attribute of the incoming document of a create-collection call and store this in the Backend. artifacts/trunk@1436 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 94654cbf8db2 -r 6370369412e9 ChangeLog --- a/ChangeLog Wed Mar 09 10:24:56 2011 +0000 +++ b/ChangeLog Wed Mar 09 11:03:25 2011 +0000 @@ -1,3 +1,10 @@ +2011-03-09 Ingo Weinzierl + + * artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java: + Parse the collection attribute that is contained in the incoming + document while creating a new collection and use this document as parameter + for calling createCollection() of the Backend. + 2011-03-09 Ingo Weinzierl * artifact-database/src/main/resources/sql/org-h2-driver.properties, diff -r 94654cbf8db2 -r 6370369412e9 artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java --- a/artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java Wed Mar 09 10:24:56 2011 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java Wed Mar 09 11:03:25 2011 +0000 @@ -215,6 +215,12 @@ "/art:action/art:type/art:collection/@name"; /** + * XPath to figure out the attributes for a collection. + */ + public static final String XPATH_COLLECTION_ATTRIBUTE = + "/art:action/art:type/art:collection/art:attribute"; + + /** * XPath to figure out the attributes for an artifact that is put into a * collection. */ @@ -1192,8 +1198,20 @@ logger.debug("Create new collection with name: " + name); + Document attr = XMLUtils.newDocument(); + + Node attrNode = (Node) XMLUtils.xpath( + data, + XPATH_COLLECTION_ATTRIBUTE, + XPathConstants.NODE, + ArtifactNamespaceContext.INSTANCE); + + if (attrNode != null) { + attr.appendChild(attr.importNode(attrNode, true)); + } + ArtifactCollection ac = backend.createCollection( - ownerId, name, acf, data, context); + ownerId, name, acf, attr, context); if (ac == null) { throw new ArtifactDatabaseException(COLLECTION_CREATION_FAILED);