Mercurial > dive4elements > framework
comparison artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java @ 222:98695dc6d94d
The operation that adds an artifact to an artifact collection will now return the DESCRIBE document of the artifact collection.
artifacts/trunk@1566 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 25 Mar 2011 08:27:07 +0000 |
parents | cabe4c02ab64 |
children | dd977fb7552e |
comparison
equal
deleted
inserted
replaced
221:f75f83af19e0 | 222:98695dc6d94d |
---|---|
84 * Error message issued if a requested artifact is not found | 84 * Error message issued if a requested artifact is not found |
85 * in this database. | 85 * in this database. |
86 */ | 86 */ |
87 public static final String NO_SUCH_ARTIFACT = | 87 public static final String NO_SUCH_ARTIFACT = |
88 "No such artifact"; | 88 "No such artifact"; |
89 | |
90 /** | |
91 * Error message issued if a requested artifact is not found | |
92 * in this database. | |
93 */ | |
94 public static final String NO_SUCH_COLLECTION = | |
95 "No such collection"; | |
89 | 96 |
90 /** | 97 /** |
91 * Error message issued if the creation of an artifact failed. | 98 * Error message issued if the creation of an artifact failed. |
92 */ | 99 */ |
93 public static final String CREATION_FAILED = | 100 public static final String CREATION_FAILED = |
1172 ArtifactCollection c = backend.getCollection( | 1179 ArtifactCollection c = backend.getCollection( |
1173 collectionId, acf, uf, context); | 1180 collectionId, acf, uf, context); |
1174 | 1181 |
1175 if (c == null) { | 1182 if (c == null) { |
1176 logger.warn("No collection found with identifier: " + collectionId); | 1183 logger.warn("No collection found with identifier: " + collectionId); |
1184 throw new ArtifactDatabaseException(NO_SUCH_COLLECTION); | |
1177 } | 1185 } |
1178 | 1186 |
1179 CallContext cc = new CollectionCallContext( | 1187 CallContext cc = new CollectionCallContext( |
1180 ArtifactDatabaseImpl.this, | 1188 ArtifactDatabaseImpl.this, |
1181 CallContext.NOTHING, | 1189 CallContext.NOTHING, |
1255 boolean success = backend.addCollectionArtifact( | 1263 boolean success = backend.addCollectionArtifact( |
1256 collectionId, | 1264 collectionId, |
1257 artifactId, | 1265 artifactId, |
1258 attr); | 1266 attr); |
1259 | 1267 |
1260 Document result = XMLUtils.newDocument(); | 1268 if (!success) { |
1261 | 1269 Document result = XMLUtils.newDocument(); |
1262 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( | 1270 |
1263 result, | 1271 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
1264 ArtifactNamespaceContext.NAMESPACE_URI, | 1272 result, |
1265 ArtifactNamespaceContext.NAMESPACE_PREFIX); | 1273 ArtifactNamespaceContext.NAMESPACE_URI, |
1266 | 1274 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
1267 Element root = ec.create("result"); | 1275 |
1268 result.appendChild(root); | 1276 Element root = ec.create("result"); |
1269 | 1277 result.appendChild(root); |
1270 root.setTextContent(success ? OPERATION_SUCCESSFUL: OPERATION_FAILURE); | 1278 |
1271 | 1279 root.setTextContent(OPERATION_FAILURE); |
1272 return result; | 1280 |
1281 return result; | |
1282 } | |
1283 | |
1284 return describeCollection(collectionId, callMeta); | |
1273 } | 1285 } |
1274 | 1286 |
1275 public Document removeCollectionArtifact(String collectionId, String artifactId, | 1287 public Document removeCollectionArtifact(String collectionId, String artifactId, |
1276 CallMeta callMeta) throws ArtifactDatabaseException | 1288 CallMeta callMeta) throws ArtifactDatabaseException |
1277 { | 1289 { |