Class SubjectAreaRestClient
- java.lang.Object
-
- org.odpi.openmetadata.commonservices.ffdc.rest.FFDCRESTClientBase
-
- org.odpi.openmetadata.commonservices.ffdc.rest.FFDCRESTClient
-
- org.odpi.openmetadata.accessservices.subjectarea.client.SubjectAreaRestClient
-
public class SubjectAreaRestClient extends FFDCRESTClient
RESTClient is responsible for issuing calls to the Subject Area OMAS REST APIs. In this class with methods there is a parameter "urnTemplate" below is an example for a better understanding. For example "/servers/%s/open-metadata/access-services/subject-area/users/%s/categories/%s" where first %s - serverName, second %s - userId and third %s - guid This URN will be a continuation of serverPlatformURLRoot, which was set when creating the object
-
-
Field Summary
Fields Modifier and Type Field Description protected static InvalidParameterHandlerinvalidParameterHandler-
Fields inherited from class org.odpi.openmetadata.commonservices.ffdc.rest.FFDCRESTClientBase
auditLog, exceptionHandler
-
-
Constructor Summary
Constructors Constructor Description SubjectAreaRestClient(String serverName, String serverPlatformURLRoot)SubjectAreaRestClient(String serverName, String serverPlatformURLRoot, String userId, String password)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QueryBuildercreateFindQuery(String methodName, FindRequest findRequest)Method for constructing a query (https://en.wikipedia.org/wiki/Query_string) using the information described in the findRequest page size and startingFrom need to set by the caller.QueryBuildercreateFindQuery(String methodName, FindRequest findRequest, QueryParams queryParams)Method for constructing a query (https://en.wikipedia.org/wiki/Query_string) using the information described in the findRequest page size and startingFrom need to set by the caller.<T> GenericResponse<T>deleteRESTCall(String userId, String guid, String methodName, org.springframework.core.ParameterizedTypeReference<GenericResponse<T>> type, String urnTemplate)Issue a Delete REST call<T> GenericResponse<T>findRESTCall(String userId, String guid, String methodName, String urnTemplate, org.springframework.core.ParameterizedTypeReference<GenericResponse<T>> type, FindRequest findRequest, Integer maximumPageSizeOnRestCall)Issue a GET REST call that returns a response found objects using the information described in findRequest<T> GenericResponse<T>findRESTCall(String userId, String methodName, String urnTemplate, org.springframework.core.ParameterizedTypeReference<GenericResponse<T>> type, FindRequest findRequest, QueryParams queryParams)Issue a GET REST call that returns a response found objects using the information described in findRequest, specifying the maximum amount that the downstream server supports.<T> GenericResponse<T>findRESTCall(String userId, String methodName, String urnTemplate, org.springframework.core.ParameterizedTypeReference<GenericResponse<T>> type, FindRequest findRequest, QueryParams queryParams, Integer maximumPageSizeOnRestCall)Issue a GET REST call that returns a response found objects using the information described in findRequest, specifying the maximum amount that the downstream server supports.<T> GenericResponse<T>getByIdRESTCall(String userId, String guid, String methodName, org.springframework.core.ParameterizedTypeReference<GenericResponse<T>> type, String urnTemplate)Issue a GET REST call that returns a response object by guid.<T> GenericResponse<T>getByIdRESTCall(String userId, String guid, String methodName, org.springframework.core.ParameterizedTypeReference<GenericResponse<T>> type, String urnTemplate, FindRequest findRequest)Issue a GET REST call that returns a response object by guid.<T> GenericResponse<T>getByIdRESTCall(String userId, String guid, String methodName, org.springframework.core.ParameterizedTypeReference<GenericResponse<T>> type, String urnTemplate, FindRequest findRequest, Integer maximumPageSizeOnRestCall, QueryParams queryParams)Issue a GET REST call that returns a response object by guid.StringgetServerName()StringgetServerPlatformURLRoot()<T> GenericResponse<T>postRESTCall(String userId, String methodName, String urnTemplate, org.springframework.core.ParameterizedTypeReference<GenericResponse<T>> type, T requestBody)Issue a POST REST call that returns a response object.<T> GenericResponse<T>putRESTCall(String userId, String guid, String methodName, String urnTemplate, org.springframework.core.ParameterizedTypeReference<GenericResponse<T>> type, T requestBody)Issue a PUT REST call that returns a response object.<T> GenericResponse<T>restoreRESTCall(String userId, String guid, String methodName, org.springframework.core.ParameterizedTypeReference<GenericResponse<T>> type, String urnTemplate)Issue a restore object-
Methods inherited from class org.odpi.openmetadata.commonservices.ffdc.rest.FFDCRESTClient
callCountGetRESTCall, callGUIDGetRESTCall, callGUIDListGetRESTCall, callGUIDListPostRESTCall, callGUIDPostRESTCall, callNameListGetRESTCall, callOCFConnectorReportGetRESTCall, callStringMapGetRESTCall, callVoidGetRESTCall, callVoidPostRESTCall
-
Methods inherited from class org.odpi.openmetadata.commonservices.ffdc.rest.FFDCRESTClientBase
callDeleteRESTCall, callDeleteRESTCall, callGetRESTCall, callGetRESTCall, callGetRESTCallNoParams, callPostRESTCall, callPostRESTCall, callPostRESTCallNoParams, callPutRESTCall, callPutRESTCall
-
-
-
-
Field Detail
-
invalidParameterHandler
protected static final InvalidParameterHandler invalidParameterHandler
-
-
Constructor Detail
-
SubjectAreaRestClient
public SubjectAreaRestClient(String serverName, String serverPlatformURLRoot) throws InvalidParameterException
- Throws:
InvalidParameterException
-
SubjectAreaRestClient
public SubjectAreaRestClient(String serverName, String serverPlatformURLRoot, String userId, String password) throws InvalidParameterException
- Throws:
InvalidParameterException
-
-
Method Detail
-
postRESTCall
public <T> GenericResponse<T> postRESTCall(String userId, String methodName, String urnTemplate, org.springframework.core.ParameterizedTypeReference<GenericResponse<T>> type, T requestBody) throws PropertyServerException, UserNotAuthorizedException, InvalidParameterException
Issue a POST REST call that returns a response object. This is typically a create, update, or find with complex parameters.- Type Parameters:
T- return type for results inGenericResponse- Parameters:
userId- unique identifier for requesting user, under which the request is performedmethodName- name of the method being called.type- class of the response for generic object. Descried usingParameterizedTypeReferenceAn example can be seen hereResponseParameterization.getParameterizedType()urnTemplate- template of the URN for the REST API call with place-holders for the parameters.requestBody- request body for the request.- Returns:
- GenericResponse with T result
- Throws:
PropertyServerException- something went wrong with the REST call stack.UserNotAuthorizedException- the requesting user is not authorized to issue this request.InvalidParameterException- one of the parameters is null or invalid
-
putRESTCall
public <T> GenericResponse<T> putRESTCall(String userId, String guid, String methodName, String urnTemplate, org.springframework.core.ParameterizedTypeReference<GenericResponse<T>> type, T requestBody) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException
Issue a PUT REST call that returns a response object. This is typically an update.- Type Parameters:
T- return type for results inGenericResponse- Parameters:
userId- unique identifier for requesting user, under which the request is performedguid- unique identifier of the update objectmethodName- name of the method being called.type- class of the response for generic object. Descried usingParameterizedTypeReferenceAn example can be seen hereResponseParameterization.getParameterizedType()urnTemplate- template of the URN for the REST API call with place-holders for the parameters.requestBody- request body for the request.- Returns:
- GenericResponse with T result
- Throws:
PropertyServerException- something went wrong with the REST call stack.UserNotAuthorizedException- the requesting user is not authorized to issue this request.InvalidParameterException- one of the parameters is null or invalid
-
getByIdRESTCall
public <T> GenericResponse<T> getByIdRESTCall(String userId, String guid, String methodName, org.springframework.core.ParameterizedTypeReference<GenericResponse<T>> type, String urnTemplate) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException
Issue a GET REST call that returns a response object by guid. This is a get for a single object.- Type Parameters:
T- return type for results inGenericResponse- Parameters:
userId- unique identifier for requesting user, under which the request is performedguid- unique identifier of the received objectmethodName- name of the method being called.type- class of the response for generic object. Descried usingParameterizedTypeReferenceAn example can be seen hereResponseParameterization.getParameterizedType()urnTemplate- template of the URN for the REST API call with place-holders for the parameters.- Returns:
- GenericResponse with T result
- Throws:
PropertyServerException- something went wrong with the REST call stack.UserNotAuthorizedException- the requesting user is not authorized to issue this request.InvalidParameterException- one of the parameters is null or invalid
-
getByIdRESTCall
public <T> GenericResponse<T> getByIdRESTCall(String userId, String guid, String methodName, org.springframework.core.ParameterizedTypeReference<GenericResponse<T>> type, String urnTemplate, FindRequest findRequest) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException
Issue a GET REST call that returns a response object by guid.- Type Parameters:
T- return type for results inGenericResponse- Parameters:
userId- unique identifier for requesting user, under which the request is performedguid- unique identifier of the received objectmethodName- name of the method being called.type- class of the response for generic object. Descried usingParameterizedTypeReferenceAn example can be seen hereResponseParameterization.getParameterizedType()urnTemplate- template of the URN for the REST API call with place-holders for the parameters.findRequest- search specification- Returns:
- GenericResponse with T result
- Throws:
PropertyServerException- something went wrong with the REST call stack.UserNotAuthorizedException- the requesting user is not authorized to issue this request.InvalidParameterException- one of the parameters is null or invalid
-
getByIdRESTCall
public <T> GenericResponse<T> getByIdRESTCall(String userId, String guid, String methodName, org.springframework.core.ParameterizedTypeReference<GenericResponse<T>> type, String urnTemplate, FindRequest findRequest, Integer maximumPageSizeOnRestCall, QueryParams queryParams) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException
Issue a GET REST call that returns a response object by guid.- Type Parameters:
T- return type for results inGenericResponse- Parameters:
userId- unique identifier for requesting user, under which the request is performedguid- unique identifier of the received objectmethodName- name of the method being called.type- class of the response for generic object. Descried usingParameterizedTypeReferenceAn example can be seen hereResponseParameterization.getParameterizedType()urnTemplate- template of the URN for the REST API call with place-holders for the parameters.maximumPageSizeOnRestCall- maximum page size that can be used on rest calls, null and 0 mean no limit set.findRequest- search specificationqueryParams-QueryParams- Returns:
- GenericResponse with T result
- Throws:
PropertyServerException- something went wrong with the REST call stack.UserNotAuthorizedException- the requesting user is not authorized to issue this request.InvalidParameterException- one of the parameters is null or invalid
-
findRESTCall
public <T> GenericResponse<T> findRESTCall(String userId, String methodName, String urnTemplate, org.springframework.core.ParameterizedTypeReference<GenericResponse<T>> type, FindRequest findRequest, QueryParams queryParams) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException
Issue a GET REST call that returns a response found objects using the information described in findRequest, specifying the maximum amount that the downstream server supports.- Type Parameters:
T- return type for results inGenericResponse- Parameters:
userId- unique identifier for requesting user, under which the request is performedmethodName- name of the method being called.urnTemplate- template of the URN for the REST API call with place-holders for the parameters.type- class of the response for generic object. Descried usingParameterizedTypeReferenceAn example can be seen hereResponseParameterization.getParameterizedType()findRequest-FindRequestqueryParams-QueryParams- Returns:
- GenericResponse with T results
- Throws:
PropertyServerException- something went wrong with the REST call stack.UserNotAuthorizedException- the requesting user is not authorized to issue this request.InvalidParameterException- one of the parameters is null or invalid
-
findRESTCall
public <T> GenericResponse<T> findRESTCall(String userId, String methodName, String urnTemplate, org.springframework.core.ParameterizedTypeReference<GenericResponse<T>> type, FindRequest findRequest, QueryParams queryParams, Integer maximumPageSizeOnRestCall) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException
Issue a GET REST call that returns a response found objects using the information described in findRequest, specifying the maximum amount that the downstream server supports.- Type Parameters:
T- return type for results inGenericResponse- Parameters:
userId- unique identifier for requesting user, under which the request is performedmethodName- name of the method being called.urnTemplate- template of the URN for the REST API call with place-holders for the parameters.type- class of the response for generic object. Descried usingParameterizedTypeReferenceAn example can be seen hereResponseParameterization.getParameterizedType()findRequest-FindRequestmaximumPageSizeOnRestCall- maximum page size that can be used on rest calls, null and 0 mean no limit set.queryParams-QueryParams- Returns:
- GenericResponse with T results
- Throws:
PropertyServerException- something went wrong with the REST call stack.UserNotAuthorizedException- the requesting user is not authorized to issue this request.InvalidParameterException- one of the parameters is null or invalid
-
findRESTCall
public <T> GenericResponse<T> findRESTCall(String userId, String guid, String methodName, String urnTemplate, org.springframework.core.ParameterizedTypeReference<GenericResponse<T>> type, FindRequest findRequest, Integer maximumPageSizeOnRestCall) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException
Issue a GET REST call that returns a response found objects using the information described in findRequest- Type Parameters:
T- return type for results inGenericResponse- Parameters:
userId- unique identifier for requesting user, under which the request is performedguid- unique identifier of the object to which the found objects should relatemethodName- name of the method being called.urnTemplate- template of the URN for the REST API call with place-holders for the parameters.type- class of the response for generic object. Descried usingParameterizedTypeReferenceAn example can be seen hereResponseParameterization.getParameterizedType()findRequest-FindRequestmaximumPageSizeOnRestCall- maximum number of results- Returns:
- GenericResponse with T results
- Throws:
PropertyServerException- something went wrong with the REST call stack.UserNotAuthorizedException- the requesting user is not authorized to issue this request.InvalidParameterException- one of the parameters is null or invalid
-
deleteRESTCall
public <T> GenericResponse<T> deleteRESTCall(String userId, String guid, String methodName, org.springframework.core.ParameterizedTypeReference<GenericResponse<T>> type, String urnTemplate) throws PropertyServerException, UserNotAuthorizedException, InvalidParameterException
Issue a Delete REST call- Type Parameters:
T- return type for results inGenericResponse- Parameters:
userId- unique identifier for requesting user, under which the request is performedguid- unique identifier of the delete objectmethodName- name of the method being called.type- class of the response for generic object. Descried usingParameterizedTypeReferenceAn example can be seen hereResponseParameterization.getParameterizedType()urnTemplate- template of the URN for the REST API call with place-holders for the parameters.- Returns:
- GenericResponse with T result
- Throws:
PropertyServerException- something went wrong with the REST call stack.UserNotAuthorizedException- the requesting user is not authorized to issue this request.InvalidParameterException- one of the parameters is null or invalid
-
restoreRESTCall
public <T> GenericResponse<T> restoreRESTCall(String userId, String guid, String methodName, org.springframework.core.ParameterizedTypeReference<GenericResponse<T>> type, String urnTemplate) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException
Issue a restore object- Type Parameters:
T- return type for results inGenericResponse- Parameters:
userId- unique identifier for requesting user, under which the request is performedguid- unique identifier of the restore objectmethodName- name of the method being called.type- class of the response for generic object. Descried usingParameterizedTypeReferenceAn example can be seen hereResponseParameterization.getParameterizedType()urnTemplate- template of the URN for the REST API call with place-holders for the parameters.- Returns:
- GenericResponse with T result
- Throws:
PropertyServerException- something went wrong with the REST call stack.UserNotAuthorizedException- the requesting user is not authorized to issue this request.InvalidParameterException- one of the parameters is null or invalid
-
createFindQuery
public QueryBuilder createFindQuery(String methodName, FindRequest findRequest) throws InvalidParameterException
Method for constructing a query (https://en.wikipedia.org/wiki/Query_string) using the information described in the findRequest page size and startingFrom need to set by the caller.- Parameters:
methodName- name of the method being called.findRequest-FindRequest- Returns:
- query
- Throws:
InvalidParameterException- one of the parameters is null or invalid
-
createFindQuery
public QueryBuilder createFindQuery(String methodName, FindRequest findRequest, QueryParams queryParams) throws InvalidParameterException
Method for constructing a query (https://en.wikipedia.org/wiki/Query_string) using the information described in the findRequest page size and startingFrom need to set by the caller.- Parameters:
methodName- name of the method being called.findRequest-FindRequestqueryParams-QueryParams- Returns:
- query
- Throws:
InvalidParameterException- one of the parameters is null or invalid
-
getServerName
public String getServerName()
-
getServerPlatformURLRoot
public String getServerPlatformURLRoot()
-
-