Appendix > Installing the Remote API > To work with document configurations
To work with document configurations
Document properties within a roundtrip configuration can be configured for each document separately. From a handle to the document, you can set the baseline, view and export/import settings etc. See the example below:
// To set the export document options:
IRemoteExportDocument exportDocument;
exportDocument.setSelected(true);
exportDocument.setAliasName("AliasName");

// You will find the tool specific options like "Exported Baseline" in the tool options
IRemoteToolAttribute[] toolOptions = exportDocument.getToolOptions();

// A doors module will have the enumeration attribute "Exported baseline"
IRemoteToolEnumerationAttribute exportedBaselinecAttribute = ...;
exportedBaselinecAttribute.getValue(); // Could be "current"
// if a connection to Doors is established, you can get the availalble baselines
with the getLiterals() method
for(String baseline : exportedBaselinecAttribute.getLiterals()) {
// the baseline
}
// Before you set an option, you can check if this is enabled
// If you try to set a disabled option a DisabledException will be thrown
if(exportedBaselinecAttribute.getEnabled()) {
exportedBaselinecAttribute.setValue("1.0");
}

// To transfer the local changes to the server you must commit the changes
IRemoteExchangeConfiguration configuration = ...;
IOperationResult result = remoteClient.commitRoundtripChanges(configuration);

// If you have dependend options you must commit the changes
before you can change the option

// The configuration
IRemoteExchangeConfiguration configuration = ..;
// Attribute: "Create baseline before export"
IRemoteToolBooleanAttribute createBaselineAttribute = ...;
// Attribute: "Increase baseline number"
IRemoteToolEnumerationAttribute increaseAttribute = ...;
// The increaseAttribte will be disabled until the "Create baseline before export"
attribute is set to true
// To be able to change the "Increase baseline number" attribute you must
createBaselineAttribute.setValue(true);
IOperationResult result = remoteClient.commitRoundtripChanges(configuration);
// check the result
// The "Increase baseline number" is enabled now
increaseAttribute.setValue("Major");
...
// Commit the changes
IOperationResult result = remoteClient.commitRoundtripChanges(configuration);
}
Was this helpful?