Class UserObjectsOwnedList
- java.lang.Object
-
- com.ibm.as400.access.UserObjectsOwnedList
-
public class UserObjectsOwnedList extends java.lang.Object
Allows you to retrieve a list of IBM i objects that a user is authorized to and/or list of IBM i objects that the user owns.
Refer to the QSYLOBJA API for additional information.The list of authorized objects only includes objects the user is specifically authorized to. The list does not include objects the user is solely authorized to because:
- The user is part of a group that is authorized
- The user can access the object using the public authority
- The object is secured with an authorization list the user is authorized to
- The user can access the object using adopted authority
Example code:
AS400 system = new AS400("sysname", "userid", "password"); UserObjectsOwnedList list1 = new UserObjectsOwnedList(system, "USER1", UserObjectsOwnedList.SELECTION_FILE_SYSTEM_LIBRARY, UserObjectsOwnedList.SELECTION_OBJECT_RELATION_OWNED_OR_AUTHORIZED); UserObjectsOwnedListEntry[] entries1 = list1.getObjectList(); System.out.println(list1); for (int i=0; i < entries1.length; ++i) { System.out.println("Entry["+i+"/"+entries1.length+"]= "+entries1[i]); } list1.setSelectionObjectRelation(UserObjectsOwnedList.SELECTION_OBJECT_RELATION_OWNED); entries1 = list1.getObjectList(); System.out.println(list1); for (int i=0; i < entries1.length; ++i) { System.out.println("Entry["+i+"/"+entries1.length+"]= "+entries1[i]); }
- See Also:
User.getObjectsOwned()
-
-
Field Summary
Fields Modifier and Type Field and Description static int
SELECTION_FILE_SYSTEM_DIRECTORY
Selection value indicating to select IBM i objects that reside in a directory (non-QSYS) based file system.static int
SELECTION_FILE_SYSTEM_LIBRARY
Selection value indicating to select IBM i objects that reside in the QSYS library based file system.static int
SELECTION_OBJECT_RELATION_AUTHORIZED
Selection value indicating to select the list of objects the user is authorized tostatic int
SELECTION_OBJECT_RELATION_OWNED
Selection value indicating to select the list of objects the user owns.static int
SELECTION_OBJECT_RELATION_OWNED_OR_AUTHORIZED
Selection value indicating to select the both list of objects the user is authorized to and the list of objects the user owns.
-
Constructor Summary
Constructors Constructor and Description UserObjectsOwnedList(AS400 system, java.lang.String userName)
Constructs a UserObjectsOwnedList object.UserObjectsOwnedList(AS400 system, java.lang.String userName, int selectionFileSystem, int selectionObjectRelation)
Constructs a UserObjectsOwnedList object.
-
Method Summary
Methods Modifier and Type Method and Description UserObjectsOwnedListEntry[]
getObjectList()
Returns a list of all UserObjectsOwnedListEntry IBM i objects based on the current selection criteria for the file system and object relation.int
getSelectionFileSystem()
Returns the current selection criteria for the file system from which to retrieve the list of objects that a user is authorized to or list of objects the user owns.int
getSelectionObjectRelation()
Returns the returned objects setting indicating that objects to be returned are objects that the user is authorized to, objects owned, or both.AS400
getSystem()
Returns the system from which to retrieve the list of objects that a user is authorized to and the list of objects the user owns.java.lang.String
getUserName()
Returns the user name for which to retrieve the list of objects that a user is authorized to and list of objects the user owns.void
setSelectionFileSystem(int selectionFileSystem)
Sets the selection criteria for the file system from which to retrieve the list of objects that the user is authorized to or the list of objects the user owns.void
setSelectionObjectRelation(int selectionObjectRelation)
Sets which objects are to be selected (indicating objects authorized to, objects owned, or both).void
setSystem(AS400 system)
Sets the system from which to retrieve the list of objects that a user is authorized to and the list of objects the user owns.void
setUserName(java.lang.String userName)
Sets the user name for which to retrieve the list of objects that the user is authorized to and/or the list of objects the user owns.java.lang.String
toString()
Returns a string representation of this object.
-
-
-
Field Detail
-
SELECTION_FILE_SYSTEM_LIBRARY
public static final int SELECTION_FILE_SYSTEM_LIBRARY
Selection value indicating to select IBM i objects that reside in the QSYS library based file system.- See Also:
- Constant Field Values
-
SELECTION_FILE_SYSTEM_DIRECTORY
public static final int SELECTION_FILE_SYSTEM_DIRECTORY
Selection value indicating to select IBM i objects that reside in a directory (non-QSYS) based file system.- See Also:
- Constant Field Values
-
SELECTION_OBJECT_RELATION_AUTHORIZED
public static final int SELECTION_OBJECT_RELATION_AUTHORIZED
Selection value indicating to select the list of objects the user is authorized to- See Also:
- Constant Field Values
-
SELECTION_OBJECT_RELATION_OWNED
public static final int SELECTION_OBJECT_RELATION_OWNED
Selection value indicating to select the list of objects the user owns.- See Also:
- Constant Field Values
-
SELECTION_OBJECT_RELATION_OWNED_OR_AUTHORIZED
public static final int SELECTION_OBJECT_RELATION_OWNED_OR_AUTHORIZED
Selection value indicating to select the both list of objects the user is authorized to and the list of objects the user owns.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
UserObjectsOwnedList
public UserObjectsOwnedList(AS400 system, java.lang.String userName)
Constructs a UserObjectsOwnedList object.
You must callgetObjectList()
method to retrieve the object list.
Default values are set to select library based objects which the user owns.
The selectionFileSystem parameter defaults toSELECTION_FILE_SYSTEM_LIBRARY
, the selectionObjectRelation parameter defaults toSELECTION_OBJECT_RELATION_OWNED
.- Parameters:
system
- The system upon which the user resides.userName
- The user name which owns the objects to be returned.
-
UserObjectsOwnedList
public UserObjectsOwnedList(AS400 system, java.lang.String userName, int selectionFileSystem, int selectionObjectRelation)
Constructs a UserObjectsOwnedList object.
You must callgetObjectList()
method to retrieve the object list.- Parameters:
system
- The system upon which the user resides.userName
- The user name which owns (or is authorized to) the objects to be returned.selectionFileSystem
- The format name. Possible values are:SELECTION_FILE_SYSTEM_LIBRARY
- QSYS objects in the QSYS library based file system.SELECTION_FILE_SYSTEM_DIRECTORY
- IFS objects that reside in a directory.
selectionObjectRelation
- The objects to return. Possible values are:SELECTION_OBJECT_RELATION_AUTHORIZED
- select the list of objects the user is authorized toSELECTION_OBJECT_RELATION_OWNED
- select the list of objects the user ownsSELECTION_OBJECT_RELATION_OWNED_OR_AUTHORIZED
- select the list of objects the user is authorized to and the list of objects the user owns
-
-
Method Detail
-
getObjectList
public UserObjectsOwnedListEntry[] getObjectList() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns a list of all UserObjectsOwnedListEntry IBM i objects based on the current selection criteria for the file system and object relation.This method retrieves the list of objects from the system based on the selection critera set via the constructor or modified by any of the set methods.
- Returns:
- The array of objects retrieved from the system.
- Throws:
AS400Exception
- If an error occurs.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist.
-
setSystem
public void setSystem(AS400 system)
Sets the system from which to retrieve the list of objects that a user is authorized to and the list of objects the user owns.This method changes the value set via the constructor, allowing subsequent calls to
getObjectList()
method to retrieve a different list of objects.- Parameters:
system
- The system upon which the user resides.
-
getSystem
public AS400 getSystem()
Returns the system from which to retrieve the list of objects that a user is authorized to and the list of objects the user owns.- Returns:
- The system upon which the user resides.
-
setUserName
public void setUserName(java.lang.String userName)
Sets the user name for which to retrieve the list of objects that the user is authorized to and/or the list of objects the user owns.This method changes the value set via the constructor, allowing subsequent calls to
getObjectList()
method to retrieve a different list of objects.- Parameters:
userName
- The user name which owns (or is authorized to) the objects to be returned.
-
getUserName
public java.lang.String getUserName()
Returns the user name for which to retrieve the list of objects that a user is authorized to and list of objects the user owns.- Returns:
- The user name which owns (or is authorized to) the objects to be returned.
-
setSelectionFileSystem
public void setSelectionFileSystem(int selectionFileSystem)
Sets the selection criteria for the file system from which to retrieve the list of objects that the user is authorized to or the list of objects the user owns.This method changes the value set via the constructor, allowing subsequent calls to
getObjectList()
method to retrieve a different list of objects.- Parameters:
selectionFileSystem
- The format name. Valid values:SELECTION_FILE_SYSTEM_LIBRARY
- objects that reside in an IBM i librarySELECTION_FILE_SYSTEM_DIRECTORY
- objects that reside in an IBM i directory
-
getSelectionFileSystem
public int getSelectionFileSystem()
Returns the current selection criteria for the file system from which to retrieve the list of objects that a user is authorized to or list of objects the user owns.- Returns:
- the selection file system. Possible values:
SELECTION_FILE_SYSTEM_LIBRARY
- objects that reside in an IBM i librarySELECTION_FILE_SYSTEM_DIRECTORY
- objects that reside in an IBM i directory
-
setSelectionObjectRelation
public void setSelectionObjectRelation(int selectionObjectRelation)
Sets which objects are to be selected (indicating objects authorized to, objects owned, or both).This method changes the value set via the constructor, allowing subsequent calls to
getObjectList()
method to retrieve a different list of objects.- Parameters:
selectionObjectRelation
- Which objects are to be selected . Valid values:SELECTION_OBJECT_RELATION_AUTHORIZED
- select a list of objects the user is authorized toSELECTION_OBJECT_RELATION_OWNED
- select a list of objects the user ownsSELECTION_OBJECT_RELATION_OWNED_OR_AUTHORIZED
- select a list of objects the user is authorized to and a list of objects the user owns
-
getSelectionObjectRelation
public int getSelectionObjectRelation()
Returns the returned objects setting indicating that objects to be returned are objects that the user is authorized to, objects owned, or both.- Returns:
- the selection object relation. Possible values:
SELECTION_OBJECT_RELATION_AUTHORIZED
- select a list of objects the user is authorized toSELECTION_OBJECT_RELATION_OWNED
- select a list of objects the user ownsSELECTION_OBJECT_RELATION_OWNED_OR_AUTHORIZED
- select a list of objects the user is authorized to and a list of objects the user owns
-
toString
public java.lang.String toString()
Returns a string representation of this object.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string with the system, userName, selectionFileSystem, and selectionObjectRelation
-
-