# HG changeset patch # User Andre Heinecke # Date 1374146097 -7200 # Node ID df1140486ba49d025581e91eaf579dd5fa92e84f # Parent 38ee580a30cb830fcfbb2e4950138368be6d8bea Add getArtifactsByName to collection This helps to escape the narrow view of an artifact and use the data from other artifacts in that collection. diff -r 38ee580a30cb -r df1140486ba4 artifacts/src/main/java/org/dive4elements/river/collections/D4EArtifactCollection.java --- 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 getArtifactsByName(String name, CallContext context) + { + log.debug("Searching for Artifacts: " + name); + List ret = new ArrayList(); + 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 :