Mercurial > dive4elements > framework
comparison artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java @ 254:6cf9560bd249
Bugfix: do not write empty xml documents into database any longer - caused exceptions while serialization/deserialization.
artifacts/trunk@1752 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 27 Apr 2011 16:57:20 +0000 |
parents | a2df2b48d2aa |
children | 4edaf3073109 |
comparison
equal
deleted
inserted
replaced
253:a2df2b48d2aa | 254:6cf9560bd249 |
---|---|
1169 String name = XMLUtils.xpathString( | 1169 String name = XMLUtils.xpathString( |
1170 data, XPATH_COLLECTION_NAME, ArtifactNamespaceContext.INSTANCE); | 1170 data, XPATH_COLLECTION_NAME, ArtifactNamespaceContext.INSTANCE); |
1171 | 1171 |
1172 logger.debug("Create new collection with name: " + name); | 1172 logger.debug("Create new collection with name: " + name); |
1173 | 1173 |
1174 Document attr = XMLUtils.newDocument(); | 1174 Document attr = null; |
1175 | 1175 |
1176 Node attrNode = (Node) XMLUtils.xpath( | 1176 Node attrNode = (Node) XMLUtils.xpath( |
1177 data, | 1177 data, |
1178 XPATH_COLLECTION_ATTRIBUTE, | 1178 XPATH_COLLECTION_ATTRIBUTE, |
1179 XPathConstants.NODE, | 1179 XPathConstants.NODE, |
1180 ArtifactNamespaceContext.INSTANCE); | 1180 ArtifactNamespaceContext.INSTANCE); |
1181 | 1181 |
1182 if (attrNode != null) { | 1182 if (attrNode != null) { |
1183 attr = XMLUtils.newDocument(); | |
1183 attr.appendChild(attr.importNode(attrNode, true)); | 1184 attr.appendChild(attr.importNode(attrNode, true)); |
1184 } | 1185 } |
1185 | 1186 |
1186 ArtifactCollection ac = backend.createCollection( | 1187 ArtifactCollection ac = backend.createCollection( |
1187 ownerId, name, acf, attr, context); | 1188 ownerId, name, acf, attr, context); |
1283 Document attribute) | 1284 Document attribute) |
1284 throws ArtifactDatabaseException | 1285 throws ArtifactDatabaseException |
1285 { | 1286 { |
1286 logger.debug("Set the attribute for the collection: " + collectionId); | 1287 logger.debug("Set the attribute for the collection: " + collectionId); |
1287 | 1288 |
1288 Document attributes = XMLUtils.newDocument(); | 1289 Document attributes = null; |
1289 | 1290 |
1290 Node attr = (Node) XMLUtils.xpath( | 1291 Node attr = (Node) XMLUtils.xpath( |
1291 attribute, | 1292 attribute, |
1292 XPATH_COLLECTION_ATTRIBUTE, | 1293 XPATH_COLLECTION_ATTRIBUTE, |
1293 XPathConstants.NODE, | 1294 XPathConstants.NODE, |
1294 ArtifactNamespaceContext.INSTANCE); | 1295 ArtifactNamespaceContext.INSTANCE); |
1295 | 1296 |
1296 if (attr != null) { | 1297 if (attr != null) { |
1298 attributes = XMLUtils.newDocument(); | |
1297 attributes.appendChild(attributes.importNode(attr, true)); | 1299 attributes.appendChild(attributes.importNode(attr, true)); |
1298 } | 1300 } |
1299 | 1301 |
1300 Document result = XMLUtils.newDocument(); | 1302 Document result = XMLUtils.newDocument(); |
1301 | 1303 |
1327 Document source, CallMeta callMeta) | 1329 Document source, CallMeta callMeta) |
1328 throws ArtifactDatabaseException | 1330 throws ArtifactDatabaseException |
1329 { | 1331 { |
1330 logger.debug("Set the attribute for the artifact: " + artifactId); | 1332 logger.debug("Set the attribute for the artifact: " + artifactId); |
1331 | 1333 |
1332 Document attribute = XMLUtils.newDocument(); | 1334 Document attribute = null; |
1333 | 1335 |
1334 Node attr = (Node) XMLUtils.xpath( | 1336 Node attr = (Node) XMLUtils.xpath( |
1335 source, | 1337 source, |
1336 XPATH_COLLECTION_ITEM_ATTRIBUTE, | 1338 XPATH_COLLECTION_ITEM_ATTRIBUTE, |
1337 XPathConstants.NODE, | 1339 XPathConstants.NODE, |
1338 ArtifactNamespaceContext.INSTANCE); | 1340 ArtifactNamespaceContext.INSTANCE); |
1339 | 1341 |
1340 if (attr != null) { | 1342 if (attr != null) { |
1343 attribute = XMLUtils.newDocument(); | |
1341 attribute.appendChild(attribute.importNode(attr, true)); | 1344 attribute.appendChild(attribute.importNode(attr, true)); |
1342 } | 1345 } |
1343 | 1346 |
1344 Document result = XMLUtils.newDocument(); | 1347 Document result = XMLUtils.newDocument(); |
1345 | 1348 |