Appendix > Installing the Remote API > To work with roundtrip configurations
To work with roundtrip configurations
From a project handle, you can get a list of all contained roundtrip configurations. You can also create or delete a roundtrip configuration inside a project. See the example below:
// You will find existing roundtrip files in the workspace
IRemoteClient remoteClient = ...;
IRemoteFile roundtripFile = ..;

// To open a roundtrip file
IOperationResult result = remoteClient.openRoundtrip(roundtripFile);
if(!result.getSuccessful()) {
// failed to open roundtrip configuration
} else {
// you can get the configuration with the getOpenConfiguration method
IRemoteExchangeConfiguration configuration =
remoteClient.getOpenConfiguration(roundtripFile);
}

// To list all open configurations
for(IRemoteExchangeConfiguration configuration : remoteClient.getOpenConfigurations()) {
// ...
}

// To close and save roundtrip
IRemoteExchangeConfiguration configuration ...;
remoteClient.closeRoundtrip(configuration, true);

// To create a new roundtrip configuration
IRemoteProject project ...;
IOperationResult result = remoteClient.createRoundtrip(project, "Example.configuration");
if(!result.getSuccessful()) {
// Failed to create the roundtrip
} else {
// you will find the file with the name "Example.configuration" in the project
}
// To set the password and connect to Windchill RV&S
IOperationResult result = remoteClient.openRoundtrip(roundtripFile);
// check the result
IRemoteExchangeConfiguration configuration =
remoteClient.getOpenConfiguration(roundtripFile);
configuration.setGlobalLoginData(false);
remoteClient.commitRoundtripChanges(configuration);
configuration.setLocalTool("Windchill");
remoteClient.commitRoundtripChanges(configuration);
IRemoteToolStringAttribute pAttribute =
findStringAttribute(configuration.getConnectionAttributes(), "Password");
// This change will be stored locally
pAttribute.setValue("my_password");
// To send the changes to the server, you must run the commit method
result = remoteClient.commitRoundtripChanges(exchangeConfig);
// check the result
// After the password is set you can run the connect method
result = remoteClient.connectRoundtrip(exchangeConfig);
// To disconnect
result = remoteClient.disconnectRoundtrip(exchangeConfig);
}
Was this helpful?