com.tszadel.qctools4j.clients
Class QcConnectionImpl

java.lang.Object
  extended by com.tszadel.qctools4j.clients.QcConnectionImpl
All Implemented Interfaces:
IQcConnection

public class QcConnectionImpl
extends Object
implements IQcConnection

The implementation of the connection to QC.

Author:
tszadel

Constructor Summary
QcConnectionImpl(String pServerURL)
          Constructor.
 
Method Summary
 void connect(String pUsername, String pPassword, String pDomain, String pProject)
          Overrides connect.
 void disconnect()
          Overrides disconnect.
 BugClient getBugClient()
          Overrides getDefectClient.
 com.mercury.qualitycenter.otaclient.ITDConnection3 getConnection()
          Returns connection.
 String getCurrentDomain()
          Overrides getCurrentDomain.
 List<Group> getCurrentGroups()
          Overrides getCurrentGroups.
 String getCurrentProject()
          Overrides getCurrentProject.
 String getCurrentUser()
          Overrides getCurrentUser.
 List<Domain> getDomainList()
          Overrides getDomainList.
 FieldDescriptionClient getPermissionClient()
          Overrides getPermissionClient.
 String getServerURL()
          Overrides getServerURL.
 TestClient getTestClient()
          Overrides getTestClient.
 UserClient getUserClient()
          Overrides getUserClient.
 String getVersion()
          Overrides getVersion.
protected  void initConnection()
          Init the connection.
 boolean isConnected()
          Overrides isInitialized.
 boolean isLoggedIn()
          Overrides isLoggedIn.
 void login(String pUsername, String pPassword)
          Overrides login.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QcConnectionImpl

public QcConnectionImpl(String pServerURL)
                 throws QcException
Constructor.

Parameters:
pServerURL - The server URL.
Throws:
QcException - The connection fails.
Method Detail

connect

public void connect(String pUsername,
                    String pPassword,
                    String pDomain,
                    String pProject)
             throws QcException
Overrides connect. Connect to a given project.

Need to call disconnect once the work is terminated

Specified by:
connect in interface IQcConnection
Parameters:
pUsername - The user name.
pPassword - The password.
pDomain - The domain.
pProject - The project.
Throws:
QcException - Connection error.
See Also:
IQcConnection.connect(java.lang.String, java.lang.String, java.lang.String, java.lang.String)

disconnect

public void disconnect()
                throws QcException
Overrides disconnect. Disconnect from Quality center.

Specified by:
disconnect in interface IQcConnection
Throws:
QcException - QC Error.
See Also:
IQcConnection.disconnect()

getBugClient

public BugClient getBugClient()
                       throws QcException
Overrides getDefectClient. Returns the defect client.

Specified by:
getBugClient in interface IQcConnection
Returns:
The defect client.
Throws:
QcException - QC Error
See Also:
IQcConnection.getBugClient()

getConnection

public com.mercury.qualitycenter.otaclient.ITDConnection3 getConnection()
Returns connection.

Returns:
The connection.

getCurrentDomain

public String getCurrentDomain()
                        throws QcException
Overrides getCurrentDomain. Returns the name of the current project.

Specified by:
getCurrentDomain in interface IQcConnection
Returns:
The name of the current project or null if not logged in.
Throws:
QcException - QC Error.
See Also:
IQcConnection.getCurrentDomain()

getCurrentGroups

public List<Group> getCurrentGroups()
                             throws QcException
Overrides getCurrentGroups. Returns the groups that the current user is member.

Specified by:
getCurrentGroups in interface IQcConnection
Returns:
The groups of the current user.
Throws:
QcException - Qc Error.
See Also:
IQcConnection.getCurrentGroups()

getCurrentProject

public String getCurrentProject()
                         throws QcException
Overrides getCurrentProject. Returns the name of the current project.

Specified by:
getCurrentProject in interface IQcConnection
Returns:
The name of the current project or null if not logged in.
Throws:
QcException - QC Error.
See Also:
IQcConnection.getCurrentProject()

getCurrentUser

public String getCurrentUser()
                      throws QcException
Overrides getCurrentUser. Returns the name of the current user.

Specified by:
getCurrentUser in interface IQcConnection
Returns:
The name of the current user or null if not logged in.
Throws:
QcException - QC Error.
See Also:
IQcConnection.getCurrentUser()

getDomainList

public List<Domain> getDomainList()
                           throws QcException
Overrides getDomainList. Returns the list of visible domains.
The user need to be logged in.

Specified by:
getDomainList in interface IQcConnection
Returns:
The list of visible domains.
Throws:
QcException - Connection error.
See Also:
IQcConnection.getDomainList()

getPermissionClient

public FieldDescriptionClient getPermissionClient()
                                           throws QcException
Overrides getPermissionClient. Returns the Permission client.

Specified by:
getPermissionClient in interface IQcConnection
Returns:
The test client.
Throws:
QcException - QC Error
See Also:
IQcConnection.getPermissionClient()

getServerURL

public String getServerURL()
                    throws QcException
Overrides getServerURL. Returns the name of the server.

Specified by:
getServerURL in interface IQcConnection
Returns:
The name of the server.
Throws:
QcException - QC Error.
See Also:
IQcConnection.getServerURL()

getTestClient

public TestClient getTestClient()
                         throws QcException
Overrides getTestClient. Returns the Test client.

Specified by:
getTestClient in interface IQcConnection
Returns:
The test client.
Throws:
QcException - QC Error
See Also:
IQcConnection.getTestClient()

getUserClient

public UserClient getUserClient()
                         throws QcException
Overrides getUserClient. Returns the user client.

Specified by:
getUserClient in interface IQcConnection
Returns:
The user client.
Throws:
QcException - Qc Error.
See Also:
IQcConnection.getUserClient()

getVersion

public String getVersion()
                  throws QcException
Overrides getVersion. Returns the version of the QC Server.

Specified by:
getVersion in interface IQcConnection
Returns:
The version of the QC Server.
Throws:
QcException - QC Error
See Also:
IQcConnection.getVersion()

isConnected

public boolean isConnected()
Overrides isInitialized. Check if the client is connected to a server.

Specified by:
isConnected in interface IQcConnection
Returns:
True if connected, false otherwise.
See Also:
IQcConnection.isConnected()

isLoggedIn

public boolean isLoggedIn()
Overrides isLoggedIn. Check if the client is connected to a project.

Specified by:
isLoggedIn in interface IQcConnection
Returns:
True if connected, false otherwise.
See Also:
IQcConnection.isLoggedIn()

login

public void login(String pUsername,
                  String pPassword)
           throws QcException
Overrides login. Login.

Specified by:
login in interface IQcConnection
Parameters:
pUsername - The username.
pPassword - The password.
Throws:
QcException - Login error.
See Also:
IQcConnection.login(java.lang.String, java.lang.String)

initConnection

protected void initConnection()
                       throws QcException
Init the connection.

Throws:
QcException - QC Error.