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 PrometheusSheetControl pControl) {
53
54 super(pControl, SHEET_NAME);
55
56
57 final PrometheusDataSet myData = pControl.getData();
58 setDataList(myData.getControlKeys());
59 }
60
61 @Override
62 protected PrometheusDataValues loadSecureValues() throws OceanusException {
63
64 final PrometheusDataValues myValues = getRowValues(PrometheusControlKey.OBJECT_NAME);
65 myValues.addValue(PrometheusDataResource.CONTROLKEY_CREATION, loadDate(COL_CREATION));
66 myValues.addValue(PrometheusDataResource.CONTROLKEY_LOCKBYTES, loadBytes(COL_KEYDATA));
67
68
69 return myValues;
70 }
71
72 @Override
73 protected void insertSecureItem(final PrometheusControlKey pItem) throws OceanusException {
74
75 super.insertSecureItem(pItem);
76 writeDate(COL_CREATION, pItem.getCreationDate());
77 writeBytes(COL_KEYDATA, pItem.getLockBytes());
78 }
79
80 @Override
81 protected int getLastColumn() {
82
83 return COL_KEYDATA;
84 }
85 }