### *** This class provides Binary Compatibility only, not Source Compatibility ***

Package com.sas.services.publish

# Class ResultPackage

java.lang.Object
java.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
com.sas.services.publish.AbstractEntry
com.sas.services.publish.ResultPackage

All Implemented Interfaces:
  `com.sas.entities.EntityKeyInterface`, `com.sas.io.InputStreamProviderInterface`, `EntryInterface`, `ResultPackageInterface`, `Serializable`, `Remote`

@SASScope("ALL") @BinaryCompatibilityOnly public class ResultPackage extends AbstractEntry implements ResultPackageInterface
Represents a result package that can then be published using one of the supported delivery transports. See Constructing a Result Package to Publish for an example of how this class is used. A result package is a collection of information, such as a collection of reports, tables and documents. A package can contain text files, binary files (such as GIF or JPG), HTML files, references, and viewer files.

Package metadata can be defined to provide more information about the result package:

- Abstract - An abstract can be assigned to the result package. Analogous to the abstract of a technical paper, the result package abstract is typically a paragraph length overview of the contents of the package. It is assigned by the package's creator.
- Creation Date/Time - The creation datetime stamp indicates the result package creation date and time. The creation datetime is assigned when the result package is published. The value is in UTC (not local) time.
- Description - This description is typically a single line summary of the package contents. It is assigned by the package's creator.
- Expiration Date/Time - The expiration datetime indicates the date and time on which the result package is scheduled to expire. The expiration datetime is assigned by the packages's creator. If not specified, the value of Dec 31, 9999 will be assigned when the result package is published. The publish framework does not enforce the expiration. It is up to the calling application to use this expiration value as desired. The value should be stored and interpreted in UTC (not local) time.
- Name/Values - The result package name/values can be assigned to the result package to provide user or application control information that describes the package. Name/value pairs are typically assigned to support subsequent package retrieval in search operations, but they could be used for other purposes as well.

Since:
  1.0
See Also:
  - `TransportFactory`
  - Serialized Form

