| java.lang.Object |
| ↳ |
org.mule.LiquidPlanner.client.services.impl.AbstractServiceClient |
Known Direct Subclasses
AccountServiceClient,
ActivityServiceClient,
CheckListItemServiceClient,
ClientServiceClient,
CommentServiceClient,
CustomFieldServiceClient,
DocumentServiceClient,
EventServiceClient,
FolderServiceClient,
LinkServiceClient,
MemberServiceClient,
MilestoneServiceClient,
PackageServiceClient,
ProjectServiceClient,
TaskServiceClient,
TimesheetEntryServiceClient,
TimesheetServiceClient,
TreeItemServiceClient,
WorkspaceServiceClient
|
Class Overview
Base class for all the service client in this project. The class handles:
base URL creation, creation of the Jersey client, set up of basic
authentication headers, read of files from input streams, string
serialization of the responses
Summary
| Protected Methods |
|
<T extends TreeItem>
T
|
createEntity(String entityType, T entity, String url)
|
|
<T extends TreeItem>
T
|
deleteEntity(String url, Class clazz)
|
|
<T>
T
|
deserializeResponse(ClientResponse clientResponse, Type type)
|
|
<T extends TreeItem>
T
|
deserializeResponse(ClientResponse clientResponse, Class<T> clazz)
|
|
abstract
String
|
extendGetBaseUrl(String baseUrl)
This method is called by getBaseURL for the user to extend the base URL
of its ServiceClient implementation.
|
|
Map<String, String>
|
filterListToMap(List<Filter> filters)
Wraps the filter into a map that can be use as a parameter map for the
request.
|
|
String
|
getBaseURL()
Builds the base URL for this service.
|
|
WebResource.Builder
|
getBuilder(String user, String password, String url, Map<String, String> queryParameters)
Creates a Builder
|
|
String
|
getFileContentInBase64(InputStream inputStream)
|
|
abstract
ClientConfig
|
getJerseyClientConfiguration()
This method is called by getBuilder before the creation of the
Client.
|
|
abstract
List<ClientFilter>
|
getJerseyClientFilters()
This method is called by getBuilder before the creation of the
Client.
|
|
MultivaluedMap<String, String>
|
mapToMultivaluedMap(Map<String, String> map)
Transform a map in a MultivaluedMap which is needed by Jersey to
send query parameters.
|
|
String
|
readInputStreamToString(InputStream inputStream)
|
|
String
|
readResponseFromClientResponse(ClientResponse clientResponse)
|
|
<T extends TreeItem>
T
|
updateEntity(String entityType, T entity, String url)
|
|
void
|
validateHttpStatus(ClientResponse clientResponse)
Throws exception when the status is greater than 400.
|
|
[Expand]
Inherited Methods |
From class
java.lang.Object
|
Object
|
clone()
|
|
boolean
|
equals(Object arg0)
|
|
void
|
finalize()
|
|
final
Class<?>
|
getClass()
|
|
int
|
hashCode()
|
|
final
void
|
notify()
|
|
final
void
|
notifyAll()
|
|
String
|
toString()
|
|
final
void
|
wait()
|
|
final
void
|
wait(long arg0, int arg1)
|
|
final
void
|
wait(long arg0)
|
|
Constants
private
static
final
String
DEFAULT_BASE_URL
Constant Value:
"https://app.liquidplanner.com/api"
Fields
protected
String
password
Public Constructors
public
AbstractServiceClient
(String user, String password)
Public Methods
public
void
setBaseUrl
(String baseUrl)
Protected Methods
protected
T
createEntity
(String entityType, T entity, String url)
protected
T
deleteEntity
(String url, Class clazz)
protected
T
deserializeResponse
(ClientResponse clientResponse, Type type)
protected
T
deserializeResponse
(ClientResponse clientResponse, Class<T> clazz)
protected
abstract
String
extendGetBaseUrl
(String baseUrl)
This method is called by getBaseURL for the user to extend the base URL
of its ServiceClient implementation.
Parameters
| baseUrl
| The URL created by getBaseURL |
protected
Map<String, String>
filterListToMap
(List<Filter> filters)
Wraps the filter into a map that can be use as a parameter map for the
request.
Returns
- null if the filter is null
protected
String
getBaseURL
()
Builds the base URL for this service.
Returns
- the base URL with no final "/".
protected
WebResource.Builder
getBuilder
(String user, String password, String url, Map<String, String> queryParameters)
Parameters
| user
| |
| password
| |
| url
| The URL to be hit by the client |
| queryParameters
| A map containing all the query parameters |
protected
String
getFileContentInBase64
(InputStream inputStream)
protected
abstract
ClientConfig
getJerseyClientConfiguration
()
This method is called by getBuilder before the creation of the
Client. The ClientConfig is used to create the
Client.
Returns
- null if there are ClientConfig to be added.
protected
abstract
List<ClientFilter>
getJerseyClientFilters
()
This method is called by getBuilder before the creation of the
Client. The ClientFilter is used to create the
Client. If there are no ClientFilter to be added just
return null.
Returns
- null if there are no ClientFilter to be added.
protected
MultivaluedMap<String, String>
mapToMultivaluedMap
(Map<String, String> map)
Transform a map in a MultivaluedMap which is needed by Jersey to
send query parameters. It also validate that not empty parameters are
being send.
Parameters
| map
| The map of query parameters |
Returns
- the same map in an MultivaluedMap object.
protected
String
readInputStreamToString
(InputStream inputStream)
protected
String
readResponseFromClientResponse
(ClientResponse clientResponse)
protected
T
updateEntity
(String entityType, T entity, String url)
protected
void
validateHttpStatus
(ClientResponse clientResponse)
Throws exception when the status is greater than 400. It knows how to
build the error and deserialize the status response.