Class Options
- java.lang.Object
-
- com.sodius.mdw.metamodel.integrity.io.Options
-
public class Options extends Object
Provides options available when reading or updating Integrity data.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
-
-
Field Summary
Fields Modifier and Type Field Description static String
OPTION_API_VERSION
The API version to communicate to the Integrity server when contacting it.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 interfaceAttachmentResolver
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 aCommandListener
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 aField
shall be read if it's value equals the default value of theField
.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 whenQuery.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 whenType.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.
-
-
-
Field Detail
-
OPTION_DATABASE_CONFIGURATION
public static final String OPTION_DATABASE_CONFIGURATION
Determines the configuration of the database for reading, notably the list of projects of interest.- See Also:
- Constant Field Values
-
OPTION_DATABASE_PRELOAD
public static final String OPTION_DATABASE_PRELOAD
Specifies an Integrity XMI file that contains the structure of an Integrity database (types, fields, states). This can be used to preload the content of an Integrity model, when using the Application model reader. It avoids the reader to fetch this information from the database, notably for cases where the user is not allowed to access such content (i.e. the user is not allowed to execute Integrity administraion commands).- See Also:
- Constant Field Values
-
OPTION_ATTACHMENT_RESOLVER
public static final String OPTION_ATTACHMENT_RESOLVER
An instance of the interfaceAttachmentResolver
that determines the physical location of attachments to be written in Integrity, when using the Integrity Application model writer.- See Also:
AttachmentResolver
, Constant Field Values
-
OPTION_ATTACHMENT_DIRECTORY
@Deprecated public static final String OPTION_ATTACHMENT_DIRECTORY
Deprecated.Clients are advised not to use this field.- See Also:
- Constant Field Values
-
OPTION_INTEGRATION_POINT_KIND
public static final String OPTION_INTEGRATION_POINT_KIND
Determines whether access to the Integrity database is performed on the Integrity server or using an Integrity local client.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 isfalse
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 settrue
in such use case.- See Also:
IntegrationPointKind
, Constant Field Values
-
OPTION_SERVER
public static final String OPTION_SERVER
The server of the Integrity database.
-
OPTION_PORT
public static final String OPTION_PORT
The port of the Integrity database. If the port is using a secure connection, theOPTION_SECURE_PORT
option must also be set totrue
.
-
OPTION_SECURE_PORT
public static final String OPTION_SECURE_PORT
Determines whether access to Integrity server is performed using a secure port (SSL connection).Default value is
false
(meaning port is not using a secure connection).- Since:
- 1.10.0
- See Also:
OPTION_PORT
, Constant Field Values
-
OPTION_USER
public static final String OPTION_USER
The name of the Integrity user to connect to the Integrity database.
-
OPTION_PASSWORD
public static final String OPTION_PASSWORD
The name of the Integrity password to connect to the Integrity database.
-
OPTION_API_VERSION
public static final String OPTION_API_VERSION
The API version to communicate to the Integrity server when contacting it. Default value is"4.10"
, which allows compatibility with all Integrity versions since 2009. Refer to PTC's Integrations Builder Guide for details on the possible values of API version and compatibility matrix.- Since:
- 1.12.2
- See Also:
- Constant Field Values
-
OPTION_IGNORE_CONNECTOR_UI
public static final String OPTION_IGNORE_CONNECTOR_UI
Determines whether the connector selection dialog should be avoided. When the connector is integrated in a Java program, this setting should be set totrue
. Default value isfalse
(meaning the connector UI is displayed).- See Also:
- Constant Field Values
-
OPTION_IGNORE_ATTACHMENTS
public static final String OPTION_IGNORE_ATTACHMENTS
Determines whether attachments should be ignored. Default value isfalse
(meaning attachments are read and written).- See Also:
- Constant Field Values
-
OPTION_ATTACHMENT_MAXIMUM_SIZE
public static final String OPTION_ATTACHMENT_MAXIMUM_SIZE
Determines the maximum size (in bytes) of attachments. If one attachment is bigger than the specified size, a warning is logged and the attachment is skipped by the model writer.- See Also:
- Constant Field Values
-
OPTION_IGNORE_RICH_TEXT
public static final String OPTION_IGNORE_RICH_TEXT
Determines whether text formatting (bold, italic, etc.) is to be ignored when reading data. Default value isfalse
(meaning rich text formatting is read).- See Also:
- Constant Field Values
-
OPTION_IGNORE_TYPE_ITEMS
public static final String OPTION_IGNORE_TYPE_ITEMS
Determine whether Items shall be read on-demand whenType.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 istrue
(meaning Items are not read on-demand in this context).
-
OPTION_IGNORE_DEFAULT_FIELD_VALUES
public static final String OPTION_IGNORE_DEFAULT_FIELD_VALUES
Determines whether aField
shall be read if it's value equals the default value of theField
.If no default value is defined for a
FieldValue
the Java default value will be used instead. For a Numeric field the default value is0.0
, for a Boolean field the default value isfalse
. 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
(meaningField
with default values are not read and not added to the model in this context).- Since:
- Version 1.7.0.
- See Also:
- Constant Field Values
-
OPTION_IGNORE_QUERY_ITEMS
public static final String OPTION_IGNORE_QUERY_ITEMS
Determine whether Items shall be read on-demand whenQuery.getItems()
is called.Disabling queries execution can be interesting in two different use cases:
- You just want to get the list of available queries in the database, but you are not interested in Items.
- The model is loaded as a base to add new Item instances and then be written back to Integrity. If the created Items are not related to
existing Items, setting this property to
true
might improve the performances.
Default value is
false
(meaning Items are read on-demand in this context).- See Also:
Query.getItems()
, Constant Field Values
-
OPTION_IGNORE_ITEM_LABELS
public static final String OPTION_IGNORE_ITEM_LABELS
Determines whether a label shall be read for an Item, even if field values are not yet available.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 thetoString()
method.Default value is
false
.- See Also:
OPTION_ITEM_LABEL_FIELDS
, Constant Field Values
-
OPTION_ITEM_LABEL_FIELDS
public static final String OPTION_ITEM_LABEL_FIELDS
Determines the field names that can contain the label of an Item.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 thetoString()
method.Default label fields are:
Summary
,Title
,Text
andShared Text
The value must a
String
with field names separated by'|'
character.- See Also:
OPTION_IGNORE_ITEM_LABELS
, Constant Field Values
-
OPTION_AS_NON_ADMINISTRATOR
public static final String OPTION_AS_NON_ADMINISTRATOR
Determines whether the connection is performed in a non-administrator mode.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 totrue
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 returnsfalse
.Field.isReadOnly()
: always returns an empty list.
Default value is
false
(meaning the connection runs in administrator mode).- Since:
- 1.9.7
- See Also:
- Constant Field Values
-
OPTION_DEBUG
public static final String OPTION_DEBUG
Determines whether the connection is performed in debug mode. In this mode, a log of executed commands is written in the file specified using theOPTION_DEBUG_FILE
option. Default value isfalse
(meaning no debug output is generated).- See Also:
OPTION_DEBUG_FILE
, Constant Field Values
-
OPTION_DEBUG_FILE
public static final String OPTION_DEBUG_FILE
Determines the file is which debug information is written. The optionOPTION_DEBUG
should also be set totrue
.- See Also:
OPTION_DEBUG
, Constant Field Values
-
OPTION_COMMAND_LISTENER
public static final String OPTION_COMMAND_LISTENER
Registers aCommandListener
instance, to be notified of each Integrity command executed by the Integrity Application model reader.- See Also:
CommandListener
, Constant Field Values
-
OPTION_IGNORE_INCLUDE_VERSIONED_ITEM
public static final String OPTION_IGNORE_INCLUDE_VERSIONED_ITEM
Determines whether Versioned Items shall be read for an 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).- Since:
- Version 1.7.0.
- See Also:
- Constant Field Values
-
-