Package io.vertigo.ui.core
Class ViewContext
- java.lang.Object
-
- io.vertigo.ui.core.ViewContext
-
- All Implemented Interfaces:
Serializable
public final class ViewContext extends Object implements Serializable
Liste des couples (clé, object) enregistrés.- Author:
- npiedeloup
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static ViewContextKey<String>
CTX
Clée de l'id de context dans le context.
-
Constructor Summary
Constructors Constructor Description ViewContext(ViewContextMap viewContextMap, JsonEngine jsonEngine)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ViewContextMap
asMap()
ViewContextMap
asUpdatesMap()
<O extends io.vertigo.datamodel.structure.model.DtObject>
voidcheckDtListErrors(ViewContextKey<O> contextKey, UiMessageStack uiMessageStack)
Vérifie les erreurs de la liste.<O extends io.vertigo.datamodel.structure.model.DtObject>
voidcheckDtoErrors(ViewContextKey<O> contextKey, UiMessageStack uiMessageStack)
Vérifie les erreurs de l'objet.boolean
containsKey(Object key)
String
findKey(io.vertigo.datamodel.structure.model.DtObject dtObject)
String
findKey(UiObject<?> uiObject)
Serializable
get(Object key)
Boolean
getBoolean(ViewContextKey<Boolean> key)
Optional<io.vertigo.datastore.filestore.model.FileInfoURI>
getFileInfoURI(ViewContextKey<io.vertigo.datastore.filestore.model.FileInfoURI> contextKey)
Get UI file uri.ArrayList<io.vertigo.datastore.filestore.model.FileInfoURI>
getFileInfoURIs(ViewContextKey<io.vertigo.datastore.filestore.model.FileInfoURI> contextKey)
Get UI file info uri list.String
getFilteredViewContextAsJson()
String
getId()
Integer
getInteger(ViewContextKey<Integer> key)
Long
getLong(ViewContextKey<Long> key)
<O extends io.vertigo.datamodel.structure.model.DtObject>
SelectedFacetValuesgetSelectedFacetValues(ViewContextKey<FacetedQueryResult<O,FacetedQuery>> contextKey)
Returns selectedFacetValues of a given facetedQuery.String
getString(ViewContextKey<String> key)
<O extends io.vertigo.datamodel.structure.model.DtObject>
UiList<O>getUiList(ViewContextKey<O> key)
<O extends io.vertigo.datamodel.structure.model.DtObject>
BasicUiListModifiable<O>getUiListModifiable(ViewContextKey<O> key)
<O extends io.vertigo.datamodel.structure.model.DtObject>
UiObject<O>getUiObject(ViewContextKey<O> key)
boolean
isDirty()
void
makeModifiable()
Génère un nouvel Id et passe le context en modifiable.void
makeUnmodifiable()
passe le context en non-modifiable.void
markDirty()
Mark this context as Dirty : shouldn't be stored and keep old id.void
markModifiedKeys(ViewContextKey... newModifiedKeys)
void
markModifiedKeys(String... newModifiedKeys)
<O extends io.vertigo.datamodel.structure.model.DtObject>
voidpublishDtList(ViewContextKey<O> contextKey, io.vertigo.datamodel.structure.definitions.DtFieldName<O> keyFieldName, io.vertigo.datamodel.structure.model.DtList<O> dtList)
Ajoute une liste au context.<O extends io.vertigo.datamodel.structure.model.DtObject>
voidpublishDtList(ViewContextKey<O> contextKey, io.vertigo.datamodel.structure.model.DtList<O> dtList)
Ajoute une liste au context.<O extends io.vertigo.datamodel.structure.model.DtObject>
voidpublishDtListModifiable(ViewContextKey<O> contextKey, io.vertigo.datamodel.structure.model.DtList<O> dtList)
Ajoute une liste au context.<O extends io.vertigo.datamodel.structure.model.DtObject>
voidpublishDto(ViewContextKey<O> contextKey, O dto)
Ajoute un objet de type form au context.<O extends io.vertigo.datamodel.structure.model.DtObject>
voidpublishFacetedQueryResult(ViewContextKey<FacetedQueryResult<O,SearchQuery>> contextKey, io.vertigo.datamodel.structure.definitions.DtFieldName<O> keyFieldName, FacetedQueryResult<O,SearchQuery> facetedQueryResult, ViewContextKey<?> criteriaContextKey)
Publie une FacetedQueryResult.void
publishFileInfoURI(ViewContextKey<io.vertigo.datastore.filestore.model.FileInfoURI> contextKey, io.vertigo.datastore.filestore.model.FileInfoURI fileInfoURI)
Publish file's info.void
publishFileInfoURIs(ViewContextKey<io.vertigo.datastore.filestore.model.FileInfoURI> contextKey, ArrayList<io.vertigo.datastore.filestore.model.FileInfoURI> fileInfoURIs)
Publish list of file's info.<E extends io.vertigo.datamodel.structure.model.Entity>
voidpublishMdl(ViewContextKey<E> contextKey, Class<E> entityClass, String code)
Publie une liste de référence.<O extends Serializable>
voidpublishRef(ViewContextKey<O> key, O value)
<O extends Serializable>
voidpublishTypedRef(ViewContextKey<O> key, O value, Type paramType)
<O extends io.vertigo.datamodel.structure.model.DtObject>
io.vertigo.datamodel.structure.model.DtList<O>readDtList(ViewContextKey<O> contextKey, DtObjectValidator<O> validator, UiMessageStack uiMessageStack)
<O extends io.vertigo.datamodel.structure.model.DtObject>
io.vertigo.datamodel.structure.model.DtList<O>readDtList(ViewContextKey<O> contextKey, UiMessageStack uiMessageStack)
<O extends io.vertigo.datamodel.structure.model.DtObject>
io.vertigo.datamodel.structure.model.DtList<O>readDtListModifiable(ViewContextKey<O> contextKey, DtObjectValidator<O> validator, UiMessageStack uiMessageStack)
<O extends io.vertigo.datamodel.structure.model.DtObject>
io.vertigo.datamodel.structure.model.DtList<O>readDtListModifiable(ViewContextKey<O> contextKey, UiMessageStack uiMessageStack)
<O extends io.vertigo.datamodel.structure.model.DtObject>
OreadDto(ViewContextKey<O> contextKey, DtObjectValidator<O> validator, UiMessageStack uiMessageStack)
<O extends io.vertigo.datamodel.structure.model.DtObject>
OreadDto(ViewContextKey<O> contextKey, UiMessageStack uiMessageStack)
void
setCtxId()
void
setInputCtxId(String ctxId)
-
-
-
Field Detail
-
CTX
public static final ViewContextKey<String> CTX
Clée de l'id de context dans le context.
-
-
Constructor Detail
-
ViewContext
public ViewContext(ViewContextMap viewContextMap, JsonEngine jsonEngine)
-
-
Method Detail
-
getId
public String getId()
- Returns:
- Clé de ce context
-
setInputCtxId
public void setInputCtxId(String ctxId)
-
setCtxId
public void setCtxId()
-
makeModifiable
public void makeModifiable()
Génère un nouvel Id et passe le context en modifiable.
-
makeUnmodifiable
public void makeUnmodifiable()
passe le context en non-modifiable.
-
markDirty
public void markDirty()
Mark this context as Dirty : shouldn't be stored and keep old id.
-
isDirty
public boolean isDirty()
- Returns:
- if context dirty : shouldn't be stored and keep old id
-
asMap
public ViewContextMap asMap()
-
asUpdatesMap
public ViewContextMap asUpdatesMap()
-
getFilteredViewContextAsJson
public String getFilteredViewContextAsJson()
-
markModifiedKeys
public void markModifiedKeys(ViewContextKey... newModifiedKeys)
-
markModifiedKeys
public void markModifiedKeys(String... newModifiedKeys)
-
get
public Serializable get(Object key)
-
containsKey
public boolean containsKey(Object key)
-
findKey
public String findKey(UiObject<?> uiObject)
- Parameters:
uiObject
- UiObject recherché- Returns:
- Clé de context de l'élément (null si non trouvé)
-
findKey
public String findKey(io.vertigo.datamodel.structure.model.DtObject dtObject)
- Parameters:
dtObject
- DtObject recherché- Returns:
- Clé de context de l'élément (null si non trouvé)
-
publishRef
public <O extends Serializable> void publishRef(ViewContextKey<O> key, O value)
- Parameters:
key
- Clé de context
-
publishTypedRef
public <O extends Serializable> void publishTypedRef(ViewContextKey<O> key, O value, Type paramType)
- Parameters:
key
- Clé de context
-
getUiObject
public <O extends io.vertigo.datamodel.structure.model.DtObject> UiObject<O> getUiObject(ViewContextKey<O> key)
- Parameters:
key
- Clé de context- Returns:
- UiObject du context
-
getUiList
public <O extends io.vertigo.datamodel.structure.model.DtObject> UiList<O> getUiList(ViewContextKey<O> key)
- Parameters:
key
- Clé de context- Returns:
- UiList du context
-
getUiListModifiable
public <O extends io.vertigo.datamodel.structure.model.DtObject> BasicUiListModifiable<O> getUiListModifiable(ViewContextKey<O> key)
- Parameters:
key
- Clé de context- Returns:
- UiListModifiable du context
-
getString
public String getString(ViewContextKey<String> key)
- Parameters:
key
- Clé de context- Returns:
- String du context
-
getLong
public Long getLong(ViewContextKey<Long> key)
- Parameters:
key
- Clé de context- Returns:
- Long du context
-
getInteger
public Integer getInteger(ViewContextKey<Integer> key)
- Parameters:
key
- Clé de context- Returns:
- Integer du context
-
getBoolean
public Boolean getBoolean(ViewContextKey<Boolean> key)
- Parameters:
key
- Clé de context- Returns:
- Boolean du context
-
publishDto
public <O extends io.vertigo.datamodel.structure.model.DtObject> void publishDto(ViewContextKey<O> contextKey, O dto)
Ajoute un objet de type form au context.- Parameters:
dto
- Objet à publier
-
checkDtoErrors
public <O extends io.vertigo.datamodel.structure.model.DtObject> void checkDtoErrors(ViewContextKey<O> contextKey, UiMessageStack uiMessageStack)
Vérifie les erreurs de l'objet. Celles-ci sont ajoutées à l'uiMessageStack si nécessaire.
-
readDto
public <O extends io.vertigo.datamodel.structure.model.DtObject> O readDto(ViewContextKey<O> contextKey, UiMessageStack uiMessageStack)
- Returns:
- objet métier valid�. Lance une exception si erreur.
-
readDto
public <O extends io.vertigo.datamodel.structure.model.DtObject> O readDto(ViewContextKey<O> contextKey, DtObjectValidator<O> validator, UiMessageStack uiMessageStack)
- Returns:
- objet métier validé. Lance une exception si erreur.
-
publishDtList
public <O extends io.vertigo.datamodel.structure.model.DtObject> void publishDtList(ViewContextKey<O> contextKey, io.vertigo.datamodel.structure.definitions.DtFieldName<O> keyFieldName, io.vertigo.datamodel.structure.model.DtList<O> dtList)
Ajoute une liste au context.- Parameters:
dtList
- List à publier
-
publishDtList
public <O extends io.vertigo.datamodel.structure.model.DtObject> void publishDtList(ViewContextKey<O> contextKey, io.vertigo.datamodel.structure.model.DtList<O> dtList)
Ajoute une liste au context.- Parameters:
dtList
- List à publier
-
readDtList
public <O extends io.vertigo.datamodel.structure.model.DtObject> io.vertigo.datamodel.structure.model.DtList<O> readDtList(ViewContextKey<O> contextKey, DtObjectValidator<O> validator, UiMessageStack uiMessageStack)
- Returns:
- List des objets métiers validée. Lance une exception si erreur.
-
readDtList
public <O extends io.vertigo.datamodel.structure.model.DtObject> io.vertigo.datamodel.structure.model.DtList<O> readDtList(ViewContextKey<O> contextKey, UiMessageStack uiMessageStack)
- Returns:
- List des objets métiers validée. Lance une exception si erreur.
-
publishDtListModifiable
public <O extends io.vertigo.datamodel.structure.model.DtObject> void publishDtListModifiable(ViewContextKey<O> contextKey, io.vertigo.datamodel.structure.model.DtList<O> dtList)
Ajoute une liste au context.- Parameters:
dtList
- List à publier
-
checkDtListErrors
public <O extends io.vertigo.datamodel.structure.model.DtObject> void checkDtListErrors(ViewContextKey<O> contextKey, UiMessageStack uiMessageStack)
Vérifie les erreurs de la liste. Celles-ci sont ajoutées à l'uiMessageStack si nécessaire.
-
readDtListModifiable
public <O extends io.vertigo.datamodel.structure.model.DtObject> io.vertigo.datamodel.structure.model.DtList<O> readDtListModifiable(ViewContextKey<O> contextKey, UiMessageStack uiMessageStack)
- Returns:
- List des objets métiers validée. Lance une exception si erreur.
-
readDtListModifiable
public <O extends io.vertigo.datamodel.structure.model.DtObject> io.vertigo.datamodel.structure.model.DtList<O> readDtListModifiable(ViewContextKey<O> contextKey, DtObjectValidator<O> validator, UiMessageStack uiMessageStack)
- Returns:
- List des objets métiers validée. Lance une exception si erreur.
-
publishMdl
public <E extends io.vertigo.datamodel.structure.model.Entity> void publishMdl(ViewContextKey<E> contextKey, Class<E> entityClass, String code)
Publie une liste de référence.- Parameters:
contextKey
- Context keyentityClass
- Class associéecode
- Code
-
getFileInfoURI
public Optional<io.vertigo.datastore.filestore.model.FileInfoURI> getFileInfoURI(ViewContextKey<io.vertigo.datastore.filestore.model.FileInfoURI> contextKey)
Get UI file uri.- Parameters:
contextKey
- Context key
-
getFileInfoURIs
public ArrayList<io.vertigo.datastore.filestore.model.FileInfoURI> getFileInfoURIs(ViewContextKey<io.vertigo.datastore.filestore.model.FileInfoURI> contextKey)
Get UI file info uri list.- Parameters:
contextKey
- Context key
-
publishFileInfoURI
public void publishFileInfoURI(ViewContextKey<io.vertigo.datastore.filestore.model.FileInfoURI> contextKey, io.vertigo.datastore.filestore.model.FileInfoURI fileInfoURI)
Publish file's info.- Parameters:
contextKey
- Context keyfileInfo
- file's info
-
publishFileInfoURIs
public void publishFileInfoURIs(ViewContextKey<io.vertigo.datastore.filestore.model.FileInfoURI> contextKey, ArrayList<io.vertigo.datastore.filestore.model.FileInfoURI> fileInfoURIs)
Publish list of file's info.- Parameters:
contextKey
- Context keyfileInfos
- list of file's info.
-
publishFacetedQueryResult
public <O extends io.vertigo.datamodel.structure.model.DtObject> void publishFacetedQueryResult(ViewContextKey<FacetedQueryResult<O,SearchQuery>> contextKey, io.vertigo.datamodel.structure.definitions.DtFieldName<O> keyFieldName, FacetedQueryResult<O,SearchQuery> facetedQueryResult, ViewContextKey<?> criteriaContextKey)
Publie une FacetedQueryResult.- Parameters:
contextKey
- Context keykeyFieldName
- Id's fieldNamefacetedQueryResult
- Result
-
getSelectedFacetValues
public <O extends io.vertigo.datamodel.structure.model.DtObject> SelectedFacetValues getSelectedFacetValues(ViewContextKey<FacetedQueryResult<O,FacetedQuery>> contextKey)
Returns selectedFacetValues of a given facetedQuery.- Parameters:
contextKey
- Context key- Returns:
- selectedFacetValues
-
-