Mercurial > dive4elements > framework
comparison artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java @ 198:6370369412e9
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
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 09 Mar 2011 11:03:25 +0000 |
parents | 171b6200d26d |
children | b2115f484edb |
comparison
equal
deleted
inserted
replaced
197:94654cbf8db2 | 198:6370369412e9 |
---|---|
211 * XPath to figure out the name of a collection described in the incoming | 211 * XPath to figure out the name of a collection described in the incoming |
212 * document. | 212 * document. |
213 */ | 213 */ |
214 public static final String XPATH_COLLECTION_NAME = | 214 public static final String XPATH_COLLECTION_NAME = |
215 "/art:action/art:type/art:collection/@name"; | 215 "/art:action/art:type/art:collection/@name"; |
216 | |
217 /** | |
218 * XPath to figure out the attributes for a collection. | |
219 */ | |
220 public static final String XPATH_COLLECTION_ATTRIBUTE = | |
221 "/art:action/art:type/art:collection/art:attribute"; | |
216 | 222 |
217 /** | 223 /** |
218 * XPath to figure out the attributes for an artifact that is put into a | 224 * XPath to figure out the attributes for an artifact that is put into a |
219 * collection. | 225 * collection. |
220 */ | 226 */ |
1190 String name = XMLUtils.xpathString( | 1196 String name = XMLUtils.xpathString( |
1191 data, XPATH_COLLECTION_NAME, ArtifactNamespaceContext.INSTANCE); | 1197 data, XPATH_COLLECTION_NAME, ArtifactNamespaceContext.INSTANCE); |
1192 | 1198 |
1193 logger.debug("Create new collection with name: " + name); | 1199 logger.debug("Create new collection with name: " + name); |
1194 | 1200 |
1201 Document attr = XMLUtils.newDocument(); | |
1202 | |
1203 Node attrNode = (Node) XMLUtils.xpath( | |
1204 data, | |
1205 XPATH_COLLECTION_ATTRIBUTE, | |
1206 XPathConstants.NODE, | |
1207 ArtifactNamespaceContext.INSTANCE); | |
1208 | |
1209 if (attrNode != null) { | |
1210 attr.appendChild(attr.importNode(attrNode, true)); | |
1211 } | |
1212 | |
1195 ArtifactCollection ac = backend.createCollection( | 1213 ArtifactCollection ac = backend.createCollection( |
1196 ownerId, name, acf, data, context); | 1214 ownerId, name, acf, attr, context); |
1197 | 1215 |
1198 if (ac == null) { | 1216 if (ac == null) { |
1199 throw new ArtifactDatabaseException(COLLECTION_CREATION_FAILED); | 1217 throw new ArtifactDatabaseException(COLLECTION_CREATION_FAILED); |
1200 } | 1218 } |
1201 | 1219 |