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
Class PackageRelationshipCollection

    java.lang.Object
      org.apache.poi.openxml4j.opc.PackageRelationshipCollection

All Implemented Interfaces:
  java.lang.Iterable<PackageRelationship>

    public final class PackageRelationshipCollection

extends java.lang.Object
implements java.lang.Iterable<PackageRelationship>

Represents a collection of PackageRelationship elements that are owned by a given PackagePart or the Package.

Version:
  0.1
Author:
  Julien Chable, CDubettier

Constructor Summary
`PackageRelationshipCollection(OPCPackage container)` Constructor.
`PackageRelationshipCollection(OPCPackage container, PackagePart part)` Constructor.
`PackageRelationshipCollection(PackagePart part)` Constructor.
`PackageRelationshipCollection(PackageRelationshipCollection coll, java.lang.String filter)` Copy constructor.

Method Summary
`void` | `addRelationship(PackageRelationship relPart)` Add the specified relationship to the collection.
`PackageRelationship` | `addRelationship(java.net.URI targetUri, TargetMode targetMode, java.lang.String relationshipType, java.lang.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(java.lang.String id)` Retrieves a package relationship based on its id.
`PackageRelationshipCollection` | `getRelationships(java.lang.String typeFilter)` Retrieves all relations with the specified type.
`java.util.Iterator<PackageRelationship>` | `iterator()` Get this collection's iterator.
`java.util.Iterator<PackageRelationship>` | `iterator(java.lang.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(java.lang.String id)` Remove a relationship by its ID.
`int` | `size()` Get the numbe rof relationships in the collection.
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### PackageRelationshipCollection

    public PackageRelationshipCollection(PackageRelationshipCollection coll,
                                         java.lang.String filter)

  Copy constructor. This collection will contain only elements from the specified collection for which the type is compatible with the specified relationship type filter.

  Parameters:
    `coll` - Collection to import.
    `filter` - Relationship type filter.

### PackageRelationshipCollection

    public PackageRelationshipCollection(OPCPackage container)
                                  throws InvalidFormatException

  Constructor.

  Throws:
    `InvalidFormatException`

### PackageRelationshipCollection

    public PackageRelationshipCollection(PackagePart part)
                                  throws InvalidFormatException

  Constructor.

  Throws:
    `InvalidFormatException` - Throws if the format of the content part is invalid.
    `InvalidOperationException` - Throws if the specified part is a relationship part.

### PackageRelationshipCollection

    public PackageRelationshipCollection(OPCPackage container,
                                         PackagePart part)
                                  throws InvalidFormatException

  Constructor. Parse the existing package relationship part if one exists.

  Parameters:
    `container` - The parent package.
    `part` - The part that own this relationships collection. If null then this part is considered as the package root.
  Throws:
    `InvalidFormatException` - If an error occurs during the parsing of the relatinships part fo the specified part.

Method Detail

### addRelationship

    public void addRelationship(PackageRelationship relPart)

  Add the specified relationship to the collection.

  Parameters:
    `relPart` - The relationship to add.

### addRelationship

    public PackageRelationship addRelationship(java.net.URI targetUri,
                                               TargetMode targetMode,
                                               java.lang.String relationshipType,
                                               java.lang.String id)

  Add a relationship to the collection.

  Parameters:
    `targetUri` - Target URI.
    `targetMode` - The target mode : INTERNAL or EXTERNAL
    `relationshipType` - Relationship type.
    `id` - Relationship ID.
  Returns:
    The newly created relationship.
  See Also:
    `PackageAccess`

### removeRelationship

    public void removeRelationship(java.lang.String id)

  Remove a relationship by its ID.

  Parameters:
    `id` - The relationship ID to remove.

### removeRelationship

    public void removeRelationship(PackageRelationship rel)

  Remove a relationship by its reference.

  Parameters:
    `rel` - The relationship to delete.

### getRelationship

    public PackageRelationship getRelationship(int index)

  Retrieves a relationship by its index in the collection.

  Parameters:
    `index` - Must be a value between [0-relationships_count-1]

### getRelationshipByID

    public PackageRelationship getRelationshipByID(java.lang.String id)

  Retrieves a package relationship based on its id.

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

### size

    public int size()

  Get the numbe rof relationships in the collection.

### getRelationships

    public PackageRelationshipCollection getRelationships(java.lang.String typeFilter)

  Retrieves all relations with the specified type.

  Parameters:
    `typeFilter` - Relationship type filter. If null then all relationships are returned.
  Returns:
    All relationships of the type specified by the filter.

### iterator

    public java.util.Iterator<PackageRelationship> iterator()

  Get this collection's iterator.

  Specified by:
    `iterator` in interface `java.lang.Iterable<PackageRelationship>`

### iterator

    public java.util.Iterator<PackageRelationship> iterator(java.lang.String typeFilter)

  Get an iterator of a collection with all relationship with the specified type.

  Parameters:
    `typeFilter` - Type filter.
  Returns:
    An iterator to a collection containing all relationships with the specified type contain in this collection.

### clear

    public void clear()

  Clear all relationships.

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

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

Copyright 2010 The Apache Software Foundation or its licensors, as applicable.