com.licorize.api.client.impl
Class LicorizeClientImpl

java.lang.Object
  extended by com.licorize.api.client.impl.LicorizeClientImpl
All Implemented Interfaces:
LicorizeAuthenticationClient, LicorizeClient

public class LicorizeClientImpl
extends java.lang.Object
implements LicorizeClient

Author:
Federico Soldani - fsoldani@open-lab.com

Field Summary
protected  java.util.logging.Logger LOG
          The static logger.
 
Constructor Summary
LicorizeClientImpl(java.lang.String consumerKey, java.lang.String consumerSecret)
          Constructs ...
 
Method Summary
protected  void assertNotNullOrEmpty(java.lang.String name, java.lang.String value)
           
protected  void assertPositiveNumber(java.lang.String name, int value)
           
protected  org.scribe.oauth.OAuthService buildService()
           
protected  org.scribe.model.Response callApiMethod(java.lang.String apiUrl)
           
protected  org.scribe.model.Response callApiMethod(java.lang.String apiUrl, org.scribe.model.Verb verb)
           
protected  org.scribe.model.Response callOAuthApiMethod(java.lang.String apiUrl)
           
protected  org.scribe.model.Response callOAuthApiMethod(java.lang.String apiUrl, java.util.List<Parameter<java.lang.String,java.lang.String>> parameters)
           
protected  org.scribe.model.Response callOAuthApiMethod(java.lang.String apiUrl, java.util.List<Parameter<java.lang.String,java.lang.String>> parameters, org.scribe.model.Verb verb)
           
 LicorizeApiResponse changeStripType(int stripId, java.lang.String stripType)
          Change a strip type.
protected  LicorizeApiUrls.LicorizeApiUrlBuilder createLicorizeApiUrlBuilder(java.lang.String urlFormat)
           
 LicorizeApiResponse createProject(java.util.List<Parameter<java.lang.String,java.lang.String>> parameters)
          Create project
 LicorizeApiResponse createStrip(java.util.List<Parameter<java.lang.String,java.lang.String>> parameters)
          Create single strip
 org.scribe.model.Token getAccessToken(org.scribe.model.Token requestToken)
           
 java.lang.String getAuthenticationUrl(org.scribe.model.Token requestToken)
           
 LicorizeApiResponse getProject(int projectId)
          Return the project identified by the specified ID.
 LicorizeApiResponse getProjectMembers(int projectId)
          Return the project members list.
 LicorizeApiResponse getProjectsList()
          Return the projects list for the current user.
 LicorizeApiResponse getPublicUser(java.lang.String userName)
          Get user public data from userName.
 org.scribe.model.Token getRequestToken()
           
 LicorizeApiResponse getStrip(int stripId)
          Returns the strip identified by the specified ID.
 LicorizeApiResponse getStripList()
          Returns strips from time line in descending order
 LicorizeApiResponse getStripList(java.util.List<Parameter<java.lang.String,java.lang.String>> parameters)
          Returns the last strips from the user time line
 LicorizeApiResponse getTagsList()
          Show the complete tag cloud.
 LicorizeApiResponse getUser()
          Get the current user.
protected  boolean isNullOrEmpty(java.lang.String s)
           
protected  LicorizeApiResponse readResponse(org.scribe.model.Response response)
           
 LicorizeApiResponse remindMeLater(java.lang.String url)
          Method for saving a new remind me later strip.
 LicorizeApiResponse remindMeLater(java.lang.String url, java.util.List<Parameter<java.lang.String,java.lang.String>> parameters)
          Method for save a new remind me later strip.
 LicorizeApiResponse removeProject(int projectId)
          Remove single project identified by the specified ID.
 LicorizeApiResponse removeStrip(int stripId)
          Remove the strip identified by the specified ID.
 void setAccessToken(org.scribe.model.Token accessToken)
           
protected  LicorizeApiResponse unmarshallObject(org.scribe.model.Response response)
           
 LicorizeApiResponse updateProject(int projectId, java.util.List<Parameter<java.lang.String,java.lang.String>> parameters)
          Update project.
 LicorizeApiResponse updateStrip(int stripId, java.util.List<Parameter<java.lang.String,java.lang.String>> parameters)
          Update single strip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected final java.util.logging.Logger LOG
The static logger.

Constructor Detail

LicorizeClientImpl

