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