Fixed stuff
This commit is contained in:
@@ -118,9 +118,15 @@ public class Dashboard extends JFrame {
|
||||
try {
|
||||
while (true) {
|
||||
// Read the next message from the server
|
||||
Message receivedMessage = (Message) inputStream.readObject();
|
||||
receivedMessages.add(receivedMessage);
|
||||
updateMessageDisplay(receivedMessage); // Update the GUI with the new message
|
||||
Object receivedMessage = inputStream.readObject();
|
||||
if(receivedMessage instanceof Message) {
|
||||
Message message = (Message) receivedMessage;
|
||||
logger.info("Received EHR response: {}", message);
|
||||
if(message.data().length == 0) {continue;}
|
||||
receivedMessages.add(message);
|
||||
updateMessageDisplay(message); // Update the GUI with the new message
|
||||
}
|
||||
|
||||
}
|
||||
} catch (IOException | ClassNotFoundException e) {
|
||||
logger.error("Error while listening for messages: {}", e.getMessage());
|
||||
|
||||
@@ -195,6 +195,7 @@ public class ServerDaemon implements Runnable {
|
||||
case "EHR":
|
||||
logger.info("EHR caught");
|
||||
EHR found = EHRUtils.searchClosestEHR(assetId, Path.of(basePath));
|
||||
if(found == null) {return null;}
|
||||
return new Message(MessageVariant.SET, "", 5, SerializationUtils.toBytes(found));
|
||||
case "XRAY":
|
||||
logger.info("XRAY caught");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.ayyalasomayajula.net.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -9,7 +10,7 @@ import java.util.UUID;
|
||||
* @author Krishna Ayyalasomayajula
|
||||
* @version 1.0
|
||||
*/
|
||||
public record Appointment(UUID uuid, UUID patient, LocalDateTime time, boolean attendance, String description) {
|
||||
public record Appointment(UUID uuid, UUID patient, LocalDateTime time, boolean attendance, String description) implements Serializable {
|
||||
/**
|
||||
* Evaluates whether the allotted time has already passed.
|
||||
* @return boolean object, true if date time is past
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.ayyalasomayajula.net.shared;
|
||||
import net.ayyalasomayajula.net.shared.Appointment;
|
||||
import net.ayyalasomayajula.net.shared.Message;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.nio.file.Path;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
@@ -17,7 +18,7 @@ import java.util.UUID;
|
||||
* @author Krishna Ayyalasomayajula
|
||||
* @version 1.0
|
||||
*/
|
||||
public class EHR {
|
||||
public class EHR implements Serializable {
|
||||
private String patientName;
|
||||
private UUID uuid;
|
||||
private List<String> medicalNotes;
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package net.ayyalasomayajula.net.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Encapsulates the socket message objects using a record.
|
||||
*
|
||||
* @author Krishna Ayyalasomayajula
|
||||
* @version 1.0
|
||||
*/
|
||||
public record Message(MessageVariant messageVariant, String messageQuery, int timeoutSeconds, byte[] data) {
|
||||
|
||||
public record Message(MessageVariant messageVariant, String messageQuery, int timeoutSeconds, byte[] data) implements Serializable {
|
||||
/**
|
||||
* Constructor for Message record.
|
||||
* @author Krishna Ayyalasomayajula
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package net.ayyalasomayajula.net.shared;
|
||||
|
||||
public enum MessageVariant{
|
||||
import java.io.Serializable;
|
||||
|
||||
public enum MessageVariant implements Serializable {
|
||||
GET("GET"), SET("SET"), UPSERT("UPSERT"), INSERT("INSERT");
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user