oracle.sysman.dbTarget.db.changemgr.emo.cpapi
Class ChangePlanAccess

java.lang.Object
  extended by oracle.sysman.dbTarget.db.changemgr.emo.cpapi.ChangePlanAccess

public class ChangePlanAccess
extends java.lang.Object

ChangePlanAccess provides methods that allow a client to access Change Manager Change Plans. To use this class:


Field Summary
static int CP_ACTION_ALLOWED
          Indicates that an action is allowed.
static int CP_ACTION_NOT_ALLOWED
          Indicates that an action is not allowed.
static int CP_ACTION_NOT_APPLICABLE
          Indicates that an action is not applicable in the current situation.
static int CP_ADD_CHANGE_ITEM
          Indicates an intention to add a change item to a change plan.
static int CP_CREATE_CHANGE_PLAN
          Indicates an intention to create a change plan.
static int CP_EDIT_CHANGE_PLAN
          Indicates an intention to edit (modify) a change plan.
static int CP_REMOVE_CHANGE_ITEM
          Indicates an intention to remove a change item from a change plan.
static int CP_REMOVE_CHANGE_PLAN
          Indicates an intention to remove (delete) a change plan.
static int CP_UPDATE_CHANGE_ITEM
          Indicates an intention to update a change item in a change plan.
static int CP_VIEW_CHANGE_ITEM
          Indicates an intention to view a change item in a change plan.
static int CP_VIEW_CHANGE_PLAN
          Indicates an intention to edit (modify) a change plan.
 
Constructor Summary
ChangePlanAccess()
           
 
Method Summary
 void createChangePlan(ChangePlanInfo planInfo)
          Creates a new Change Plan.
 ChangePlanInfo[] getChangePlans()
          Gets a list of existing Change Plans that are visible to the logged-in user.
 ChangePlan getOneChangePlan(java.lang.String name, java.lang.String owner)
          Gets a Change Plan.
 boolean isConnected()
          Indicates whether the ChangePlanAccess is currently connected to the repository.
static boolean isTypeSupported(java.lang.String objType)
          Indicates whether an object type is supported in Change Plans.
 boolean isValidConnection()
          Indicates whether the current connection is a valid Enterprise Manager connection.
 void login(java.sql.Connection connection)
          Establishes a session in the EM repository.
 void login(java.lang.String username, java.lang.String password, java.lang.String connectString)
          Establishes a session in the EM repository.
 void logout()
          Terminates the EM repository session.
 void removeChangePlan(java.lang.String name, java.lang.String owner)
          Removes a Change Plan from the EM repository.
 void setConnection(CMConnection cmConn)
          Accepts existing connection for change plan access in case the user is already logged in.
 int userActionAllowed(int userAction, ChangePlanInfo planInfo)
          Indicates whether a specified action can be performed by the logged-in user.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CP_ACTION_ALLOWED

public static final int CP_ACTION_ALLOWED
Indicates that an action is allowed.

See Also:
Constant Field Values

CP_ACTION_NOT_ALLOWED

public static final int CP_ACTION_NOT_ALLOWED
Indicates that an action is not allowed.

See Also:
Constant Field Values

CP_ACTION_NOT_APPLICABLE

public static final int CP_ACTION_NOT_APPLICABLE
Indicates that an action is not applicable in the current situation.

See Also:
Constant Field Values

CP_CREATE_CHANGE_PLAN

public static final int CP_CREATE_CHANGE_PLAN
Indicates an intention to create a change plan.

See Also:
Constant Field Values

CP_REMOVE_CHANGE_PLAN

public static final int CP_REMOVE_CHANGE_PLAN
Indicates an intention to remove (delete) a change plan.

See Also:
Constant Field Values

CP_VIEW_CHANGE_PLAN

public static final int CP_VIEW_CHANGE_PLAN
Indicates an intention to edit (modify) a change plan.

See Also:
Constant Field Values

CP_EDIT_CHANGE_PLAN

public static final int CP_EDIT_CHANGE_PLAN
Indicates an intention to edit (modify) a change plan.

See Also:
Constant Field Values

CP_ADD_CHANGE_ITEM

public static final int CP_ADD_CHANGE_ITEM
Indicates an intention to add a change item to a change plan.

See Also:
Constant Field Values

CP_VIEW_CHANGE_ITEM

public static final int CP_VIEW_CHANGE_ITEM
Indicates an intention to view a change item in a change plan.

See Also:
Constant Field Values

CP_REMOVE_CHANGE_ITEM

public static final int CP_REMOVE_CHANGE_ITEM
Indicates an intention to remove a change item from a change plan.

See Also:
Constant Field Values

CP_UPDATE_CHANGE_ITEM

public static final int CP_UPDATE_CHANGE_ITEM
Indicates an intention to update a change item in a change plan.

See Also:
Constant Field Values
Constructor Detail

ChangePlanAccess

public ChangePlanAccess()
Method Detail

login

public void login(java.sql.Connection connection)
           throws java.sql.SQLException
Establishes a session in the EM repository.

Parameters:
connection - connection to the EM repository
Throws:
java.sql.SQLException

login

