Class StaticView
- All Implemented Interfaces:
Serializable,overit.geocall.marks.MethodExposer,overit.geocall.marks.NameExposer,Identified
Being kept in memory, each access to this object is very quick, because we don't need to interrogate the database to retrieve the records.
When we change a table that has a StaticView associated, we must invalidate the view, to force the system to load the updated data from the database, and maintain in memory an up to date view.
Every StaticView is defined by an xml placed inside the folder named global located under the applicative root folder.
A typical example of tables that can be mapped into StaticViews is the tables that defines the typologies, because this type of tables has the right characteristics of dimensionality and staticity suitable to be kept in memory and don't be often loaded from the database.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprotected class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected Stringprotected Stringprotected ArrayListprotected DBTableprotected Stringprotected Stringprotected Stringprotected static HashMapprotected Identitystatic final StringString that defines the name of the attribute that will contains the key mapprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected StringRecyclable field that can be used for future purpose (ex callcenter)protected Stringprotected Longstatic final StringString that defines the name of the attribute that contains the key fieldstatic final StringString that defines the name of the attribute that will contains the date of last load -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Stringprotected Stringprotected StringReturns theDBViewthat corresponds to the StaticView.getDBView(boolean filterDeleted) Returns aDBViewcorresponding to the current StaticView, optionally filtering out records based on a visibility condition.Returns theIdentityassociated to the componentstatic intgetIndexByKey(DBView dbv, Object o) Returns the index of the record of the StaticView with the key passed as parameterReturns the name of the field that contains the key of the tablestatic DategetLoadDate(DBView dbv) Returns the date of the last load of the StaticViewgetRoot()Returns the root of the user interface component definition tree of this UINodestatic ArrayListgetRowListByKey(DBView dbv, Object o) Returns the row listDBView.getRowList(int)of the record of the StaticView with the key passed as parameterstatic HashGettergetRowMapByKey(DBView dbv, Object o) Returns the row mapDBView.getRowMap(int)of the record of the StaticView with the key passed as parametergetTable()Returns the name of the table to which the StaticView refersstatic HashMapgetViews()Returns the viewsReturns the name of the field used to determine if a record is visible (must be inserted in the StaticView) or notvoidInvalidates the StaticView (if it is not a bogus one), that means that is cleared from the cache and the next access to thegetDBView()will make a query to the database to extract the recordsstatic voidInvalidates all the StaticViewsbooleanisChangedSince(Date currentDate) Check if the date of the last loading made from the database, it was made before the date passed as a parameter.
It can be used,for example, to check if theStaticViewhas been invalidated, previously to the date passed as parameter.protected DBViewvoidIf set totruedefines that the StaticView must reload its values (making a query) on every access to itsDBView.voidSets the name of the field used as foreign key field of the branches tablevoidSets an sql clause used to filter the records of the StaticView.voidsetFACTORY(String s) Sets the name of the field used as foreign key field of the companies tablevoidSets a condition used to filter the records of the StaticView.voidSets the name of the field that contains a date value that will be used as constraint in the extraction of the records.voidsetIdentity(Identity id) Sets theIdentityto the componentvoidSets the name of the field that contains the key of the tablevoidSets the name of the field (or the list of fields, separated by the comma) used for the sorting of the values of the StaticViewvoidSets the name of theConnectionPoolfrom which extract the connection to retrieve the table to which the StaticView refersvoidSets the name of the table to which the StaticView refersvoidSets the name of the field that contains a date value that will be used as constraint in the extraction of the records.voidsetVISIBLE(String s) Sets the name of the field used to determine if a record is visible (must be inserted in the StaticView) or notMethods inherited from class overit.geocall.platform.ui.UINode
addChild, addChildText, getChildren, getNodeId, getParent, getSchema, setNodeId, setParent, setSchema
-
Field Details
-
_KEY_MAP
String that defines the name of the attribute that will contains the key map- See Also:
-
LOAD_DATE
String that defines the name of the attribute that will contains the date of last load- See Also:
-
KEY_FIELD
String that defines the name of the attribute that contains the key field- See Also:
-
_ord
-
_pool
-
_visible
-
_table
-
_branch
-
_factory
-
_keyField
-
_from
-
_to
-
_filter
-
_clause
-
_unusedField
Recyclable field that can be used for future purpose (ex callcenter) -
_clauses
-
branch
-
_dbt
-
_bogus
protected boolean _bogus -
_hm
-
_identity
-
-
Constructor Details
-
StaticView
public StaticView()
-
-
Method Details
-
setORD
Sets the name of the field (or the list of fields, separated by the comma) used for the sorting of the values of the StaticView- Parameters:
s- The string that defines the name of the field used for sorting
-
setPOOL
Sets the name of theConnectionPoolfrom which extract the connection to retrieve the table to which the StaticView refers- Parameters:
s- The string that defines the name of the pool
-
setTABLE
Sets the name of the table to which the StaticView refers- Parameters:
s- The string that defines the name of the table
-
setVISIBLE
Sets the name of the field used to determine if a record is visible (must be inserted in the StaticView) or not- Parameters:
s- The string that defines the name of the field used for the visibility
-
setCLAUSE
Sets an sql clause used to filter the records of the StaticView. The records loaded are the ones that we obtains making a query likeSELECT * FROM TABLE WHERE CLAUSE- Parameters:
s- A string that defines an sql clause used to extract the records
-
setFILTER
Sets a condition used to filter the records of the StaticView.- Parameters:
s- A string that defines a filter on the records
-
setBRANCH
Sets the name of the field used as foreign key field of the branches table- Parameters:
s- The string that defines the name of the foreign key field of the branches table
-
setFACTORY
Sets the name of the field used as foreign key field of the companies table- Parameters:
s- The string that defines the name of the foreign key field of the companies table
-
setKEYFIELD
Sets the name of the field that contains the key of the table- Parameters:
s- The string that defines the name of the key field of the table
-
setFROM
Sets the name of the field that contains a date value that will be used as constraint in the extraction of the records. The record extracted will have, in the field settet by this method, a date that is greater or equal to the one returned byDate()- Parameters:
s- The name of a date field, used as range constraints
-
setTO
Sets the name of the field that contains a date value that will be used as constraint in the extraction of the records. The record extracted will have, in the field settet by this method, a date that is less or equal to the one returned byDate()- Parameters:
s- The name of a date field, used as range constraints
-
setBOGUS
If set totruedefines that the StaticView must reload its values (making a query) on every access to itsDBView. A bogus StaticView is a StaticView that don't use the caching mechanism- Parameters:
s-trueto obtain a bogus StaticView,falseotherwise
-
getCacheKey
-
getCacheKeyPart
-
getCacheViewPart
-
invalidate
public void invalidate()Invalidates the StaticView (if it is not a bogus one), that means that is cleared from the cache and the next access to thegetDBView()will make a query to the database to extract the records -
invalidateAll
public static void invalidateAll()Invalidates all the StaticViews -
getDBView
Returns theDBViewthat corresponds to the StaticView. It makes the query to the database only if it is necessary (ie if the StaticView is a bogus one or if it has been invalidated), otherwise it returns the DBView stored in memory.- Returns:
- A new DBView that contains the StaticView records
-
isChangedSince
Check if the date of the last loading made from the database, it was made before the date passed as a parameter.
It can be used,for example, to check if theStaticViewhas been invalidated, previously to the date passed as parameter.- Parameters:
currentDate- TheDatepassed as parameter, after which you want to know if theStaticView's DBView, has been reloaded from the database or not.- Returns:
trueif the StaticView was invalidated after the date passed as a parameter,falseotherwise.
-
selectDBView
-
getDBView
Returns aDBViewcorresponding to the current StaticView, optionally filtering out records based on a visibility condition.If
filterDeletedisfalse, this method behaves exactly likegetDBView()and returns the unmodifiable underlying view as-is, without applying any filtering.If
filterDeletedistrue, and a visibility field has been defined usingsetVISIBLE(String), this method creates a new, editableDBViewinstance. This new view will include only those rows for which the visibility field equalsBoolean.TRUE. This filtering process creates a full copy of the visible data.Note: If your goal is to work with a filtered subset of the data, it is generally more efficient to retrieve the full unfiltered
DBViewviagetDBView(), and then compute the subset manually, based on your own logic. UsegetDBView(true)only if you specifically need a filtered, editable copy of the data.- Parameters:
filterDeleted-falseto return the original unfiltered and unmodifiable view (same asgetDBView());trueto return a new editable view containing only rows marked as visible (if a visibility field has been defined)- Returns:
- A
DBViewrepresenting either the full data or a filtered subset, depending on the parameter
-
getKeyField
Returns the name of the field that contains the key of the table- Returns:
- The string that defines the name of the key field of the table
-
getTable
Returns the name of the table to which the StaticView refers- Returns:
- The string that defines the name of the table
-
getVisibleField
Returns the name of the field used to determine if a record is visible (must be inserted in the StaticView) or not- Returns:
- The string that defines the name of the field used for the visibility
-
getLoadDate
Returns the date of the last load of the StaticView -
getIndexByKey
Returns the index of the record of the StaticView with the key passed as parameter- Parameters:
dbv- TheDBViewin which search the recordo- The object used as the key searched- Returns:
- The index of the record, or -1 if the record does not exists
-
getRowMapByKey
Returns the row mapDBView.getRowMap(int)of the record of the StaticView with the key passed as parameter- Parameters:
dbv- TheDBViewin which search the recordo- The object used as the key searched- Returns:
- The row map of the record, or null if the record does not exists
-
getRowListByKey
Returns the row listDBView.getRowList(int)of the record of the StaticView with the key passed as parameter- Parameters:
dbv- TheDBViewin which search the recordo- The object used as the key searched- Returns:
- The row list of the record, or null if the record does not exists
-
getViews
Returns the views- Returns:
- The views
-
getIdentity
Description copied from interface:IdentifiedReturns theIdentityassociated to the component- Specified by:
getIdentityin interfaceIdentified- Returns:
- The Identity of the user currently logged in the application
-
setIdentity
Description copied from interface:IdentifiedSets theIdentityto the component- Specified by:
setIdentityin interfaceIdentified- Parameters:
id- The Identity that must be associated to the component
-
getRoot
Description copied from class:UINodeReturns the root of the user interface component definition tree of this UINode
-