public final class PackageRelationshipCollection extends Object implements Iterable<PackageRelationship>
| Constructor and Description |
|---|
PackageRelationshipCollection(OPCPackage container)
Constructor.
|
PackageRelationshipCollection(OPCPackage container,
PackagePart part)
Constructor.
|
PackageRelationshipCollection(PackagePart part)
Constructor.
|
PackageRelationshipCollection(PackageRelationshipCollection coll,
String filter)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addRelationship(PackageRelationship relPart)
Add the specified relationship to the collection.
|
PackageRelationship |
addRelationship(URI targetUri,
TargetMode targetMode,
String relationshipType,
String id)
Add a relationship to the collection.
|
void |
clear()
Clear all relationships.
|
PackageRelationship |
getRelationship(int index)
Retrieves a relationship by its index in the collection.
|
PackageRelationship |
getRelationshipByID(String id)
Retrieves a package relationship based on its id.
|
PackageRelationshipCollection |
getRelationships(String typeFilter)
Retrieves all relations with the specified type.
|
Iterator<PackageRelationship> |
iterator()
Get this collection's iterator.
|
Iterator<PackageRelationship> |
iterator(String typeFilter)
Get an iterator of a collection with all relationship with the specified
type.
|
void |
removeRelationship(PackageRelationship rel)
Remove a relationship by its reference.
|
void |
removeRelationship(String id)
Remove a relationship by its ID.
|
int |
size()
Get the numbe rof relationships in the collection.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic PackageRelationshipCollection(PackageRelationshipCollection coll, String filter)
coll - Collection to import.filter - Relationship type filter.public PackageRelationshipCollection(OPCPackage container) throws InvalidFormatException
InvalidFormatExceptionpublic PackageRelationshipCollection(PackagePart part) throws InvalidFormatException
InvalidFormatException - Throws if the format of the content part is invalid.InvalidOperationException - Throws if the specified part is a relationship part.public PackageRelationshipCollection(OPCPackage container, PackagePart part) throws InvalidFormatException
container - The parent package.part - The part that own this relationships collection. If null
then this part is considered as the package root.InvalidFormatException - If an error occurs during the parsing of the relatinships
part fo the specified part.public void addRelationship(PackageRelationship relPart)
relPart - The relationship to add.public PackageRelationship addRelationship(URI targetUri, TargetMode targetMode, String relationshipType, String id)
targetUri - Target URI.targetMode - The target mode : INTERNAL or EXTERNALrelationshipType - Relationship type.id - Relationship ID.PackageAccesspublic void removeRelationship(String id)
id - The relationship ID to remove.public void removeRelationship(PackageRelationship rel)
rel - The relationship to delete.public PackageRelationship getRelationship(int index)
index - Must be a value between [0-relationships_count-1]public PackageRelationship getRelationshipByID(String id)
id - ID of the package relationship to retrieve.public int size()
public PackageRelationshipCollection getRelationships(String typeFilter)
typeFilter - Relationship type filter. If null then all
relationships are returned.public Iterator<PackageRelationship> iterator()
iterator in interface Iterable<PackageRelationship>public Iterator<PackageRelationship> iterator(String typeFilter)
typeFilter - Type filter.public void clear()
Copyright © 2020. All rights reserved.