Package com.tietoenator.trip.jxp.users

# Class TdbProcedure

java.lang.Object
com.tietoenator.trip.jxp.session.TdbSessionObject
com.tietoenator.trip.jxp.TdbMessageProvider
com.tietoenator.trip.jxp.session.TdbSerializableObject
com.tietoenator.trip.jxp.users.TdbProcedure

All Implemented Interfaces:
  `com.tietoenator.trip.jxp.internal.utils.DOMSink`, `TdbControlObjectProvider`, `Iterable<String>`

public class TdbProcedure extends TdbSerializableObject implements com.tietoenator.trip.jxp.internal.utils.DOMSink, Iterable<String>
Container and manipulation logic for a stored procedure.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TdbProcedure(TdbSession session)`
  Constructor, creates a blank instance.
  `TdbProcedure(TdbSession session, TdbControlObject ob)`
  Constructor, creates a container for the referenced stored procedure.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<String>`
  `content()`
  Retrieve the collection of lines that comprise the procedure
  `void`
  `copy(String newowner, String newname, TdbControlObject newobject)`
  Copy the current procedure to a new owner, or to a new name under the same owner.
  `void`
  `create(String owner, String name, String comment)`
  Create a new procedure.
  `void`
  `delete()`
  Delete the current stored procedure from the server.
  `void`
  `delete(String owner, String name)`
  Delete a stored procedure from the server.
  `void`
  `export(String filename)`
  Export the content of the current stored procedure to a named file.
  `void`
  `export(String filename, String owner, String name)`
  Export the content of the stored procedure to a named file.
  `void`
  `get()`
  Retrieve the content of the current stored procedure from the server.
  `void`
  `get(String owner, String name)`
  Retrieve the content of a stored procedure from the server.
  `String`
  `getComment()`
  Retrieve any comment associated with the procedure
  `String`
  `getName()`
  Retrieve the name of the procedure
  `String`
  `getOwnerName()`
  Retrieve the name of the user or group with which this procedure is associated
  `void`
  `importProcedure(String filename, String owner, String name)`
  Import a new procedure from a file.
  `void`
  `importUpdate(String filename)`
  Update the current procedure with a definition stored in a file.
  `void`
  `importUpdate(String filename, String owner, String name)`
  Update a procedure with a definition stored in file.
  `Iterator<String>`
  `iterator()`
  Retrieve an iterator over the collection of lines that comprise the procedure
  `void`
  `put()`
  Save the current procedure to the server.
  `void`
  `rename(String newname)`
  Rename the procedure maintaining the current owner.
  `void`
  `saveSearch(int searchSetNumber, String owner, String name, String comment)`
  Save the CCL commands for a search set as a procedure.
  `void`
  `setComment(String comment)`
  Establish a comment to associate with the procedure
  `void`
  `setContent(Collection<String> lines)`
  Set the collection of lines that comprise the procedure

  ### Methods inherited from class com.tietoenator.trip.jxp.session.TdbSerializableObject

  `getControlObject`

  ### Methods inherited from class com.tietoenator.trip.jxp.TdbMessageProvider

  `codeList, getLastCode, getLastMessage, hasMessages, messageList, resetMessages`

  ### Methods inherited from class com.tietoenator.trip.jxp.session.TdbSessionObject

  `cancel, getSession, isCancelable, setCancelable`

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

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface java.lang.Iterable

  `forEach, spliterator`

- ## Constructor Details

  - ### TdbProcedure

    public TdbProcedure(TdbSession session, TdbControlObject ob) throws TdbException
    Constructor, creates a container for the referenced stored procedure.
    Parameters:
      `session` - Active session
      `ob` - Control object referencing the procedure desired
    Throws:
      `TdbException`

  - ### TdbProcedure

    public TdbProcedure(TdbSession session) throws TdbException
    Constructor, creates a blank instance.
    Parameters:
      `session` - Active session
    Throws:
      `TdbException`

