Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

# /

.DS_Store
.java-version
.idea
**/*.iml
donkey/donkey-src
Expand Down
16 changes: 0 additions & 16 deletions client/src/com/mirth/connect/client/ui/FirstLoginDialog.form
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
<Component id="jScrollPane1" alignment="0" pref="353" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="registerCheckBox" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="userEditPanel" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="19" max="32767" attributes="0"/>
Expand All @@ -77,8 +76,6 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="userEditPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="registerCheckBox" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jSeparator1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="finishButton" min="-2" max="-2" attributes="0"/>
Expand Down Expand Up @@ -159,19 +156,6 @@
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JCheckBox" name="registerCheckBox">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="Register user with NextGen Healthcare"/>
<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;"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="registerCheckBoxActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
Expand Down
51 changes: 1 addition & 50 deletions client/src/com/mirth/connect/client/ui/FirstLoginDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ public FirstLoginDialog(User currentUser) {

userEditPanel.setUser(this, currentUser);
userEditPanel.setRequiredFields(false, true);
if (currentUser.getId() == 1) {
registerCheckBox.setVisible(false);
}

jLabel2.setForeground(UIConstants.HEADER_TITLE_TEXT_COLOR);
setModal(true);
Expand Down Expand Up @@ -104,8 +101,6 @@ private void initComponents() {
userEditPanel = new com.mirth.connect.client.ui.UserEditPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextPane1 = new javax.swing.JTextPane();
registerCheckBox = new javax.swing.JCheckBox();
userConsentCheckBox = new javax.swing.JCheckBox();
contentTextPane = new javax.swing.JTextPane();

setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
Expand Down Expand Up @@ -149,21 +144,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextPane1.setDisabledTextColor(new java.awt.Color(0, 0, 0));
jTextPane1.setEnabled(false);
jScrollPane1.setViewportView(jTextPane1);

registerCheckBox.setBackground(new java.awt.Color(255, 255, 255));
registerCheckBox.setSelected(true);
registerCheckBox.setText(String.format("Register user with %s", BrandingConstants.COMPANY_NAME));
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));
registerCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
registerCheckBoxActionPerformed(evt);
}
});

userConsentCheckBox.setBackground(new java.awt.Color(255, 255, 255));
userConsentCheckBox.setSelected(true);
userConsentCheckBox.setText(String.format("I consent to receive email updates and marketing messages from %s.", BrandingConstants.COMPANY_NAME));
userConsentCheckBox.setToolTipText("<html></html>");

contentTextPane.setContentType("text/html");
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));
Expand Down Expand Up @@ -209,8 +189,6 @@ public void hyperlinkUpdate(HyperlinkEvent evt) {
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 353, Short.MAX_VALUE)
.addGroup(channelOverviewLayout.createSequentialGroup()
.addGroup(channelOverviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(registerCheckBox)
.addComponent(userConsentCheckBox)
.addComponent(contentTextPane)
.addComponent(userEditPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 19, Short.MAX_VALUE)))
Expand All @@ -224,10 +202,6 @@ public void hyperlinkUpdate(HyperlinkEvent evt) {
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(userEditPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(registerCheckBox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(userConsentCheckBox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(contentTextPane)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:248 - :265 seems to store user information. Unclear of purpose. Might be removed.

Expand Down Expand Up @@ -262,21 +236,12 @@ private void finishButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
parent.alertWarning(this, validateUserMessage);
} else {
User user = userEditPanel.getUser();
if (userConsentCheckBox.isSelected()) {
user.setUserConsent(true);
}
boolean success = false;

success = parent.updateCurrentUser(this, user, userEditPanel.getPassword());
boolean success = parent.updateCurrentUser(this, user, userEditPanel.getPassword());

if (!success) {
return;
}

if (registerCheckBox.isSelected()) {
parent.registerUser(user);
}

try {
User currentUser = parent.getCurrentUser(parent);
parent.mirthClient.setUserPreference(currentUser.getId(), "firstlogin", "false");
Expand Down Expand Up @@ -307,18 +272,6 @@ private void finishButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
}
}//GEN-LAST:event_finishButtonActionPerformed

private void registerCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_registerCheckBoxActionPerformed
boolean allRequired = registerCheckBox.isSelected();
if (allRequired) {
userConsentCheckBox.setSelected(true);
userConsentCheckBox.setEnabled(true);
} else {
userConsentCheckBox.setSelected(false);
userConsentCheckBox.setEnabled(false);
}
userEditPanel.setRequiredFields(false, true);
}//GEN-LAST:event_registerCheckBoxActionPerformed

public boolean getResult() {
return this.result;
}
Expand All @@ -331,8 +284,6 @@ public boolean getResult() {
private javax.swing.JSeparator jSeparator1;
private javax.swing.JTextPane jTextPane1;
private com.mirth.connect.client.ui.MirthHeadingPanel mirthHeadingPanel1;
private javax.swing.JCheckBox registerCheckBox;
private javax.swing.JCheckBox userConsentCheckBox;
private com.mirth.connect.client.ui.UserEditPanel userEditPanel;
private javax.swing.JTextPane contentTextPane;
// End of variables declaration//GEN-END:variables
Expand Down
63 changes: 1 addition & 62 deletions client/src/com/mirth/connect/client/ui/Frame.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.NotImplementedException;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Unused imports:

  • org.apache.commons.lang3.NotImplementedException
  • com.mirth.connect.client.core.ConnectServiceUtil
  • com.mirth.connect.model.UpdateSettings

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.http.conn.HttpHostConnectException;
Expand Down Expand Up @@ -1948,68 +1949,6 @@ public User getCurrentUser(Component parentComponent, boolean alertOnFailure) {
return currentUser;
}

public void registerUser(final User user) {
final String workingId = startWorking("Registering user...");

SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {

public Void doInBackground() {
try {
ConnectServiceUtil.registerUser(PlatformUI.SERVER_ID, PlatformUI.SERVER_VERSION, user, PlatformUI.HTTPS_PROTOCOLS, PlatformUI.HTTPS_CIPHER_SUITES);
} catch (ClientException e) {
// ignore errors connecting to update/stats server
}

return null;
}

public void done() {
stopWorking(workingId);
}
};

worker.execute();
}

public void sendUsageStatistics() {
UpdateSettings updateSettings = null;
try {
updateSettings = mirthClient.getUpdateSettings();
} catch (Exception e) {
}

if (updateSettings != null && updateSettings.getStatsEnabled()) {
final String workingId = startWorking("Sending usage statistics...");

SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {

public Void doInBackground() {
try {
String usageData = mirthClient.getUsageData(getClientStats());
if (usageData != null) {
boolean isSent = ConnectServiceUtil.sendStatistics(PlatformUI.SERVER_ID, PlatformUI.SERVER_VERSION, false, usageData, PlatformUI.HTTPS_PROTOCOLS, PlatformUI.HTTPS_CIPHER_SUITES);
if (isSent) {
UpdateSettings settings = new UpdateSettings();
settings.setLastStatsTime(System.currentTimeMillis());
mirthClient.setUpdateSettings(settings);
}
}
} catch (ClientException e) {
// ignore errors connecting to update/stats server
}

return null;
}

public void done() {
stopWorking(workingId);
}
};

worker.execute();
}
}

private Map<String, Object> getClientStats() {
Map<String, Object> clientStats = new HashMap<String, Object>();
clientStats.put("javaVersion", System.getProperty("java.version"));
Expand Down
2 changes: 0 additions & 2 deletions client/src/com/mirth/connect/client/ui/LoginPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,6 @@ private boolean handleSuccess(LoginStatus loginStatus) throws ClientException {
PlatformUI.MIRTH_FRAME.alertThrowable(PlatformUI.MIRTH_FRAME, e);
}

PlatformUI.MIRTH_FRAME.sendUsageStatistics();

return true;
}

Expand Down
69 changes: 0 additions & 69 deletions server/src/com/mirth/connect/client/core/ConnectServiceUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,44 +49,12 @@

public class ConnectServiceUtil {
private final static String URL_CONNECT_SERVER = "https://connect.mirthcorp.com";
private final static String URL_REGISTRATION_SERVLET = "/RegistrationServlet";
private final static String URL_USAGE_SERVLET = "/UsageStatisticsServlet";
private final static String URL_NOTIFICATION_SERVLET = "/NotificationServlet";
private static String NOTIFICATION_GET = "getNotifications";
private static String NOTIFICATION_COUNT_GET = "getNotificationCount";
private final static int TIMEOUT = 10000;
public final static Integer MILLIS_PER_DAY = 86400000;

public static void registerUser(String serverId, String mirthVersion, User user, String[] protocols, String[] cipherSuites) throws ClientException {
CloseableHttpClient httpClient = null;
CloseableHttpResponse httpResponse = null;
NameValuePair[] params = { new BasicNameValuePair("serverId", serverId),
new BasicNameValuePair("version", mirthVersion),
new BasicNameValuePair("user", ObjectXMLSerializer.getInstance().serialize(user)) };

HttpPost post = new HttpPost();
post.setURI(URI.create(URL_CONNECT_SERVER + URL_REGISTRATION_SERVLET));
post.setEntity(new UrlEncodedFormEntity(Arrays.asList(params), Charset.forName("UTF-8")));
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(TIMEOUT).setConnectionRequestTimeout(TIMEOUT).setSocketTimeout(TIMEOUT).build();

try {
HttpClientContext postContext = HttpClientContext.create();
postContext.setRequestConfig(requestConfig);
httpClient = getClient(protocols, cipherSuites);
httpResponse = httpClient.execute(post, postContext);
StatusLine statusLine = httpResponse.getStatusLine();
int statusCode = statusLine.getStatusCode();
if ((statusCode != HttpStatus.SC_OK) && (statusCode != HttpStatus.SC_MOVED_TEMPORARILY)) {
throw new Exception("Failed to connect to update server: " + statusLine);
}
} catch (Exception e) {
throw new ClientException(e);
} finally {
HttpClientUtils.closeQuietly(httpResponse);
HttpClientUtils.closeQuietly(httpClient);
}
}

public static List<Notification> getNotifications(String serverId, String mirthVersion, Map<String, String> extensionVersions, String[] protocols, String[] cipherSuites) throws Exception {
CloseableHttpClient client = null;
HttpPost post = new HttpPost();
Expand Down Expand Up @@ -195,43 +163,6 @@ public static int getNotificationCount(String serverId, String mirthVersion, Map
return notificationCount;
}

public static boolean sendStatistics(String serverId, String mirthVersion, boolean server, String data, String[] protocols, String[] cipherSuites) {
if (data == null) {
return false;
}

boolean isSent = false;

CloseableHttpClient client = null;
HttpPost post = new HttpPost();
CloseableHttpResponse response = null;
NameValuePair[] params = { new BasicNameValuePair("serverId", serverId),
new BasicNameValuePair("version", mirthVersion),
new BasicNameValuePair("server", Boolean.toString(server)),
new BasicNameValuePair("data", data) };
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(TIMEOUT).setConnectionRequestTimeout(TIMEOUT).setSocketTimeout(TIMEOUT).build();

post.setURI(URI.create(URL_CONNECT_SERVER + URL_USAGE_SERVLET));
post.setEntity(new UrlEncodedFormEntity(Arrays.asList(params), Charset.forName("UTF-8")));

try {
HttpClientContext postContext = HttpClientContext.create();
postContext.setRequestConfig(requestConfig);
client = getClient(protocols, cipherSuites);
response = client.execute(post, postContext);
StatusLine statusLine = response.getStatusLine();
int statusCode = statusLine.getStatusCode();
if ((statusCode == HttpStatus.SC_OK)) {
isSent = true;
}
} catch (Exception e) {
} finally {
HttpClientUtils.closeQuietly(response);
HttpClientUtils.closeQuietly(client);
}
return isSent;
}

private static CloseableHttpClient getClient(String[] protocols, String[] cipherSuites) {
RegistryBuilder<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory> create();
String[] enabledProtocols = MirthSSLUtil.getEnabledHttpsProtocols(protocols);
Expand Down
19 changes: 0 additions & 19 deletions server/src/com/mirth/connect/server/Mirth.java
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,6 @@ public void startup() {
configurationController.setStatus(ConfigurationController.STATUS_OK);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Unused imports

  • java.util.Timer
  • java.util.TimerTask
  • com.mirth.connect.client.core.ConnectServiceUtil
  • com.mirth.connect.model.UpdateSettings

eventController.dispatchEvent(new ServerEvent(configurationController.getServerId(), "Server startup complete"));
printSplashScreen();

// schedule usage statistics to be sent at startup and every 24 hours
Timer timer = new Timer();
timer.schedule(new UsageSenderTask(), 0, ConnectServiceUtil.MILLIS_PER_DAY);
}

/**
Expand Down Expand Up @@ -650,19 +646,4 @@ private void initializeLogging() {
}
}
}

private class UsageSenderTask extends TimerTask {
@Override
public void run() {
boolean isSent = ConnectServiceUtil.sendStatistics(configurationController.getServerId(), configurationController.getServerVersion(), true, usageController.createUsageStats(null), configurationController.getHttpsClientProtocols(), configurationController.getHttpsCipherSuites());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only use of usageController. Presumably this should kill the instantiation at :92. Should UsageController and UpdateSettings in entirety be killed?

if (isSent) {
UpdateSettings settings = new UpdateSettings();
settings.setLastStatsTime(System.currentTimeMillis());
try {
configurationController.setUpdateSettings(settings);
} catch (ControllerException e) {
}
}
}
}
}