com.ibm.as400.access
Class ValidationList

java.lang.Object
  extended by com.ibm.as400.access.ValidationList

public class ValidationList
extends Object

Represents a system validation list object.

Note: The ability to find and modify the list is dependent on the access rights of the signed-on user profile to the validation list.

Author:
Thomas Johnson (tom.johnson@kingland.com), Kingland Systems Corporation

Constructor Summary
Constructor and Description
ValidationList()
          Constructs a validation list.
ValidationList(AS400 as400)
          Constructs a validation list for the given system.
ValidationList(AS400 as400, QSYSObjectPathName path)
          Constructs a validation list for the given system and path.
ValidationList(AS400 as400, String obj, String lib)
          Constructs a validation list for the given system and object/library names.
 
Method Summary
Modifier and Type Method and Description
 void addEntry(ValidationListEntry entry)
          Adds the entry to the validation list.
 void changeEntry(ValidationListEntry entry)
          Alters the entry in the validation list.
 void create()
          Creates the validation list on the IBM i system.
 void delete()
          Deletes the validation list from the IBM i system.
 ValidationListEntry findEntry(String identifier, int ccsid)
          Returns an entry from the validation list with the given identifier.
 ValidationListEntry findEntry(String identifier, int ccsid, ValidationListAttribute[] attributes)
          Returns an entry from the validation list with the given identifier and attributes.
 AS400 getAS400()
          Returns the IBM i system containing the validation list.
 String getDescription()
          Returns the text description for the validation list object.
 ValidationListEntry[] getEntries()
          Returns all entries from the validation list.
 int getNumberOfEntries()
          Returns the number of entries in the validation list.
 QSYSObjectPathName getPath()
          Returns the location (library context) of the validation list.
protected  ProgramParameter getQualifiedNameParm()
          Returns a program parameter to be used for IBM i Toolbox program calls that require the qualifed name of the validation list.
 void removeEntry(ValidationListEntry entry)
          Deletes the entry from the validation list.
 void setAS400(AS400 as400)
          Sets the IBM i system containing the validation list.
 void setDescription(String s)
          Sets the text description for the validation list object.
 void setPath(QSYSObjectPathName path)
          Sets the location (library context) of the validation list.
 boolean verifyEntry(ValidationListEntry entry)
          Verify that the encrypted information specified for the given entry is correct.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidationList

public ValidationList()
Constructs a validation list.

Note: The AS400 and Path properties must be set prior to taking action against the object.


ValidationList

public ValidationList(AS400 as400)
Constructs a validation list for the given system.

Note: The Path property must be set prior to taking action against the object.

Parameters:
as400 - com.ibm.as400.access.AS400

ValidationList

public ValidationList(AS400 as400,
                      QSYSObjectPathName path)
Constructs a validation list for the given system and path.

Parameters:
as400 - com.ibm.as400.access.AS400
path - com.ibm.as400.access.QSYSObjectPathName

ValidationList

public ValidationList(AS400 as400,
                      String obj,
                      String lib)
Constructs a validation list for the given system and object/library names.

Parameters:
as400 - com.ibm.as400.access.AS400
obj - java.lang.String
lib - java.lang.String
Method Detail

addEntry

public void addEntry(ValidationListEntry entry)
              throws PersistenceException
Adds the entry to the validation list.

Parameters:
entry - ValidationListEntry
Throws:
PersistenceException - If an error occurs while calling the IBM i APIs.

changeEntry

public void changeEntry(ValidationListEntry entry)
                 throws PersistenceException
Alters the entry in the validation list.

Parameters:
entry - ValidationListEntry
Throws:
PersistenceException - If an error occurs while calling the IBM i APIs.

create

public void create()
            throws PersistenceException
Creates the validation list on the IBM i system.

Throws:
PersistenceException - If an error occurs while calling the IBM i command.

delete

public void delete()
            throws PersistenceException
Deletes the validation list from the IBM i system.

Throws:
PersistenceException - If an error occurs while calling the IBM i command.

findEntry

public ValidationListEntry findEntry(String identifier,
                                     int ccsid)
                              throws PersistenceException
