de.espirit.firstspirit.service.treedata
Interface TNodeProvider<I,R>

Type Parameters:
I - id class.
R - request class.

public interface TNodeProvider<I,R>

Client provider interface for hierarchically organized data. This class will be created of client-side TNodeService.

Since:
4.0.63

Field Summary
static int SEARCH_DATA
          Search flag: search data (like labels, properties, etc.).
static int SEARCH_EXACT
          Search flag: enables exact search; default is a not-exact search.
static int SEARCH_ID
          Search flag: search ids.
 
Method Summary
 R createRequest(IDProvider element, Map<String,String> properties)
          Creates a request object.
 R createRequest(UserService userService, Map<String,String> properties)
          Creates a request object.
 Class<? extends I> getIdClass()
          Returns id class of this provider.
 List<TNode<I>> getNodes(R request, Collection<I> ids)
          Returns objects for the given ids.
 Iterable<TNode<I>> getPath(R request, I id)
          Returns path to root or null for root nodes.
 TNode<I> getRoot(R request)
          Returns root object.
 Iterable<TNode<I>> search(R request, String text, int flags)
          Searches the given text.
 

Field Detail

SEARCH_ID

static final int SEARCH_ID
Search flag: search ids.

Since:
4.0.63
See Also:
Constant Field Values

SEARCH_DATA

static final int SEARCH_DATA
Search flag: search data (like labels, properties, etc.).

Since:
4.0.63
See Also:
Constant Field Values

SEARCH_EXACT

static final int SEARCH_EXACT
Search flag: enables exact search; default is a not-exact search.

Since:
4.0.63
See Also:
Constant Field Values
Method Detail

createRequest

R createRequest(@NotNull
                UserService userService,
                @Nullable
                Map<String,String> properties)
Creates a request object. Request objects are used to transport neccessary information about the client environment to the server. It's recommended to reuse this request object as long as possible.

Parameters:
userService - current user-service.
properties - properties for the provider.
Returns:
request object.
Since:
4.0.63

createRequest

R createRequest(@NotNull
                IDProvider element,
                @Nullable
                Map<String,String> properties)
Creates a request object. Request objects are used to transport neccessary information about the client environment to the server. It's recommended to reuse this request object as long as possible.

Parameters:
element - current store-element.
properties - properties for the provider.
Returns:
request object.
Since:
4.0.63

getIdClass

@NotNull
Class<? extends I> getIdClass()
Returns id class of this provider. This value must not be changed during lifetime of a provider.

For implementors: Id classes must implement a constructor Id(String) which can be used to de-serialize a string represantation created with Id.toString().

Returns:
id class for this adapter.
Since:
4.0.63

getRoot

@NotNull
TNode<I> getRoot(@NotNull
                         R request)
Returns root object.

Parameters:
request - request.
Returns:
root object.
Since:
4.0.63

getNodes

@NotNull
List<TNode<I>> getNodes(@NotNull
                                R request,
                                @NotNull
                                Collection<I> ids)
Returns objects for the given ids. For every index i with 0 <= i < ids.length is result[i] == null <=> ids[i] is unknown.

Parameters:
request - request.
ids - object ids.
Returns:
objects for the given ids (result[i] == null <=> ids[i] is unknown).
Since:
4.0.63

getPath

@NotNull
Iterable<TNode<I>> getPath(@NotNull
                                   R request,
                                   @NotNull
                                   I id)
Returns path to root or null for root nodes. The path starts with the node's parent, ..., root node.

Parameters:
request - request.
id - object id.
Returns:
path to root or null for root nodes.
Since:
4.0.63

search

@NotNull
Iterable<TNode<I>> search(@NotNull
                                  R request,
                                  @NotNull
                                  String text,
                                  int flags)
Searches the given text. The flags specifies what (ids and/or data) and how to search (e.g. exact).

Example:
Search for ids or data containing "test":

 ids = prov.search(request, "test", SEARCH_ID | SEARCH_DATA); // search
 objects = prov.get(request, ids); // get objects
 

Parameters:
request - request.
text - search text.
flags - what (ids and/or data) and how to search (e.g. exact).
Returns:
ids of found objects.
Since:
4.0.63


Copyright © 2012 e-Spirit AG. All Rights Reserved. Build 4.2.480