businesslogic
Class DefectPolicy

java.lang.Object
  |
  +--businesslogic.DefectPolicy

public class DefectPolicy
extends java.lang.Object
implements _DefectPolicyIntfOperations, Testable

Singleton class that enforces the policies of the business objects of the BugTracker application. This involves primarily the creation and modification of Defects and Users. Implements the _DefectPolicyIntfOperations interface used by the tie class generated by javatoidl


Constructor Summary
DefectPolicy()
           
 
Method Summary
 boolean canAdminister(java.lang.String userid)
          Determines if the specified user holds administrative privileges for the BugTracker application
 boolean canAssign(java.lang.String userid)
          Determines if the specified user holds privileges for assigning defects
 boolean canPrioritize(java.lang.String userid)
          Determines if the specified user holds privileges for prioritizing defects
 boolean canResolve(java.lang.String userid)
          Determines if the specified user holds privileges for marking defects as fixed
 boolean canVerify(java.lang.String userid)
          Determines if the specified user holds privileges for marking fixed defects as "verified"
 DefectIntf createNewDefect(java.lang.String uid)
          creates a new defect object.
 UserIntf createNewUser(java.lang.String requestor, java.lang.String userid)
          Provides a factory method for creating new User objects.
 int getNextDefectID()
          Returns the next sequential defect number.
 void implConnect(org.omg.CORBA.Object obj)
           
 void implDisconnect(org.omg.CORBA.Object obj)
           
 void securityCheck(PersistentDefect defect, java.lang.String username)
          this method checks to ensure that changes made to the defect are permitted by the defect change policies
 void securityCheck(PersistentUser user, java.lang.String username)
           
 void setOrb(org.omg.CORBA.ORB orb)
           
 void statusChanged(_DefectIntfOperations theDefect)
          when the defect has changed, the policy object will notify the list of addressees (in the changedMailList member of the defect) that the defect has changed, and include the updated defect.
 boolean TestUnit()
          Method for supporting the TestHarness
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefectPolicy

public DefectPolicy()
Method Detail

createNewDefect

public DefectIntf createNewDefect(java.lang.String uid)
creates a new defect object. This method is called by the DefectFactory, thus allowing the DefectPolicy object to enforce creation policies where they may exist.
Specified by:
createNewDefect in interface _DefectPolicyIntfOperations
Parameters:
uid - users identifier
Returns:
returns the new DefectIntf - implementing objecf

createNewUser

public UserIntf createNewUser(java.lang.String requestor,
                              java.lang.String userid)
                       throws AlreadyExistsException,
                              AppSecurityException
Provides a factory method for creating new User objects. Calling this method requires that the requesting user have administrator privileges. if sufficient privileges are not held, an AppSecurityException will be thrown. Once this method has been successfully called, the client application can populate the User object via the setXXXX methods, and write it to the database with the commit() method.
Parameters:
requestor - id of the user making the request to create a new user
userid - identification for the new user. This must be unique; otherwise this method will throw an AlreadyExistsException
Throws:
AlreadyExistsException - thrown if the userid already exists
AppSecurityException - thrown if the requesting user does not have sufficient privileges

statusChanged

public void statusChanged(_DefectIntfOperations theDefect)
                   throws java.lang.SecurityException
when the defect has changed, the policy object will notify the list of addressees (in the changedMailList member of the defect) that the defect has changed, and include the updated defect. If the defect has been set to FIXED or FIX_VERIFIED, the policy object will notify the list of addressees indicated in the defect's resolvedMailList member

canAssign

public boolean canAssign(java.lang.String userid)
Determines if the specified user holds privileges for assigning defects
Specified by:
canAssign in interface _DefectPolicyIntfOperations
Parameters:
userid - id of the user
Returns:
true if user holds sufficient privileges, false otherwise

canPrioritize

public boolean canPrioritize(java.lang.String userid)
Determines if the specified user holds privileges for prioritizing defects
Specified by:
canPrioritize in interface _DefectPolicyIntfOperations
Parameters:
userid - id of the user
Returns:
true if user holds sufficient privileges, false otherwise

canVerify

public boolean canVerify(java.lang.String userid)
Determines if the specified user holds privileges for marking fixed defects as "verified"
Specified by:
canVerify in interface _DefectPolicyIntfOperations
Parameters:
userid - id of the user
Returns:
true if user holds sufficient privileges, false otherwise

canResolve

public boolean canResolve(java.lang.String userid)
Determines if the specified user holds privileges for marking defects as fixed
Specified by:
canResolve in interface _DefectPolicyIntfOperations
Parameters:
userid - id of the user
Returns:
true if user holds sufficient privileges, false otherwise

canAdminister

public boolean canAdminister(java.lang.String userid)
Determines if the specified user holds administrative privileges for the BugTracker application
Specified by:
canAdminister in interface _DefectPolicyIntfOperations
Parameters:
userid - id of the user
Returns:
true if user holds sufficient privileges, false otherwise

getNextDefectID

public int getNextDefectID()
Returns the next sequential defect number.
Specified by:
getNextDefectID in interface _DefectPolicyIntfOperations
Returns:
the next available, sequential defect id

setOrb

public void setOrb(org.omg.CORBA.ORB orb)

implConnect

public void implConnect(org.omg.CORBA.Object obj)

implDisconnect

public void implDisconnect(org.omg.CORBA.Object obj)

securityCheck

public void securityCheck(PersistentUser user,
                          java.lang.String username)
                   throws AppSecurityException
Parameters:
username - id of user making the changes
Throws:
AppSecurityException - thrown if appropriate privileges don't exist for username

securityCheck

public void securityCheck(PersistentDefect defect,
                          java.lang.String username)
                   throws AppSecurityException
this method checks to ensure that changes made to the defect are permitted by the defect change policies
Parameters:
defect - a referece to the user to be changed
username - id of user making the changes
Throws:
AppSecurityException - thrown if appropriate privileges don't exist for username

TestUnit

public boolean TestUnit()
Method for supporting the TestHarness
Specified by:
TestUnit in interface Testable