Class ArtifactSetImpl
java.lang.Object
org.apache.jackrabbit.vault.fs.impl.ArtifactSetImpl
- All Implemented Interfaces:
ArtifactSet,Dumpable
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an artifactsadd(Artifact parent, String relPath, String ext, ArtifactType type, Property prop, long lastModified) Adds anPropertyValueArtifactwith the given name, type and serializeradd(Artifact parent, String name, String ext, ArtifactType type, Serializer ser, long lastModified) Adds anSerializerArtifactwith the given name, type and serializer.voidaddAll(Collection<? extends Artifact> artifacts) Adds a collection of artifactsvoidaddAll(ArtifactSet artifacts) Adds a set of artifactsvoiddump(DumpContext ctx, boolean isLast) Dumps some human readable information using the given context.getArtifact(String path) Returns the artifact with the given path ornullif it does not exist.Returns the item filter set that defines the coverage of the items in this artifact set.Returns the directory artifact ornull.Returns the primary data artifact ornull.booleanisEmpty()Checks if this set is empty.Puts the given artifact to this set.booleanRemoves the artifact from this set.removed()Returns the collection of removed artifactsvoidsetCoverage(ItemFilterSet filter) Sets the item filter set that defines the coverage of the items in this artifact set.intsize()Returns the number of artifacts in this set.intsize(ArtifactType type) Returns the number of artifacts in this set that have the given type.toString()values()Returns a collection of all artifactsvalues(ArtifactType type) Returns a collection of all artifacts that have the given type.
-
Constructor Details
-
ArtifactSetImpl
public ArtifactSetImpl()
-
-
Method Details
-
getCoverage
Description copied from interface:ArtifactSetReturns the item filter set that defines the coverage of the items in this artifact set.- Specified by:
getCoveragein interfaceArtifactSet- Returns:
- the item filter set.
-
setCoverage
Sets the item filter set that defines the coverage of the items in this artifact set.- Parameters:
filter- the item filter set.
-
addAll
Description copied from interface:ArtifactSetAdds a collection of artifacts- Specified by:
addAllin interfaceArtifactSet- Parameters:
artifacts- the artifacts collection
-
addAll
Description copied from interface:ArtifactSetAdds a set of artifacts- Specified by:
addAllin interfaceArtifactSet- Parameters:
artifacts- the artifacts set
-
add
Description copied from interface:ArtifactSetAdds an artifacts- Specified by:
addin interfaceArtifactSet- Parameters:
artifact- the artifact to add
-
add
public SerializerArtifact add(Artifact parent, String name, String ext, ArtifactType type, Serializer ser, long lastModified) Adds anSerializerArtifactwith the given name, type and serializer.- Parameters:
parent- the parent artifactname- the name of the artifactext- the extension of the artifacttype- the type of the artifactser- the serializer of the artifactlastModified- 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 anPropertyValueArtifactwith the given name, type and serializer- Parameters:
parent- parent artifactrelPath- the name of the artifactext- the extensiontype- the type of the artifactprop- the property of the artifactlastModified- the last modified date. can be 0.- Returns:
- a collection of artifacts
- Throws:
RepositoryException- if an error occurs.
-
getPrimaryData
Description copied from interface:ArtifactSetReturns the primary data artifact ornull.- Specified by:
getPrimaryDatain interfaceArtifactSet- Returns:
- the primary data artifact or
null.
-
getDirectory
Description copied from interface:ArtifactSetReturns the directory artifact ornull.- Specified by:
getDirectoryin interfaceArtifactSet- Returns:
- the directory artifact or
null.
-
isEmpty
public boolean isEmpty()Description copied from interface:ArtifactSetChecks if this set is empty.- Specified by:
isEmptyin interfaceArtifactSet- Returns:
trueif this set is empty.
-
size
public int size()Description copied from interface:ArtifactSetReturns the number of artifacts in this set.- Specified by:
sizein interfaceArtifactSet- Returns:
- the number of artifacts in this set.
-
remove
Removes the artifact from this set.- Parameters:
a- the artifact to remove- Returns:
trueif the artifact was removed.
-
put
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 isArtifactType.BINARYit equivalent with the same name is replaced.- Parameters:
a- the artifact to put- Returns:
- the previous artifact or
null
-
size
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
Returns a collection of all artifacts that have the given type.- Specified by:
valuesin interfaceArtifactSet- Parameters:
type- the type of the artifacts to return- Returns:
- the artifacts
-
values
Returns a collection of all artifacts- Specified by:
valuesin interfaceArtifactSet- Returns:
- the artifacts
-
removed
Returns the collection of removed artifacts- Specified by:
removedin interfaceArtifactSet- Returns:
- the removed artifacts
-
toString
-
getArtifact
Returns the artifact with the given path ornullif it does not exist.- Parameters:
path- the name of the artifact.- Returns:
- the desired artifact or
null
-
dump
Dumps some human readable information using the given context.
-