Returns an entry from the validation list with the given identifier.

The ccsid parameter indicates the ccsid used to store the identifier in the entry on the IBM i system. This apparently needs to be an exact match in order to find the entry as it was originally inserted.

No attribute values are retrieved for the entry.

Parameters:
identifier - java.lang.String
ccsid - int
Returns:
ValidationListEntry
Throws:
PersistenceException - If an error occurs while calling the IBM i APIs.

findEntry

public ValidationListEntry findEntry(String identifier,
                                     int ccsid,
                                     ValidationListAttribute[] attributes)
                              throws PersistenceException
Returns an entry from the validation list with the given identifier and attributes.

The ccsid parameter indicates the ccsid used to store the identifier in the entry on the IBM i system. This apparently needs to be an exact match in order to find the entry as it was originally inserted.

The attributes parameter indicates the list of attributes to retrieve for the entry. Each attribute specified must contain a valid identifier.

Parameters:
identifier - java.lang.String
ccsid - int
attributes - ValidationListAttribute[]
Returns:
ValidationListEntry
Throws:
PersistenceException - If an error occurs while calling the IBM i APIs.

getAS400

public AS400 getAS400()
Returns the IBM i system containing the validation list.

Returns:
com.ibm.as400.access.AS400

getDescription

public String getDescription()
Returns the text description for the validation list object.

Note: Only returned if set by the setDescription() method.

Returns:
java.lang.String

getEntries

public ValidationListEntry[] getEntries()
                                 throws PersistenceException
Returns all entries from the validation list.

Note: The list is opened by the initial call to the list API. In doing so, the entire contents of the list is retrieved as a snapshot and stored in a buffer on the IBM i system. The list contents can then be retrieved from the pre-filled buffer, in whole or in part, at the convenience of the application by using a system-provided handle. The handle is used to close the list when the application has completed processing of all entries.

Currently the entire list is built and retrieved synchronously by this method. This could potentially be changed to allow for additional processing options, such as asynchronous building of the list, retrieving only a subset of entries, etc. For now we just keep it simple.

Throws:
PersistenceException - If an error occurs while calling the IBM i APIs.

getNumberOfEntries

public int getNumberOfEntries()
                       throws PersistenceException
Returns the number of entries in the validation list.

Throws:
PersistenceException - If an error occurs while calling the IBM i APIs.

getPath

public QSYSObjectPathName getPath()
Returns the location (library context) of the validation list.

Returns:
com.ibm.as400.access.QSYSObjectPathName

getQualifiedNameParm

protected ProgramParameter getQualifiedNameParm()
Returns a program parameter to be used for IBM i Toolbox program calls that require the qualifed name of the validation list.

The object name is set into the first 10 bytes of the parameter value. The library name is set into the next 10 bytes of the parameter value.

Returns:
com.ibm.as400.access.ProgramParameter

removeEntry

public void removeEntry(ValidationListEntry entry)
                 throws PersistenceException
Deletes the entry from the validation list.

Note: The AS400 and Path properties must be set prior to calling this method.

Parameters:
entry - ValidationListEntry
Throws:
PersistenceException - If an error occurs while calling the IBM i validation list APIs.

setAS400

public void setAS400(AS400 as400)
Sets the IBM i system containing the validation list.

Parameters:
as400 - com.ibm.as400.access.AS400

setDescription

public void setDescription(String s)
Sets the text description for the validation list object.

Note: Only recognized if set prior to invoking the create() method.

Parameters:
s - java.lang.String

setPath

public void setPath(QSYSObjectPathName path)
Sets the location (library context) of the validation list.

Parameters:
path - com.ibm.as400.access.QSYSObjectPathName

verifyEntry

public boolean verifyEntry(ValidationListEntry entry)
                    throws PersistenceException
Verify that the encrypted information specified for the given entry is correct.

The EntryID and DataToEncrypt must be specified for the entry prior to verification. Returns true if the data to encrypt matches the data already encrypted for the entry at that ID on the IBM i; otherwise returns false.

Parameters:
entry - ValidationListEntry
Returns:
boolean
Throws:
PersistenceException - If an error occurs while calling the IBM i APIs.