Compare commits

...

3 Commits

Author SHA1 Message Date
46057701ca Fixed stuff 12 2025-03-23 20:08:33 -05:00
3203801710 Fixed stuff 2025-03-23 20:08:10 -05:00
fe81a701d8 Fixed stuff 2025-03-23 20:02:18 -05:00
19 changed files with 40 additions and 7 deletions

15
.idea/runConfigurations/App.xml generated Normal file
View File

@@ -0,0 +1,15 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="App" type="Application" factoryName="Application" singleton="false" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="net.ayyalasomayajula.net.App" />
<module name="my-app" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="net.ayyalasomayajula.net.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@@ -0,0 +1 @@
<EFBFBD>

1
server/lock.lock Normal file
View File

@@ -0,0 +1 @@
<EFBFBD>

View File

@@ -0,0 +1 @@
<EFBFBD>

View File

@@ -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());

View File

@@ -195,6 +195,8 @@ 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");

View File

@@ -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

View File

@@ -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;

View File

@@ -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

View File

@@ -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");