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.PrometheusControlKeySet;
21 import io.github.tonywasher.joceanus.prometheus.data.PrometheusCryptographyDataType;
22 import io.github.tonywasher.joceanus.prometheus.data.PrometheusDataKeySet;
23 import io.github.tonywasher.joceanus.prometheus.data.PrometheusDataResource;
24 import io.github.tonywasher.joceanus.prometheus.data.PrometheusDataSet;
25 import io.github.tonywasher.joceanus.prometheus.data.PrometheusDataValues;
26
27
28
29
30
31
32 public class PrometheusSheetControlKeySet
33 extends PrometheusSheetDataItem<PrometheusControlKeySet> {
34
35
36
37 private static final String SHEET_NAME = PrometheusControlKeySet.class.getSimpleName();
38
39
40
41
42 private static final int COL_CONTROL = COL_ID + 1;
43
44
45
46
47 private static final int COL_KEYSETDEF = COL_CONTROL + 1;
48
49
50
51
52
53
54 protected PrometheusSheetControlKeySet(final PrometheusSheetControl pControl) {
55
56 super(pControl, SHEET_NAME);
57
58
59 final PrometheusDataSet myData = pControl.getData();
60 setDataList(myData.getControlKeySets());
61 }
62
63 @Override
64 protected PrometheusDataValues loadSecureValues() throws OceanusException {
65
66 final PrometheusDataValues myValues = getRowValues(PrometheusDataKeySet.OBJECT_NAME);
67 myValues.addValue(PrometheusCryptographyDataType.CONTROLKEY, loadInteger(COL_CONTROL));
68 myValues.addValue(PrometheusDataResource.KEYSET_KEYSETDEF, loadBytes(COL_KEYSETDEF));
69
70
71 return myValues;
72 }
73
74 @Override
75 protected void insertSecureItem(final PrometheusControlKeySet pItem) throws OceanusException {
76
77 super.insertSecureItem(pItem);
78 writeInteger(COL_CONTROL, pItem.getControlKeyId());
79 writeBytes(COL_KEYSETDEF, pItem.getSecuredKeySetDef());
80 }
81
82 @Override
83 protected int getLastColumn() {
84
85 return COL_KEYSETDEF;
86 }
87 }