Mercurial > dive4elements > framework
comparison artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java @ 192:dad6071c9072
Implemented the getCollectionAttribute() and setCollectionAttribute() methods.
artifacts/trunk@1422 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 08 Mar 2011 09:10:55 +0000 |
parents | 7acf4a325bfe |
children | 171b6200d26d |
comparison
equal
deleted
inserted
replaced
191:3bce5556a2e5 | 192:dad6071c9072 |
---|---|
1238 | 1238 |
1239 return result; | 1239 return result; |
1240 } | 1240 } |
1241 | 1241 |
1242 public Document getCollectionAttribute(String collectionId, String artifactId, | 1242 public Document getCollectionAttribute(String collectionId, String artifactId, |
1243 CallMeta callMeta) throws ArtifactDatabaseException { | 1243 CallMeta callMeta) throws ArtifactDatabaseException |
1244 throw new ArtifactDatabaseException("Not implemented, yet!"); | 1244 { |
1245 logger.debug("Fetch the attribute for the artifact: " + artifactId); | |
1246 | |
1247 return backend.getCollectionAttribute(collectionId, artifactId); | |
1245 } | 1248 } |
1246 | 1249 |
1247 public Document setCollectionAttribute(String collectionId, String artifactId, | 1250 public Document setCollectionAttribute(String collectionId, String artifactId, |
1248 Document attribute, CallMeta callMeta) | 1251 Document source, CallMeta callMeta) |
1249 throws ArtifactDatabaseException { | 1252 throws ArtifactDatabaseException |
1250 throw new ArtifactDatabaseException("Not implemented, yet!"); | 1253 { |
1254 logger.debug("Set the attribute for the artifact: " + artifactId); | |
1255 | |
1256 Document attribute = XMLUtils.newDocument(); | |
1257 | |
1258 Node attr = (Node) XMLUtils.xpath( | |
1259 source, | |
1260 XPATH_COLLECTION_ITEM_ATTRIBUTE, | |
1261 XPathConstants.NODE, | |
1262 ArtifactNamespaceContext.INSTANCE); | |
1263 | |
1264 if (attr != null) { | |
1265 attribute.appendChild(attribute.importNode(attr, true)); | |
1266 } | |
1267 | |
1268 Document result = XMLUtils.newDocument(); | |
1269 | |
1270 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( | |
1271 result, | |
1272 ArtifactNamespaceContext.NAMESPACE_URI, | |
1273 ArtifactNamespaceContext.NAMESPACE_PREFIX); | |
1274 | |
1275 Element root = ec.create("result"); | |
1276 result.appendChild(root); | |
1277 | |
1278 boolean success = backend.setCollectionAttribute( | |
1279 collectionId, artifactId, attribute); | |
1280 | |
1281 root.setTextContent(success ? OPERATION_SUCCESSFUL: OPERATION_FAILURE); | |
1282 | |
1283 return result; | |
1251 } | 1284 } |
1252 | 1285 |
1253 public Document addCollectionArtifact( | 1286 public Document addCollectionArtifact( |
1254 String collectionId, | 1287 String collectionId, |
1255 String artifactId, | 1288 String artifactId, |