*\r
* @param model\r
* @return cookie value\r
+ * @since 0.5.0\r
*/\r
String getCookie(UserModel model);\r
\r
*\r
* @param cookie\r
* @return a user object or null\r
+ * @since 0.5.0\r
*/\r
UserModel getUserModel(char[] cookie);\r
\r
*\r
* @param username\r
* @return a user object or null\r
+ * @since 0.5.0\r
*/\r
UserModel getUserModel(String username);\r
\r
*\r
* @param model\r
* @return true if update is successful\r
+ * @since 0.5.0\r
*/\r
boolean updateUserModel(UserModel model);\r
\r
* @param model\r
* the user object to use for username\r
* @return true if update is successful\r
+ * @since 0.5.0\r
*/\r
boolean updateUserModel(String username, UserModel model);\r
\r
*\r
* @param model\r
* @return true if successful\r
+ * @since 0.5.0\r
*/\r
boolean deleteUserModel(UserModel model);\r
\r
*\r
* @param username\r
* @return true if successful\r
+ * @since 0.5.0\r
*/\r
boolean deleteUser(String username);\r
\r
* Returns the list of all users available to the login service.\r
*\r
* @return list of all usernames\r
+ * @since 0.5.0\r
*/\r
List<String> getAllUsernames();\r
\r
* @param oldRole\r
* @param newRole\r
* @return true if successful\r
+ * @since 0.5.0\r
*/\r
boolean renameRepositoryRole(String oldRole, String newRole);\r
\r
*\r
* @param role\r
* @return true if successful\r
+ * @since 0.5.0\r
*/\r
boolean deleteRepositoryRole(String role);\r
\r
*
* @param httpRequest
* @return a user object or null
+ * @since 1.4.0
*/
UserModel authenticate(HttpServletRequest httpRequest);
* @param username
* @param key
* @return a user object or null
+* * @since 1.5.0
*/
UserModel authenticate(String username, SshKey key);
* @param httpRequest
* @param requiresCertificate
* @return a user object or null
+ * @since 1.4.0
*/
UserModel authenticate(HttpServletRequest httpRequest, boolean requiresCertificate);
* @param username
* @param password
* @return a user object or null
+ * @since 1.4.0
*/
UserModel authenticate(String username, char[] password);
*
* @param request
* @return the Gitblit cookie for the request or null if not found
+ * @since 1.4.0
*/
String getCookie(HttpServletRequest request);
*
* @param response
* @param user
+ * @since 1.4.0
*/
void setCookie(HttpServletResponse response, UserModel user);
* Logout a user.
*
* @param user
+ * @since 1.4.0
*/
void logout(HttpServletResponse response, UserModel user);
* Does the user service support changes to credentials?
*
* @return true or false
- * @since 1.0.0
+ * @since 1.4.0
*/
boolean supportsCredentialChanges(UserModel user);
*
* @param user
* @return true if the user service supports display name changes
+ * @since 1.4.0
*/
boolean supportsDisplayNameChanges(UserModel user);
*
* @param user
* @return true if the user service supports email address changes
+ * @since 1.4.0
*/
boolean supportsEmailAddressChanges(UserModel user);
*
* @param user
* @return true if the user service supports team membership changes
+ * @since 1.4.0
*/
boolean supportsTeamMembershipChanges(UserModel user);
*
* @param user
* @return true if the team memberships can be changed
+ * @since 1.4.0
*/
boolean supportsTeamMembershipChanges(TeamModel team);
* Gitblit is running on a cloud service and may return an adjusted path.
*
* @return the proposals folder path
+ * @since 1.4.0
*/
File getProposalsFolder();
* Returns the federation user account.
*
* @return the federation user account
+ * @since 1.4.0
*/
UserModel getFederationUser();
*
* @param httpRequest
* @return the federation user, if authenticated
+ * @since 1.4.0
*/
UserModel authenticate(HttpServletRequest httpRequest);
* try to pull.
*
* @return list of registered gitblit instances
+ * @since 1.4.0
*/
List<FederationModel> getFederationRegistrations();
* @param name
* the name of the registration
* @return a federation registration
+ * @since 1.4.0
*/
FederationModel getFederationRegistration(String url, String name);
* Returns the list of federation sets.
*
* @return list of federation sets
+ * @since 1.4.0
*/
List<FederationSet> getFederationSets(String gitblitUrl);
* Returns the list of possible federation tokens for this Gitblit instance.
*
* @return list of federation tokens
+ * @since 1.4.0
*/
List<String> getFederationTokens();
*
* @param type
* @return a federation token
+ * @since 1.4.0
*/
String getFederationToken(FederationToken type);
*
* @param value
* @return a federation token
+ * @since 1.4.0
*/
String getFederationToken(String value);
* @param req
* @param token
* @return true if the request can be executed
+ * @since 1.4.0
*/
boolean validateFederationRequest(FederationRequest req, String token);
* @param registration
* the registration from the pulling Gitblit instance
* @return true if acknowledged
+ * @since 1.4.0
*/
boolean acknowledgeFederationStatus(String identification, FederationModel registration);
* Returns the list of registration results.
*
* @return the list of registration results
+ * @since 1.4.0
*/
List<FederationModel> getFederationResultRegistrations();
* the url of your gitblit instance to send an email to
* administrators
* @return true if the proposal was submitted
+ * @since 1.4.0
*/
boolean submitFederationProposal(FederationProposal proposal, String gitblitUrl);
* Returns the list of pending federation proposals
*
* @return list of federation proposals
+ * @since 1.4.0
*/
List<FederationProposal> getPendingFederationProposals();
* @param token
* the federation token
* @return a map of <cloneurl, RepositoryModel>
+ * @since 1.4.0
*/
Map<String, RepositoryModel> getRepositories(String gitblitUrl, String token);
* the url of this Gitblit instance
* @param token
* @return a potential proposal
+ * @since 1.4.0
*/
FederationProposal createFederationProposal(String gitblitUrl, String token);
*
* @param token
* @return the specified proposal or null
+ * @since 1.4.0
*/
FederationProposal getPendingFederationProposal(String token);
* @param a
* proposal
* @return true if the proposal was deleted
+ * @since 1.4.0
*/
boolean deletePendingFederationProposal(FederationProposal proposal);
* @param user
* @param repository
* @return a list of repository urls
+ * @since 1.4.0
*/
List<RepositoryUrl> getRepositoryUrls(HttpServletRequest request, UserModel user, RepositoryModel repository);
* @param user
* @param isCreate
* @throws GitBlitException
+ * @since 1.4.0
*/
void addUser(UserModel user) throws GitBlitException;
* @param username
* @param user
* @throws GitBlitException
+ * @since 1.4.0
*/
void reviseUser(String username, UserModel user) throws GitBlitException;
*
* @param team
* @param isCreate
+ * @since 1.4.0
*/
void addTeam(TeamModel team) throws GitBlitException;
*
* @param teamname
* @param team
+ * @since 1.4.0
*/
void reviseTeam(String teamname, TeamModel team) throws GitBlitException;
* @param user
* @return the repository model of the fork, if successful
* @throws GitBlitException
+ * @since 1.4.0
*/
RepositoryModel fork(RepositoryModel repository, UserModel user) throws GitBlitException;
* repository url panel;
*
* @return a collection of client applications
+ * @since 1.4.0
*/
Collection<GitClientApplication> getClientApplications();
* Returns the ticket service.
*
* @return a ticket service
+ * @since 1.4.0
*/
ITicketService getTicketService();
* Returns the SSH public key manager.
*
* @return the SSH public key manager
+ * @since 1.5.0
*/
IPublicKeyManager getPublicKeyManager();
public interface IManager {
+ /**
+ * Start the manager.
+ *
+ * @return the manager
+ * @since 1.4.0
+ */
IManager start();
+ /**
+ * Stop the manager.
+ *
+ * @return the manager
+ * @since 1.4.0
+ */
IManager stop();
}
*
* @param subject
* @param message
+ * @since 1.4.0
*/
void sendMailToAdministrators(String subject, String message);
* @param subject
* @param message
* @param toAddresses
+ * @since 1.4.0
*/
void sendMail(String subject, String message, Collection<String> toAddresses);
* @param subject
* @param message
* @param toAddresses
+ * @since 1.4.0
*/
void sendHtmlMail(String subject, String message, Collection<String> toAddresses);
*
* @param mailing
* @return the mail message object
+ * @since 1.4.0
*/
void send(Mailing mailing);
* Returns the system version.
*
* @return the system version
+ * @since 1.5.0
*/
Version getSystemVersion();
/**
* Starts all plugins.
+ * @since 1.5.0
*/
void startPlugins();
/**
* Stops all plugins.
+ * @since 1.5.0
*/
void stopPlugins();
*
* @param pluginId
* @return the state of the plugin
+ * @since 1.5.0
*/
PluginState startPlugin(String pluginId);
*
* @param pluginId
* @return the state of the plugin
+ * @since 1.5.0
*/
PluginState stopPlugin(String pluginId);
*
* @param type
* @return a list of extensions the plugin provides
+ * @since 1.5.0
*/
List<Class<?>> getExtensionClasses(String pluginId);
*
* @param type
* @return a list of extension instances
+ * @since 1.5.0
*/
<T> List<T> getExtensions(Class<T> type);
* Returns the list of all resolved plugins.
*
* @return a list of resolved plugins
+ * @since 1.5.0
*/
List<PluginWrapper> getPlugins();
*
* @param pluginId
* @return the plugin wrapper
+ * @since 1.5.0
*/
PluginWrapper getPlugin(String pluginId);
*
* @param clazz extension point class to retrieve extension for
* @return PluginWrapper that loaded the given class
+ * @since 1.5.0
*/
PluginWrapper whichPlugin(Class<?> clazz);
*
* @param pluginId
* @return true if successful
+ * @since 1.5.0
*/
boolean disablePlugin(String pluginId);
*
* @param pluginId
* @return true if successful
+ * @since 1.5.0
*/
boolean enablePlugin(String pluginId);
*
* @param pluginId
* @return true if successful
+ * @since 1.5.0
*/
boolean uninstallPlugin(String pluginId);
* Refresh the plugin registry.
*
* @param verifyChecksum
+ * @since 1.5.0
*/
boolean refreshRegistry(boolean verifyChecksum);
*
* @param url
* @param verifyChecksum
+ * @since 1.5.0
*/
boolean installPlugin(String url, boolean verifyChecksum) throws IOException;
* @param verifyChecksum
* @return true if the upgrade has been successful
* @throws IOException
+ * @since 1.5.0
*/
boolean upgradePlugin(String pluginId, String url, boolean verifyChecksum) throws IOException;
* The list of all registered plugins.
*
* @return a list of registered plugins
+ * @since 1.5.0
*/
List<PluginRegistration> getRegisteredPlugins();
*
* @param state
* @return the list of plugins that match the install state
+ * @since 1.5.0
*/
List<PluginRegistration> getRegisteredPlugins(InstallState state);
*
* @param idOrName
* @return a plugin registration or null
+ * @since 1.5.0
*/
PluginRegistration lookupPlugin(String idOrName);
* @param idOrName
* @param version (use null for the current version)
* @return the identified plugin version or null
+ * @since 1.5.0
*/
PluginRelease lookupRelease(String idOrName, String version);
}
* @param user
* @param includeUsers
* @return list of projects that are accessible to the user
+ * @since 1.4.0
*/
List<ProjectModel> getProjectModels(UserModel user, boolean includeUsers);
* @param name
* @param user
* @return a project model, or null if it does not exist
+ * @since 1.4.0
*/
ProjectModel getProjectModel(String name, UserModel user);
*
* @param name a project name
* @return a project model or null if the project does not exist
+ * @since 1.4.0
*/
ProjectModel getProjectModel(String name);
* @param repositoryModels
* @param includeUsers
* @return a list of project models
+ * @since 1.4.0
*/
List<ProjectModel> getProjectModels(List<RepositoryModel> repositoryModels, boolean includeUsers);
* Gitblit is running on a cloud service and may return an adjusted path.
*
* @return the repositories folder path
+ * @since 1.4.0
*/
File getRepositoriesFolder();
* Gitblit is running on a cloud service and may return an adjusted path.
*
* @return the Groovy hook scripts folder path
+ * @since 1.4.0
*/
File getHooksFolder();
* Gitblit is running on a cloud service and may return an adjusted path.
*
* @return the Groovy grapes folder path
+ * @since 1.4.0
*/
File getGrapesFolder();
* Returns the most recent change date of any repository served by Gitblit.
*
* @return a date
+ * @since 1.4.0
*/
Date getLastActivityDate();
*
* @param user
* @return the effective list of permissions for the user
+ * @since 1.4.0
*/
List<RegistrantAccessPermission> getUserAccessPermissions(UserModel user);
*
* @param repository
* @return a list of RegistrantAccessPermissions
+ * @since 1.4.0
*/
List<RegistrantAccessPermission> getUserAccessPermissions(RepositoryModel repository);
* @param repository
* @param permissions
* @return true if the user models have been updated
+ * @since 1.4.0
*/
boolean setUserAccessPermissions(RepositoryModel repository, Collection<RegistrantAccessPermission> permissions);
* @see IUserService.getUsernamesForRepositoryRole(String)
* @param repository
* @return list of all usernames that have an access permission for the repository
+ * @since 1.4.0
*/
List<String> getRepositoryUsers(RepositoryModel repository);
*
* @param repository
* @return a list of RegistrantAccessPermissions
+ * @since 1.4.0
*/
List<RegistrantAccessPermission> getTeamAccessPermissions(RepositoryModel repository);
* @param repository
* @param permissions
* @return true if the team models have been updated
+ * @since 1.4.0
*/
boolean setTeamAccessPermissions(RepositoryModel repository, Collection<RegistrantAccessPermission> permissions);
* @see IUserService.getTeamnamesForRepositoryRole(String)
* @param repository
* @return list of all teamnames with explicit access permissions to the repository
+ * @since 1.4.0
*/
List<String> getRepositoryTeams(RepositoryModel repository);
* configured to cache the repository list.
*
* @param model
+ * @since 1.4.0
*/
void addToCachedRepositoryList(RepositoryModel model);
/**
* Resets the repository list cache.
*
+ * @since 1.4.0
+ *
*/
void resetRepositoryListCache();
* does not consider user access permissions.
*
* @return list of all repositories
+ * @since 1.4.0
*/
List<String> getRepositoryList();
*
* @param repositoryName
* @return repository or null
+ * @since 1.4.0
*/
Repository getRepository(String repositoryName);
* @param repositoryName
* @param logError
* @return repository or null
+ * @since 1.4.0
*/
Repository getRepository(String repositoryName, boolean logError);
*
* @param user
* @return list of repository models accessible to user
+ * @since 1.4.0
*/
List<RepositoryModel> getRepositoryModels(UserModel user);
* @param user
* @param repositoryName
* @return repository model or null
+ * @since 1.4.0
*/
RepositoryModel getRepositoryModel(UserModel user, String repositoryName);
*
* @param repositoryName
* @return repository model or null
+ * @since 1.4.0
*/
RepositoryModel getRepositoryModel(String repositoryName);
*
* @param repository
* @return the star count
+ * @since 1.4.0
*/
long getStarCount(RepositoryModel repository);
*
* @param n
* @return true if the repository exists
+ * @since 1.4.0
*/
boolean hasRepository(String repositoryName);
* @param n
* @param caseInsensitive
* @return true if the repository exists
+ * @since 1.4.0
*/
boolean hasRepository(String repositoryName, boolean caseSensitiveCheck);
* @param username
* @param origin
* @return true the if the user has a fork
+ * @since 1.4.0
*/
boolean hasFork(String username, String origin);
* @param username
* @param origin
* @return the name of the user's fork, null otherwise
+ * @since 1.4.0
*/
String getFork(String username, String origin);
*
* @param repository
* @return a ForkModel
+ * @since 1.4.0
*/
ForkModel getForkNetwork(String repository);
*
* @param model
* @return size in bytes of the repository
+ * @since 1.4.0
*/
long updateLastChangeFields(Repository r, RepositoryModel model);
* @param model
* @param repository
* @return a new array list of metrics
+ * @since 1.4.0
*/
List<Metric> getRepositoryDefaultMetrics(RepositoryModel model, Repository repository);
* @param repository
* @param isCreate
* @throws GitBlitException
+ * @since 1.4.0
*/
void updateRepositoryModel(String repositoryName, RepositoryModel repository, boolean isCreate)
throws GitBlitException;
* the Git repository
* @param repository
* the Gitblit repository model
+ * @since 1.4.0
*/
void updateConfiguration(Repository r, RepositoryModel repository);
*
* @param model
* @return true if successful
+ * @since 1.4.0
*/
boolean deleteRepositoryModel(RepositoryModel model);
*
* @param repositoryName
* @return true if successful
+ * @since 1.4.0
*/
boolean deleteRepository(String repositoryName);
* .groovy extension
*
* @return list of available hook scripts
+ * @since 1.4.0
*/
List<String> getAllScripts();
* @param repository
* if null only the globally specified scripts are returned
* @return a list of scripts
+ * @since 1.4.0
*/
List<String> getPreReceiveScriptsInherited(RepositoryModel repository);
* @param repository
* optional parameter
* @return list of available hook scripts
+ * @since 1.4.0
*/
List<String> getPreReceiveScriptsUnused(RepositoryModel repository);
* @param repository
* if null only the globally specified scripts are returned
* @return a list of scripts
+ * @since 1.4.0
*/
List<String> getPostReceiveScriptsInherited(RepositoryModel repository);
* @param repository
* optional parameter
* @return list of available hook scripts
+ * @since 1.4.0
*/
List<String> getPostReceiveScriptsUnused(RepositoryModel repository);
* @param page
* @param pageSize
* @param repositories
- * @return
+ * @return a list of search results
+ * @since 1.4.0
*/
List<SearchResult> search(String query, int page, int pageSize, List<String> repositories);
/**
*
* @return true if we are running the gc executor
+ * @since 1.4.0
*/
boolean isCollectingGarbage();
*
* @param repositoryName
* @return true if actively collecting garbage
+ * @since 1.4.0
*/
boolean isCollectingGarbage(String repositoryName);
/**
* Ensures that all cached repositories are completely closed and their resources
* are properly released.
+ * @since 1.4.0
*/
void closeAll();
/**
* Ensures that a cached repository is completely closed and it's resources
* are properly released.
+ * @since 1.4.0
*/
void close(String repository);
*
* @param repository
* @return true if the repository is idle
+ * @since 1.4.0
*/
boolean isIdle(Repository repository);
}
\ No newline at end of file
* Returns the preferred timezone for the Gitblit instance.
*
* @return a timezone
+ * @since 1.4.0
*/
TimeZone getTimezone();
* or if it is merely a repository viewer.
*
* @return true if Gitblit is serving repositories
+ * @since 1.4.0
*/
boolean isServingRepositories();
* Determine if this Gitblit instance is running in debug mode
*
* @return true if Gitblit is running in debug mode
+ * @since 1.4.0
*/
boolean isDebugMode();
* Returns the boot date of the Gitblit server.
*
* @return the boot date of Gitblit
+ * @since 1.4.0
*/
Date getBootDate();
+ /**
+ * Returns the server status.
+ *
+ * @return the server status
+ * @since 1.4.0
+ */
ServerStatus getStatus();
/**
* Returns the descriptions/comments of the Gitblit config settings.
*
* @return SettingsModel
+ * @since 1.4.0
*/
ServerSettings getSettingsModel();
* Returns the file object for the specified configuration key.
*
* @return the file
+ * @since 1.4.0
*/
File getFileOrFolder(String key, String defaultFileOrFolder);
* access based on environment or some other indicator.
*
* @return the file
+ * @since 1.4.0
*/
File getFileOrFolder(String fileOrFolder);
* Returns the runtime settings.
*
* @return settings
+ * @since 1.4.0
*/
IStoredSettings getSettings();
*
* @param settings
* @return true if the update succeeded
+ * @since 1.4.0
*/
boolean updateSettings(Map<String, String> updatedSettings);
}
\ No newline at end of file
*
* @param username
* @return true if the specified username represents an internal account
+ * @since 1.4.0
*/
boolean isInternalAccount(String username);
/**
* Start the service.
- *
+ * @since 1.4.0
*/
public abstract ITicketService start();
/**
* Stop the service.
- *
+ * @since 1.4.0
*/
public final ITicketService stop() {
indexer.close();
/**
* Creates a ticket notifier. The ticket notifier is not thread-safe!
- *
+ * @since 1.4.0
*/
public TicketNotifier createNotifier() {
return new TicketNotifier(
* Returns the ready status of the ticket service.
*
* @return true if the ticket service is ready
+ * @since 1.4.0
*/
public boolean isReady() {
return true;
*
* @param repository
* @return true if patchsets are being accepted
+ * @since 1.4.0
*/
public boolean isAcceptingNewPatchsets(RepositoryModel repository) {
return isReady()
*
* @param repository
* @return true if tickets are being accepted
+ * @since 1.4.0
*/
public boolean isAcceptingNewTickets(RepositoryModel repository) {
return isReady()
*
* @param repository
* @return true if tickets are allowed to be updated
+ * @since 1.4.0
*/
public boolean isAcceptingTicketUpdates(RepositoryModel repository) {
return isReady()
* Returns true if the repository has any tickets
* @param repository
* @return true if the repository has tickets
+ * @since 1.4.0
*/
public boolean hasTickets(RepositoryModel repository) {
return indexer.hasTickets(repository);
/**
* Closes any open resources used by this service.
+ * @since 1.4.0
*/
protected abstract void close();
/**
* Reset all caches in the service.
+ * @since 1.4.0
*/
public final synchronized void resetCaches() {
ticketsCache.invalidateAll();
resetCachesImpl();
}
+ /**
+ * Reset all caches in the service.
+ * @since 1.4.0
+ */
protected abstract void resetCachesImpl();
/**
* Reset any caches for the repository in the service.
+ * @since 1.4.0
*/
public final synchronized void resetCaches(RepositoryModel repository) {
List<TicketKey> repoKeys = new ArrayList<TicketKey>();
resetCachesImpl(repository);
}
+ /**
+ * Reset the caches for the specified repository.
+ *
+ * @param repository
+ * @since 1.4.0
+ */
protected abstract void resetCachesImpl(RepositoryModel repository);
*
* @param repository
* @return the list of labels
+ * @since 1.4.0
*/
public List<TicketLabel> getLabels(RepositoryModel repository) {
String key = repository.name;
* @param repository
* @param label
* @return a TicketLabel
+ * @since 1.4.0
*/
public TicketLabel getLabel(RepositoryModel repository, String label) {
for (TicketLabel tl : getLabels(repository)) {
* @param milestone
* @param createdBy
* @return the label
+ * @since 1.4.0
*/
public synchronized TicketLabel createLabel(RepositoryModel repository, String label, String createdBy) {
TicketLabel lb = new TicketMilestone(label);
* @param label
* @param createdBy
* @return true if the update was successful
+ * @since 1.4.0
*/
public synchronized boolean updateLabel(RepositoryModel repository, TicketLabel label, String createdBy) {
Repository db = null;
* @param newName
* @param createdBy
* @return true if the rename was successful
+ * @since 1.4.0
*/
public synchronized boolean renameLabel(RepositoryModel repository, String oldName, String newName, String createdBy) {
if (StringUtils.isEmpty(newName)) {
* @param label
* @param createdBy
* @return true if the delete was successful
+ * @since 1.4.0
*/
public synchronized boolean deleteLabel(RepositoryModel repository, String label, String createdBy) {
if (StringUtils.isEmpty(label)) {
*
* @param repository
* @return the list of milestones
+ * @since 1.4.0
*/
public List<TicketMilestone> getMilestones(RepositoryModel repository) {
String key = repository.name;
* @param repository
* @param status
* @return the list of milestones
+ * @since 1.4.0
*/
public List<TicketMilestone> getMilestones(RepositoryModel repository, Status status) {
List<TicketMilestone> matches = new ArrayList<TicketMilestone>();
* @param repository
* @param milestone
* @return the milestone or null if it does not exist
+ * @since 1.4.0
*/
public TicketMilestone getMilestone(RepositoryModel repository, String milestone) {
for (TicketMilestone ms : getMilestones(repository)) {
* @param milestone
* @param createdBy
* @return the milestone
+ * @since 1.4.0
*/
public synchronized TicketMilestone createMilestone(RepositoryModel repository, String milestone, String createdBy) {
TicketMilestone ms = new TicketMilestone(milestone);
* @param milestone
* @param createdBy
* @return true if successful
+ * @since 1.4.0
*/
public synchronized boolean updateMilestone(RepositoryModel repository, TicketMilestone milestone, String createdBy) {
Repository db = null;
* @param newName
* @param createdBy
* @return true if successful
+ * @since 1.4.0
*/
public synchronized boolean renameMilestone(RepositoryModel repository, String oldName, String newName, String createdBy) {
if (StringUtils.isEmpty(newName)) {
}
return false;
}
+
/**
* Deletes a milestone.
*
* @param milestone
* @param createdBy
* @return true if successful
+ * @since 1.4.0
*/
public synchronized boolean deleteMilestone(RepositoryModel repository, String milestone, String createdBy) {
if (StringUtils.isEmpty(milestone)) {
*
* @param repository
* @return a new ticket id
+ * @since 1.4.0
*/
public abstract long assignNewId(RepositoryModel repository);
* @param repository
* @param ticketId
* @return true if the ticket exists
+ * @since 1.4.0
*/
public abstract boolean hasTicket(RepositoryModel repository, long ticketId);
*
* @param repository
* @return all tickets
+ * @since 1.4.0
*/
public List<TicketModel> getTickets(RepositoryModel repository) {
return getTickets(repository, null);
* @param filter
* optional issue filter to only return matching results
* @return a list of tickets
+ * @since 1.4.0
*/
public abstract List<TicketModel> getTickets(RepositoryModel repository, TicketFilter filter);
* @param repository
* @param ticketId
* @return a ticket, if it exists, otherwise null
+ * @since 1.4.0
*/
public final TicketModel getTicket(RepositoryModel repository, long ticketId) {
TicketKey key = new TicketKey(repository, ticketId);
TicketModel ticket = ticketsCache.getIfPresent(key);
-
+
// if ticket not cached
if (ticket == null) {
//load ticket
* @param repository
* @param ticketId
* @return a ticket, if it exists, otherwise null
+ * @since 1.4.0
*/
protected abstract TicketModel getTicketImpl(RepositoryModel repository, long ticketId);
*
* @param ticket
* @return the ticket url
+ * @since 1.4.0
*/
public String getTicketUrl(TicketModel ticket) {
final String canonicalUrl = settings.getString(Keys.web.canonicalUrl, "https://localhost:8443");
* @param base
* @param tip
* @return the compare url
+ * @since 1.4.0
*/
public String getCompareUrl(TicketModel ticket, String base, String tip) {
final String canonicalUrl = settings.getString(Keys.web.canonicalUrl, "https://localhost:8443");
* Returns true if attachments are supported.
*
* @return true if attachments are supported
+ * @since 1.4.0
*/
public abstract boolean supportsAttachments();
* @param ticketId
* @param filename
* @return an attachment, if found, null otherwise
+ * @since 1.4.0
*/
public abstract Attachment getAttachment(RepositoryModel repository, long ticketId, String filename);
* @param repository
* @param change
* @return true if successful
+ * @since 1.4.0
*/
public TicketModel createTicket(RepositoryModel repository, Change change) {
return createTicket(repository, 0L, change);
* @param ticketId (if <=0 the ticket id will be assigned)
* @param change
* @return true if successful
+ * @since 1.4.0
*/
public TicketModel createTicket(RepositoryModel repository, long ticketId, Change change) {
* @param ticketId
* @param change
* @return the ticket model if successful
+ * @since 1.4.0
*/
public final TicketModel updateTicket(RepositoryModel repository, long ticketId, Change change) {
if (change == null) {
* Deletes all tickets in every repository.
*
* @return true if successful
+ * @since 1.4.0
*/
public boolean deleteAll() {
List<String> repositories = repositoryManager.getRepositoryList();
* Deletes all tickets in the specified repository.
* @param repository
* @return true if succesful
+ * @since 1.4.0
*/
public boolean deleteAll(RepositoryModel repository) {
boolean success = deleteAllImpl(repository);
return success;
}
+ /**
+ * Delete all tickets for the specified repository.
+ * @param repository
+ * @return true if successful
+ * @since 1.4.0
+ */
protected abstract boolean deleteAllImpl(RepositoryModel repository);
/**
* @param oldRepositoryName
* @param newRepositoryName
* @return true if successful
+ * @since 1.4.0
*/
public boolean rename(RepositoryModel oldRepository, RepositoryModel newRepository) {
if (renameImpl(oldRepository, newRepository)) {
return false;
}
+ /**
+ * Renames a repository.
+ *
+ * @param oldRepository
+ * @param newRepository
+ * @return true if successful
+ * @since 1.4.0
+ */
protected abstract boolean renameImpl(RepositoryModel oldRepository, RepositoryModel newRepository);
/**
* @param ticketId
* @param deletedBy
* @return true if successful
+ * @since 1.4.0
*/
public boolean deleteTicket(RepositoryModel repository, long ticketId, String deletedBy) {
TicketModel ticket = getTicket(repository, ticketId);
* @param ticket
* @param deletedBy
* @return true if successful
+ * @since 1.4.0
*/
protected abstract boolean deleteTicketImpl(RepositoryModel repository, TicketModel ticket, String deletedBy);
* @param comment
* the revised comment
* @return the revised ticket if the change was successful
+ * @since 1.4.0
*/
public final TicketModel updateComment(TicketModel ticket, String commentId,
String updatedBy, String comment) {
* @param deletedBy
* the user deleting the comment
* @return the revised ticket if the deletion was successful
+ * @since 1.4.0
*/
public final TicketModel deleteComment(TicketModel ticket, String commentId, String deletedBy) {
Change deletion = new Change(deletedBy);
* @param ticketId
* @param change
* @return true, if the change was committed
+ * @since 1.4.0
*/
protected abstract boolean commitChangeImpl(RepositoryModel repository, long ticketId, Change change);
* @param page
* @param pageSize
* @return a list of matching tickets
+ * @since 1.4.0
*/
public List<QueryResult> searchFor(RepositoryModel repository, String text, int page, int pageSize) {
return indexer.searchFor(repository, text, page, pageSize);
* @param sortBy
* @param descending
* @return a list of matching tickets or an empty list
+ * @since 1.4.0
*/
public List<QueryResult> queryFor(String query, int page, int pageSize, String sortBy, boolean descending) {
return indexer.queryFor(query, page, pageSize, sortBy, descending);
/**
* Destroys an existing index and reindexes all tickets.
* This operation may be expensive and time-consuming.
+ * @since 1.4.0
*/
public void reindex() {
long start = System.nanoTime();
/**
* Destroys any existing index and reindexes all tickets.
* This operation may be expensive and time-consuming.
+ * @since 1.4.0
*/
public void reindex(RepositoryModel repository) {
long start = System.nanoTime();
* of ticket updates, namely merging from the web ui.
*
* @param runnable
+ * @since 1.4.0
*/
public synchronized void exec(Runnable runnable) {
runnable.run();