public class ReferenceServiceImpl extends AbstractReferenceServiceImpl implements ReferenceService
converters, errorDocumentService, listService, referenceSetService, valueBuilders
Constructor and Description |
---|
ReferenceServiceImpl() |
Modifier and Type | Method and Description |
---|---|
boolean |
delete(List<T2Reference> references) |
boolean |
delete(T2Reference reference) |
void |
deleteReferencesForWorkflowRun(String workflowRunId) |
T2Reference |
referenceFromString(String reference)
Parse the reference contained in the string and return a
T2Reference with the correct properties |
T2Reference |
register(Object o,
int targetDepth,
boolean useConverterSPI,
ReferenceContext context)
The top level registration method is used to register either as yet
unregistered ErrorDocuments and ReferenceSets (if these are passed in and
already have an identifier this call does nothing) and arbitrarily nested
Lists of the same.
|
Object |
renderIdentifier(T2Reference id,
Class<?> leafClass,
ReferenceContext context)
Resolve the given identifier, building a POJO structure where the
non-list items are of the desired class.
|
Identified |
resolveIdentifier(T2Reference id,
Set<Class<ExternalReferenceSPI>> ensureTypes,
ReferenceContext context)
Perform recursive identifier resolution, building a collection structure
of Identified objects, any collection elements being IdentifiedLists of
Identified subclasses.
|
Iterator<ContextualizedT2Reference> |
traverseFrom(T2Reference source,
int desiredDepth)
Initiates a traversal of the specified t2reference, traversing to
whatever level of depth is required such that all identifiers returned
within the iterator have the specified depth.
|
checkConverterRegistry, checkServices, getErrorDocumentService, getListService, getReferenceSetService, resolveIdentifierAsynch, setConverters, setErrorDocumentService, setListService, setReferenceSetService, setValueBuilders
executeRunnable, makeExecutionThread
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getErrorDocumentService, getListService, getReferenceSetService, resolveIdentifierAsynch
public T2Reference register(Object o, int targetDepth, boolean useConverterSPI, ReferenceContext context) throws ReferenceServiceException
This method is only valid on parameters of the following type :
ReferenceSet
- registered if not already registered,
otherwise returns existing T2ReferenceErrorDocument
- same behaviour as ReferenceSetExternalReferenceSPI
- wrapped in ReferenceSet, registered
and ID returnedregister
in interface ReferenceService
o
- the object to register with the reference system, must comply
with and will be interpreted as shown in the type list above.targetDepth
- the depth of the top level object supplied. This is needed
when registering empty collections and error documents,
whether as top level types or as members of a collection
within the top level type. If registering a collection this is
the collection depth, so a List of ReferenceSchemeSPI would be
depth 1. Failing to specify this correctly will result in
serious problems downstream so be careful! We can't catch all
potential problems in this method (although some errors will
be trapped).useConverterSPI
- whether to attempt to use the ValueToReferenceConvertorSPI
registry (if defined and available) to map arbitrary objects
to ExternalReferenceSPI instances on the fly. The registry of
converters is generally injected into the implementation of
this service.context
- ReferenceContext to use if required by component services,
this is most likely to be used by the object to reference
converters if engaged.
If the context is null a new empty reference context is inserted.
ReferenceServiceException
- if the object type (or, for collections, the recursive type
of its contents) is not in the allowed list or if a problem
occurs during registration. Also thrown if attempting to use
the converter SPI without an attached registry.ValueToReferenceConverterSPI
public Identified resolveIdentifier(T2Reference id, Set<Class<ExternalReferenceSPI>> ensureTypes, ReferenceContext context) throws ReferenceServiceException
resolveIdentifier
in interface ReferenceService
id
- the T2Reference to resolveensureTypes
- a set of ExternalReferenceSPI classes, this is used to augment
any resolved ReferenceSet instances to ensure that each one
has at least one of the specified types. If augmentation is
not required this can be set to null.context
- the ReferenceContext to use to resolve this and any
recursively resolved identifiers
If the context is null a new EmptyReferenceContext is inserted in its place.
ReferenceServiceException
- if any problems occur during resolutionpublic Object renderIdentifier(T2Reference id, Class<?> leafClass, ReferenceContext context) throws ReferenceServiceException
ReferenceService
This method will return a collection structure mirroring that of the specified T2Reference, client code should use T2Reference.getDepth() to determine the depth of this structure; a reference with depth of 0 means that the object returned is of the specified class, one of depth 1 is a list of this class and so on.
If the T2Reference contains or is an error this method will not retrieve it, and instead throws ReferenceServiceException
renderIdentifier
in interface ReferenceService
id
- the T2Reference to render to a POJOleafClass
- the java class for leaves in the resulting POJO structurecontext
- a reference context, potentially used if required by the
openStream methods of ExternalReferenceSPI implementations
used as sources for the POJO construction ReferenceServiceException
- if anything fails during this processStreamToValueConverterSPI
,
ValueCarryingExternalReference
public Iterator<ContextualizedT2Reference> traverseFrom(T2Reference source, int desiredDepth) throws ReferenceServiceException
traverseFrom
in interface ReferenceService
source
- the T2Reference from which to traverse. In general this is the
root of a collection structure.desiredDepth
- the desired depth of all returned T2References, must be less
than or equal to that of the source reference.ReferenceServiceException
- if unable to create the iterator for some reason. Note that
implementations are free to lazily perform the iteration so
this method may succeed but the iterator produced can fail
when used. If the iterator fails it will do so by throwing
one of the underlying sub-service exceptions.public T2Reference referenceFromString(String reference)
T2Reference
with the correct propertiesreferenceFromString
in interface ReferenceService
public boolean delete(List<T2Reference> references) throws ReferenceServiceException
delete
in interface ReferenceService
ReferenceServiceException
public boolean delete(T2Reference reference) throws ReferenceServiceException
delete
in interface ReferenceService
ReferenceServiceException
public void deleteReferencesForWorkflowRun(String workflowRunId) throws ReferenceServiceException
deleteReferencesForWorkflowRun
in interface ReferenceService
ReferenceServiceException
Copyright © 2015–2016 The Apache Software Foundation. All rights reserved.