Skip to content

Commit 381e341

Browse files
committed
Issue #5 Disable Telemetry
1 parent e2b5878 commit 381e341

File tree

7 files changed

+5
-218
lines changed

7 files changed

+5
-218
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22
# /
33

4+
.DS_Store
5+
.java-version
46
.idea
57
**/*.iml
68
donkey/donkey-src

client/src/com/mirth/connect/client/ui/FirstLoginDialog.form

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
<Component id="jScrollPane1" alignment="0" pref="353" max="32767" attributes="0"/>
5959
<Group type="102" alignment="0" attributes="0">
6060
<Group type="103" groupAlignment="0" attributes="0">
61-
<Component id="registerCheckBox" alignment="0" min="-2" max="-2" attributes="0"/>
6261
<Component id="userEditPanel" alignment="0" min="-2" max="-2" attributes="0"/>
6362
</Group>
6463
<EmptySpace min="0" pref="19" max="32767" attributes="0"/>
@@ -77,8 +76,6 @@
7776
<EmptySpace max="-2" attributes="0"/>
7877
<Component id="userEditPanel" min="-2" max="-2" attributes="0"/>
7978
<EmptySpace max="-2" attributes="0"/>
80-
<Component id="registerCheckBox" min="-2" max="-2" attributes="0"/>
81-
<EmptySpace max="32767" attributes="0"/>
8279
<Component id="jSeparator1" min="-2" max="-2" attributes="0"/>
8380
<EmptySpace max="-2" attributes="0"/>
8481
<Component id="finishButton" min="-2" max="-2" attributes="0"/>
@@ -159,19 +156,6 @@
159156
</Component>
160157
</SubComponents>
161158
</Container>
162-
<Component class="javax.swing.JCheckBox" name="registerCheckBox">
163-
<Properties>
164-
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
165-
<Color blue="ff" green="ff" red="ff" type="rgb"/>
166-
</Property>
167-
<Property name="selected" type="boolean" value="true"/>
168-
<Property name="text" type="java.lang.String" value="Register user with NextGen Healthcare"/>
169-
<Property name="toolTipText" type="java.lang.String" value="&lt;html&gt;Register your user information with NextGen Healthcare to help us&lt;br&gt;improve the product and provide better service.&lt;/html&gt;"/>
170-
</Properties>
171-
<Events>
172-
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="registerCheckBoxActionPerformed"/>
173-
</Events>
174-
</Component>
175159
</SubComponents>
176160
</Container>
177161
</SubComponents>

client/src/com/mirth/connect/client/ui/FirstLoginDialog.java

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ public FirstLoginDialog(User currentUser) {
4848

4949
userEditPanel.setUser(this, currentUser);
5050
userEditPanel.setRequiredFields(false, true);
51-
if (currentUser.getId() == 1) {
52-
registerCheckBox.setVisible(false);
53-
}
5451

5552
jLabel2.setForeground(UIConstants.HEADER_TITLE_TEXT_COLOR);
5653
setModal(true);
@@ -104,8 +101,6 @@ private void initComponents() {
104101
userEditPanel = new com.mirth.connect.client.ui.UserEditPanel();
105102
jScrollPane1 = new javax.swing.JScrollPane();
106103
jTextPane1 = new javax.swing.JTextPane();
107-
registerCheckBox = new javax.swing.JCheckBox();
108-
userConsentCheckBox = new javax.swing.JCheckBox();
109104
contentTextPane = new javax.swing.JTextPane();
110105

111106
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
@@ -149,21 +144,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
149144
jTextPane1.setDisabledTextColor(new java.awt.Color(0, 0, 0));
150145
jTextPane1.setEnabled(false);
151146
jScrollPane1.setViewportView(jTextPane1);
152-
153-
registerCheckBox.setBackground(new java.awt.Color(255, 255, 255));
154-
registerCheckBox.setSelected(true);
155-
registerCheckBox.setText(String.format("Register user with %s", BrandingConstants.COMPANY_NAME));
156-
registerCheckBox.setToolTipText(String.format("<html>Register your user information with %s to help us<br>improve the product and provide better service.</html>", BrandingConstants.COMPANY_NAME));
157-
registerCheckBox.addActionListener(new java.awt.event.ActionListener() {
158-
public void actionPerformed(java.awt.event.ActionEvent evt) {
159-
registerCheckBoxActionPerformed(evt);
160-
}
161-
});
162-
163-
userConsentCheckBox.setBackground(new java.awt.Color(255, 255, 255));
164-
userConsentCheckBox.setSelected(true);
165-
userConsentCheckBox.setText(String.format("I consent to receive email updates and marketing messages from %s.", BrandingConstants.COMPANY_NAME));
166-
userConsentCheckBox.setToolTipText("<html></html>");
167147

168148
contentTextPane.setContentType("text/html");
169149
contentTextPane.setText(String.format("<html>&nbsp;&nbsp;&nbsp;&nbsp;For more information on the processing of your personal data, click <a href=\"%s\">here to find our Privacy Policy.</a></html>", BrandingConstants.PRIVACY_URL));
@@ -209,8 +189,6 @@ public void hyperlinkUpdate(HyperlinkEvent evt) {
209189
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 353, Short.MAX_VALUE)
210190
.addGroup(channelOverviewLayout.createSequentialGroup()
211191
.addGroup(channelOverviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
212-
.addComponent(registerCheckBox)
213-
.addComponent(userConsentCheckBox)
214192
.addComponent(contentTextPane)
215193
.addComponent(userEditPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
216194
.addGap(0, 19, Short.MAX_VALUE)))
@@ -224,10 +202,6 @@ public void hyperlinkUpdate(HyperlinkEvent evt) {
224202
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
225203
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
226204
.addComponent(userEditPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
227-
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
228-
.addComponent(registerCheckBox)
229-
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
230-
.addComponent(userConsentCheckBox)
231205
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
232206
.addComponent(contentTextPane)
233207
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
@@ -262,21 +236,12 @@ private void finishButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
262236
parent.alertWarning(this, validateUserMessage);
263237
} else {
264238
User user = userEditPanel.getUser();
265-
if (userConsentCheckBox.isSelected()) {
266-
user.setUserConsent(true);
267-
}
268-
boolean success = false;
269-
270-
success = parent.updateCurrentUser(this, user, userEditPanel.getPassword());
239+
boolean success = parent.updateCurrentUser(this, user, userEditPanel.getPassword());
271240

272241
if (!success) {
273242
return;
274243
}
275244

276-
if (registerCheckBox.isSelected()) {
277-
parent.registerUser(user);
278-
}
279-
280245
try {
281246
User currentUser = parent.getCurrentUser(parent);
282247
parent.mirthClient.setUserPreference(currentUser.getId(), "firstlogin", "false");
@@ -307,18 +272,6 @@ private void finishButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
307272
}
308273
}//GEN-LAST:event_finishButtonActionPerformed
309274

310-
private void registerCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_registerCheckBoxActionPerformed
311-
boolean allRequired = registerCheckBox.isSelected();
312-
if (allRequired) {
313-
userConsentCheckBox.setSelected(true);
314-
userConsentCheckBox.setEnabled(true);
315-
} else {
316-
userConsentCheckBox.setSelected(false);
317-
userConsentCheckBox.setEnabled(false);
318-
}
319-
userEditPanel.setRequiredFields(false, true);
320-
}//GEN-LAST:event_registerCheckBoxActionPerformed
321-
322275
public boolean getResult() {
323276
return this.result;
324277
}
@@ -331,8 +284,6 @@ public boolean getResult() {
331284
private javax.swing.JSeparator jSeparator1;
332285
private javax.swing.JTextPane jTextPane1;
333286
private com.mirth.connect.client.ui.MirthHeadingPanel mirthHeadingPanel1;
334-
private javax.swing.JCheckBox registerCheckBox;
335-
private javax.swing.JCheckBox userConsentCheckBox;
336287
private com.mirth.connect.client.ui.UserEditPanel userEditPanel;
337288
private javax.swing.JTextPane contentTextPane;
338289
// End of variables declaration//GEN-END:variables

client/src/com/mirth/connect/client/ui/Frame.java

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
import org.apache.commons.collections4.CollectionUtils;
8080
import org.apache.commons.io.FileUtils;
8181
import org.apache.commons.io.FilenameUtils;
82+
import org.apache.commons.lang3.NotImplementedException;
8283
import org.apache.commons.lang3.StringUtils;
8384
import org.apache.commons.lang3.exception.ExceptionUtils;
8485
import org.apache.http.conn.HttpHostConnectException;
@@ -1948,68 +1949,6 @@ public User getCurrentUser(Component parentComponent, boolean alertOnFailure) {
19481949
return currentUser;
19491950
}
19501951

1951-
public void registerUser(final User user) {
1952-
final String workingId = startWorking("Registering user...");
1953-
1954-
SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
1955-
1956-
public Void doInBackground() {
1957-
try {
1958-
ConnectServiceUtil.registerUser(PlatformUI.SERVER_ID, PlatformUI.SERVER_VERSION, user, PlatformUI.HTTPS_PROTOCOLS, PlatformUI.HTTPS_CIPHER_SUITES);
1959-
} catch (ClientException e) {
1960-
// ignore errors connecting to update/stats server
1961-
}
1962-
1963-
return null;
1964-
}
1965-
1966-
public void done() {
1967-
stopWorking(workingId);
1968-
}
1969-
};
1970-
1971-
worker.execute();
1972-
}
1973-
1974-
public void sendUsageStatistics() {
1975-
UpdateSettings updateSettings = null;
1976-
try {
1977-
updateSettings = mirthClient.getUpdateSettings();
1978-
} catch (Exception e) {
1979-
}
1980-
1981-
if (updateSettings != null && updateSettings.getStatsEnabled()) {
1982-
final String workingId = startWorking("Sending usage statistics...");
1983-
1984-
SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
1985-
1986-
public Void doInBackground() {
1987-
try {
1988-
String usageData = mirthClient.getUsageData(getClientStats());
1989-
if (usageData != null) {
1990-
boolean isSent = ConnectServiceUtil.sendStatistics(PlatformUI.SERVER_ID, PlatformUI.SERVER_VERSION, false, usageData, PlatformUI.HTTPS_PROTOCOLS, PlatformUI.HTTPS_CIPHER_SUITES);
1991-
if (isSent) {
1992-
UpdateSettings settings = new UpdateSettings();
1993-
settings.setLastStatsTime(System.currentTimeMillis());
1994-
mirthClient.setUpdateSettings(settings);
1995-
}
1996-
}
1997-
} catch (ClientException e) {
1998-
// ignore errors connecting to update/stats server
1999-
}
2000-
2001-
return null;
2002-
}
2003-
2004-
public void done() {
2005-
stopWorking(workingId);
2006-
}
2007-
};
2008-
2009-
worker.execute();
2010-
}
2011-
}
2012-
20131952
private Map<String, Object> getClientStats() {
20141953
Map<String, Object> clientStats = new HashMap<String, Object>();
20151954
clientStats.put("javaVersion", System.getProperty("java.version"));

client/src/com/mirth/connect/client/ui/LoginPanel.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,6 @@ private boolean handleSuccess(LoginStatus loginStatus) throws ClientException {
631631
PlatformUI.MIRTH_FRAME.alertThrowable(PlatformUI.MIRTH_FRAME, e);
632632
}
633633

634-
PlatformUI.MIRTH_FRAME.sendUsageStatistics();
635-
636634
return true;
637635
}
638636

server/src/com/mirth/connect/client/core/ConnectServiceUtil.java

Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import org.apache.commons.httpclient.HttpStatus;
2121
import org.apache.commons.io.IOUtils;
22+
import org.apache.commons.lang3.NotImplementedException;
2223
import org.apache.http.HttpEntity;
2324
import org.apache.http.NameValuePair;
2425
import org.apache.http.StatusLine;
@@ -49,44 +50,12 @@
4950

5051
public class ConnectServiceUtil {
5152
private final static String URL_CONNECT_SERVER = "https://connect.mirthcorp.com";
52-
private final static String URL_REGISTRATION_SERVLET = "/RegistrationServlet";
53-
private final static String URL_USAGE_SERVLET = "/UsageStatisticsServlet";
5453
private final static String URL_NOTIFICATION_SERVLET = "/NotificationServlet";
5554
private static String NOTIFICATION_GET = "getNotifications";
5655
private static String NOTIFICATION_COUNT_GET = "getNotificationCount";
5756
private final static int TIMEOUT = 10000;
5857
public final static Integer MILLIS_PER_DAY = 86400000;
5958

60-
public static void registerUser(String serverId, String mirthVersion, User user, String[] protocols, String[] cipherSuites) throws ClientException {
61-
CloseableHttpClient httpClient = null;
62-
CloseableHttpResponse httpResponse = null;
63-
NameValuePair[] params = { new BasicNameValuePair("serverId", serverId),
64-
new BasicNameValuePair("version", mirthVersion),
65-
new BasicNameValuePair("user", ObjectXMLSerializer.getInstance().serialize(user)) };
66-
67-
HttpPost post = new HttpPost();
68-
post.setURI(URI.create(URL_CONNECT_SERVER + URL_REGISTRATION_SERVLET));
69-
post.setEntity(new UrlEncodedFormEntity(Arrays.asList(params), Charset.forName("UTF-8")));
70-
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(TIMEOUT).setConnectionRequestTimeout(TIMEOUT).setSocketTimeout(TIMEOUT).build();
71-
72-
try {
73-
HttpClientContext postContext = HttpClientContext.create();
74-
postContext.setRequestConfig(requestConfig);
75-
httpClient = getClient(protocols, cipherSuites);
76-
httpResponse = httpClient.execute(post, postContext);
77-
StatusLine statusLine = httpResponse.getStatusLine();
78-
int statusCode = statusLine.getStatusCode();
79-
if ((statusCode != HttpStatus.SC_OK) && (statusCode != HttpStatus.SC_MOVED_TEMPORARILY)) {
80-
throw new Exception("Failed to connect to update server: " + statusLine);
81-
}
82-
} catch (Exception e) {
83-
throw new ClientException(e);
84-
} finally {
85-
HttpClientUtils.closeQuietly(httpResponse);
86-
HttpClientUtils.closeQuietly(httpClient);
87-
}
88-
}
89-
9059
public static List<Notification> getNotifications(String serverId, String mirthVersion, Map<String, String> extensionVersions, String[] protocols, String[] cipherSuites) throws Exception {
9160
CloseableHttpClient client = null;
9261
HttpPost post = new HttpPost();
@@ -195,43 +164,6 @@ public static int getNotificationCount(String serverId, String mirthVersion, Map
195164
return notificationCount;
196165
}
197166

198-
public static boolean sendStatistics(String serverId, String mirthVersion, boolean server, String data, String[] protocols, String[] cipherSuites) {
199-
if (data == null) {
200-
return false;
201-
}
202-
203-
boolean isSent = false;
204-
205-
CloseableHttpClient client = null;
206-
HttpPost post = new HttpPost();
207-
CloseableHttpResponse response = null;
208-
NameValuePair[] params = { new BasicNameValuePair("serverId", serverId),
209-
new BasicNameValuePair("version", mirthVersion),
210-
new BasicNameValuePair("server", Boolean.toString(server)),
211-
new BasicNameValuePair("data", data) };
212-
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(TIMEOUT).setConnectionRequestTimeout(TIMEOUT).setSocketTimeout(TIMEOUT).build();
213-
214-
post.setURI(URI.create(URL_CONNECT_SERVER + URL_USAGE_SERVLET));
215-
post.setEntity(new UrlEncodedFormEntity(Arrays.asList(params), Charset.forName("UTF-8")));
216-
217-
try {
218-
HttpClientContext postContext = HttpClientContext.create();
219-
postContext.setRequestConfig(requestConfig);
220-
client = getClient(protocols, cipherSuites);
221-
response = client.execute(post, postContext);
222-
StatusLine statusLine = response.getStatusLine();
223-
int statusCode = statusLine.getStatusCode();
224-
if ((statusCode == HttpStatus.SC_OK)) {
225-
isSent = true;
226-
}
227-
} catch (Exception e) {
228-
} finally {
229-
HttpClientUtils.closeQuietly(response);
230-
HttpClientUtils.closeQuietly(client);
231-
}
232-
return isSent;
233-
}
234-
235167
private static CloseableHttpClient getClient(String[] protocols, String[] cipherSuites) {
236168
RegistryBuilder<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory> create();
237169
String[] enabledProtocols = MirthSSLUtil.getEnabledHttpsProtocols(protocols);

server/src/com/mirth/connect/server/Mirth.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -399,10 +399,6 @@ public void startup() {
399399
configurationController.setStatus(ConfigurationController.STATUS_OK);
400400
eventController.dispatchEvent(new ServerEvent(configurationController.getServerId(), "Server startup complete"));
401401
printSplashScreen();
402-
403-
// schedule usage statistics to be sent at startup and every 24 hours
404-
Timer timer = new Timer();
405-
timer.schedule(new UsageSenderTask(), 0, ConnectServiceUtil.MILLIS_PER_DAY);
406402
}
407403

408404
/**
@@ -650,19 +646,4 @@ private void initializeLogging() {
650646
}
651647
}
652648
}
653-
654-
private class UsageSenderTask extends TimerTask {
655-
@Override
656-
public void run() {
657-
boolean isSent = ConnectServiceUtil.sendStatistics(configurationController.getServerId(), configurationController.getServerVersion(), true, usageController.createUsageStats(null), configurationController.getHttpsClientProtocols(), configurationController.getHttpsCipherSuites());
658-
if (isSent) {
659-
UpdateSettings settings = new UpdateSettings();
660-
settings.setLastStatsTime(System.currentTimeMillis());
661-
try {
662-
configurationController.setUpdateSettings(settings);
663-
} catch (ControllerException e) {
664-
}
665-
}
666-
}
667-
}
668649
}

0 commit comments

Comments
 (0)