org.nuiton.jredmine
Class DefaultRedmineAnonymousService

java.lang.Object
  extended by org.nuiton.jredmine.DefaultRedmineAnonymousService
All Implemented Interfaces:
RedmineAnonymousService, RedmineServiceImplementor
Direct Known Subclasses:
DefaultRedmineService

public class DefaultRedmineAnonymousService
extends Object
implements RedmineServiceImplementor, RedmineAnonymousService

Default implementation of RedmineAnonymousService.

This implementation just make sure that the rest client is anonnymous.

Created: 2 janv. 2010

Since:
1.0.3
Author:
tchemit
See Also:
RestClientConfiguration.isAnonymous()
Plexus component:
role:
"org.nuiton.jredmine.RedmineAnonymousService"
role-hint:
"default"

Field Summary
protected  RedmineServiceImplementor delegateImplementor
           
 
Constructor Summary
DefaultRedmineAnonymousService()
           
 
Method Summary
 void checkLoggued()
          Checks if the current session is not a anonymous one.
 void checkNotLoggued(org.nuiton.io.rest.RestClient session)
          Checks if the current session is anonymous.
 void destroy()
          Close the service and destroy any connexion to the redmine service.
 Attachment[] getAttachments(String projectName, String versionName)
          Obtain all attachments for a specific version on a given project.
 Issue[] getClosedIssues(String projectName)
          Obtain all closed issues for a given project.
<T> T
getData(String requestName, Class<T> type, Object... args)
          Generic method to obtain a single data from a redmine server.
<T> T[]
getDatas(String requestName, Class<T> type, Object... args)
          Generic method to obtain a array of data from a redmine server.
 IssueCategory[] getIssueCategories(String projectName)
          Obtain all categories defined on issues for a given project.
 IssuePriority[] getIssuePriorities()
          Obtain all the priorities defined on a Issue.
 Issue[] getIssues(String projectName)
          Obtain all issues for a given project.
 Issue[] getIssues(String projectName, String versionName)
          Obtain all issues for a specific version on a given project.
 IssueStatus[] getIssueStatuses()
          Obtain all the statuses defined on a Issue.
 TimeEntry[] getIssueTimeEntries(String projectName, String issueId)
          Obtain for a given issue of a given project all the time entries.
 News[] getNews(String projectName)
          Obtain all news defined on a given project.
 Issue[] getOpenedIssues(String projectName)
          Obtain all opened issues for a given project.
 Project getProject(String projectName)
          Obtain a project given his name.
 User[] getProjectMembers(String projectName)
          Obtain all users defined on a given project.
 Project[] getProjects()
          Obtain all accessible projects.
 Tracker[] getTrackers(String projectName)
          Obtain all trackers defined on a given project.
 Version getVersion(String projectName, String versionName)
          Obtain a specific version for a given project.
 Version[] getVersions(String projectName)
          Obtain all versions defined on a given project.
 RedmineServiceImplementor init(org.nuiton.io.rest.RestClient session)
          Initialize the service given a redmine client already initialized.
 RedmineServiceImplementor init(org.nuiton.io.rest.RestClientConfiguration configuration)
          Initialize the service given a client configuration.
 boolean isInit()
          Tests if the service is loogued to the redmine service.
<T> T
sendData(String requestName, Class<T> klazz, Object... args)
          Generic method to send a data to a redmine server and return the single data updated from the redmine server.
<T> T[]
sendDatas(String requestName, Class<T> klazz, Object... args)
          Generic method to send a data (or more ) to a redmine server and return the array of data from the redmine server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delegateImplementor

protected RedmineServiceImplementor delegateImplementor
Plexus requirement:
role:
"org.nuiton.jredmine.RedmineServiceImplementor"
role-hint:
"default"
Constructor Detail

DefaultRedmineAnonymousService

public DefaultRedmineAnonymousService()
Method Detail

getIssueStatuses

public IssueStatus[] getIssueStatuses()
                               throws RedmineServiceException
Description copied from interface: RedmineAnonymousService
Obtain all the statuses defined on a Issue.

Note : The statuses are common for all projects.

Specified by:
getIssueStatuses in interface RedmineAnonymousService
Returns:
all the issue statuses
Throws:
RedmineServiceException - if any pb while retriving datas
See Also:
IssueStatus

getIssuePriorities

public IssuePriority[] getIssuePriorities()
                                   throws RedmineServiceException
Description copied from interface: RedmineAnonymousService
Obtain all the priorities defined on a Issue.

Note : The priorities are common for all projects.

Specified by:
getIssuePriorities in interface RedmineAnonymousService
Returns:
all the issue properties
Throws:
RedmineServiceException - if any pb while retriving datas
See Also:
IssuePriority

getProjects

public Project[] getProjects()
                      throws RedmineServiceException
Description copied from interface: RedmineAnonymousService
Obtain all accessible projects.

Specified by:
getProjects in interface RedmineAnonymousService
Returns:
all the projects
Throws:
RedmineServiceException - if any pb while retriving datas
See Also:
Project

