Importing Model Elements
Elements of an existing model can be imported into other models. Developers can work simultaneously on the same model, importing the different elements to create a new model. You can also reuse parts of a model, streamlining your work and letting multiple developers work efficiently.
Settings and properties are not inherited from the source model. You can reconfigure them in the destination model if you want to keep the existing settings and properties.
Workflow
-
Open the destination model in the Design Tool.
The destination model is the model that you are importing to. It is a good idea to always backup your model before importing model elements.
-
From the File menu, choose Import Model Elements to open the Import Model Elements dialog box. You can open either a
.modelx file
ora .model file
. -
Browse to the import model. You import from the source model (in the dialog box) to the destination model, which is open in the Design Tool.
The left pane displays a tree representation of the source model, including all entities, tables, and variables.
-
Choose the elements of the model you want to import into the destination model.
Note
Model elements are those items that can be imported and comprise entities, attributes, operations, recordsets, recordset fields, tables, table columns, procedures, compound procedures, and model variables. When an operation containing a
WaitForMultipleEvents
command is imported, the referenced Host Events are also imported.Patterns and events cannot be imported separately from their entity.
-
Preview your selected elements in the Destination pane. This pane is divided into the following elements.
Insert elements are new elements that are added to the model when the import is complete.
Update elements are elements that are updated after the import is complete.
Referenced elements are elements that are referenced by other elements. If these are not resolved, either manually or automatically, a temporary replacement version of the element is created. These replacement elements are marked with a _notImported suffix.
-
Click OK.
Note
If an element already exists in the destination model, importing it overwrites the current element.
By default, the destination model with all imported model elements is validated using the Host Integrator Validator.
-
Resolve any validation errors.
-
If you are importing a model that contains an event handler, copy the Java code from the model source Scripts sub-directory to the corresponding sub-directory in the destination model.
A reference to the event handler is imported along with the parent element.
Terminology and Best Practices for Importing Models
Elements of an existing model can be imported into other models. Developers can work simultaneously on the same model, importing the different elements to create a new model. You can also reuse parts of a model, streamlining your work and letting multiple developers work efficiently.
Terminology
-
Destination model
The destination model is the model that you are importing to and the model which is open in the Design Tool.
-
Master model
After the import is complete, the new model that was created by importing elements from the source model into the destination model is called the master model.
-
Source model
You import from the source model to the destination model. The source model is selected in the Model Import dialog box.
-
Model elements
Model elements are those items that may be imported and comprise entities, attributes, operations, recordsets, recordset fields, tables, table columns, procedures, compound procedures, and model variables.
-
Referenced elements
A referenced element is referenced by another element, but not selected for import. All referenced elements must be resolved, either manually or automatically, before the new model can be deployed.
Note
If the option Automatically select referenced elements is selected on the Preferences dialog box, then
_notImported
elements do not occur. If this option is cleared, then these replacement elements must be resolved manually.
Best Practices
-
Always backup your model before you begin the import process.
-
Understand your model.
-
Elements that are identified as
_notImported
in the preview pane of the Model Import dialog box are not problems. It is not unusual to have elements that you do not want to import.An element, for example an attribute, might reference another element, such as a variable. When the attribute is imported, but the variable isn't, then the referenced element is missing. The import function creates a temporary replacement version of the referenced element. These replacements are marked with the
_notImported
suffix and inserted into the destination model.Since all referenced elements must eventually be resolved before a model can be deployed, after finishing the import, use the Design Tool to modify the attribute you have just imported. Find the reference to the placeholder variable and change it to refer to a "real" variable in your model.
-
Create a base model with all the entities up to the home entity. This model should include a model of lifecycle event handlers.
If all the screens you want to model are known in advance, it is beneficial to include the entities that will be duplicated across different models in the base model. This prevents a particular entity from having different names across different models and reduces the size of the model.
-
Developers should use the base model and extend it to include other model elements. The model should be given a unique name. For example,
<DeveloperInitials>
_<BaseModelName>
. -
Add a prefix to the names of event handlers to make them unique to each model. This ensures that there are no clashes during the import process.
-
Code freeze both models during the import merge process.
- Test the destination (master) model when the import is complete.
- Provide the master model to the developers to continue the task of extending the model.
Frequently Asked Questions
-
Can I import models with event handlers?
Yes. If you import a model that contains an event handler, a reference to it is imported along with the parent element. However, you must manually copy the Java code from the model source Scripts sub-directory to the corresponding sub-directory in the destination model files.
-
How do I make sure I don't overwrite existing elements during import?
When you select an element that is already in the destination model the element is replaced. However, you must confirm your decision before the element is overwritten. This option is set on the Import tab of the Preferences Setup dialog box and is selected by default.
-
Do I have to validate my new master model?
By default, all import models are validated in the Host Integrator Validator. A model must successfully validate before it can be deployed.
-
Can I change how sub-items and referenced items are selected in the Model Import pane?
Options that determine how to work with the Import Model Elements dialog box are set on Settings > Preferences > Import. See Import Preferences for a description of each option, as well as the default settings.
-
What do the green and yellow equal signs mean?
All of the element's properties in the source model are the same as those in the destination model. For example, if an entity exists in both models and all of the entity's sub-items are also marked with a green equal sign, you do not have to import this element.
However, a yellow equal sign indicates that the element properties are the same, but there are differences between one or more sub-items of the element.
More information
Copy Objects
You can copy objects you have already created for reuse. Copying patterns, attributes, or recordsets allows you to quickly create new model objects based on objects that you have already defined within a given entity.
You can copy patterns, attributes, and recordsets as described below. You can also copy tables and procedures, and complete entities can be replicated a shown in Copy Entity.
-
From the drop down list attached to the following buttons, click Create Copy:
-
Attribute
-
Recordset
-
Pattern
-
Operation
The copied object has a similar name to the original object with a number appended (for example, Password_2).
-
-
Make the necessary modifications to the new copy.
Avoiding Problems
Use these best practices to avoid common problems:
- If you copy a pattern that is configured to be a signature pattern for an entity, edit the pattern characteristics to avoid invalid signatures.
- When you copy an entity, you must identify a signature that uniquely identifies the entity. It cannot have the same signature as the source entity you copied from.
- Avoid copying an object that is relative to a pattern, since the relative relationship is usually not the same for the new object.
- Copying or importing operations that act on entity-specific objects may not function as originally designed, even if each command in the operation is copied successfully.
Copy Entity
You can copy entities you have already created. This is a fast way to build models that contain multiple occurrences of similar screens.
To Copy an Entity
-
Click Copy From on the options list next to the Entity button. This option is available when you are on an undefined screen.
-
Select the entity to copy.
Note
On the left side of the Copy Entity object dialog box is a list of entities within this model. Entities that cannot be copied are marked with a red X.
-
Confirm that this item can be copied as you expect.
The right pane's Snapshot tab includes a snapshot of the selected entity. The Entity tab shows the name of the source entity and the objects within the entity.
The Copy status column indicates whether the entity can be copied. If an object cannot be copied (for example, you are trying to copy an attribute from a 132 column entity to an 80 column entity), an error icon is displayed.
-
Click Copy.
-
Edit the resulting entity.
- At a minimum, you must identify a signature that uniquely identifies the entity. It cannot have the same signature as the source entity you copied from.
- Modify any patterns that are defined for the source entity and are not present in the target entity. They are listed with a red X to the left of the pattern name.
More information