public abstract class BoxResourceManager
extends java.lang.Object
Constructor and Description |
---|
BoxResourceManager(IBoxConfig config,
IBoxResourceHub resourceHub,
IBoxJSONParser parser,
IBoxRequestAuth auth,
IBoxRESTClient restClient)
private constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
executeRequestWithNoResponseBody(DefaultBoxRequest request)
Execute a request and expect no response body.
|
IBoxRequestAuth |
getAuth()
Get auth.
|
IBoxConfig |
getConfig()
Get config.
|
IBoxJSONParser |
getJSONParser() |
IBoxResourceHub |
getResourceHub() |
java.lang.Object |
getResponseAndParse(DefaultBoxRequest request,
BoxResourceType type,
IBoxJSONParser parser)
Make a rest api request, get response, and then parse the response.
|
java.lang.Object |
getResponseAndParseAndTryCast(DefaultBoxRequest request,
BoxResourceType type,
IBoxJSONParser parser)
Make a rest api request, get response, parse the response, and try to cast parsed out object into expected object.
|
protected java.lang.Object |
tryCastBoxItem(BoxResourceType type,
java.lang.Object item)
Try to cast a box item into a concrete class(i.e.
|
java.lang.Object |
tryCastObject(BoxResourceType expectedType,
java.lang.Object obj)
Try to cast an object into a specific class.
|
public BoxResourceManager(IBoxConfig config, IBoxResourceHub resourceHub, IBoxJSONParser parser, IBoxRequestAuth auth, IBoxRESTClient restClient)
config
- ConfigresourceHub
- IResourceHubparser
- json parserauth
- auth for api callsrestClient
- REST client to make api calls.public IBoxRequestAuth getAuth()
public IBoxResourceHub getResourceHub()
public IBoxJSONParser getJSONParser()
public IBoxConfig getConfig()
protected void executeRequestWithNoResponseBody(DefaultBoxRequest request) throws BoxServerException, BoxRestException, AuthFatalFailureException
request
- requestBoxServerException
- excepitonBoxRestException
- exceptionAuthFatalFailureException
- exception indicating authenticating totally failedpublic java.lang.Object getResponseAndParseAndTryCast(DefaultBoxRequest request, BoxResourceType type, IBoxJSONParser parser) throws BoxRestException, AuthFatalFailureException, BoxServerException
request
- requesttype
- typeparser
- json parserAuthFatalFailureException
- exceptionBoxRestException
- exceptionBoxServerException
- exceptionpublic java.lang.Object getResponseAndParse(DefaultBoxRequest request, BoxResourceType type, IBoxJSONParser parser) throws BoxRestException, AuthFatalFailureException
request
- requesttype
- typeparser
- ObjectMapperBoxRestException
- exceptionAuthFatalFailureException
- exception indicating authenticating totally failedprotected java.lang.Object tryCastBoxItem(BoxResourceType type, java.lang.Object item) throws BoxServerException, BoxRestException
isFolder
- whether it's folderitem
- the box item.BoxServerException
- exceptionBoxRestException
- exceptionpublic java.lang.Object tryCastObject(BoxResourceType expectedType, java.lang.Object obj) throws BoxServerException, BoxRestException
expectedType
- expected resource type classobj
- objectBoxServerException
- exceptionBoxRestException
- exception