@Service public class ResourceServiceImpl extends Object implements ResourceService
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
LOG |
protected org.apache.cxf.jaxrs.ext.MessageContext |
messageContext |
protected static String |
OPTIONS_ALLOW |
protected SearchCondVisitor |
searchCondVisitor |
protected org.apache.cxf.jaxrs.ext.search.SearchContext |
searchContext |
protected javax.ws.rs.core.UriInfo |
uriInfo |
CRLF, DOUBLE_DASH, PARAM_ANYTYPE_KIND, PARAM_ANYTYPEKEY, PARAM_CONNID_PAGED_RESULTS_COOKIE, PARAM_DETAILS, PARAM_ENTITY_KEY, PARAM_FIQL, PARAM_MAX, PARAM_NOTIFICATION, PARAM_ORDERBY, PARAM_PAGE, PARAM_REALM, PARAM_RESOURCE, PARAM_SIZE, PARAM_USER
Constructor and Description |
---|
ResourceServiceImpl() |
Modifier and Type | Method and Description |
---|---|
protected javax.ws.rs.core.Response.ResponseBuilder |
applyPreference(ProvisioningResult<?> provisioningResult,
javax.ws.rs.core.Response.ResponseBuilder builder) |
protected <T extends BaseBean> |
buildPagedResult(List<T> list,
int page,
int size,
int totalCount)
Builds a paged result out of a list of items and additional information.
|
void |
check(ResourceTO resourceTO)
Checks whether the connection to resource could be established.
|
protected void |
checkETag(String etag) |
javax.ws.rs.core.Response |
create(ResourceTO resourceTO)
Creates a new resource.
|
protected javax.ws.rs.core.Response |
createResponse(ProvisioningResult<?> provisioningResult)
Builds response to successful
create request, taking into account any Prefer header. |
void |
delete(String key)
Deletes the resource matching the given name.
|
protected String |
getActualKey(AnyDAO<?> dao,
String pretendingKey) |
javax.ws.rs.core.Response |
getConnObjectKeyValue(String key,
String anyTypeKey,
String anyKey)
Returns the calculated connObjectKey value for the given type and key.
|
protected List<OrderByClause> |
getOrderByClauses(String orderBy) |
protected Preference |
getPreference()
Reads
Prefer header from request and parses into a Preference instance. |
protected SearchCond |
getSearchCond(String fiql,
String realm) |
protected boolean |
isNullPriorityAsync() |
List<ResourceTO> |
list()
Returns a list of all resources.
|
protected javax.ws.rs.core.Response |
modificationResponse(Object entity)
Builds response to successful modification request, taking into account any
Prefer header. |
ResourceTO |
read(String key)
Returns the resource with matching name.
|
ConnObjectTO |
readConnObject(String key,
String anyTypeKey,
String value)
Returns connector object from the external resource, for the given type and key.
|
void |
removeSyncToken(String key,
String anyTypeKey)
Removes the sync token value associated to the given any type from the given resource.
|
PagedConnObjectTOResult |
searchConnObjects(String key,
String anyTypeKey,
ConnObjectTOQuery query)
Returns a paged list of connector objects from external resource, for the given type, matching
page/size conditions.
|
void |
setLatestSyncToken(String key,
String anyTypeKey)
Queries the connector underlying the given resource for the latest sync token value associated to the given any
type and stores the value internally, for later usage.
|
void |
update(ResourceTO resourceTO)
Updates the resource matching the given name.
|
protected static final org.slf4j.Logger LOG
protected static final String OPTIONS_ALLOW
@Context protected javax.ws.rs.core.UriInfo uriInfo
@Context protected org.apache.cxf.jaxrs.ext.MessageContext messageContext
@Context protected org.apache.cxf.jaxrs.ext.search.SearchContext searchContext
@Autowired protected SearchCondVisitor searchCondVisitor
public javax.ws.rs.core.Response create(ResourceTO resourceTO)
ResourceService
create
in interface ResourceService
resourceTO
- Resource to be createdpublic void update(ResourceTO resourceTO)
ResourceService
update
in interface ResourceService
resourceTO
- resource to be storedpublic void setLatestSyncToken(String key, String anyTypeKey)
ResourceService
setLatestSyncToken
in interface ResourceService
key
- resourceanyTypeKey
- any typepublic void removeSyncToken(String key, String anyTypeKey)
ResourceService
removeSyncToken
in interface ResourceService
key
- resourceanyTypeKey
- any typepublic void delete(String key)
ResourceService
delete
in interface ResourceService
key
- name of resource to be deletedpublic ResourceTO read(String key)
ResourceService
read
in interface ResourceService
key
- Name of resource to be readpublic List<ResourceTO> list()
ResourceService
list
in interface ResourceService
public javax.ws.rs.core.Response getConnObjectKeyValue(String key, String anyTypeKey, String anyKey)
ResourceService
getConnObjectKeyValue
in interface ResourceService
key
- name of resource to read connector object fromanyTypeKey
- any object typeanyKey
- user, group or any object keypublic ConnObjectTO readConnObject(String key, String anyTypeKey, String value)
ResourceService
readConnObject
in interface ResourceService
key
- name of resource to read connector object fromanyTypeKey
- any object typevalue
- if value looks like a UUID then it is interpreted as user, group or any object key, otherwise
as key value on the resourcepublic PagedConnObjectTOResult searchConnObjects(String key, String anyTypeKey, ConnObjectTOQuery query)
ResourceService
searchConnObjects
in interface ResourceService
key
- name of resource to read connector object fromanyTypeKey
- any object typequery
- query conditionspublic void check(ResourceTO resourceTO)
ResourceService
check
in interface ResourceService
resourceTO
- resource to be checkedprotected boolean isNullPriorityAsync()
protected Preference getPreference()
Prefer
header from request and parses into a Preference
instance.Preference
instance matching the passed Prefer
header,
or Preference.NONE
if missing.protected javax.ws.rs.core.Response.ResponseBuilder applyPreference(ProvisioningResult<?> provisioningResult, javax.ws.rs.core.Response.ResponseBuilder builder)
protected javax.ws.rs.core.Response createResponse(ProvisioningResult<?> provisioningResult)
create
request, taking into account any Prefer
header.provisioningResult
- the entity just createdcreate
requestprotected javax.ws.rs.core.Response modificationResponse(Object entity)
Prefer
header.entity
- the entity just modifiedprotected void checkETag(String etag)
protected SearchCond getSearchCond(String fiql, String realm)
protected List<OrderByClause> getOrderByClauses(String orderBy)
protected <T extends BaseBean> PagedResult<T> buildPagedResult(List<T> list, int page, int size, int totalCount)
T
- result typelist
- bare list of items to be returnedpage
- current pagesize
- requested sizetotalCount
- total result size (not considering pagination)Copyright © 2010–2023 The Apache Software Foundation. All rights reserved.