1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package io.github.tonywasher.joceanus.moneywise.archive;
18
19 import io.github.tonywasher.joceanus.oceanus.base.OceanusException;
20 import io.github.tonywasher.joceanus.oceanus.profile.OceanusProfile;
21 import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseDataSet;
22 import io.github.tonywasher.joceanus.moneywise.data.statics.MoneyWiseTaxBasis;
23 import io.github.tonywasher.joceanus.moneywise.data.statics.MoneyWiseTaxBasis.MoneyWiseTaxBasisList;
24 import io.github.tonywasher.joceanus.moneywise.exc.MoneyWiseIOException;
25 import io.github.tonywasher.joceanus.prometheus.service.sheet.PrometheusSheetCell;
26 import io.github.tonywasher.joceanus.prometheus.service.sheet.PrometheusSheetRow;
27 import io.github.tonywasher.joceanus.prometheus.service.sheet.PrometheusSheetView;
28 import io.github.tonywasher.joceanus.prometheus.service.sheet.PrometheusSheetWorkBook;
29 import io.github.tonywasher.joceanus.tethys.api.thread.TethysUIThreadCancelException;
30 import io.github.tonywasher.joceanus.tethys.api.thread.TethysUIThreadStatusReport;
31
32
33
34
35
36
37 public final class MoneyWiseArchiveTaxBasis {
38
39
40
41 private static final String AREA_TAXBASES = MoneyWiseTaxBasis.LIST_NAME;
42
43
44
45
46 private final TethysUIThreadStatusReport theReport;
47
48
49
50
51 private final PrometheusSheetWorkBook theWorkBook;
52
53
54
55
56 private final MoneyWiseDataSet theData;
57
58
59
60
61
62
63
64
65 MoneyWiseArchiveTaxBasis(final TethysUIThreadStatusReport pReport,
66 final PrometheusSheetWorkBook pWorkBook,
67 final MoneyWiseDataSet pData) {
68 theReport = pReport;
69 theWorkBook = pWorkBook;
70 theData = pData;
71 }
72
73
74
75
76
77
78
79 void loadArchive(final OceanusProfile pStage) throws OceanusException {
80
81 pStage.startTask(AREA_TAXBASES);
82 final MoneyWiseTaxBasisList myList = theData.getTaxBases();
83
84
85 try {
86
87 final PrometheusSheetView myView = theWorkBook.getRangeView(AREA_TAXBASES);
88
89
90 theReport.setNewStage(AREA_TAXBASES);
91
92
93 final int myTotal = myView.getRowCount();
94
95
96 theReport.setNumSteps(myTotal);
97
98
99 for (int i = 0; i < myTotal; i++) {
100
101 final PrometheusSheetRow myRow = myView.getRowByIndex(i);
102 final PrometheusSheetCell myCell = myView.getRowCellByIndex(myRow, 0);
103
104
105 myList.addBasicItem(myCell.getString());
106
107
108 theReport.setNextStep();
109 }
110
111
112 myList.postProcessOnLoad();
113
114
115 } catch (TethysUIThreadCancelException e) {
116 throw e;
117 } catch (OceanusException e) {
118 throw new MoneyWiseIOException("Failed to Load " + myList.getItemType().getListName(), e);
119 }
120 }
121 }