Class ArtifactSetImpl

java.lang.Object
org.apache.jackrabbit.vault.fs.impl.ArtifactSetImpl
All Implemented Interfaces:
ArtifactSet, Dumpable

public class ArtifactSetImpl extends Object implements Dumpable, ArtifactSet
Implements a set of artifacts. The artifacts can be retrieved via an ArtifactIterator. Special artifacts like ArtifactType.PRIMARY and ArtifactType.DIRECTORY can be retrieved individually. This set only allows one of those artifacts per type. All modifications to this set have no influence on the persisted data.
  • Constructor Details

    • ArtifactSetImpl

      public ArtifactSetImpl()
  • Method Details

    • getCoverage

      public ItemFilterSet getCoverage()
      Description copied from interface: ArtifactSet
      Returns the item filter set that defines the coverage of the items in this artifact set.
      Specified by:
      getCoverage in interface ArtifactSet
      Returns:
      the item filter set.
    • setCoverage

      public void setCoverage(ItemFilterSet filter)
      Sets the item filter set that defines the coverage of the items in this artifact set.
      Parameters:
      filter - the item filter set.
    • addAll

      public void addAll(Collection<? extends Artifact> artifacts)
      Description copied from interface: ArtifactSet
      Adds a collection of artifacts
      Specified by:
      addAll in interface ArtifactSet
      Parameters:
      artifacts - the artifacts collection
    • addAll

      public void addAll(ArtifactSet artifacts)
      Description copied from interface: ArtifactSet
      Adds a set of artifacts
      Specified by:
      addAll in interface ArtifactSet
      Parameters:
      artifacts - the artifacts set
    • add

      public void add(Artifact artifact)
      Description copied from interface: ArtifactSet
      Adds an artifacts
      Specified by:
      add in interface ArtifactSet
      Parameters:
      artifact - the artifact to add
    • add

      public SerializerArtifact add(Artifact parent, String name, String ext, ArtifactType type, Serializer ser, long lastModified)
      Adds an SerializerArtifact with the given name, type and serializer.
      Parameters:
      parent - the parent artifact
      name - the name of the artifact
      ext - the extension of the artifact
      type - the type of the artifact
      ser - the serializer of the artifact
      lastModified - the last modified date
      Returns:
      the added artifact
    • add

      public Collection<PropertyValueArtifact> add(Artifact parent, String relPath, String ext, ArtifactType type, Property prop, long lastModified) throws RepositoryException
      Adds an PropertyValueArtifact with the given name, type and serializer
      Parameters:
      parent - parent artifact
      relPath - the name of the artifact
      ext - the extension
      type - the type of the artifact
      prop - the property of the artifact
      lastModified - the last modified date. can be 0.
      Returns:
      a collection of artifacts
      Throws:
      RepositoryException - if an error occurs.
    • getPrimaryData

      public Artifact getPrimaryData()
      Description copied from interface: ArtifactSet
      Returns the primary data artifact or null.
      Specified by:
      getPrimaryData in interface ArtifactSet
      Returns:
      the primary data artifact or null.
    • getDirectory

      public Artifact getDirectory()
      Description copied from interface: ArtifactSet
      Returns the directory artifact or null.
      Specified by:
      getDirectory in interface ArtifactSet
      Returns:
      the directory artifact or null.
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: ArtifactSet
      Checks if this set is empty.
      Specified by:
      isEmpty in interface ArtifactSet
      Returns:
      true if this set is empty.
    • size

      public int size()
      Description copied from interface: ArtifactSet
      Returns the number of artifacts in this set.
      Specified by:
      size in interface ArtifactSet
      Returns:
      the number of artifacts in this set.
    • remove

      public boolean remove(Artifact a)
      Removes the artifact from this set.
      Parameters:
      a - the artifact to remove
      Returns:
      true if the artifact was removed.
    • put

      public Artifact put(Artifact a)
      Puts the given artifact to this set. In comparison to the add operations, an already existing artifact is replaced. If the type of the newly artifact is ArtifactType.BINARY it equivalent with the same name is replaced.
      Parameters:
      a - the artifact to put
      Returns:
      the previous artifact or null
    • size

      public int size(ArtifactType type)
      Returns the number of artifacts in this set that have the given type.
      Parameters:
      type - the artifact type
      Returns:
      the number of artifacts in this set that have the given type.
    • values

      public Collection<Artifact> values(ArtifactType type)
      Returns a collection of all artifacts that have the given type.
      Specified by:
      values in interface ArtifactSet
      Parameters:
      type - the type of the artifacts to return
      Returns:
      the artifacts
    • values

      public Collection<Artifact> values()
      Returns a collection of all artifacts
      Specified by:
      values in interface ArtifactSet
      Returns:
      the artifacts
    • removed

      public Collection<Artifact> removed()
      Returns the collection of removed artifacts
      Specified by:
      removed in interface ArtifactSet
      Returns:
      the removed artifacts
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getArtifact

      public Artifact getArtifact(String path)
      Returns the artifact with the given path or null if it does not exist.
      Parameters:
      path - the name of the artifact.
      Returns:
      the desired artifact or null
    • dump

      public void dump(DumpContext ctx, boolean isLast)
      Dumps some human readable information using the given context.
      Specified by:
      dump in interface Dumpable
      Parameters:
      ctx - the dump context
      isLast - specifies if this is the last element to dump on this level