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