Compare commits
3 Commits
3ced22bbdd
...
46057701ca
| Author | SHA1 | Date | |
|---|---|---|---|
| 46057701ca | |||
| 3203801710 | |||
| fe81a701d8 |
15
.idea/runConfigurations/App.xml
generated
Normal file
15
.idea/runConfigurations/App.xml
generated
Normal 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>
|
||||
@@ -0,0 +1 @@
|
||||
<EFBFBD>
|
||||
1
server/lock.lock
Normal file
1
server/lock.lock
Normal file
@@ -0,0 +1 @@
|
||||
<EFBFBD>
|
||||
1
serverDirectory/lock.lock
Normal file
1
serverDirectory/lock.lock
Normal file
@@ -0,0 +1 @@
|
||||
<EFBFBD>
|
||||
@@ -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,8 @@ 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.
BIN
target/classes/net/ayyalasomayajula/net/server/EHRUtils.class
Normal file
BIN
target/classes/net/ayyalasomayajula/net/server/EHRUtils.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/classes/net/ayyalasomayajula/net/shared/EHR.class
Normal file
BIN
target/classes/net/ayyalasomayajula/net/shared/EHR.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user