org.paylogic.fogbugz
Class FogbugzManager

java.lang.Object
  extended by org.paylogic.fogbugz.FogbugzManager

public class FogbugzManager
extends Object

Manager for FogbugzCase objects. Use this to retrieve, save and create cases.


Constructor Summary
FogbugzManager(String url, String token, String featureBranchFieldname, String originalBranchFieldname, String targetBranchFieldname, String approvedRevisionFieldname, String ciProjectFieldName, int mergekeeperUserId, int gatekeeperUserId)
          Constructor of FogbugzManager.
 
Method Summary
 FogbugzCase assignToGatekeepers(FogbugzCase fbCase)
          Assign the given case to gatekeepers (uses GatekeeperUserID from global settings)
 FogbugzCase assignToMergekeepers(FogbugzCase fbCase)
          Assign case to mergekeepers user id.
 boolean createMilestone(FogbugzMilestone milestone)
          Creates new Milestone in Fogbugz.
 boolean createMilestoneIfNotExists(String milestoneName)
           
 FogbugzCase getCaseById(int id)
          Retrieves a case using the Fogbugz API by caseId.
 List<FogbugzEvent> getEventsForCase(int id)
          Retrieves all events for a certain case.
 FogbugzUser getFogbugzUser(int ix)
           
 FogbugzEvent getLastAssignedTo(int caseId, int userId)
          Loop through all FogbugzEvent for given case id, and return last (in time) with assignment to given user.
 FogbugzEvent getLastAssignedToGatekeepersEvent(int caseId)
          Loop through all FogbugzEvent for given case id, and return last (in time) with assignment to gatekeepers.
 List<FogbugzMilestone> getMilestones()
          Retrieves all milestones and returns them in a nice List of FogbugzMilestone objects.
 boolean saveCase(FogbugzCase fbCase)
          Additional save method that does not propagate a comment.
 boolean saveCase(FogbugzCase fbCase, String comment)
          Saves a case to fogbugz using its API.
 List<FogbugzCase> searchForCases(String query)
          Retrieves cases using the Fogbugz API by a query
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FogbugzManager

public FogbugzManager(String url,
                      String token,
                      @Nullable
                      String featureBranchFieldname,
                      @Nullable
                      String originalBranchFieldname,
                      @Nullable
                      String targetBranchFieldname,
                      @Nullable
                      String approvedRevisionFieldname,
                      @Nullable
                      String ciProjectFieldName,
                      int mergekeeperUserId,
                      int gatekeeperUserId)
Constructor of FogbugzManager.

Method Detail

getCaseById

public FogbugzCase getCaseById(int id)
                        throws InvalidResponseException,
                               NoSuchCaseException
Retrieves a case using the Fogbugz API by caseId.

Parameters:
id - the id of the case to fetch.
Returns:
FogbugzCase if all is well, else null.
Throws:
InvalidResponseException
NoSuchCaseException

searchForCases

public List<FogbugzCase> searchForCases(String query)
                                 throws InvalidResponseException,
                                        NoSuchCaseException
Retrieves cases using the Fogbugz API by a query

Parameters:
query - fogbugz search query
Returns:
List of cases
Throws:
InvalidResponseException
NoSuchCaseException

getEventsForCase

public List<FogbugzEvent> getEventsForCase(int id)
Retrieves all events for a certain case.

Parameters:
id - Case id to fetch events from
Returns:
list of FogbugzEvents

getLastAssignedToGatekeepersEvent

public FogbugzEvent getLastAssignedToGatekeepersEvent(int caseId)
Loop through all FogbugzEvent for given case id, and return last (in time) with assignment to gatekeepers.

Parameters:
caseId -
Returns:
Last event with gatekeeper assignment or null.

getLastAssignedTo

public FogbugzEvent getLastAssignedTo(int caseId,
                                      int userId)
Loop through all FogbugzEvent for given case id, and return last (in time) with assignment to given user.

Parameters:
caseId -
userId -
Returns:
Last event with user assignment or null.

saveCase

public boolean saveCase(FogbugzCase fbCase,
                        String comment)
Saves a case to fogbugz using its API. Supports creating new cases, by setting caseId to 0 on case object.

Parameters:
fbCase - The case to save.
comment - A message to pass for this edit.
Returns:
boolean, true if all is well, else false.

saveCase

public boolean saveCase(FogbugzCase fbCase)
Additional save method that does not propagate a comment.

Parameters:
fbCase - The case to save.
Returns:
boolean, true if all is well, else false.

assignToMergekeepers

public FogbugzCase assignToMergekeepers(FogbugzCase fbCase)
Assign case to mergekeepers user id. Note: does not save case.

Parameters:
fbCase - the case to set assignedTo on.
Returns:
modified case.

assignToGatekeepers

public FogbugzCase assignToGatekeepers(FogbugzCase fbCase)
Assign the given case to gatekeepers (uses GatekeeperUserID from global settings)

Parameters:
fbCase - The case to edit.
Returns:
modified case.

getFogbugzUser

public FogbugzUser getFogbugzUser(int ix)

getMilestones

public List<FogbugzMilestone> getMilestones()
Retrieves all milestones and returns them in a nice List of FogbugzMilestone objects.

Returns:
list of FogbugzMilestones

createMilestone

public boolean createMilestone(FogbugzMilestone milestone)
Creates new Milestone in Fogbugz. Please leave id of milestone object empty. Only creates global milestones.

Parameters:
milestone - to edit/create

createMilestoneIfNotExists

public boolean createMilestoneIfNotExists(String milestoneName)


Copyright © 2015. All rights reserved.