String localAETitle = "LocalAETitle";
String localHostName = "localMachine.domainName";
int localPort = 11112;
String remoteAETitle = "OsiriXAE";
String remoteHost = "remoteMachine.domainName";
int remotePort = 1025;
Device device = new Device(localHostName);
Connection connection = new Connection(localAETitle, localHostName, localPort);
connection.setDevice(device);
ApplicationEntity ae = new ApplicationEntity(remoteAETitle);
device.addApplicationEntity(ae);
ae.addConnection(connection);
String queryLevel = "STUDY";
String queryModel = "";
boolean relational = false;
QueryTool queryTool = new QueryTool(remoteHost, remotePort, remoteAETitle, queryLevel, queryModel,
relational, device, localAETitle, connection);
String testDescription = "QueryTest";
try {
queryTool.query(testDescription);
}
catch (Exception e) {
System.err.println(e.getMessage());
e.printStackTrace();
System.exit(2);
}