comparison artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java @ 268:4edaf3073109

Repaired the setting of a new attribute for a Collection. artifacts/trunk@2016 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 27 May 2011 08:47:31 +0000
parents 6cf9560bd249
children d9a99b28a847
comparison
equal deleted inserted replaced
267:72de5c373c9b 268:4edaf3073109
1282 String collectionId, 1282 String collectionId,
1283 CallMeta meta, 1283 CallMeta meta,
1284 Document attribute) 1284 Document attribute)
1285 throws ArtifactDatabaseException 1285 throws ArtifactDatabaseException
1286 { 1286 {
1287 logger.debug("Set the attribute for the collection: " + collectionId); 1287 logger.debug("Set new attribute for the collection: " + collectionId);
1288
1289 Document attributes = null;
1290
1291 Node attr = (Node) XMLUtils.xpath(
1292 attribute,
1293 XPATH_COLLECTION_ATTRIBUTE,
1294 XPathConstants.NODE,
1295 ArtifactNamespaceContext.INSTANCE);
1296
1297 if (attr != null) {
1298 attributes = XMLUtils.newDocument();
1299 attributes.appendChild(attributes.importNode(attr, true));
1300 }
1301 1288
1302 Document result = XMLUtils.newDocument(); 1289 Document result = XMLUtils.newDocument();
1303 1290
1304 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( 1291 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator(
1305 result, 1292 result,
1308 1295
1309 Element root = ec.create("result"); 1296 Element root = ec.create("result");
1310 result.appendChild(root); 1297 result.appendChild(root);
1311 1298
1312 boolean success = backend.setCollectionAttribute( 1299 boolean success = backend.setCollectionAttribute(
1313 collectionId, attributes); 1300 collectionId, attribute);
1314 1301
1315 root.setTextContent(success ? OPERATION_SUCCESSFUL: OPERATION_FAILURE); 1302 root.setTextContent(success ? OPERATION_SUCCESSFUL: OPERATION_FAILURE);
1316 1303
1317 return result; 1304 return result;
1318 } 1305 }

http://dive4elements.wald.intevation.org