- ## Field Summary

  ### Fields inherited from class com.sas.services.publish.AbstractEntry

  `BINARY_COMPAT_VERSION, CATALOG_COMPAT_VERSION, DATASET_COMPAT_VERSION, DEFAULT_ENTRY_VERSION, HTML_COMPAT_VERSION, MDDB_COMPAT_VERSION, NESTEDPACKAGE_COMPAT_VERSION, REFERENCE_COMPAT_VERSION, SQLVIEW_COMPAT_VERSION, TEXT_COMPAT_VERSION, VERSION_94_EXTENDED_ATTRIBUTES, VIEWER_COMPAT_VERSION`

  ### Fields inherited from class java.rmi.server.RemoteObject

  `ref`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ResultPackage()`
  Creates a result package.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addEntry(EntryInterface entry)`
  Adds a new entry to the result package.
  `void`
  `close()`
  Close the result package.
  `void`
  `delete()`
  Delete the result package.
  `String`
  `getAbstract()`
  Returns the abstract of the result package.
  `long`
  `getCreationDateTime()`
  Returns the creation datetime stamp.
  `EntryInterface[]`
  `getEntries()`
  Returns an array of all entries in this package.
  `EntryInterface`
  `getEntry(int index)`
  Returns a particular result package entry as indicated by the specified index.
  `EntryInterface`
  `getEntry(String uniqueId)`
  Returns the result package entry identified by the entity key.
  `EventDataInterface`
  `getEventData()`
  Returns the event data.
  `long`
  `getExpirationDateTime()`
  Returns the expiration datetime stamp.
  `InputStream`
  `getInputStream()`
  Gets the input stream for this result package.
  `InputStream`
  `getInputStream(Object streamID)`
  Deprecated.
  Use `getInputStream()` which now supports remote input streams.
  `String`
  `getName()`
  Returns the name for this result package.
  `com.sas.io.RemoteInputStreamInterface`
  `getRemoteInputStream(Object streamID)`
  Deprecated.
  Use `getInputStream()` which now supports remote input streams.
  `Object`
  `hasInputStream()`
  Deprecated.
  this method no longer needed as getInputStream() will return an input stream that can be used in a remote environment
  `boolean`
  `isNested()`
  Returns true when the result package is a nested package.
  `void`
  `setAbstract(String pkgAbstract)`
  Set the abstract for the result package.
  `void`
  `setExpirationDateTime(long expiration)`
  Set the expiration datetime stamp for the package
  `void`
  `setName(String name)`
  Set the name for the result package.

  ### Methods inherited from class com.sas.services.publish.AbstractEntry

  `getDescription, getEntityKey, getNameValuePairs, getURL, isClosed, isReadOnly, sameEntity, setClosed, setDescription, setEntityKey, setNameValuePairs, setRead, throwExceptionIfClosed`

  ### Methods inherited from class java.rmi.server.UnicastRemoteObject

  `clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObject`

  ### Methods inherited from class java.rmi.server.RemoteServer

  `getClientHost, getLog, setLog`

  ### Methods inherited from class java.rmi.server.RemoteObject

  `equals, getRef, hashCode, toString, toStub`

  ### Methods inherited from class java.lang.Object

  `finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface com.sas.entities.EntityKeyInterface

  `getEntityKey, sameEntity, setEntityKey`

  ### Methods inherited from interface com.sas.services.publish.EntryInterface

  `getDescription, getNameValuePairs, getURL, isReadOnly, setDescription, setNameValuePairs`

- ## Constructor Details

  - ### ResultPackage

    public ResultPackage() throws RemoteException
    Creates a result package.
    Throws:
      `RemoteException` - If a network anomaly is encountered.

- ## Method Details

  - ### hasInputStream

    public Object hasInputStream() throws IllegalStateException
    Deprecated.
    this method no longer needed as getInputStream() will return an input stream that can be used in a remote environment
    Check if `getInputStream(java.lang.Object)` will succeed. This method will always return `null`.
    Specified by:
      `hasInputStream` in interface `com.sas.io.InputStreamProviderInterface`
    Specified by:
      `hasInputStream` in interface `ResultPackageInterface`
    Returns:
      `Object` `null`
    Throws:
      `IllegalStateException` - if this result package has already been closed.

  - ### getInputStream

    public InputStream getInputStream(Object streamID) throws IllegalStateException
    Deprecated.
    Use `getInputStream()` which now supports remote input streams.
    Gets the input stream for this result package. This method will always return `null` and is only present becuase this class implements `ResultPackageInterface` which extends `RemoteInputStreamInterface` which defines it.
    Specified by:
      `getInputStream` in interface `com.sas.io.InputStreamProviderInterface`
    Specified by:
      `getInputStream` in interface `ResultPackageInterface`
    Parameters:
      `streamID` - The stream description should be `null`; it will be ignored.
    Returns:
      `null`
    Throws:
      `IllegalStateException` - if this result package has already been closed.

  - ### getInputStream

    public InputStream getInputStream() throws IllegalStateException
    Gets the input stream for this result package. This method will always return `null` and is only present because this class implements `ResultPackageInterface` which extends `RemoteInputStreamInterface` which defines it.
    Specified by:
      `getInputStream` in interface `ResultPackageInterface`
    Returns:
      `null`
    Throws:
      `IllegalStateException` - if this result package has already been closed.

  - ### getRemoteInputStream

    public com.sas.io.RemoteInputStreamInterface getRemoteInputStream(Object streamID) throws IOException, RemoteException, IllegalStateException
    Deprecated.
    Use `getInputStream()` which now supports remote input streams.
    Gets the remote input stream for this result package. This method will always return `null` and is only present becuase this class implements `ResultPackageInterface` which extends `RemoteInputStreamInterface` which defines it.
    Specified by:
      `getRemoteInputStream` in interface `com.sas.io.InputStreamProviderInterface`
    Specified by:
      `getRemoteInputStream` in interface `ResultPackageInterface`
    Parameters:
      `streamID` - The stream description should be `null`; it will be ignored.
    Returns:
      `null`
    Throws:
      `IllegalStateException` - if this result package has already been closed.
      `IOException` - If an error occurs constructing the remote input stream.
      `RemoteException` - If a network anomaly is encountered.

  - ### getAbstract

    public String getAbstract() throws RemoteException, IllegalStateException
    Returns the abstract of the result package.
    Specified by:
      `getAbstract` in interface `ResultPackageInterface`
    Returns:
      `Object` The abstract of the result package; can be null.
    Throws:
      `RemoteException` - If a network anomaly is encountered.
      `IllegalStateException` - if this result package has already been closed.

  - ### setAbstract

    public void setAbstract(String pkgAbstract) throws RemoteException, IllegalStateException
    Set the abstract for the result package.
    Specified by:
      `setAbstract` in interface `ResultPackageInterface`
    Parameters:
      `pkgAbstract` - Plain text that is the abstract for this result package.
    Throws:
      `IllegalStateException` - If the result package is read only or if the result package is already closed.
      `RemoteException` - If a network anomaly is encountered.

  - ### getExpirationDateTime

    public long getExpirationDateTime() throws RemoteException, IllegalStateException
    Returns the expiration datetime stamp.
    Specified by:
      `getExpirationDateTime` in interface `ResultPackageInterface`
    Returns:
      `long` The expiration datetime stamp for this result package.
    Throws:
      `RemoteException` - If a network anomaly is encountered.
      `IllegalStateException` - if this result package has already been closed.

  - ### setExpirationDateTime

    public void setExpirationDateTime(long expiration) throws RemoteException, IllegalStateException
    Set the expiration datetime stamp for the package
    Specified by:
      `setExpirationDateTime` in interface `ResultPackageInterface`
    Parameters:
      `expiration` - The expiration datetime.
    Throws:
      `IllegalStateException` - If the result package is read only or if the result package is already closed.
      `RemoteException` - If a network anomaly is encountered.

  - ### getCreationDateTime

    public long getCreationDateTime() throws IllegalStateException, RemoteException
    Returns the creation datetime stamp. Because ResultPackage is used to construct new result packages, this method will cause an IllegalStateException.
    Specified by:
      `getCreationDateTime` in interface `ResultPackageInterface`
    Returns:
      `long` The creation datetime stamp for this result package.
    Throws:
      `IllegalStateException` - if this result package has already been closed.
      `RemoteException` - If a network anomaly is encountered.

  - ### getName

    public String getName() throws IllegalStateException, TransportException, RemoteException
    Returns the name for this result package.
    Specified by:
      `getName` in interface `ResultPackageInterface`
    Returns:
      `String` The name of the result package; can be null.
    Throws:
      `IllegalStateException` - if this result package has already been closed.
      `TransportException` - If the transport encounters an error getting the nested name.
      `RemoteException` - If a network anomaly is encountered.

  - ### setName

    public void setName(String name) throws IllegalStateException, RemoteException
    Set the name for the result package. This name will only be used if the result package is published as a nested package. A result package can be nested by adding it as an entry to another result package. When the nested package is published, a unique nested package name is generated by the transports. This can be overridden by providing the nested name to use.
    Specified by:
      `setName` in interface `ResultPackageInterface`
    Parameters:
      `name` - The name for this result package; can be null.
    Throws:
      `IllegalStateException` - If the result package is read only or the result package is already closed.
      `RemoteException` - If a network anomaly is encountered.

  - ### getEntry

    public EntryInterface getEntry(int index) throws RemoteException, IllegalStateException
    Returns a particular result package entry as indicated by the specified index. Distributed applications should use {#link getEntries} to obtain the array of entries. It is more efficient to obtain the entire entry array in one request, instead of invoking this method to obtain each entry separately.
    Specified by:
      `getEntry` in interface `ResultPackageInterface`
    Parameters:
      `index` - The zero-based index of the desired result package entry.
    Returns:
      `ResultPackageEntryInterface` The result package entry.
    Throws:
      `RemoteException` - If a network anomaly is encountered.
      `IllegalStateException` - if this result package has already been closed.

  - ### getEntries

    public EntryInterface[] getEntries() throws RemoteException, IllegalStateException
    Returns an array of all entries in this package. Distributed applications should use this method to obtain the package entries because it is more efficient to get all the entries in one request.
    Specified by:
      `getEntries` in interface `ResultPackageInterface`
    Returns:
      `List` An array of EntryInterface objects.
    Throws:
      `RemoteException` - If a network anomaly is encountered.
      `IllegalStateException` - if this result package has already been closed.

  - ### addEntry

    public void addEntry(EntryInterface entry) throws RemoteException, IllegalStateException, IllegalArgumentException
    Adds a new entry to the result package. The entry will be added to the end of the array of entries. This method will fail if the result package is read only.
    Specified by:
      `addEntry` in interface `ResultPackageInterface`
    Parameters:
      `entry` - The entry to add to the result package.
    Throws:
      `IllegalStateException` - If the result package is read only or if the result package has already been closed.
      `IllegalArgumentException` - If a library member entry is added to the package. Library member entries cannot be published.
      `RemoteException` - If a network anomaly is encountered.

  - ### isNested

    public boolean isNested() throws RemoteException, IllegalStateException
    Returns true when the result package is a nested package.
    Specified by:
      `isNested` in interface `ResultPackageInterface`
    Returns:
      `boolean` `True` if the result package is a nested package; otherwise if this is the main package, `false` is returned.
    Throws:
      `RemoteException` - If a network anomaly is encountered.
      `IllegalStateException` - if this result package has already been closed.

  - ### close

    public void close() throws RemoteException, IllegalStateException, TransportException
    Close the result package.
    Specified by:
      `close` in interface `ResultPackageInterface`
    Throws:
      `IllegalStateException` - If the result package has already been closed or if this is a nested package.
      `TransportException` - If the transport encounters an error getting the entry.
      `RemoteException` - If a network anomaly is encountered.

  - ### delete

    public void delete() throws TransportException, RemoteException, IllegalStateException
    Delete the result package. This method is not supported for nested packages. Because ResultPackage is used to construct new result packages, this method will cause an IllegalStateException.
    Specified by:
      `delete` in interface `ResultPackageInterface`
    Throws:
      `UnsupportedOperationException` - If the operation is not supported by the trasnport.
      `IllegalStateException` - If the result package is read only, if this is a nested package, or if this result package has already been closed.
      `TransportException` - If the transport encounters an error deleting the package.
      `RemoteException` - If a network anomaly is encountered.

  - ### getEventData

    public EventDataInterface getEventData() throws TransportException, RemoteException, IllegalStateException
    Returns the event data. This includes the SASPackage XML event that describes this result package, as well as the event persistence information. See SASPackage Event Usage for more details.
    Specified by:
      `getEventData` in interface `ResultPackageInterface`
    Returns:
      `EventDataInterface` The event data which includes the SASPackage event body, and the event persistence information.
    Throws:
      `TransportException` - If the transport encounters an error getting the nested name.
      `RemoteException` - If a network anomaly is encountered.
      `IllegalStateException` - if this result package has already been closed.

  - ### getEntry

    public EntryInterface getEntry(String uniqueId) throws IllegalStateException, RemoteException, TransportException
    Returns the result package entry identified by the entity key.
    Specified by:
      `getEntry` in interface `ResultPackageInterface`
    Parameters:
      `uniqueId` - The unique identifier of the desired result package entry.
    Returns:
      `EntryInterface` The result package entry. This may be `null` if no entry is found with the specified identifier.
    Throws:
      `IllegalStateException` - if this result package has already been closed.
      `TransportException` - If the transport encounters an error getting the entry.
      `RemoteException` - If a network anomaly is encountered.