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, java.lang.Iterable<java.lang.String>

      public class TdbProcedure
      extends TdbSerializableObject
      implements com.tietoenator.trip.jxp.internal.utils.DOMSink, java.lang.Iterable<java.lang.String>

  Container and manipulation logic for a stored procedure.

- - ### Constructor Summary

    Constructors
    Constructor and 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

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.List<java.lang.String>` | `content()` Retrieve the collection of lines that comprise the procedure
    `void` | `copy(java.lang.String newowner, java.lang.String newname, TdbControlObject newobject)` Copy the current procedure to a new owner, or to a new name under the same owner.
    `void` | `create(java.lang.String owner, java.lang.String name, java.lang.String comment)` Create a new procedure.
    `void` | `delete()` Delete the current stored procedure from the server.
    `void` | `delete(java.lang.String owner, java.lang.String name)` Delete a stored procedure from the server.
    `void` | `export(java.lang.String filename)` Export the content of the current stored procedure to a named file.
    `void` | `export(java.lang.String filename, java.lang.String owner, java.lang.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(java.lang.String owner, java.lang.String name)` Retrieve the content of a stored procedure from the server.
    `java.lang.String` | `getComment()` Retrieve any comment associated with the procedure
    `java.lang.String` | `getName()` Retrieve the name of the procedure
    `java.lang.String` | `getOwnerName()` Retrieve the name of the user or group with which this procedure is associated
    `void` | `importProcedure(java.lang.String filename, java.lang.String owner, java.lang.String name)` Import a new procedure from a file.
    `void` | `importUpdate(java.lang.String filename)` Update the current procedure with a definition stored in a file.
    `void` | `importUpdate(java.lang.String filename, java.lang.String owner, java.lang.String name)` Update a procedure with a definition stored in file.
    `java.util.Iterator<java.lang.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(java.lang.String newname)` Rename the procedure maintaining the current owner.
    `void` | `saveSearch(int searchSetNumber, java.lang.String owner, java.lang.String name, java.lang.String comment)` Save the CCL commands for a search set as a procedure.
    `void` | `setComment(java.lang.String comment)` Establish a comment to associate with the procedure
    `void` | `setContent(java.util.Collection<java.lang.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 com.tietoenator.trip.jxp.internal.utils.DOMSink

      `sinkNode`

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

      `forEach, spliterator`

- - ### Constructor Detail

    - #### 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 Detail

    - #### getOwnerName

          public java.lang.String getOwnerName()

      Retrieve the name of the user or group with which this procedure is associated
      Returns:
        Owner name

    - #### getName

          public java.lang.String getName()

      Retrieve the name of the procedure
      Returns:
        The procedure name

    - #### getComment

          public java.lang.String getComment()

      Retrieve any comment associated with the procedure
      Returns:
        Comment, if any

    - #### setComment

          public void setComment(java.lang.String comment)

      Establish a comment to associate with the procedure
      Parameters:
        `comment` - The comment, if any

    - #### content

          public java.util.List<java.lang.String> content()

      Retrieve the collection of lines that comprise the procedure
      Returns:
        The procedure's content

    - #### iterator

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

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

    - #### setContent

          public void setContent(java.util.Collection<java.lang.String> lines)

      Set the collection of lines that comprise the procedure
      Parameters:
        `lines` - The procedure's new content

    - #### get

          public void get(java.lang.String owner,
                          java.lang.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(java.lang.String filename,
                             java.lang.String owner,
                             java.lang.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(java.lang.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(java.lang.String newowner,
                           java.lang.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(java.lang.String owner,
                             java.lang.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(java.lang.String owner,
                             java.lang.String name,
                             java.lang.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(java.lang.String filename,
                                      java.lang.String owner,
                                      java.lang.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(java.lang.String filename,
                                   java.lang.String owner,
                                   java.lang.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(java.lang.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(java.lang.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,
                                 java.lang.String owner,
                                 java.lang.String name,
                                 java.lang.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`