public abstract class LspsContextHolder extends Object implements Serializable
Base class for beans that encapsulate LSPS context and the associated component tree. It holds and provides various contextual information for the view and form components such as opened document/todo, current execution context, model instance, etc.
The API allows the hosting application to send messages to the LSPS forms (reloadContent()
,
reactivate()
, ...). On the other hand it provides services for the various LSPS
form components such as access to the ExecutionContext
, LspsScreen
or garbage
collection of unused objects in model instance.
Modifier and Type | Field and Description |
---|---|
protected ModelInstanceUtilsService |
modelInstanceUtilsService
Instance of ModelInstanceUtilsService.
|
protected ModelProviderClientService |
modelProviderService
Instance of ModelProviderService to be used by subclasses
|
protected SharedRecordTypeFactory |
sharedRecordTypeFactory
Instance of SharedRecordTypeFactory to be used by subclasses
|
Constructor and Description |
---|
LspsContextHolder(LspsAppConnector appConnector,
LspsFormConnector formConnector,
String userId)
Full constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
addSaveMetadataToUploadedBinaryData(BinaryDataServiceLocal binaryDataService,
List<Long> uploadedBinaryData)
Adds metadata to the binary data uploaded in this holder.
|
void |
collectGarbage()
Collects garbage in the used model instance.
|
protected abstract ExecutionContext |
createEvaluationContext()
Creates the evaluation context.
|
abstract RecordHolder |
createSavedStateHolder()
Returns a representation of the saved state in the model.
|
protected abstract LspsScreen |
createScreen()
Creates the user interface.
|
void |
deactivate()
Should be called when the content is hidden.
|
LspsAppConnector |
getAppConnector()
Returns the application connector.
|
ExecutionContext |
getExecutionContext()
Returns the associated evaluation execution context.
|
ExecutionContext |
getExecutionContext(String evaluationLevel)
Returns an execution context in the given evaluation level.
|
LspsFormConnector |
getFormConnector()
Returns the form connector.
|
Handle |
getHandle(ValueHolder valueHolder)
Returns handle for the given value holder.
|
ModelInstance |
getModelInstance()
Returns the model instance over which the evaluation context operates.
|
LspsScreen |
getScreen()
Returns current screen or null if no screen is active.
|
abstract Variant.ClosureVariant |
getSubmitNavigationDefinition()
Gets the navigation definition from the document/todo definition.
|
abstract String |
getTitle()
Returns the title for the form content.
|
ValueHolder |
getValueHolder(Handle handle)
Returns value holder for the given handle.
|
<T extends ValueHolder> |
getValueHolderInLevel(T valueHolder,
String evaluationLevel)
Returns the value holder in the given evaluation level.
|
void |
invalidate()
Marks the context as invalid and calls
LspsScreen.cleanup() . |
boolean |
isClosureWithQuery(ClosureHolder closureHolder)
Returns true if the closure contains a call of a query as the last expression.
|
abstract boolean |
isReadOnly()
Returns true if the GUI should be opened in read-only mode.
|
abstract boolean |
isSaved()
Returns true if the state of the GUI was already saved before opening.
|
boolean |
isValid()
Returns true if the context is valid.
|
protected Couple<ExecutionContext,ModelInstance> |
minimalModelInstanceCopy(ModelInstance modelInstance,
UIScreenState uiState) |
protected void |
performPersist(ModelInstance modelInstance)
Persists the changes done within the context.
|
void |
persist()
Persists the changes done within the context, using a save point
if an exception occurs, model instance is restored.
|
void |
reactivate()
Should be called when the content is shown again after it was previously
hidden.
|
void |
reloadContent()
Loads the context and creates Vaadin component tree that represents the content.
|
abstract void |
save(UIScreenState uiState)
Saves the changes done within the context.
|
protected abstract RecordHolder |
submit()
Submits the changes done within the context and closes the context.
|
Variant.RecordVariant |
submitContext(Variant.RecordVariant screenNavigation)
Submits the context and handles the navigation.
|
protected void |
updateApplicationData(ModelInstance modelInstance)
Updates the data available to the model through the
getApplicationData() function. |
protected ModelProviderClientService modelProviderService
protected ModelInstanceUtilsService modelInstanceUtilsService
protected SharedRecordTypeFactory sharedRecordTypeFactory
public LspsContextHolder(LspsAppConnector appConnector, LspsFormConnector formConnector, String userId)
appConnector
- not nullformConnector
- not nulluserId
- ?, not null.public LspsScreen getScreen()
public LspsAppConnector getAppConnector()
public LspsFormConnector getFormConnector()
public abstract String getTitle()
public void reloadContent() throws LspsException
ErrorException
LspsException
protected void updateApplicationData(ModelInstance modelInstance)
getApplicationData()
function.modelInstance
- public void reactivate()
UIScreen.resume()
.public void deactivate()
protected abstract ExecutionContext createEvaluationContext() throws LspsException
reloadContent()
.LspsException
protected abstract LspsScreen createScreen() throws LspsException
reloadContent()
.LspsException
public abstract boolean isSaved()
public abstract boolean isReadOnly()
public abstract RecordHolder createSavedStateHolder()
UISaveAction
when the save action is going to be executed.protected abstract RecordHolder submit() throws LspsException
LspsException
public final Variant.RecordVariant submitContext(Variant.RecordVariant screenNavigation) throws LspsException
UIScreen.cleanup()
.screenNavigation
- may be null. Note that submit navigation takes precedence.LspsException
public abstract void save(UIScreenState uiState) throws LspsException
uiState
- LspsException
public void persist() throws LspsException
LspsException
protected void performPersist(ModelInstance modelInstance) throws LspsException
modelInstance
- LspsException
public void collectGarbage()
public boolean isValid()
public void invalidate()
LspsScreen.cleanup()
. Any changes
in the context are lost.
Should be invoked whenever the context/screen is not valid anymore.public ExecutionContext getExecutionContext()
public ExecutionContext getExecutionContext(String evaluationLevel)
evaluationLevel
- protected Couple<ExecutionContext,ModelInstance> minimalModelInstanceCopy(ModelInstance modelInstance, UIScreenState uiState)
modelInstance
- - model to be copieduiState
- - its definition must remain in copy after garbage collection.public <T extends ValueHolder> T getValueHolderInLevel(T valueHolder, String evaluationLevel)
T
- valueHolder
- evaluationLevel
- public ModelInstance getModelInstance()
public Handle getHandle(ValueHolder valueHolder)
valueHolder
- public ValueHolder getValueHolder(Handle handle)
handle
- public boolean isClosureWithQuery(ClosureHolder closureHolder)
closureHolder
- the closure, not null.public abstract Variant.ClosureVariant getSubmitNavigationDefinition()
{Set<Todo> : Navigation}
public abstract void addSaveMetadataToUploadedBinaryData(BinaryDataServiceLocal binaryDataService, List<Long> uploadedBinaryData)
binaryDataService
- uploadedBinaryData
- Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.