Skip to content

Commit

Permalink
Merge pull request #38 from rwth-acis/releases/1.2.5
Browse files Browse the repository at this point in the history
Releases/1.2.5
  • Loading branch information
lakhoune authored Oct 18, 2023
2 parents 78be5ae + 85159f1 commit f0fc2a3
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,55 +104,58 @@ private static PreparedStatement returnMySQLMessageStatement(Connection con,
PreparedStatement statement = null;
try {
if (message instanceof XESEventMessageWithEncryptedAgents) {
statement = con.prepareStatement("INSERT INTO MESSAGE (`EVENT`, `TIME_STAMP`, `SOURCE_NODE`, `SOURCE_AGENT`, "
+ "`DESTINATION_NODE`, `DESTINATION_AGENT`, `REMARKS` , `CASE_ID`, `ACTIVITY_NAME`, `RESOURCE`, `RESOURCE_TYPE`,`LIFECYCLE_PHASE`, `TIME_OF_EVENT`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?);");
statement = con
.prepareStatement("INSERT INTO EVENTLOG (`CASE_ID`, `ACTIVITY_NAME`, `TIME_STAMP`, `EVENT_TYPE`, "
+ "`RESOURCE`, `RESOURCE_TYPE`, `LIFECYCLE_PHASE` , `REMARKS`) VALUES (?,?,?,?,?,?,?,?);");

statement.setString(1, ((XESEventMessageWithEncryptedAgents) message).getCaseId()); // CASE_ID
statement.setString(2, ((XESEventMessageWithEncryptedAgents) message).getActivityName()); // ACTIVITY_NAME
statement.setString(3, new Timestamp(message.getTimestamp()).toString()); // TIME_STAMP
statement.setString(4, message.getEvent().toString()); // EVENT_TYPE
statement.setString(5, ((XESEventMessageWithEncryptedAgents) message).getResourceId()); // RESOURCE
statement.setString(6, ((XESEventMessageWithEncryptedAgents) message).getResourceType()); // RESOURCE_TYPE
statement.setString(7, ((XESEventMessageWithEncryptedAgents) message).getLifecyclePhase()); // LIFECYCLE_PHASE
statement.setString(8, message.getRemarks() != null ? message.getJsonRemarks() : ""); // REMARKS AS JSON
return statement;
} else {
statement = con.prepareStatement("INSERT INTO MESSAGE (`EVENT`, `TIME_STAMP`, `SOURCE_NODE`, `SOURCE_AGENT`, "
+ "`DESTINATION_NODE`, `DESTINATION_AGENT`, `REMARKS`) VALUES (?,?,?,?,?,?,?);");
+ "`DESTINATION_NODE`, `DESTINATION_AGENT`, `REMARKS`) VALUES (?,?,?,?,?,?,?);");
statement.setString(1, message.getEvent().toString()); // EVENT
statement.setString(2, new Timestamp(message.getTimestamp()).toString()); // TIME_STAMP
if (message.getSourceNode() != null) {
statement.setString(3, message.getSourceNode().substring(0, 12)); // SOURCE_NODE
} else {
statement.setString(3, "");
}
if (message.getSourceAgentId() != null) {
statement.setString(4, message.getSourceAgentId().toString()); // SOURCE_AGENT
} else {
statement.setString(4, "");
}
if (message.getDestinationNode() != null) {
statement.setString(5, message.getDestinationNode().substring(0, 12)); // DESTINATION_NODE
} else {
statement.setString(5, "");
}
if (message.getDestinationAgentId() != null) {
statement.setString(6, message.getDestinationAgentId().toString()); // DESTINATION_AGENT
} else {
statement.setString(6, "");
}
if (message.getRemarks() != null) {
statement.setString(7, message.getJsonRemarks()); // REMARKS AS JSON
} else {
statement.setString(7, "");
}
return statement;
}

statement.setString(1, message.getEvent().toString()); // EVENT
statement.setString(2, new Timestamp(message.getTimestamp()).toString()); // TIME_STAMP
if (message.getSourceNode() != null) {
statement.setString(3, message.getSourceNode().substring(0, 12)); // SOURCE_NODE
} else {
statement.setString(3, "");
}
if (message.getSourceAgentId() != null) {
statement.setString(4, message.getSourceAgentId().toString()); // SOURCE_AGENT
} else {
statement.setString(4, "");
}
if (message.getDestinationNode() != null) {
statement.setString(5, message.getDestinationNode().substring(0, 12)); // DESTINATION_NODE
} else {
statement.setString(5, "");
}
if (message.getDestinationAgentId() != null) {
statement.setString(6, message.getDestinationAgentId().toString()); // DESTINATION_AGENT
} else {
statement.setString(6, "");
}
if (message.getRemarks() != null) {
statement.setString(7, message.getJsonRemarks()); // REMARKS AS JSON
} else {
statement.setString(7, "");
}
if (message instanceof XESEventMessageWithEncryptedAgents) {
statement.setString(8, ((XESEventMessageWithEncryptedAgents) message).getCaseId()); // CASE_ID
statement.setString(9, ((XESEventMessageWithEncryptedAgents) message).getActivityName()); // ACTIVITY_NAME
statement.setString(10, ((XESEventMessageWithEncryptedAgents) message).getResourceId()); // RESOURCE
statement.setString(11, ((XESEventMessageWithEncryptedAgents) message).getResourceType()); // RESOURCE_TYPE
statement.setString(12, ((XESEventMessageWithEncryptedAgents) message).getLifecyclePhase()); // LIFECYCLE_PHASE
statement.setTimestamp(13,
new Timestamp(((XESEventMessageWithEncryptedAgents) message).getTimeOfEvent())); // TIME_OF_EVENT
}
} catch (Exception e) {
// TODO LOG
System.out.println(e.getMessage());
e.printStackTrace();
return null;
}
return statement;
}

/**
Expand Down
21 changes: 14 additions & 7 deletions etc/create_database.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ CREATE TABLE `MESSAGE` (
`SOURCE_AGENT` char(32) DEFAULT NULL,
`DESTINATION_NODE` varchar(255) DEFAULT NULL,
`DESTINATION_AGENT` char(32) DEFAULT NULL,
`REMARKS` json DEFAULT NULL,
`CASE_ID` varchar(63) DEFAULT NULL,
`ACTIVITY_NAME` varchar(255) DEFAULT NULL,
`RESOURCE` varchar(255) DEFAULT NULL,
`RESOURCE_TYPE` varchar(255) DEFAULT NULL,
`LIFECYCLE_PHASE` varchar(32) DEFAULT NULL,
`TIME_OF_EVENT` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`REMARKS` json DEFAULT NULL,
PRIMARY KEY (`ID`)
);

Expand Down Expand Up @@ -75,3 +69,16 @@ CREATE TABLE `MESSAGE` (
(GROUP_AGENT_ID_MD5) REFERENCES AGENT
(AGENT_ID)
);

CREATE TABLE IF NOT EXISTS `EVENTLOG` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`CASE_ID` char(36) NOT NULL,
`ACTIVITY_NAME` varchar(255) NOT NULL,
`EVENT_TYPE` varchar(255) DEFAULT NULL,
`RESOURCE` varchar(255) DEFAULT NULL,
`RESOURCE_TYPE` varchar(255) DEFAULT NULL,
`LIFECYCLE_PHASE` varchar(255) DEFAULT NULL,
`TIME_STAMP` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`REMARKS` json DEFAULT NULL,
PRIMARY KEY (`ID`)
);
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
core.version=1.3.1
service.name=i5.las2peer.services.mobsos.dataProcessing
service.class=MobSOSDataProcessingService
service.version=1.2.4
service.version=1.2.5
java.version=17

las2peer_user1.name=alice
Expand Down

0 comments on commit f0fc2a3

Please sign in to comment.