getIssueCategories

public IssueCategory[] getIssueCategories(String projectName)
                                   throws RedmineServiceException
Description copied from interface: RedmineAnonymousService
Obtain all categories defined on issues for a given project.

Specified by:
getIssueCategories in interface RedmineAnonymousService
Parameters:
projectName - the name of the project
Returns:
the categories of issues for the given project.
Throws:
RedmineServiceException - if any pb while retriving datas
See Also:
IssueCategory

getProject

public Project getProject(String projectName)
                   throws RedmineServiceException
Description copied from interface: RedmineAnonymousService
Obtain a project given his name.

Specified by:
getProject in interface RedmineAnonymousService
Parameters:
projectName - the name of the project
Returns:
the project
Throws:
RedmineServiceException - if any pb while retriving datas
See Also:
Project

getTrackers

public Tracker[] getTrackers(String projectName)
                      throws RedmineServiceException
Description copied from interface: RedmineAnonymousService
Obtain all trackers defined on a given project.

Specified by:
getTrackers in interface RedmineAnonymousService
Parameters:
projectName - the name of the project
Returns:
the trackers for the given project.
Throws:
RedmineServiceException - if any pb while retriving datas
See Also:
Tracker

getNews

public News[] getNews(String projectName)
               throws RedmineServiceException
Description copied from interface: RedmineAnonymousService
Obtain all news defined on a given project.

Specified by:
getNews in interface RedmineAnonymousService
Parameters:
projectName - the name of the project
Returns:
the news for the given project.
Throws:
RedmineServiceException - if any pb while retriving datas
See Also:
News

getProjectMembers

public User[] getProjectMembers(String projectName)
                         throws RedmineServiceException
Description copied from interface: RedmineAnonymousService
Obtain all users defined on a given project.

Specified by:
getProjectMembers in interface RedmineAnonymousService
Parameters:
projectName - the name of the project
Returns:
the users for the given project.
Throws:
RedmineServiceException - if any pb while retriving datas
See Also:
User

getVersions

public Version[] getVersions(String projectName)
                      throws RedmineServiceException
Description copied from interface: RedmineAnonymousService
Obtain all versions defined on a given project.

Specified by:
getVersions in interface RedmineAnonymousService
Parameters:
projectName - the name of the project
Returns:
the versions of the given project.
Throws:
RedmineServiceException - if any pb while retriving datas
See Also:
Version

getVersion

public Version getVersion(String projectName,
                          String versionName)
                   throws RedmineServiceException
Description copied from interface: RedmineAnonymousService
Obtain a specific version for a given project.

Specified by:
getVersion in interface RedmineAnonymousService
Parameters:
projectName - the name of the project
versionName - the name of the version
Returns:
the version
Throws:
RedmineServiceException - if any pb while retriving datas
See Also:
Version

getAttachments

public Attachment[] getAttachments(String projectName,
                                   String versionName)
                            throws RedmineServiceException
Description copied from interface: RedmineAnonymousService
Obtain all attachments for a specific version on a given project.

Specified by:
getAttachments in interface RedmineAnonymousService
Parameters:
projectName - the name of the project
versionName - the name of the version
Returns:
the attachments
Throws:
RedmineServiceException - if any pb while retriving datas
See Also:
Attachment

getIssues

public Issue[] getIssues(String projectName,
                         String versionName)
                  throws RedmineServiceException
Description copied from interface: RedmineAnonymousService
Obtain all issues for a specific version on a given project.

Specified by:
getIssues in interface RedmineAnonymousService
Parameters:
projectName - the name of the project
versionName - the name of the version
Returns:
the issues
Throws:
RedmineServiceException - if any pb while retriving datas
See Also:
Issue

getIssueTimeEntries

public TimeEntry[] getIssueTimeEntries(String projectName,
                                       String issueId)
                                throws RedmineServiceException
Description copied from interface: RedmineAnonymousService
Obtain for a given issue of a given project all the time entries.

Specified by:
getIssueTimeEntries in interface RedmineAnonymousService
Parameters:
projectName - the name of the project
issueId - the id of the issue
Returns:
the time entries of the issue
Throws:
RedmineServiceException - if any pb while retrieving time entries of the issue

getIssues

public Issue[] getIssues(String projectName)
                  throws RedmineServiceException
Description copied from interface: RedmineAnonymousService
Obtain all issues for a given project.

Specified by:
getIssues in interface RedmineAnonymousService
Parameters:
projectName - the name of the project
Returns:
the issues
Throws:
RedmineServiceException - if any pb while retriving datas
See Also:
Issue

getOpenedIssues

public Issue[] getOpenedIssues(String projectName)
                        throws RedmineServiceException
Description copied from interface: RedmineAnonymousService
Obtain all opened issues for a given project.

Specified by:
getOpenedIssues in interface RedmineAnonymousService
Parameters:
projectName - the name of the project
Returns:
the issues
Throws:
RedmineServiceException - if any pb while retriving datas
See Also:
Issue

