]> gerrit.simantics Code Review - simantics/platform.git/blob - docs/Developer/Database/ResourceSerialization.md
Optimise performance of job scheduling in QueryListening
[simantics/platform.git] / docs / Developer / Database / ResourceSerialization.md
1 Serializing a resource\r
2 \r
3 ~~~\r
4     long serializeResource(RequestProcessor processor, Resource resource) throws DatabaseException {\r
5         SerialisationSupport ss = processor.getService(SerialisationSupport.class);\r
6         return ss.getRandomAccessId(resource);\r
7     }\r
8     String serializeResourceToString(RequestProcessor processor, Resource resource) throws DatabaseException {\r
9         return String.valueOf(serializeResource(processor, resource));\r
10     }\r
11 ~~~\r
12 \r
13 Deserializing a resource\r
14 \r
15 ~~~\r
16     Resource deserializeResource(ReadGraph graph, long randomAccessId) throws DatabaseException {\r
17         SerialisationSupport ss = session.getService(SerialisationSupport.class);\r
18         return rs.getResource(randomAccessId);\r
19     }\r
20     Resource deserializeResource(ReadGraph graph, String randomAccessId) throws DatabaseException, NumberFormatException {\r
21         return deserializeResource(graph, Long.parseLong(randomAccessId));\r
22     }\r
23 ~~~\r