- ## Method Details

  - ### getOwnerName

    public String getOwnerName()
    Retrieve the name of the user or group with which this procedure is associated
    Returns:
      Owner name

  - ### getName

    public String getName()
    Retrieve the name of the procedure
    Returns:
      The procedure name

  - ### getComment

    public String getComment()
    Retrieve any comment associated with the procedure
    Returns:
      Comment, if any

  - ### setComment

    public void setComment(String comment)
    Establish a comment to associate with the procedure
    Parameters:
      `comment` - The comment, if any

  - ### content

    public List<String> content()
    Retrieve the collection of lines that comprise the procedure
    Returns:
      The procedure's content

  - ### iterator

    public Iterator<String> iterator()
    Retrieve an iterator over the collection of lines that comprise the procedure
    Specified by:
      `iterator` in interface `Iterable<String>`
    Returns:
      Iterator over the procedure's content

  - ### setContent

    public void setContent(Collection<String> lines)
    Set the collection of lines that comprise the procedure
    Parameters:
      `lines` - The procedure's new content

  - ### get

    public void get(String owner, String name) throws TdbException
    Retrieve the content of a stored procedure from the server.

    This method causes network I/O.

    Parameters:
      `owner` - The owning entity of the stored procedure to be retrieved, null for the calling user.
      `name` - The name of the stored procedure to be retrieved.
    Throws:
      `TdbException`

  - ### get

    public void get() throws TdbException
    Retrieve the content of the current stored procedure from the server.

    This method causes network I/O.

    Throws:
      `TdbException`

  - ### export

    public void export(String filename, String owner, String name) throws TdbException
    Export the content of the stored procedure to a named file.

    This method causes network I/O.

    Parameters:
      `filename` - The name of the file to which the procedure definition should be written
      `owner` - The name of the owner of the procedure (group/user), null for the calling user
      `name` - The name of the procedure to be exported
    Throws:
      `TdbException`

  - ### export

    public void export(String filename) throws TdbException
    Export the content of the current stored procedure to a named file.

    This method causes network I/O.

    Parameters:
      `filename` - The name of the file to which the procedure definition should be written
    Throws:
      `TdbException`

  - ### copy

    public void copy(String newowner, String newname, TdbControlObject newobject) throws TdbException
    Copy the current procedure to a new owner, or to a new name under the same owner.

    This method causes network I/O.

    Parameters:
      `newowner` - The name of the entity that will own the newly created procedure, set null for the calling user.
      `newname` - The name of the newly created procedure.
      `newobject` - If not null, this will hold the Control information for the newly created procedure on return.
    Throws:
      `TdbException`

  - ### delete

    public void delete(String owner, String name) throws TdbException
    Delete a stored procedure from the server.

    This method causes network I/O.

    Parameters:
      `owner` - The owning entity of the stored procedure to be deleted, set null for the calling user.
      `name` - The name of the stored procedure to be deleted.
    Throws:
      `TdbException`

  - ### delete

    public void delete() throws TdbException
    Delete the current stored procedure from the server.

    This method causes network I/O.

    Throws:
      `TdbException`

  - ### create

    public void create(String owner, String name, String comment) throws TdbException
    Create a new procedure.

    This method causes network I/O.

    Parameters:
      `owner` - The owning entity of the stored procedure to be created, set as null for the calling user.
      `name` - The name of the stored procedure to be created.
      `comment` - An optional comment for the new procedure
    Throws:
      `TdbException`

  - ### put

    public void put() throws TdbException
    Save the current procedure to the server.

    This method causes network I/O.

    Throws:
      `TdbException`

  - ### importProcedure

    public void importProcedure(String filename, String owner, String name) throws TdbException
    Import a new procedure from a file.

    This method causes network I/O.

    Parameters:
      `filename` - The name of the file containing the procedure definition
      `owner` - The owner of the new procedure (either a user or a group name), null for the calling user.
      `name` - The name of the new procedure
    Throws:
      `TdbException`

  - ### importUpdate

    public void importUpdate(String filename, String owner, String name) throws TdbException
    Update a procedure with a definition stored in file.

    This method causes network I/O.

    Parameters:
      `filename` - The name of the file containing the updated procedure definition
      `owner` - The owner of the procedure to be updated (either a user or a group name), null for the calling user.
      `name` - The name of the procedure to be updated
    Throws:
      `TdbException`

  - ### importUpdate

    public void importUpdate(String filename) throws TdbException
    Update the current procedure with a definition stored in a file.

    This method causes network I/O.

    Parameters:
      `filename` - File to read updated definition from
    Throws:
      `TdbException`

  - ### rename

    public void rename(String newname) throws TdbException
    Rename the procedure maintaining the current owner.

    This method causes network I/O.

    Parameters:
      `newname` - The new name of the procedure.
    Throws:
      `TdbException`

  - ### saveSearch

    public void saveSearch(int searchSetNumber, String owner, String name, String comment) throws TdbException
    Save the CCL commands for a search set as a procedure.

    IMPORTANT: This procedure must be executed using the FIND SAVE command.

    The CCL command that generated the search set is saved in the procedure, as is all the CCL commands upon which it depends, such as BASE and other search sets that are referred to using the S=<num> expression. All search set references in the procedure are renumbered automatically.

    This method causes network I/O.
    Parameters:
      `searchSetNumber` - The number of an existing search set
      `owner` - The owner of the new procedure (user or group name), or null for the calling user
      `name` - The name of the new procedure
      `comment` - A brief comment describing the procedure, or null for no comment
    Throws:
      `TdbException`