getClosedIssues

public Issue[] getClosedIssues(String projectName)
                        throws RedmineServiceException
Description copied from interface: RedmineAnonymousService
Obtain all closed issues for a given project.

Specified by:
getClosedIssues in interface RedmineAnonymousService
Parameters:
projectName - the name of the project
Returns:
the issues
Throws:
RedmineServiceException - if any pb while retriving datas
See Also:
Issue

init

public RedmineServiceImplementor init(org.nuiton.io.rest.RestClientConfiguration configuration)
                               throws RedmineServiceException
Description copied from interface: RedmineServiceImplementor
Initialize the service given a client configuration.

Specified by:
init in interface RedmineServiceImplementor
Parameters:
configuration - the configuration to be used to init the internal redmine client
Returns:
the initialized service
Throws:
RedmineServiceException - if any pb

init

public RedmineServiceImplementor init(org.nuiton.io.rest.RestClient session)
                               throws RedmineServiceException
Description copied from interface: RedmineServiceImplementor
Initialize the service given a redmine client already initialized.

Specified by:
init in interface RedmineServiceImplementor
Parameters:
session - the redmine client to be used by the service
Returns:
the initialized service
Throws:
RedmineServiceException - if any pb
See Also:
RedmineRestClient

getData

public <T> T getData(String requestName,
                     Class<T> type,
                     Object... args)
          throws RedmineServiceException
Description copied from interface: RedmineServiceImplementor
Generic method to obtain a single data from a redmine server.

Specified by:
getData in interface RedmineServiceImplementor
Type Parameters:
T - the type of data to obtain
Parameters:
requestName - the name of the request to use
type - the type of data to obtain
args - the parameters to obtain the data
Returns:
the obtained data
Throws:
RedmineServiceException - if any pb

getDatas

public <T> T[] getDatas(String requestName,
                        Class<T> type,
                        Object... args)
             throws RedmineServiceException
Description copied from interface: RedmineServiceImplementor
Generic method to obtain a array of data from a redmine server.

Specified by:
getDatas in interface RedmineServiceImplementor
Type Parameters:
T - the type of data to obtain
Parameters:
requestName - the name of the request to use
type - the type of data to obtain
args - the parameters to obtain the datas
Returns:
the obtained datas
Throws:
RedmineServiceException - if any pb

sendData

public <T> T sendData(String requestName,
                      Class<T> klazz,
                      Object... args)
           throws RedmineServiceException
Description copied from interface: RedmineServiceImplementor
Generic method to send a data to a redmine server and return the single data updated from the redmine server.

Specified by:
sendData in interface RedmineServiceImplementor
Type Parameters:
T - the type of data to treate
Parameters:
requestName - the name of the request used
klazz - the type of data to treate
args - the parameters of the request
Returns:
the updated data
Throws:
RedmineServiceException - if any pb

sendDatas

public <T> T[] sendDatas(String requestName,
                         Class<T> klazz,
                         Object... args)
              throws RedmineServiceException
Description copied from interface: RedmineServiceImplementor
Generic method to send a data (or more ) to a redmine server and return the array of data from the redmine server.

Specified by:
sendDatas in interface RedmineServiceImplementor
Type Parameters:
T - the type of data to treate
Parameters:
requestName - the name of the request used
klazz - the type of data to treate
args - the parameters of the request
Returns:
the updated data
Throws:
RedmineServiceException - if any pb

isInit

public boolean isInit()
Description copied from interface: RedmineServiceImplementor
Tests if the service is loogued to the redmine service.

Specified by:
isInit in interface RedmineServiceImplementor
Returns:
true is service is init and loggued to Redmine service, false otherwise.

destroy

public void destroy()
             throws RedmineServiceException
Description copied from interface: RedmineServiceImplementor
Close the service and destroy any connexion to the redmine service.

Specified by:
destroy in interface RedmineServiceImplementor
Throws:
RedmineServiceException - if any pb

checkNotLoggued

public void checkNotLoggued(org.nuiton.io.rest.RestClient session)
                     throws IllegalStateException,
                            RedmineServiceLoginException,
                            NullPointerException
Description copied from interface: RedmineServiceImplementor
Checks if the current session is anonymous.

Specified by:
checkNotLoggued in interface RedmineServiceImplementor
Parameters:
session - the session to test
Throws:
RedmineServiceLoginException - if not anonymous
NullPointerException - if something is null
IllegalStateException

checkLoggued

public void checkLoggued()
                  throws IllegalStateException,
                         RedmineServiceLoginException,
                         NullPointerException
Description copied from interface: RedmineServiceImplementor
Checks if the current session is not a anonymous one.

Specified by:
checkLoggued in interface RedmineServiceImplementor
Throws:
IllegalStateException - if service not init
RedmineServiceLoginException - if not loggued
NullPointerException - if something is null


Copyright © 2009-2012 CodeLutin. All Rights Reserved.