public abstract class BaseRepository<T extends Base> extends Object implements Repository<T>
| Modifier and Type | Field and Description |
|---|---|
protected Class<?> |
modelClass |
| Modifier and Type | Method and Description |
|---|---|
de.whitefrog.frogr.persistence.ModelCache |
cache() |
boolean |
contains(T model) |
T |
createModel(org.neo4j.graphdb.PropertyContainer node)
Create appropriate the model for a neo4j property container.
|
void |
dispose()
Dispose method, will be called by the owning service on shutdown.
|
T |
fetch(Base model,
boolean refetch,
FieldList fields)
Fetch fields from database for a model.
|
T |
fetch(Base model,
FieldList fields)
Fetch fields from database for a model.
|
T |
fetch(Base model,
String... fields)
Fetch fields from database for a model.
|
T |
find(long id,
String... fields)
Find a entity by ID.
|
T |
findByUuid(String uuid,
String... fields)
Find a entity by UUID
|
Class<?> |
getModelClass()
Get the model class
|
String |
getType()
Get the type name for the model class.
|
org.neo4j.graphdb.GraphDatabaseService |
graph()
Get the database instance associated with the controller
|
void |
initialize() |
org.slf4j.Logger |
logger() |
de.whitefrog.frogr.persistence.Persistence |
persistence() |
QueryBuilder |
queryBuilder()
Query builder instance to use.
|
String |
queryIdentifier()
Identifier used in queries.
|
T |
refetch(Base model,
FieldList fields)
Fetch fields from database for a model, even if already fetched.
|
T |
refetch(Base model,
String... fields)
Fetch fields from database for a model, even if already fetched.
|
de.whitefrog.frogr.persistence.Relationships |
relationships() |
void |
save(T... entities)
Save some entities.
|
void |
save(T model)
Save a model
|
Search |
search()
Get a search provider.
|
Service |
service()
Reference to the service the repository is assigned to.
|
void |
sort(List<T> list,
List<SearchParameter.OrderBy> orderBy)
Sort a list like you would in a database call.
|
void |
validateModel(SaveContext<T> context) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateModel, remove, saveprotected Class<?> modelClass
public de.whitefrog.frogr.persistence.ModelCache cache()
cache in interface Repository<T extends Base>public T createModel(org.neo4j.graphdb.PropertyContainer node)
RepositorycreateModel in interface Repository<T extends Base>node - The property container to usepublic boolean contains(T model)
contains in interface Repository<T extends Base>public String getType()
RepositorygetType in interface Repository<T extends Base>public Class<?> getModelClass()
RepositorygetModelClass in interface Repository<T extends Base>public org.slf4j.Logger logger()
public T fetch(Base model, String... fields)
Repositoryfetch in interface Repository<T extends Base>model - The model to usefields - The fields to fetchpublic T refetch(Base model, String... fields)
Repositoryrefetch in interface Repository<T extends Base>model - The model to usefields - The fields to fetchpublic T fetch(Base model, FieldList fields)
Repositoryfetch in interface Repository<T extends Base>model - The model to usefields - The fields to fetch as FieldListpublic T refetch(Base model, FieldList fields)
Repositoryrefetch in interface Repository<T extends Base>model - The model to usefields - The fields to fetch as FieldListpublic T fetch(Base model, boolean refetch, FieldList fields)
Repositoryfetch in interface Repository<T extends Base>model - The model to userefetch - If true, fields will be fetched, even if they were already beforefields - The fields to fetch as FieldListpublic T find(long id, String... fields)
Repositoryfind in interface Repository<T extends Base>id - The id of the entity to look forfields - Fields to fetch, not requiredpublic T findByUuid(String uuid, String... fields)
RepositoryfindByUuid in interface Repository<T extends Base>uuid - The uuid of the entity to look forfields - Fields to fetch, not requiredpublic org.neo4j.graphdb.GraphDatabaseService graph()
Repositorygraph in interface Repository<T extends Base>public void initialize()
initialize in interface Repository<T extends Base>public QueryBuilder queryBuilder()
RepositoryqueryBuilder in interface Repository<T extends Base>public String queryIdentifier()
RepositoryqueryIdentifier in interface Repository<T extends Base>public void save(T model) throws de.whitefrog.frogr.exception.PersistException
Repositorysave in interface Repository<T extends Base>model - model to savede.whitefrog.frogr.exception.PersistException@SafeVarargs public final void save(T... entities) throws de.whitefrog.frogr.exception.PersistException
Repositorysave in interface Repository<T extends Base>entities - Entities to save.de.whitefrog.frogr.exception.PersistExceptionpublic Search search()
Repositorysearch in interface Repository<T extends Base>public Service service()
Repositoryservice in interface Repository<T extends Base>public de.whitefrog.frogr.persistence.Persistence persistence()
persistence in interface Repository<T extends Base>public de.whitefrog.frogr.persistence.Relationships relationships()
relationships in interface Repository<T extends Base>public void sort(List<T> list, List<SearchParameter.OrderBy> orderBy)
Repositorysort in interface Repository<T extends Base>list - List of models to sortorderBy - Sorting conditionspublic void validateModel(SaveContext<T> context)
public void dispose()
Repositorydispose in interface Repository<T extends Base>Copyright © 2018. All rights reserved.