1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package io.github.tonywasher.joceanus.prometheus.sheets;
18
19 import io.github.tonywasher.joceanus.oceanus.base.OceanusException;
20 import io.github.tonywasher.joceanus.prometheus.data.PrometheusControlKey;
21 import io.github.tonywasher.joceanus.prometheus.data.PrometheusDataResource;
22 import io.github.tonywasher.joceanus.prometheus.data.PrometheusDataSet;
23 import io.github.tonywasher.joceanus.prometheus.data.PrometheusDataValues;
24
25
26
27
28
29
30 public class PrometheusSheetControlKey
31 extends PrometheusSheetDataItem<PrometheusControlKey> {
32
33
34
35 private static final String SHEET_NAME = PrometheusControlKey.class.getSimpleName();
36
37
38
39
40 private static final int COL_CREATION = COL_ID + 1;
41
42
43
44
45 private static final int COL_KEYDATA = COL_CREATION + 1;
46
47
48
49
50
51
52 protected PrometheusSheetControlKey(final PrometheusSheetReader pReader) {
53
54 super(pReader, SHEET_NAME);
55
56
57 final PrometheusDataSet myData = pReader.getData();
58 setDataList(myData.getControlKeys());
59 }
60
61
62
63
64
65
66 protected PrometheusSheetControlKey(final PrometheusSheetWriter pWriter) {
67
68 super(pWriter, SHEET_NAME);
69
70
71 final PrometheusDataSet myData = pWriter.getData();
72 setDataList(myData.getControlKeys());
73 }
74
75 @Override
76 protected PrometheusDataValues loadSecureValues() throws OceanusException {
77
78 final PrometheusDataValues myValues = getRowValues(PrometheusControlKey.OBJECT_NAME);
79 myValues.addValue(PrometheusDataResource.CONTROLKEY_CREATION, loadDate(COL_CREATION));
80 myValues.addValue(PrometheusDataResource.CONTROLKEY_LOCKBYTES, loadBytes(COL_KEYDATA));
81
82
83 return myValues;
84 }
85
86 @Override
87 protected void insertSecureItem(final PrometheusControlKey pItem) throws OceanusException {
88
89 super.insertSecureItem(pItem);
90 writeDate(COL_CREATION, pItem.getCreationDate());
91 writeBytes(COL_KEYDATA, pItem.getLockBytes());
92 }
93
94 @Override
95 protected int getLastColumn() {
96
97 return COL_KEYDATA;
98 }
99 }