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