The 'Portal Data' term which has been referred in the previous sections can be classified into three types of object data: Portal Config, Page Data and Navigation Data; each of which has some differences in the import strategy.
The navigation data import strategy will be processed to the import mode level as the followings:
CONSERVE: If the navigation exists, leave it untouched. Otherwise, it imports data.
INSERT: Inserts the missing description data, but adds only new nodes. Other modifications remains untouched.
MERGE: Merges the description data, adds missing nodes and updates same name nodes.
OVERWRITE: Always destroys the previous data and recreates it.
In the GateIn navigation structure, each navigation can be referred to a tree which each node links to a page content. Each node contains some description data, such as label, icon, page reference, and more. Therefore, GateIn provides a way to insert or merge new data to the initiated navigation tree or a sub-tree.
The merge strategy performs the recursive comparison of child nodes between the existing persistent nodes of a navigation and the transient nodes provided by a descriptor:
Start with the root nodes (which is the effective root node or another node if the parent URI is specified).
Compare the set of child nodes and insert the missing nodes in the persistent nodes.
Proceed recursively for each child having the same name.
Let's see the example with two navigation nodes in each import mode. In this case, there are 2 navigation definitions:
Navigation node tree hierarchy
Navigation node tree hierarchy
For example, the navigation1 is loaded before navigation2. The Navigation Importer processes on two navigation definitions, depending on the Import Mode defined in portal configuration.
Case 1: Import mode is CONSERVE.
With the CONSERVE mode, data are only imported when they do not exist. So, if the navigation has been created by the navigation1 definition, the navigation2 definition does not affect anything on it. We have the result as follows:
Case 2: Import mode is INSERT.
If a node does not exist, the importer will add new nodes to the navigation tree. You will see the following result:
Hereafter, the node 'bar' is added to the navigation tree, because it does not exist in the initiated data. Other nodes are kept in the import process.
Case 3: Import mode is MERGE.
The MERGE mode indicates that a new node is added to the navigation tree, and updates the node data (such node label and node icon in the example) if it exists.
Case 4: Import mode is OVERWRITE.
Everything will be destroyed and replaced with new data if the OVERWRITE mode is used.
PortalConfig defines the portal name, permission, layout and some properties
of a site. These information are configured in the
user.xml, depending on the site type. The PortalConfig importer performs a strategy
that is based on the mode defined in NewPortalConfigListener, including CONSERVE,
INSERT, MERGE or OVERWRITE. Let's see how the import mode affects in the process of
portal data performance:
The import mode affects the page data import as the same as Portal Config.
If the Import mode is CONSERVE or INSERT, the data import strategy always performs as the MERGE mode in the first data initialization of the Portal.