com.tszadel.qctools4j.clients
Class BugClient

java.lang.Object
  extended by com.tszadel.qctools4j.clients.AbstractClient
      extended by com.tszadel.qctools4j.clients.BugClient

public class BugClient
extends AbstractClient

The defect client.

Author:
tszadel

Field Summary
 
Fields inherited from class com.tszadel.qctools4j.clients.AbstractClient
connection, NONE, WITH_ATTACHMENTS, WITH_CHILDREN
 
Method Summary
 void addAttachmentsToBug(int pBugId, List<Attachment> pAttachments, boolean pSynchronize)
          Add the given attachments to the bug.
 Link createLink(int pBugId1, Link pLink)
          Link 2 existing bugs.
 void delete(Bug pDefect)
          Save the given defect.
 Attachment getAttachmentFromId(int pBugId, int pAttachmentId)
          Returns an attachment from its ID.
 List<Attachment> getAttachmentsOfBug(int pBugId)
          Returns the attachments of the given bug Id.
 Bug getBug(int pId, int pFlag)
          Returns a bug.
 Collection<Bug> getBugs()
          Returns all the Bugs without any attachment.
 Collection<Bug> getBugs(List<FieldFilter> pFilterList, int pFlag)
          Returns the Bugs according to a given filter
 Map<String,FieldDescription> getFieldDescriptions()
          Overrides getFieldDescriptions.
 List<HistoryEntry> getHistory(int pBugId)
          Returns the history of a Bug.
 List<Link> getLinks(int pBugId)
          Returns all the links of a given bug.
 String[] getPriorities()
          Returns the priorities that can be used.
 String[] getSeverities()
          Returns the severities that can be used.
 Collection<Bug> getSimilarBugs(int pBugId)
          Returns all the Bugs that are similar to the given one.
 Collection<Bug> getSimilarBugs(int pBugId, int pSimilarityFactor)
          Returns all the Bugs that are similar to the given one.
 String[] getStatuses()
          Returns the statuses that can be used.
 boolean isExistingBug(int pId)
          Check if the Bug already exists.
 void removeLink(int pBugId1, int pBugId2)
          Remove link 2 existing bugs.
 void save(Bug pBug)
          Save (if id=null) or update (if id !
 
Methods inherited from class com.tszadel.qctools4j.clients.AbstractClient
canExecuteAction, checkConnection, checkLogin, checkPermission, containsFlag, getEncodedString, loadFields, retrieveAttachments, retrieveCustomFields, storeAttachments, storeFields, toAttachment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addAttachmentsToBug

public void addAttachmentsToBug(int pBugId,
                                List<Attachment> pAttachments,
                                boolean pSynchronize)
                         throws QcException
Add the given attachments to the bug.

Parameters:
pBugId - The bug Id.
pAttachments - The attachments to add/update.
pSynchronize - True if the given attachments is the whole list (update/removal can occur) or false if attachments have to be just added.
Throws:
QcException - Error.

createLink

public Link createLink(int pBugId1,
                       Link pLink)
                throws QcException
Link 2 existing bugs.

Parameters:
pBugId1 - The source bug.
pLink - The second bug.link.
Returns:
The created link (same as the given link).
Throws:
QcException - Error.

delete

public void delete(Bug pDefect)
            throws QcException
Save the given defect.

Parameters:
pDefect - The defect.
Throws:
QcException - QC Error.

getAttachmentFromId

public Attachment getAttachmentFromId(int pBugId,
                                      int pAttachmentId)
                               throws QcException
Returns an attachment from its ID.

Parameters:
pBugId - The bug Id.
pAttachmentId - The attachment Id.
Returns:
The attachment.
Throws:
QcException - QC error.

getAttachmentsOfBug

public List<Attachment> getAttachmentsOfBug(int pBugId)
                                     throws QcException
Returns the attachments of the given bug Id.

Parameters:
pBugId - The bug Id.
Returns:
The list of attachments
Throws:
QcException - QcError.

getBug

public Bug getBug(int pId,
                  int pFlag)
           throws QcException
Returns a bug.

Parameters:
pId - Id of the bug.
pFlag - A flag.
Returns:
The bug.
Throws:
QcException - QC error.

getBugs

public Collection<Bug> getBugs()
                        throws QcException
Returns all the Bugs without any attachment.

Returns:
The Bugs.
Throws:
QcException - QC Error.

getBugs

public Collection<Bug> getBugs(List<FieldFilter> pFilterList,
                               int pFlag)
                        throws QcException
Returns the Bugs according to a given filter

Parameters:
pFilterList - the filters (may be null)
pFlag - The flag to use in the request.
Returns:
The Bugs.
Throws:
QcException - QC Error.

getFieldDescriptions

public Map<String,FieldDescription> getFieldDescriptions()
                                                  throws QcException
Overrides getFieldDescriptions. Returns the descriptions of the fields.

Specified by:
getFieldDescriptions in class AbstractClient
Returns:
The description of the fields (key=name of the field, value=description of the field).
Throws:
QcException - Qc Error.
See Also:
AbstractClient.getFieldDescriptions()

getHistory

public List<HistoryEntry> getHistory(int pBugId)
                              throws QcException
Returns the history of a Bug.

Parameters:
pBugId - The Bug id.
Returns:
The history of the Bug.
Throws:
QcException - QC Error.

getLinks

public List<Link> getLinks(int pBugId)
                    throws QcException
Returns all the links of a given bug.

Parameters:
pBugId - The bug Id.
Returns:
The list of links.
Throws:
QcException - Error.

getPriorities

public String[] getPriorities()
                       throws QcException
Returns the priorities that can be used.

Returns:
The priorities that can be used.
Throws:
QcException - Qc Error.

getSeverities

public String[] getSeverities()
                       throws QcException
Returns the severities that can be used.

Returns:
The severities that can be used.
Throws:
QcException - Qc Error.

getSimilarBugs

public Collection<Bug> getSimilarBugs(int pBugId)
                               throws QcException
Returns all the Bugs that are similar to the given one.

Parameters:
pBugId - The bug id.
Returns:
The similar Bugs.
Throws:
QcException - QC Error.

getSimilarBugs

public Collection<Bug> getSimilarBugs(int pBugId,
                                      int pSimilarityFactor)
                               throws QcException
Returns all the Bugs that are similar to the given one.

Parameters:
pBugId - The bug id.
pSimilarityFactor - The similarity factor (between 0 and 100)
Returns:
The similar Bugs.
Throws:
QcException - QC Error.
IllegalArgumentException - The factor range is incorrect.

getStatuses

public String[] getStatuses()
                     throws QcException
Returns the statuses that can be used.

Returns:
The statuses that can be used.
Throws:
QcException - Qc Error.

isExistingBug

public boolean isExistingBug(int pId)
                      throws QcException
Check if the Bug already exists.

Parameters:
pId - Id of the Bug.
Returns:
True if it exists, false otherwise.
Throws:
QcException - QC Error.

removeLink

public void removeLink(int pBugId1,
                       int pBugId2)
                throws QcException
Remove link 2 existing bugs.

Parameters:
pBugId1 - The first bug.
pBugId2 - The second bug.
Throws:
QcException - Error.

save

public void save(Bug pBug)
          throws QcException
Save (if id=null) or update (if id != null) the given Bug.

Note:The attachments are not updated.

Parameters:
pBug - The Bug.
Throws:
QcException - QC Error.