public class MongoPersister<T> extends AbstractPersister<T> implements org.statefulj.fsm.Persister<T>, org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor, org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>, org.springframework.context.ApplicationContextAware
| Modifier and Type | Field and Description |
|---|---|
static String |
COLLECTION |
| Constructor and Description |
|---|
MongoPersister(List<org.statefulj.fsm.model.State<T>> states,
org.statefulj.fsm.model.State<T> start,
Class<T> clazz,
String repoId) |
MongoPersister(List<org.statefulj.fsm.model.State<T>> states,
String stateFieldName,
org.statefulj.fsm.model.State<T> start,
Class<T> clazz,
String repoId) |
| Modifier and Type | Method and Description |
|---|---|
protected org.springframework.data.mongodb.core.query.Query |
buildQuery(org.statefulj.persistence.mongo.MongoPersister.StateDocumentImpl state,
org.statefulj.fsm.model.State<T> current) |
protected org.springframework.data.mongodb.core.query.Update |
buildUpdate(org.statefulj.fsm.model.State<T> current,
org.statefulj.fsm.model.State<T> next) |
protected org.statefulj.persistence.mongo.MongoPersister.StateDocumentImpl |
createStateDocument(T stateful) |
protected Field |
findIdField(Class<?> clazz) |
protected String |
getState(T stateful) |
protected org.statefulj.persistence.mongo.MongoPersister.StateDocumentImpl |
getStateDocument(T stateful) |
protected Class<?> |
getStateFieldType() |
void |
onAfterSave(Object stateful,
com.mongodb.DBObject dbo) |
void |
onApplicationEvent(org.springframework.context.ApplicationEvent event) |
void |
postProcessBeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) |
void |
postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setCurrent(T stateful,
org.statefulj.fsm.model.State<T> current,
org.statefulj.fsm.model.State<T> next)
Set the current State.
|
protected void |
setState(T stateful,
String state) |
protected void |
setStateDocument(T stateful,
StateDocument stateDoc) |
protected void |
throwStaleState(String current,
String next) |
protected void |
updateInMemory(T stateful,
org.statefulj.persistence.mongo.MongoPersister.StateDocumentImpl stateDoc,
String current,
String next) |
protected boolean |
validStateField(Field stateField) |
findStateField, getClazz, getCurrent, getId, getIdField, getStart, getStateField, getStates, setClazz, setIdField, setStart, setStateField, setStates, throwStaleStatepublic static final String COLLECTION
public MongoPersister(List<org.statefulj.fsm.model.State<T>> states, org.statefulj.fsm.model.State<T> start, Class<T> clazz, String repoId)
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionpublic void setCurrent(T stateful, org.statefulj.fsm.model.State<T> current, org.statefulj.fsm.model.State<T> next) throws org.statefulj.fsm.StaleStateException
setCurrent in interface org.statefulj.fsm.Persister<T>setCurrent in class AbstractPersister<T>stateful - current - next - org.statefulj.fsm.StaleStateExceptionpublic void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
throws org.springframework.beans.BeansException
postProcessBeanFactory in interface org.springframework.beans.factory.config.BeanFactoryPostProcessororg.springframework.beans.BeansExceptionpublic void postProcessBeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)
throws org.springframework.beans.BeansException
postProcessBeanDefinitionRegistry in interface org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessororg.springframework.beans.BeansExceptionpublic void onAfterSave(Object stateful, com.mongodb.DBObject dbo)
public void onApplicationEvent(org.springframework.context.ApplicationEvent event)
onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>protected boolean validStateField(Field stateField)
validStateField in class AbstractPersister<T>protected Field findIdField(Class<?> clazz)
findIdField in class AbstractPersister<T>protected Class<?> getStateFieldType()
getStateFieldType in class AbstractPersister<T>protected org.springframework.data.mongodb.core.query.Query buildQuery(org.statefulj.persistence.mongo.MongoPersister.StateDocumentImpl state,
org.statefulj.fsm.model.State<T> current)
protected org.springframework.data.mongodb.core.query.Update buildUpdate(org.statefulj.fsm.model.State<T> current, org.statefulj.fsm.model.State<T> next)
protected String getState(T stateful) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException
getState in class AbstractPersister<T>NoSuchFieldExceptionSecurityExceptionIllegalArgumentExceptionIllegalAccessExceptionprotected void setState(T stateful, String state) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException
setState in class AbstractPersister<T>IllegalArgumentExceptionIllegalAccessExceptionNoSuchFieldExceptionSecurityExceptionprotected org.statefulj.persistence.mongo.MongoPersister.StateDocumentImpl getStateDocument(T stateful) throws IllegalArgumentException, IllegalAccessException
protected org.statefulj.persistence.mongo.MongoPersister.StateDocumentImpl createStateDocument(T stateful) throws IllegalArgumentException, IllegalAccessException
protected void setStateDocument(T stateful, StateDocument stateDoc) throws IllegalArgumentException, IllegalAccessException
protected void updateInMemory(T stateful, org.statefulj.persistence.mongo.MongoPersister.StateDocumentImpl stateDoc, String current, String next) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException, org.statefulj.fsm.StaleStateException
IllegalArgumentExceptionIllegalAccessExceptionNoSuchFieldExceptionSecurityExceptionorg.statefulj.fsm.StaleStateExceptionCopyright © 2014. All rights reserved.