public LicorizeClientImpl(java.lang.String consumerKey,
                          java.lang.String consumerSecret)
Constructs ...

Parameters:
consumerKey -
consumerSecret -
Method Detail

getRequestToken

public org.scribe.model.Token getRequestToken()
Specified by:
getRequestToken in interface LicorizeAuthenticationClient
Returns:
request token

getAccessToken

public org.scribe.model.Token getAccessToken(org.scribe.model.Token requestToken)
Specified by:
getAccessToken in interface LicorizeAuthenticationClient
Returns:
request token

getAuthenticationUrl

public java.lang.String getAuthenticationUrl(org.scribe.model.Token requestToken)
Specified by:
getAuthenticationUrl in interface LicorizeAuthenticationClient
Returns:
authentication url

setAccessToken

public void setAccessToken(org.scribe.model.Token accessToken)
Specified by:
setAccessToken in interface LicorizeAuthenticationClient

getStripList

public LicorizeApiResponse getStripList()
Description copied from interface: LicorizeClient
Returns strips from time line in descending order

Specified by:
getStripList in interface LicorizeClient
Returns:
strips list

getStripList

public LicorizeApiResponse getStripList(java.util.List<Parameter<java.lang.String,java.lang.String>> parameters)
Description copied from interface: LicorizeClient
Returns the last strips from the user time line

Specified by:
getStripList in interface LicorizeClient
Returns:
strip list more - true if there are more strips in result list totStrips - the whole number of matching strips lastMillis - the oldest timeStamp in the response (used in next call if more is true on "millis" parameter) strips - strip list tags - an array of tags used by matching strips

getStrip

public LicorizeApiResponse getStrip(int stripId)
Description copied from interface: LicorizeClient
Returns the strip identified by the specified ID.

Specified by:
getStrip in interface LicorizeClient
Returns:
strip

updateStrip

public LicorizeApiResponse updateStrip(int stripId,
                                       java.util.List<Parameter<java.lang.String,java.lang.String>> parameters)
Description copied from interface: LicorizeClient
Update single strip

Specified by:
updateStrip in interface LicorizeClient
parameters - Optional: type - Strip Type e.g. 'BOOKMARK' teamId - Project Id notes - Strip Notes ownerId - User Id title - Strip title url - Strip url email - Strip email tags - Strip tags (comma separated list) sticky - Is Sticky Strip - ('yes' - 'no') worklogDone - total worklog done dueDate - Strip due date time - if present 'dueDate' - for instance "REMAINDER" done - ('yes' - 'no') - Strip done
Returns:
strip updated

createStrip

public LicorizeApiResponse createStrip(java.util.List<Parameter<java.lang.String,java.lang.String>> parameters)
Description copied from interface: LicorizeClient
Create single strip

Specified by:
createStrip in interface LicorizeClient
Parameters:
parameters - Optional: type - Strip Type e.g. 'BOOKMARK' teamId - Project Id notes - Strip Notes ownerId - User Id title - Strip title url - Strip url email - Strip email tags - Strip tags (comma separated list) sticky - Is Sticky Strip - ('yes' - 'no') worklogDone - total worklog done dueDate - Strip dueDate time - if present 'dueDate' - for instance "REMAINDER" done - ('yes' - 'no') - Strip done
Returns:
strip created

removeStrip

public LicorizeApiResponse removeStrip(int stripId)
Description copied from interface: LicorizeClient
Remove the strip identified by the specified ID.

Specified by:
removeStrip in interface LicorizeClient
Returns:
success or fail operation

changeStripType

public LicorizeApiResponse changeStripType(int stripId,
                                           java.lang.String stripType)
Description copied from interface: LicorizeClient
Change a strip type.

Specified by:
changeStripType in interface LicorizeClient
Returns:
strip updated

getProjectsList

public LicorizeApiResponse getProjectsList()
Description copied from interface: LicorizeClient
Return the projects list for the current user.

Specified by:
getProjectsList in interface LicorizeClient
Returns:
projects list

updateProject

public LicorizeApiResponse updateProject(int projectId,
                                         java.util.List<Parameter<java.lang.String,java.lang.String>> parameters)
Description copied from interface: LicorizeClient
Update project.