public void login(java.lang.String username,
                  java.lang.String password,
                  java.lang.String connectString)
           throws java.sql.SQLException,
                  ChangePlanAccessException
Establishes a session in the EM repository.

Parameters:
username - the name of the EM account provided for Change Plan access
password - the password for the EM account
connectString - the connect string for the database in which the EM repository is located.
Throws:
java.sql.SQLException - if the database cannot be accessed via the connectString.
ChangePlanAccessException - if the username/password is invalid

isValidConnection

public boolean isValidConnection()
                          throws java.sql.SQLException,
                                 ChangePlanAccessException
Indicates whether the current connection is a valid Enterprise Manager connection.

Returns:
true if this connection can be used to access the EM Repository for Change Plan activities, false otherwise.
Throws:
ChangePlanAccessException - if the ChangePlanAccess object is not currently logged in.
java.sql.SQLException - if an unexpected SQLException occurs

logout

public void logout()
            throws ChangePlanAccessException,
                   java.sql.SQLException
Terminates the EM repository session.

Throws:
ChangePlanAccessException - if the ChangePlanAccess object is not currently logged in.
java.sql.SQLException

isConnected

public boolean isConnected()
Indicates whether the ChangePlanAccess is currently connected to the repository. This call does not check if the connection is valid, only that it has not been logged out.

Returns:
true if the ChangePlanAccess is connected to the repository

getChangePlans

public ChangePlanInfo[] getChangePlans()
                                throws ChangePlanAccessException,
                                       java.sql.SQLException
Gets a list of existing Change Plans that are visible to the logged-in user.

Returns:
array of ChangePlanInfo objects.
Throws:
ChangePlanAccessException - if the ChangePlanAccess object is not currently logged in.
java.sql.SQLException - if an unexpected SQLException occurs

createChangePlan

public void createChangePlan(ChangePlanInfo planInfo)
                      throws ChangePlanAccessException,
                             java.sql.SQLException
Creates a new Change Plan.

Parameters:
planInfo - the information needed to create the ChangePlan including owner, name, description
Throws:
ChangePlanAccessException - if the ChangePlanAccess object is not currently logged in, if the logged-in user does not have the permission to create the specified Change Plan, or if a Change Plan having the same owner and name already exists.
java.sql.SQLException - if an unexpected SQLException occurs

getOneChangePlan

public ChangePlan getOneChangePlan(java.lang.String name,
                                   java.lang.String owner)
                            throws ChangePlanAccessException,
                                   java.sql.SQLException
Gets a Change Plan.

Parameters:
name - the name of the Change Plan to get
owner - the owner of the Change Plan to get; if null, defaults to the logged-in EM user
Returns:
a ChangePlan object
Throws:
ChangePlanAccessException - if the ChangePlanAccess object is not currently logged in, if the logged-in user does not have the permission to access the specified Change Plan, or if the specified Change Plan does not exist.
java.sql.SQLException - if an unexpected SQLException occurs

removeChangePlan

public void removeChangePlan(java.lang.String name,
                             java.lang.String owner)
                      throws ChangePlanAccessException,
                             java.sql.SQLException
Removes a Change Plan from the EM repository.

Parameters:
name - the name of the Change Plan to remove
owner - the owner of the Change Plan to remove; if null, defaults to the logged-in EM user
Throws:
ChangePlanAccessException - if the Change Plan does not exist, or if the logged-in user does not have permission to remove the specified Change Plan.
java.sql.SQLException - if an unexpected SQLException occurs

userActionAllowed

public int userActionAllowed(int userAction,
                             ChangePlanInfo planInfo)
                      throws ChangePlanAccessException,
                             java.sql.SQLException
Indicates whether a specified action can be performed by the logged-in user. (This method needs work.)

Parameters:
userAction - Specifies the desired action:
  • CP_CREATE_CHANGE_PLAN: Can the user create the new Change Plan identified by the planInfo argument
  • CP_REMOVE_CHANGE_PLAN: Can the user remove the Change Plan identified by the planInfo argument
  • CP_VIEW_CHANGE_PLAN: Can the user view the Change Clan identified by the planInfo argument
  • CP_EDIT_CHANGE_PLAN: Can the user edit the Change Plan identified by the planInfo argument
planInfo - Identifies the Change Plan for certain userActions; ignored for others.
Returns:
  • CP_ACTION_ALLOWED
  • CP_ACTION_NOT_ALLOWED
  • CP_ACTION_NOT_APPLICABLE: Action is not applicable given the current state of the ChangePlanAccess object.
Throws:
ChangePlanAccessException - if the ChangePlanAccess object is not currently logged in.
java.sql.SQLException - if an unexpected SQLException occurs

isTypeSupported

public static boolean isTypeSupported(java.lang.String objType)
Indicates whether an object type is supported in Change Plans.

Parameters:
objType - The name of an object type as listed in the OBJECT_TYPE column of DBA_OBJECTS.
Returns:
true if the object type is supported, false if not.

setConnection

public void setConnection(CMConnection cmConn)
Accepts existing connection for change plan access in case the user is already logged in. Closing the connection is caller's responsibility. This is used by EM front-end.

Parameters:
cmConn -