public class Options extends Object
Most of the options are designed to be used in conjunction with the Integrity Application model reader, as illustrated in the snippet below:
MDWorkbench workbench = null; Model model = null; try { // configure connection on Integrity server Map<String, Object> options = new HashMap<String, Object>(); options.put(Options.OPTION_IGNORE_CONNECTOR_UI, true); options.put(Options.OPTION_INTEGRATION_POINT_KIND, IntegrationPointKind.SERVER); options.put(Options.OPTION_SERVER, "myserver"); options.put(Options.OPTION_PORT, "7001"); options.put(Options.OPTION_USER, "myUser"); options.put(Options.OPTION_PASSWORD, "myPassword"); // restrict content to one particular project DatabaseConfiguration configuration = new DatabaseConfiguration(); configuration.getProjects().add("/MyProject"); options.put(Options.OPTION_DATABASE_CONFIGURATION, configuration); // read the model model = workbench.getMetamodelManager().getMetamodel(IntegrityPackage.eINSTANCE).createModel(); model.read("Application", "", options); // get the database instance Database database = model.<Database>getInstances(IntegrityPackage.Literals.DATABASE).first(); // access on-demand the content of the database List<Type> types = database.getTypes(); ... } finally { // disposes the model if (model != null) { model.clear(); } if (workbench != null) { workbench.shutdown(); } }
Options might also be set as a Java System property. For example, for an option named "xyz"
, setting a value as a Java Virtual Machine
argument is done this way:
-Dxyz=myValue
Modifier and Type | Field and Description |
---|---|
static String |
OPTION_AS_NON_ADMINISTRATOR
Determines whether the connection is performed in a non-administrator mode.
|
static String |
OPTION_ATTACHMENT_DIRECTORY
Deprecated.
|
static String |
OPTION_ATTACHMENT_MAXIMUM_SIZE
Determines the maximum size (in bytes) of attachments.
|
static String |
OPTION_ATTACHMENT_RESOLVER
An instance of the interface
AttachmentResolver that
determines the physical location of attachments to be written in
Integrity, when using the Integrity Application model writer. |
static String |
OPTION_COMMAND_LISTENER
Registers a
CommandListener instance,
to be notified of each Integrity command executed by the Integrity Application model reader. |
static String |
OPTION_DATABASE_CONFIGURATION
Determines the configuration of the database for reading, notably the list of projects of interest.
|
static String |
OPTION_DATABASE_PRELOAD
Specifies an Integrity XMI file that contains the structure of an Integrity database (types, fields, states).
|
static String |
OPTION_DEBUG
Determines whether the connection is performed in debug mode.
|
static String |
OPTION_DEBUG_FILE
Determines the file is which debug information is written.
|
static String |
OPTION_IGNORE_ATTACHMENTS
Determines whether attachments should be ignored.
|
static String |
OPTION_IGNORE_CONNECTOR_UI
Determines whether the connector selection dialog should be avoided.
|
static String |
OPTION_IGNORE_DEFAULT_FIELD_VALUES
Determines whether a
Field shall be read if it's value equals the default value of the Field . |
static String |
OPTION_IGNORE_INCLUDE_VERSIONED_ITEM
Determines whether Versioned Items shall be read for an Item.
|
static String |
OPTION_IGNORE_ITEM_LABELS
Determines whether a label shall be read for an Item, even if field values are not yet available.
|
static String |
OPTION_IGNORE_QUERY_ITEMS
Determine whether Items shall be read on-demand when
Query.getItems() is called. |
static String |
OPTION_IGNORE_RICH_TEXT
Determines whether text formatting (bold, italic,
etc.) is to be ignored when reading data.
|
static String |
OPTION_IGNORE_TYPE_ITEMS
Determine whether Items shall be read on-demand when
Type.getItems() is called. |
static String |
OPTION_INTEGRATION_POINT_KIND
Determines whether access to the Integrity database is performed
on the Integrity server or using an Integrity local client.
|
static String |
OPTION_ITEM_LABEL_FIELDS
Determines the field names that can contain the label of an Item.
|
static String |
OPTION_PASSWORD
The name of the Integrity password to connect to the Integrity database.
|
static String |
OPTION_PORT
The port of the Integrity database.
|
static String |
OPTION_SECURE_PORT
Determines whether access to Integrity server is performed using a secure port (SSL connection).
|
static String |
OPTION_SERVER
The server of the Integrity database.
|
static String |
OPTION_USER
The name of the Integrity user to connect to the Integrity database.
|
public static final String OPTION_DATABASE_CONFIGURATION
public static final String OPTION_DATABASE_PRELOAD
public static final String OPTION_ATTACHMENT_RESOLVER
AttachmentResolver
that
determines the physical location of attachments to be written in
Integrity, when using the Integrity Application model writer.AttachmentResolver
,
Constant Field Values@Deprecated public static final String OPTION_ATTACHMENT_DIRECTORY
public static final String OPTION_INTEGRATION_POINT_KIND
When setting the connection mode to SERVER
, the following settings must also be configured:
OPTION_SERVER
- The server of the Integrity database.OPTION_PORT
- The port of the Integrity database.OPTION_SECURE_PORT
(optional) - Determines whether access to Integrity server is performed using a secure port (SSL
connection). Default is false
OPTION_USER
- The name of the Integrity user to connect to the Integrity database.OPTION_PASSWORD
- The name of the Integrity password to connect to the Integrity database.OPTION_IGNORE_CONNECTOR_UI
should also be set true
in such use case.IntegrationPointKind
,
Constant Field Valuespublic static final String OPTION_SERVER
public static final String OPTION_PORT
OPTION_SECURE_PORT
option must also be set to true
.public static final String OPTION_SECURE_PORT
Default value is false
(meaning port is not using a secure connection).
OPTION_PORT
,
Constant Field Valuespublic static final String OPTION_USER
public static final String OPTION_PASSWORD
public static final String OPTION_IGNORE_CONNECTOR_UI
true
. Default value is false
(meaning
the
connector UI is displayed).public static final String OPTION_IGNORE_ATTACHMENTS
false
(meaning attachments are read and written).public static final String OPTION_ATTACHMENT_MAXIMUM_SIZE
public static final String OPTION_IGNORE_RICH_TEXT
false
(meaning rich text formatting is read).public static final String OPTION_IGNORE_TYPE_ITEMS
Type.getItems()
is called.
Querying all items of a specific type can be time consuming and can hit a maximum number of items returned by a command,
depending on your database configuration.
It is recommended to use queries to retrieve Items.
Default value is true
(meaning Items are not read on-demand in this context).public static final String OPTION_IGNORE_DEFAULT_FIELD_VALUES
Field
shall be read if it's value equals the default value of the Field
.
If no default value is defined for a FieldValue
the Java default value will be used instead. For a Numeric field the default value
is 0.0
, for a Boolean field the default value is false
. For a String field, if the field is empty, it will be
consider as null and Integrity will no return any value.
Reading field with default value could increase significantly the size of the model read.
Default value is true
(meaning Field
with default values are not read and not added to the model in this context).
public static final String OPTION_IGNORE_QUERY_ITEMS
Query.getItems()
is called.
Disabling queries execution can be interesting in two different use cases:
true
might improve the performances.
Default value is false
(meaning Items are read on-demand in this context).
Query.getItems()
,
Constant Field Valuespublic static final String OPTION_IGNORE_ITEM_LABELS
Items content is read only on-demand, when Item.getValues()
is called. The default behavior of the model reader is to read the
label of an Item, even if its field values are not yet known, to be returned by the toString()
method.
Default value is false
.
OPTION_ITEM_LABEL_FIELDS
,
Constant Field Valuespublic static final String OPTION_ITEM_LABEL_FIELDS
Items content is read only on-demand, when Item.getValues()
is called. The default behavior of the model reader is to read the
label of an Item, even if its field values are not yet known, to be returned by the toString()
method.
Default label fields are: Summary
, Title
, Text
and Shared Text
The value must a String
with field names separated by '|'
character.
OPTION_IGNORE_ITEM_LABELS
,
Constant Field Valuespublic static final String OPTION_AS_NON_ADMINISTRATOR
Some interactions with the Integrity database, like listing projects, require administrator access
(i.e. the connected user must have ViewAdmin
permission in Integrity).
Setting this option to true
enables retrieving a subset of the information for non administrators.
Here are the differences when turning on this option:
Database.getProjects()
: returns only projects the user has access to.Project.getPermittedAdministrators()
: always returns an empty list.Project.getPermittedGroups()
: always returns an empty list.Type.getConstraints()
: always returns false
.Field.isReadOnly()
: always returns an empty list.
Default value is false
(meaning the connection runs in administrator mode).
public static final String OPTION_DEBUG
OPTION_DEBUG_FILE
option.
Default value is false
(meaning no debug output is generated).OPTION_DEBUG_FILE
,
Constant Field Valuespublic static final String OPTION_DEBUG_FILE
OPTION_DEBUG
should also be set to true
.OPTION_DEBUG
,
Constant Field Valuespublic static final String OPTION_COMMAND_LISTENER
CommandListener
instance,
to be notified of each Integrity command executed by the Integrity Application model reader.CommandListener
,
Constant Field Valuespublic static final String OPTION_IGNORE_INCLUDE_VERSIONED_ITEM
Versioned Items have been implemented since the version 10.5 of PTC Integrity and is not supported by earlier versions of the product. In addition this option is automatically ignored if the Integrity server does not handle versioned items.
Default value is false
(meaning Versioned Items are read).