Specified by:
updateProject in interface LicorizeClient
parameters - Optional: name - Team name description - Team description isActive - ('yes' - 'no') isVisible - ('yes' - 'no') code - Team code for public name
Returns:
project updated

createProject

public LicorizeApiResponse createProject(java.util.List<Parameter<java.lang.String,java.lang.String>> parameters)
Description copied from interface: LicorizeClient
Create project

Specified by:
createProject in interface LicorizeClient
Parameters:
parameters - Optional: name - Team name description - Team description isActive - ('yes' - 'no') isVisible - ('yes' - 'no') code - Team code for public name
Returns:
project created

getProject

public LicorizeApiResponse getProject(int projectId)
Description copied from interface: LicorizeClient
Return the project identified by the specified ID.

Specified by:
getProject in interface LicorizeClient
Returns:
project

getProjectMembers

public LicorizeApiResponse getProjectMembers(int projectId)
Description copied from interface: LicorizeClient
Return the project members list.

Specified by:
getProjectMembers in interface LicorizeClient
Returns:
project members

removeProject

public LicorizeApiResponse removeProject(int projectId)
Description copied from interface: LicorizeClient
Remove single project identified by the specified ID.

Specified by:
removeProject in interface LicorizeClient
Returns:
success or fail operation

getTagsList

public LicorizeApiResponse getTagsList()
Description copied from interface: LicorizeClient
Show the complete tag cloud.

Specified by:
getTagsList in interface LicorizeClient
Returns:
tags list for current user

getUser

public LicorizeApiResponse getUser()
Description copied from interface: LicorizeClient
Get the current user.

Specified by:
getUser in interface LicorizeClient
Returns:
current user

getPublicUser

public LicorizeApiResponse getPublicUser(java.lang.String userName)
Description copied from interface: LicorizeClient
Get user public data from userName.

Specified by:
getPublicUser in interface LicorizeClient
Returns:
public user

remindMeLater

public LicorizeApiResponse remindMeLater(java.lang.String url)
Description copied from interface: LicorizeClient
Method for saving a new remind me later strip.

Specified by:
remindMeLater in interface LicorizeClient
Parameters:
url - The url that will be saved.
Returns:
The created strip

remindMeLater

public LicorizeApiResponse remindMeLater(java.lang.String url,
                                         java.util.List<Parameter<java.lang.String,java.lang.String>> parameters)
Description copied from interface: LicorizeClient
Method for save a new remind me later strip.

Specified by:
remindMeLater in interface LicorizeClient
Parameters:
url - The url that will be saved.
parameters - title - Bookmark title notes - Bookmark Notes tags - Bookmark Tags - Default is "remindMeLater"
Returns:
The created strip

createLicorizeApiUrlBuilder

protected LicorizeApiUrls.LicorizeApiUrlBuilder createLicorizeApiUrlBuilder(java.lang.String urlFormat)

callOAuthApiMethod

protected org.scribe.model.Response callOAuthApiMethod(java.lang.String apiUrl)

callOAuthApiMethod

protected org.scribe.model.Response callOAuthApiMethod(java.lang.String apiUrl,
                                                       java.util.List<Parameter<java.lang.String,java.lang.String>> parameters)

callOAuthApiMethod

protected org.scribe.model.Response callOAuthApiMethod(java.lang.String apiUrl,
                                                       java.util.List<Parameter<java.lang.String,java.lang.String>> parameters,
                                                       org.scribe.model.Verb verb)

callApiMethod

protected org.scribe.model.Response callApiMethod(java.lang.String apiUrl)

callApiMethod

protected org.scribe.model.Response callApiMethod(java.lang.String apiUrl,
                                                  org.scribe.model.Verb verb)

readResponse

protected LicorizeApiResponse readResponse(org.scribe.model.Response response)

unmarshallObject

protected LicorizeApiResponse unmarshallObject(org.scribe.model.Response response)

buildService

protected org.scribe.oauth.OAuthService buildService()

isNullOrEmpty

protected boolean isNullOrEmpty(java.lang.String s)
Parameters:
s -
Returns:

assertNotNullOrEmpty

protected void assertNotNullOrEmpty(java.lang.String name,
                                    java.lang.String value)
Parameters:
name -
value -

assertPositiveNumber

protected void assertPositiveNumber(java.lang.String name,
                                    int value)
Parameters:
name -
value -


Copyright © 2010. All Rights Reserved.