Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.openxml4j.opc
Interface RelationshipSource

All Known Implementing Classes:
  DigitalCertificatePart, MemoryPackagePart, OPCPackage, Package, PackageDigitalSignature, PackagePart, PackagePropertiesPart, ZipPackage, ZipPackagePart

    public interface RelationshipSource

Method Summary
`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.

Method Detail

### addRelationship

    PackageRelationship addRelationship(PackagePartName targetPartName,
                                        TargetMode targetMode,
                                        java.lang.String relationshipType)

  Add a relationship to a part (except relationships part).

  Parameters:
    `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.
  Returns:
    The newly created and added relationship

### addRelationship

    PackageRelationship addRelationship(PackagePartName targetPartName,
                                        TargetMode targetMode,
                                        java.lang.String relationshipType,
                                        java.lang.String id)

  Add a relationship to a part (except relationships part).

  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.

  Parameters:
    `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.
  Returns:
    The newly created and added relationship
  Throws:
    `InvalidFormatException` - If the URI point to a relationship part URI.

### addExternalRelationship

    PackageRelationship addExternalRelationship(java.lang.String target,
                                                java.lang.String relationshipType)

  Adds an external relationship to a part (except relationships part). The targets of external relationships are not subject to the same validity checks that internal ones are, as the contents is potentially any file, URL or similar.

  Parameters:
    `target` - External target of the relationship
    `relationshipType` - Type of relationship.
  Returns:
    The newly created and added relationship
  See Also:
    `addExternalRelationship(java.lang.String, java.lang.String)`

### addExternalRelationship

    PackageRelationship addExternalRelationship(java.lang.String target,
                                                java.lang.String relationshipType,
                                                java.lang.String id)

  Adds an external relationship to a part (except relationships part). The targets of external relationships are not subject to the same validity checks that internal ones are, as the contents is potentially any file, URL or similar.

  Parameters:
    `target` - External target of the relationship
    `relationshipType` - Type of relationship.
    `id` - Relationship unique id.
  Returns:
    The newly created and added relationship
  See Also:
    `addExternalRelationship(java.lang.String, java.lang.String)`

### clearRelationships

    void clearRelationships()

  Delete all the relationships attached to this.

### removeRelationship

    void removeRelationship(java.lang.String id)

  Delete the relationship specified by its id.

  Parameters:
    `id` - The ID identified the part to delete.

### getRelationships

    PackageRelationshipCollection getRelationships()
                                                   throws InvalidFormatException,
                                                          OpenXML4JException

  Retrieve all the relationships attached to this.

  Returns:
    This part's relationships.
  Throws:
    `OpenXML4JException`
    `InvalidFormatException`

### getRelationship

    PackageRelationship getRelationship(java.lang.String id)

  Retrieves a package relationship from its id.

  Parameters:
    `id` - ID of the package relationship to retrieve.
  Returns:
    The package relationship

### getRelationshipsByType

    PackageRelationshipCollection getRelationshipsByType(java.lang.String relationshipType)
                                                         throws InvalidFormatException,
                                                                java.lang.IllegalArgumentException,
                                                                OpenXML4JException

  Retrieve all relationships attached to this part which have the specified type.

  Parameters:
    `relationshipType` - Relationship type filter.
  Returns:
    All relationships from this part that have the specified type.
  Throws:
    `InvalidFormatException` - If an error occurs while parsing the part.
    `InvalidOperationException` - If the package is open in write only mode.
    `java.lang.IllegalArgumentException`
    `OpenXML4JException`

### hasRelationships

    boolean hasRelationships()

  Knows if the part have any relationships.

  Returns:
    true if the part have at least one relationship else false.

### isRelationshipExists

    boolean isRelationshipExists(PackageRelationship rel)

  Checks if the specified relationship is part of this package part.

  Parameters:
    `rel` - The relationship to check.
  Returns:
    true if the specified relationship exists in this part, else returns false

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD