wt.clients.project
Class CProject

java.lang.Object
  extended bywt.clients.util.PersistableItem
      extended bywt.clients.project.CRoleHolder
          extended bywt.clients.project.CProject

public class CProject
extends CRoleHolder

A client wrapper class to handle Projects. This class represents an existing Project object by holding the Project object and/or a ProjectReference object. Both the Project object and the ProjectReference object always represent a single project. This class should be used by client applications rather than using the wt.project.Project class directly.


Field Summary
protected  ProjectReference projectRef
          The ProjectReference associated with this CProject instance
private static String RBNAME
          Resource bundle name for localizing button, label and message text
private  boolean renameProject
           
private  String renameProjectName
           
 
Fields inherited from class wt.clients.project.CRoleHolder
roleHolder
 
Fields inherited from class wt.clients.util.PersistableItem
 
Constructor Summary
CProject()
          Class constructor taking no arguments.
CProject(Project project)
          Class constructor taking Project.
CProject(ProjectReference projectReference)
          Class constructor taking ProjectReference.
 
Method Summary
protected  boolean checkModifyPermission()
          Determine if the user has modify permission on the project.
protected  ProjectReference deriveProjectRef()
          Populate the projectRef class variable and return it.
protected  void deriveRoleHolder()
          Populate the roleHolder class variable if it is not already populated.
(package private)  String getDescription()
          Get the project description.
protected  String getIdentity()
          Get the project identity.
(package private)  String getName()
          Get the project name.
protected  String getProjectLocation()
          Get the project folder location.
 RoleHolder getProjectObject()
          Get the project object.
 ProjectReference getProjectRef()
          Get the projectRef object.
(package private)  boolean isEnabled()
          Get the project enabled status
protected  boolean objectIDequals(ProjectReference projectReference)
          Determine if the project ProjectReference is equal to the passed ProjectReference.
 void refresh()
          Refresh the project from the database.
(package private)  void refreshCProject()
          Refresh the project by obtaining it from the database.
(package private)  void saveCProject()
          Persist the project to the database.
 void setCProjectIdentity(String name)
          Set the project identity.
 void setDescription(String description)
          Set the project description.
 void setEnabled(boolean enabled)
          Set the enabled flag.
 void setProjectLocation(String folder)
          Set the project folder location.
 void setProjectObject(RoleHolder value)
          Set the project object.
 
Methods inherited from class wt.clients.project.CRoleHolder
addPrincipal, containsRole, deletePrincipal, deleteRole, getPrincipals, getRoleHolder, getRoleList, getRoles
 
Methods inherited from class wt.clients.util.PersistableItem
isCreated, isModified, save, setCreated, setModified
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RBNAME

private static String RBNAME
Resource bundle name for localizing button, label and message text


projectRef

protected ProjectReference projectRef
The ProjectReference associated with this CProject instance


renameProject

private boolean renameProject

renameProjectName

private String renameProjectName
Constructor Detail

CProject

public CProject()
         throws WTException
Class constructor taking no arguments.


CProject

public CProject(Project project)
         throws WTException
Class constructor taking Project.

Parameters:
project - Previously created Project which this CProject represents

CProject

public CProject(ProjectReference projectReference)
Class constructor taking ProjectReference.

Method Detail

refresh

public void refresh()
             throws WTException
Refresh the project from the database.

Overrides:
refresh in class PersistableItem
Throws:
WTException - if the refresh fails

getName

String getName()
         throws WTException
Get the project name.

Returns:
The project name.
Throws:
WTException

isEnabled

boolean isEnabled()
            throws WTException
Get the project enabled status

Returns:
boolean
Throws:
WTException

getDescription

String getDescription()
                throws WTException
Get the project description.

Returns:
The project description.
Throws:
WTException

setDescription

public void setDescription(String description)
                    throws WTException,
                           PropertyVetoException
Set the project description.

Parameters:
description - Description text.
Throws:
WTException
PropertyVetoException

setEnabled

public void setEnabled(boolean enabled)
                throws WTException,
                       PropertyVetoException
Set the enabled flag.

Parameters:
enabled - Enabled flag.
Throws:
WTException
PropertyVetoException

setProjectLocation

public void setProjectLocation(String folder)
                        throws WTException
Set the project folder location.

Parameters:
folder - Folder in which this project is to reside.
Throws:
WTException

getProjectLocation

protected String getProjectLocation()
                             throws WTException
Get the project folder location.

Returns:
The folder location in which this project resides.
Throws:
WTException

setCProjectIdentity

public void setCProjectIdentity(String name)
                         throws PropertyVetoException,
                                WTException
Set the project identity. The project identity is made up of the project name, a period: ".", and the cabinet (also known as domain) in which the project resides. Example: System.Airplane This method takes the project name as a parameter and prepends to it the project domain name.

Parameters:
name - The project name.
Throws:
WTException
PropertyVetoException

saveCProject

void saveCProject()
            throws WTException
Persist the project to the database.

Throws:
WTException

refreshCProject

void refreshCProject()
               throws WTException
Refresh the project by obtaining it from the database.

Throws:
WTException

checkModifyPermission

protected boolean checkModifyPermission()
                                 throws WTException
Determine if the user has modify permission on the project.

Returns:
true if the user has modify permission on the project, false otherwise
Throws:
WTException

objectIDequals

protected boolean objectIDequals(ProjectReference projectReference)
                          throws WTException
Determine if the project ProjectReference is equal to the passed ProjectReference.

Parameters:
projectReference - A ProjectReference.
Returns:
true if they are equal, false otherwise
Throws:
WTException

getIdentity

protected String getIdentity()
                      throws WTException
Get the project identity. The project identity is made up of the project name, a period: ".", and the cabinet (also known as domain) in which the project resides. Example: System.Airplane

Returns:
The project identity.
Throws:
WTException

deriveRoleHolder

protected void deriveRoleHolder()
                         throws WTException
Populate the roleHolder class variable if it is not already populated. First, this method checks to see if the projectRef variable is populated. If it is populated, it obtains the Project object associated with the projectRef ProjectReference object and assigns that object to the roleHolder variable.

Throws:
WTException - If both the roleHolder and projectRef class variables are null

deriveProjectRef

protected ProjectReference deriveProjectRef()
                                     throws WTException
Populate the projectRef class variable and return it. This method turns the roleHolder class variable into a ProjectReference object and returns it.

Returns:
The ProjectReference.
Throws:
WTException - If both the roleHolder and projectRef class variables are null

getProjectObject

public RoleHolder getProjectObject()
                            throws WTException
Get the project object. This method calls deriveRoleHolder to insure the roleHolder class variable is populated and then returns the roleHolder class variable

Returns:
The project identity.
Throws:
WTException

getProjectRef

public ProjectReference getProjectRef()
                               throws WTException
Get the projectRef object. This method calls deriveProjectRef to insure the projectRef class variable is populated and then returns the projectRef class variable

Returns:
The ProjectReference.
Throws:
WTException

setProjectObject

public void setProjectObject(RoleHolder value)
                      throws WTException
Set the project object. This method takes a RoleHolder object and sets the class variable roleHolder equal to the passed RoleHolder object.

Throws:
WTException