public interface RelationshipSource
Modifier and Type | Method and Description |
---|---|
PackageRelationship |
addExternalRelationship(java.lang.String target,
java.lang.String relationshipType)
Adds an external relationship to a part
(except relationships part).
|
PackageRelationship |
addExternalRelationship(java.lang.String target,
java.lang.String relationshipType,
java.lang.String id)
Adds an external relationship to a part
(except relationships part).
|
PackageRelationship |
addRelationship(PackagePartName targetPartName,
TargetMode targetMode,
java.lang.String relationshipType)
Add a relationship to a part (except relationships part).
|
PackageRelationship |
addRelationship(PackagePartName targetPartName,
TargetMode targetMode,
java.lang.String relationshipType,
java.lang.String id)
Add a relationship to a part (except relationships part).
|
void |
clearRelationships()
Delete all the relationships attached to this.
|
PackageRelationship |
getRelationship(java.lang.String id)
Retrieves a package relationship from its id.
|
PackageRelationshipCollection |
getRelationships()
Retrieve all the relationships attached to this.
|
PackageRelationshipCollection |
getRelationshipsByType(java.lang.String relationshipType)
Retrieve all relationships attached to this part which have the specified
type.
|
boolean |
hasRelationships()
Knows if the part have any relationships.
|
boolean |
isRelationshipExists(PackageRelationship rel)
Checks if the specified relationship is part of this package part.
|
void |
removeRelationship(java.lang.String id)
Delete the relationship specified by its id.
|
PackageRelationship addRelationship(PackagePartName targetPartName, TargetMode targetMode, java.lang.String relationshipType)
targetPartName
- Name of the target part. This one must be relative to the
source root directory of the part.targetMode
- Mode [Internal|External].relationshipType
- Type of relationship.PackageRelationship addRelationship(PackagePartName targetPartName, TargetMode targetMode, java.lang.String relationshipType, java.lang.String id)
Check rule M1.25: The Relationships part shall not have relationships to any other part. Package implementers shall enforce this requirement upon the attempt to create such a relationship and shall treat any such relationship as invalid.
targetPartName
- Name of the target part. This one must be relative to the
source root directory of the part.targetMode
- Mode [Internal|External].relationshipType
- Type of relationship.id
- Relationship unique id.InvalidFormatException
- If the URI point to a relationship part URI.PackageRelationship addExternalRelationship(java.lang.String target, java.lang.String relationshipType)
target
- External target of the relationshiprelationshipType
- Type of relationship.addExternalRelationship(java.lang.String, java.lang.String)
PackageRelationship addExternalRelationship(java.lang.String target, java.lang.String relationshipType, java.lang.String id)
target
- External target of the relationshiprelationshipType
- Type of relationship.id
- Relationship unique id.addExternalRelationship(java.lang.String, java.lang.String)
void clearRelationships()
void removeRelationship(java.lang.String id)
id
- The ID identified the part to delete.PackageRelationshipCollection getRelationships() throws InvalidFormatException, OpenXML4JException
OpenXML4JException
InvalidFormatException
PackageRelationship getRelationship(java.lang.String id)
id
- ID of the package relationship to retrieve.PackageRelationshipCollection getRelationshipsByType(java.lang.String relationshipType) throws InvalidFormatException, java.lang.IllegalArgumentException, OpenXML4JException
relationshipType
- Relationship type filter.InvalidFormatException
- If an error occurs while parsing the part.InvalidOperationException
- If the package is open in write only mode.java.lang.IllegalArgumentException
OpenXML4JException
boolean hasRelationships()
boolean isRelationshipExists(PackageRelationship rel)
rel
- The relationship to check.Copyright 2021 The Apache Software Foundation or its licensors, as applicable.