Mercurial > dive4elements > river
changeset 6600:df1140486ba4
Add getArtifactsByName to collection
This helps to escape the narrow view of an artifact and
use the data from other artifacts in that collection.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Thu, 18 Jul 2013 13:14:57 +0200 |
parents | 38ee580a30cb |
children | 5ecc6d4d73f2 |
files | artifacts/src/main/java/org/dive4elements/river/collections/D4EArtifactCollection.java |
diffstat | 1 files changed, 25 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/collections/D4EArtifactCollection.java Thu Jul 18 13:13:51 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/collections/D4EArtifactCollection.java Thu Jul 18 13:14:57 2013 +0200 @@ -628,6 +628,30 @@ return persistent != null ? persistent.getArtifact() : null; } - + /** + * Returns artifacts that name facetName. + * + * @param name The Artifact name to search + * @param context The CallContext + * + * @return a list of artifacts matching this name. + */ + public List<Artifact> getArtifactsByName(String name, CallContext context) + { + log.debug("Searching for Artifacts: " + name); + List<Artifact> ret = new ArrayList<Artifact>(); + try { + for (String uuid: getArtifactUUIDs(context)) { + D4EArtifact subArt = (D4EArtifact)getArtifact(uuid, context); + if (subArt.getName() != null && subArt.getName().equals(name)) { + ret.add(subArt); + } + } + } catch (ArtifactDatabaseException e) { + log.error("Unexpected Error!", e); + } finally { + return ret; + } + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :