Skip to content

Commit c970abd

Browse files
committed
Storage Classes update with dedicated Model Classes
1 parent 5077d80 commit c970abd

20 files changed

Lines changed: 1369 additions & 210 deletions

src/main/java/it/wldt/adapter/physical/PhysicalAssetActionRequest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
package it.wldt.adapter.physical;
22

3-
import org.slf4j.Logger;
4-
import org.slf4j.LoggerFactory;
5-
63
import java.util.Map;
7-
import java.util.Objects;
84

95
/**
106
* Author:

src/main/java/it/wldt/adapter/physical/PhysicalAssetPropertyVariation.java

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,110 @@
11
package it.wldt.adapter.physical;
22

3+
import it.wldt.storage.model.StorageRecord;
4+
35
import java.util.Map;
46

7+
/**
8+
* Author: Marco Picone (picone.m@gmail.com)
9+
* Date: 01/08/2024
10+
* Physical Asset Property Variation Class
11+
* Represents a Physical Asset Property Variation in the Digital Twin Framework
12+
*/
513
public class PhysicalAssetPropertyVariation {
614

15+
// Timestamp of the variation
716
private long timestamp;
817

18+
// Property Key associated to the variation
919
private String propertykey;
1020

21+
// Body of the variation
1122
private Object body;
1223

24+
// Metadata associated to the variation
1325
private Map<String, Object> variationMetadata;
1426

27+
/**
28+
* Default Constructor
29+
*/
1530
private PhysicalAssetPropertyVariation() {
1631
}
1732

33+
/**
34+
* Constructor
35+
*
36+
* @param timestamp Timestamp of the variation
37+
* @param propertykey Property Key associated to the variation
38+
* @param body Body of the variation
39+
* @param variationMetadata Metadata associated to the variation
40+
*/
1841
public PhysicalAssetPropertyVariation(long timestamp, String propertykey, Object body, Map<String, Object> variationMetadata) {
1942
this.timestamp = timestamp;
2043
this.propertykey = propertykey;
2144
this.body = body;
2245
this.variationMetadata = variationMetadata;
2346
}
2447

48+
/**
49+
* Get the timestamp of the variation
50+
* @return timestamp of the variation
51+
*/
2552
public long getTimestamp() {
2653
return timestamp;
2754
}
2855

56+
/**
57+
* Set the timestamp of the variation
58+
* @param timestamp timestamp of the variation
59+
*/
2960
public void setTimestamp(long timestamp) {
3061
this.timestamp = timestamp;
3162
}
3263

64+
/**
65+
* Get the Property Key associated to the variation
66+
* @return Property Key associated to the variation
67+
*/
3368
public String getPropertykey() {
3469
return propertykey;
3570
}
3671

72+
/**
73+
* Set the Property Key associated to the variation
74+
* @param propertykey Property Key associated to the variation
75+
*/
3776
public void setPropertykey(String propertykey) {
3877
this.propertykey = propertykey;
3978
}
4079

80+
/**
81+
* Get the Body of the variation
82+
* @return Body of the variation
83+
*/
4184
public Object getBody() {
4285
return body;
4386
}
4487

88+
/**
89+
* Set the Body of the variation
90+
* @param body Body of the variation
91+
*/
4592
public void setBody(Object body) {
4693
this.body = body;
4794
}
4895

96+
/**
97+
* Get the Metadata associated to the variation
98+
* @return Metadata associated to the variation
99+
*/
49100
public Map<String, Object> getVariationMetadata() {
50101
return variationMetadata;
51102
}
52103

104+
/**
105+
* Set the Metadata associated to the variation
106+
* @param variationMetadata Metadata associated to the variation
107+
*/
53108
public void setVariationMetadata(Map<String, Object> variationMetadata) {
54109
this.variationMetadata = variationMetadata;
55110
}

src/main/java/it/wldt/core/state/DigitalTwinStateEventNotification.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package it.wldt.core.state;
22

3-
import it.wldt.exception.EventBusException;
4-
import java.util.Map;
5-
63
/**
74
* Authors:
85
* Marco Picone, Ph.D. (picone.m@gmail.com)

src/main/java/it/wldt/storage/DefaultWldtStorage.java

Lines changed: 143 additions & 101 deletions
Large diffs are not rendered by default.

src/main/java/it/wldt/storage/StorageManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import it.wldt.core.state.DigitalTwinStateManager;
2020
import it.wldt.exception.StorageException;
2121
import it.wldt.exception.WldtRuntimeException;
22+
import it.wldt.adapter.physical.PhysicalAssetPropertyVariation;
2223
import it.wldt.storage.query.DefaultQueryManager;
2324
import it.wldt.storage.query.QueryManager;
2425
import it.wldt.storage.query.QueryRequest;

src/main/java/it/wldt/storage/WldtStorage.java

Lines changed: 36 additions & 34 deletions
Large diffs are not rendered by default.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package it.wldt.storage.model;
2+
3+
/**
4+
* Storage Record Class
5+
* Represents a singola record in the storage with a unique id
6+
*/
7+
public class StorageRecord {
8+
9+
// Storage Record Id
10+
private String id;
11+
12+
/**
13+
* Default Constructor
14+
*/
15+
public StorageRecord() {
16+
}
17+
18+
/**
19+
* Constructor
20+
*
21+
* @param id Storage Record Id
22+
*/
23+
public StorageRecord(String id) {
24+
this.id = id;
25+
}
26+
27+
/**
28+
* Get the Storage Record Id
29+
* @return Storage Record Id
30+
*/
31+
public String getId() {
32+
return id;
33+
}
34+
35+
/**
36+
* Set the Storage Record Id
37+
* @param id Storage Record Id
38+
*/
39+
public void setId(String id) {
40+
this.id = id;
41+
}
42+
43+
@Override
44+
public String toString() {
45+
return "StorageRecord{" +
46+
"id='" + id + '\'' +
47+
'}';
48+
}
49+
}
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
package it.wldt.storage.model.digital;
2+
3+
import it.wldt.storage.model.StorageRecord;
4+
5+
import java.util.Map;
6+
7+
/**
8+
* Author: Marco Picone (picone.m@gmail.com)
9+
* Date: 01/08/2024
10+
* Digital Action Request Record Class
11+
* Represents a Digital Action Request Record in the storage
12+
*/
13+
public class DigitalActionRequestRecord extends StorageRecord {
14+
15+
// Timestamp of the request
16+
private long requestTimestamp;
17+
18+
// Action Key associated to the request
19+
private String actionkey;
20+
21+
// Request Body
22+
private Object requestBody;
23+
24+
// Metadata associated to the request
25+
private Map<String, Object> requestMetadata;
26+
27+
/**
28+
* Default Constructor
29+
*/
30+
public DigitalActionRequestRecord() {
31+
}
32+
33+
/**
34+
* Constructor with all the required parameters
35+
* @param requestTimestamp timestamp of the request
36+
* @param actionkey action key associated to the request
37+
* @param requestBody body of the request
38+
* @param requestMetadata metadata associated to the request
39+
*/
40+
public DigitalActionRequestRecord(long requestTimestamp, String actionkey, Object requestBody, Map<String, Object> requestMetadata) {
41+
this.requestTimestamp = requestTimestamp;
42+
this.actionkey = actionkey;
43+
this.requestBody = requestBody;
44+
this.requestMetadata = requestMetadata;
45+
}
46+
47+
/**
48+
* Get the timestamp of the request
49+
* @return timestamp of the request
50+
*/
51+
public long getRequestTimestamp() {
52+
return requestTimestamp;
53+
}
54+
55+
/**
56+
* Set the timestamp of the request
57+
* @param requestTimestamp timestamp of the request
58+
*/
59+
public void setRequestTimestamp(long requestTimestamp) {
60+
this.requestTimestamp = requestTimestamp;
61+
}
62+
63+
/**
64+
* Get the action key associated to the request
65+
* @return action key associated to the request
66+
*/
67+
public String getActionkey() {
68+
return actionkey;
69+
}
70+
71+
/**
72+
* Set the action key associated to the request
73+
* @param actionkey action key associated to the request
74+
*/
75+
public void setActionkey(String actionkey) {
76+
this.actionkey = actionkey;
77+
}
78+
79+
/**
80+
* Get the body of the request
81+
* @return body of the request
82+
*/
83+
public Object getRequestBody() {
84+
return requestBody;
85+
}
86+
87+
/**
88+
* Set the body of the request
89+
* @param requestBody body of the request
90+
*/
91+
public void setRequestBody(Object requestBody) {
92+
this.requestBody = requestBody;
93+
}
94+
95+
/**
96+
* Get the metadata associated to the request
97+
* @return metadata associated to the request
98+
*/
99+
public Map<String, Object> getRequestMetadata() {
100+
return requestMetadata;
101+
}
102+
103+
/**
104+
* Set the metadata associated to the request
105+
* @param requestMetadata metadata associated to the request
106+
*/
107+
public void setRequestMetadata(Map<String, Object> requestMetadata) {
108+
this.requestMetadata = requestMetadata;
109+
}
110+
111+
@Override
112+
public String toString() {
113+
final StringBuilder sb = new StringBuilder("DigitalActionRequestRecord{");
114+
sb.append("recordId=").append(getId());
115+
sb.append("requestTimestamp=").append(requestTimestamp);
116+
sb.append(", actionkey='").append(actionkey).append('\'');
117+
sb.append(", requestBody=").append(requestBody);
118+
sb.append(", requestMetadata=").append(requestMetadata);
119+
sb.append('}');
120+
return sb.toString();
121+
}
122+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
package it.wldt.storage.model.lifecycle;
2+
3+
import it.wldt.core.engine.LifeCycleState;
4+
import it.wldt.storage.model.StorageRecord;
5+
6+
/**
7+
* Author: Marco Picone (picone.m@gmail.com)
8+
* Date: 01/08/2024
9+
* Life Cycle Variation Record Class
10+
* Represents a Life Cycle Variation Record in the storage
11+
*/
12+
public class LifeCycleVariationRecord extends StorageRecord {
13+
14+
// Life Cycle State associated to the variation
15+
private LifeCycleState lifeCycleState;
16+
17+
// Timestamp of the variation
18+
private long timestamp;
19+
20+
/**
21+
* Default Constructor
22+
*/
23+
public LifeCycleVariationRecord() {
24+
}
25+
26+
/**
27+
* Constructor
28+
*
29+
* @param lifeCycleState Life Cycle State associated to the variation
30+
* @param timestamp Timestamp of the variation
31+
*/
32+
public LifeCycleVariationRecord(LifeCycleState lifeCycleState, long timestamp) {
33+
this.lifeCycleState = lifeCycleState;
34+
this.timestamp = timestamp;
35+
}
36+
37+
/**
38+
* Get the Life Cycle State associated to the variation
39+
* @return Life Cycle State associated to the variation
40+
*/
41+
public LifeCycleState getLifeCycleState() {
42+
return lifeCycleState;
43+
}
44+
45+
/**
46+
* Set the Life Cycle State associated to the variation
47+
* @param lifeCycleState Life Cycle State associated to the variation
48+
*/
49+
public void setLifeCycleState(LifeCycleState lifeCycleState) {
50+
this.lifeCycleState = lifeCycleState;
51+
}
52+
53+
/**
54+
* Get the timestamp of the variation
55+
* @return timestamp of the variation
56+
*/
57+
public long getTimestamp() {
58+
return timestamp;
59+
}
60+
61+
/**
62+
* Set the timestamp of the variation
63+
* @param timestamp timestamp of the variation
64+
*/
65+
public void setTimestamp(long timestamp) {
66+
this.timestamp = timestamp;
67+
}
68+
69+
@Override
70+
public String toString() {
71+
return "LifeCycleVariationRecord{" +
72+
"recordId=" + getId() +
73+
"lifeCycleState=" + lifeCycleState +
74+
", timestamp=" + timestamp +
75+
'}';
76+
}
77+
78+
}

0 commit comments

Comments
 (0)