View Javadoc
1   /*
2    * MoneyWise: Finance Application
3    * Copyright 2012-2026. Tony Washer
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6    * use this file except in compliance with the License.  You may obtain a copy
7    * of the License at
8    *
9    *   http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
14   * License for the specific language governing permissions and limitations under
15   * the License.
16   */
17  package io.github.tonywasher.joceanus.moneywise.quicken.file;
18  
19  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseTransaction;
20  import io.github.tonywasher.joceanus.moneywise.quicken.definitions.MoneyWiseQEventLineType;
21  import io.github.tonywasher.joceanus.moneywise.quicken.file.MoneyWiseQIFAccount.MoneyWiseQIFXferAccountLine;
22  import io.github.tonywasher.joceanus.moneywise.quicken.file.MoneyWiseQIFEventCategory.MoneyWiseQIFCategoryLine;
23  import io.github.tonywasher.joceanus.moneywise.quicken.file.MoneyWiseQIFLine.MoneyWiseQIFClearedLine;
24  import io.github.tonywasher.joceanus.moneywise.quicken.file.MoneyWiseQIFLine.MoneyWiseQIFDateLine;
25  import io.github.tonywasher.joceanus.moneywise.quicken.file.MoneyWiseQIFLine.MoneyWiseQIFMoneyLine;
26  import io.github.tonywasher.joceanus.moneywise.quicken.file.MoneyWiseQIFLine.MoneyWiseQIFStringLine;
27  import io.github.tonywasher.joceanus.moneywise.quicken.file.MoneyWiseQIFPayee.MoneyWiseQIFPayeeLine;
28  import io.github.tonywasher.joceanus.oceanus.date.OceanusDate;
29  import io.github.tonywasher.joceanus.oceanus.date.OceanusDateFormatter;
30  import io.github.tonywasher.joceanus.oceanus.decimal.OceanusDecimalParser;
31  import io.github.tonywasher.joceanus.oceanus.decimal.OceanusMoney;
32  import io.github.tonywasher.joceanus.oceanus.decimal.OceanusRate;
33  import io.github.tonywasher.joceanus.oceanus.format.OceanusDataFormatter;
34  
35  import java.util.ArrayList;
36  import java.util.List;
37  import java.util.Objects;
38  
39  /**
40   * Class representing a QIF Event record.
41   */
42  public class MoneyWiseQIFEvent
43          extends MoneyWiseQIFEventRecord<MoneyWiseQEventLineType> {
44      /**
45       * The register.
46       */
47      private final MoneyWiseQIFRegister theRegister;
48  
49      /**
50       * The Date.
51       */
52      private final OceanusDate theDate;
53  
54      /**
55       * The Cleared Flag.
56       */
57      private final Boolean isCleared;
58  
59      /**
60       * Constructor.
61       *
62       * @param pRegister the QIF register
63       * @param pTrans    the transaction
64       */
65      protected MoneyWiseQIFEvent(final MoneyWiseQIFRegister pRegister,
66                                  final MoneyWiseTransaction pTrans) {
67          /* Call super-constructor */
68          super(MoneyWiseQEventLineType.class);
69  
70          /* Store values */
71          theRegister = pRegister;
72          theDate = pTrans.getDate();
73          isCleared = pTrans.isReconciled();
74  
75          /* Add the lines */
76          addLine(new MoneyWiseQIFEventDateLine(theDate));
77          addLine(new MoneyWiseQIFEventClearedLine(isCleared));
78  
79          /* Add the reference line if it exists */
80          final String myRef = pTrans.getReference();
81          if (myRef != null) {
82              recordReference(myRef);
83          }
84  
85          /* Add the comment line if it exists */
86          final String myComment = pTrans.getComments();
87          if (myComment != null) {
88              recordComment(myComment);
89          }
90      }
91  
92      /**
93       * Constructor for opening balance.
94       *
95       * @param pRegister  the QIF Register
96       * @param pStartDate the start date
97       */
98      protected MoneyWiseQIFEvent(final MoneyWiseQIFRegister pRegister,
99                                  final OceanusDate pStartDate) {
100         /* Call super-constructor */
101         super(MoneyWiseQEventLineType.class);
102 
103         /* Store values */
104         theRegister = pRegister;
105         theDate = pStartDate;
106         isCleared = true;
107 
108         /* Add the lines */
109         addLine(new MoneyWiseQIFEventDateLine(theDate));
110         addLine(new MoneyWiseQIFEventClearedLine(isCleared));
111         addLine(new MoneyWiseQIFEventPayeeDescLine("Opening Balance"));
112     }
113 
114     /**
115      * Constructor.
116      *
117      * @param pRegister  the QIF Register
118      * @param pFormatter the Data Formatter
119      * @param pLines     the data lines
120      */
121     protected MoneyWiseQIFEvent(final MoneyWiseQIFRegister pRegister,
122                                 final OceanusDataFormatter pFormatter,
123                                 final List<String> pLines) {
124         /* Call super-constructor */
125         super(MoneyWiseQEventLineType.class);
126 
127         /* Determine details */
128         theRegister = pRegister;
129         OceanusDate myDate = null;
130         Boolean myCleared = null;
131 
132         /* Current split record */
133         MoneyWiseQIFSplitEvent mySplit = null;
134 
135         /* Obtain parsers */
136         final OceanusDateFormatter myDateParser = pFormatter.getDateFormatter();
137         final OceanusDecimalParser myDecParser = pFormatter.getDecimalParser();
138 
139         /* Loop through the lines */
140         for (String myLine : pLines) {
141             /* Determine the category */
142             final MoneyWiseQEventLineType myType = MoneyWiseQEventLineType.parseLine(myLine);
143             if (myType != null) {
144                 /* Access data */
145                 final String myData = myLine.substring(myType.getSymbol().length());
146 
147                 /* Switch on line type */
148                 switch (myType) {
149                     case DATE:
150                         final OceanusDate myDateDay = myDateParser.parseDateBase(myData, MoneyWiseQIFConstants.QIF_BASEYEAR);
151                         addLine(new MoneyWiseQIFEventDateLine(myDateDay));
152                         myDate = myDateDay;
153                         break;
154                     case CLEARED:
155                         final Boolean myFlag = myData.equals(MoneyWiseQIFLine.QIF_RECONCILED);
156                         addLine(new MoneyWiseQIFEventClearedLine(myFlag));
157                         myCleared = myFlag;
158                         break;
159                     case AMOUNT:
160                         OceanusMoney myMoney = myDecParser.parseMoneyValue(myData);
161                         addLine(new MoneyWiseQIFEventAmountLine(myMoney));
162                         break;
163                     case COMMENT:
164                         addLine(new MoneyWiseQIFEventCommentLine(myData));
165                         break;
166                     case REFERENCE:
167                         addLine(new MoneyWiseQIFEventReferenceLine(myData));
168                         break;
169                     case PAYEE:
170                         addLine(new MoneyWiseQIFEventPayeeDescLine(myData));
171                         break;
172                     case CATEGORY:
173                         /* Check for account and category */
174                         MoneyWiseQIFAccount myAccount = parseAccount(pRegister, myData);
175                         MoneyWiseQIFEventCategory myCategory = parseCategory(pRegister, myData);
176                         if (myAccount != null) {
177                             /* Look for account classes */
178                             final List<MoneyWiseQIFClass> myClasses = parseAccountClasses(pRegister, myData);
179                             addLine(new MoneyWiseQIFEventAccountLine(myAccount, myClasses));
180                         } else {
181                             /* Look for category classes */
182                             final List<MoneyWiseQIFClass> myClasses = parseCategoryClasses(pRegister, myData);
183                             addLine(new MoneyWiseQIFEventCategoryLine(myCategory, myClasses));
184                             convertPayee();
185                         }
186                         break;
187                     case SPLITCATEGORY:
188                         /* Check for account */
189                         myAccount = parseAccount(pRegister, myData);
190                         myCategory = parseCategory(pRegister, myData);
191                         if (myAccount != null) {
192                             /* Look for account classes */
193                             final List<MoneyWiseQIFClass> myClasses = parseAccountClasses(pRegister, myData);
194                             mySplit = new MoneyWiseQIFSplitEvent(myAccount, myClasses);
195                         } else {
196                             /* Look for category classes */
197                             final List<MoneyWiseQIFClass> myClasses = parseCategoryClasses(pRegister, myData);
198                             mySplit = new MoneyWiseQIFSplitEvent(myCategory, myClasses);
199                             convertPayee();
200                         }
201 
202                         /* Record new split record */
203                         addRecord(mySplit);
204                         break;
205                     case SPLITAMOUNT:
206                         myMoney = myDecParser.parseMoneyValue(myData);
207                         Objects.requireNonNull(mySplit).setSplitAmount(myMoney);
208                         break;
209                     case SPLITPERCENT:
210                         final OceanusRate myRate = myDecParser.parseRateValue(myData);
211                         Objects.requireNonNull(mySplit).setSplitPercentage(myRate);
212                         break;
213                     case SPLITCOMMENT:
214                         Objects.requireNonNull(mySplit).setSplitComment(myData);
215                         break;
216                     default:
217                         break;
218                 }
219             }
220         }
221 
222         /* Build details */
223         theDate = myDate;
224         isCleared = myCleared;
225     }
226 
227     @Override
228     public OceanusDate getDate() {
229         return theDate;
230     }
231 
232     @Override
233     public Boolean isCleared() {
234         return isCleared;
235     }
236 
237     /**
238      * Parse account line.
239      *
240      * @param pRegister the QIF Register
241      * @param pLine     the line.
242      * @return the account name (or null)
243      */
244     static MoneyWiseQIFAccount parseAccount(final MoneyWiseQIFRegister pRegister,
245                                             final String pLine) {
246         /* Determine line to use */
247         String myLine = pLine;
248 
249         /* If the line contains a category separator */
250         if (pLine.contains(MoneyWiseQIFConstants.QIF_CATSEP)) {
251             /* Move to data following separator */
252             final int i = pLine.indexOf(MoneyWiseQIFConstants.QIF_CATSEP);
253             myLine = pLine.substring(i + 1);
254         }
255 
256         /* If the line contains classes */
257         if (myLine.contains(MoneyWiseQIFConstants.QIF_CLASS)) {
258             /* drop class data */
259             final int i = myLine.indexOf(MoneyWiseQIFConstants.QIF_CLASS);
260             myLine = myLine.substring(0, i);
261         }
262 
263         /* If we have the account delimiters */
264         if (myLine.startsWith(MoneyWiseQIFConstants.QIF_XFERSTART)
265                 && myLine.endsWith(MoneyWiseQIFConstants.QIF_XFEREND)) {
266             /* Remove account delimiters */
267             final int i = MoneyWiseQIFConstants.QIF_XFERSTART.length();
268             final int j = MoneyWiseQIFConstants.QIF_XFEREND.length();
269             final String myAccount = myLine.substring(i, myLine.length()
270                     - j);
271             return pRegister.getAccount(myAccount);
272         }
273 
274         /* Return no account */
275         return null;
276     }
277 
278     /**
279      * Parse account classes.
280      *
281      * @param pRegister the QIF Register
282      * @param pLine     the line.
283      * @return the account name (or null)
284      */
285     static List<MoneyWiseQIFClass> parseAccountClasses(final MoneyWiseQIFRegister pRegister,
286                                                        final String pLine) {
287         /* Determine line to use */
288         String myLine = pLine;
289 
290         /* If the line contains a category separator */
291         if (pLine.contains(MoneyWiseQIFConstants.QIF_CATSEP)) {
292             /* Move to data following separator */
293             final int i = pLine.indexOf(MoneyWiseQIFConstants.QIF_CATSEP);
294             myLine = pLine.substring(i + 1);
295         }
296 
297         /* If the line contains classes */
298         if (myLine.contains(MoneyWiseQIFConstants.QIF_CLASS)) {
299             /* drop preceding data */
300             final int i = myLine.indexOf(MoneyWiseQIFConstants.QIF_CLASS);
301             myLine = myLine.substring(i + 1);
302 
303             /* Build list of classes */
304             final String[] myClasses = myLine.split(MoneyWiseQIFConstants.QIF_CLASSSEP);
305             final List<MoneyWiseQIFClass> myList = new ArrayList<>();
306             for (String myClass : myClasses) {
307                 myList.add(pRegister.getClass(myClass));
308             }
309 
310             /* Return the classes */
311             return myList;
312         }
313 
314         /* Return no classes */
315         return null;
316     }
317 
318 
319     /**
320      * Parse category line.
321      *
322      * @param pRegister the QIF Register
323      * @param pLine     the line.
324      * @return the account name (or null)
325      */
326     static MoneyWiseQIFEventCategory parseCategory(final MoneyWiseQIFRegister pRegister,
327                                                    final String pLine) {
328         /* Determine line to use */
329         String myLine = pLine;
330 
331         /* If the line contains a category separator */
332         if (pLine.contains(MoneyWiseQIFConstants.QIF_CATSEP)) {
333             /* Drop data after separator */
334             final int i = pLine.indexOf(MoneyWiseQIFConstants.QIF_CATSEP);
335             myLine = pLine.substring(0, i);
336         }
337 
338         /* If the line contains classes */
339         if (myLine.contains(MoneyWiseQIFConstants.QIF_CLASS)) {
340             /* drop class data */
341             final int i = myLine.indexOf(MoneyWiseQIFConstants.QIF_CLASS);
342             myLine = myLine.substring(0, i);
343         }
344 
345         /* If we have the account delimiters */
346         if ((myLine.startsWith(MoneyWiseQIFConstants.QIF_XFERSTART))
347                 && (myLine.endsWith(MoneyWiseQIFConstants.QIF_XFEREND))) {
348             /* This is an account */
349             return null;
350         }
351 
352         /* Return category */
353         return pRegister.getCategory(myLine);
354     }
355 
356     /**
357      * Parse category classes.
358      *
359      * @param pRegister the QIF Register
360      * @param pLine     the line.
361      * @return the account name (or null)
362      */
363     static List<MoneyWiseQIFClass> parseCategoryClasses(final MoneyWiseQIFRegister pRegister,
364                                                         final String pLine) {
365         /* Determine line to use */
366         String myLine = pLine;
367 
368         /* If the line contains a category separator */
369         if (pLine.contains(MoneyWiseQIFConstants.QIF_CATSEP)) {
370             /* Drop data after separator */
371             final int i = pLine.indexOf(MoneyWiseQIFConstants.QIF_CATSEP);
372             myLine = pLine.substring(0, i);
373         }
374 
375         /* If the line contains classes */
376         if (myLine.contains(MoneyWiseQIFConstants.QIF_CLASS)) {
377             /* drop preceding data */
378             final int i = myLine.indexOf(MoneyWiseQIFConstants.QIF_CLASS);
379             myLine = myLine.substring(i + 1);
380 
381             /* Build list of classes */
382             final String[] myClasses = myLine.split(MoneyWiseQIFConstants.QIF_CLASSSEP);
383             final List<MoneyWiseQIFClass> myList = new ArrayList<>();
384             for (String myClass : myClasses) {
385                 myList.add(pRegister.getClass(myClass));
386             }
387 
388             /* Return the classes */
389             return myList;
390         }
391 
392         /* Return no classes */
393         return null;
394     }
395 
396     /**
397      * record reference.
398      *
399      * @param pReference the reference
400      */
401     private void recordReference(final String pReference) {
402         /* Add reference line */
403         addLine(new MoneyWiseQIFEventReferenceLine(pReference));
404     }
405 
406     /**
407      * record comment.
408      *
409      * @param pComment the comment
410      */
411     private void recordComment(final String pComment) {
412         /* Add comment line */
413         addLine(new MoneyWiseQIFEventCommentLine(pComment));
414     }
415 
416     /**
417      * record payee.
418      *
419      * @param pPayee the payee
420      */
421     protected void recordPayee(final MoneyWiseQIFPayee pPayee) {
422         /* Add payee line */
423         addLine(new MoneyWiseQIFEventPayeeLine(pPayee));
424     }
425 
426     /**
427      * record payee description.
428      *
429      * @param pPayeeDesc the payee description
430      */
431     protected void recordPayee(final String pPayeeDesc) {
432         /* Add payee line */
433         addLine(new MoneyWiseQIFEventPayeeDescLine(pPayeeDesc));
434     }
435 
436     /**
437      * record amount.
438      *
439      * @param pAmount the amount
440      */
441     protected void recordAmount(final OceanusMoney pAmount) {
442         /* Add amount line */
443         addLine(new MoneyWiseQIFEventAmountLine(pAmount));
444     }
445 
446     /**
447      * record transfer account.
448      *
449      * @param pAccount the account
450      */
451     protected void recordAccount(final MoneyWiseQIFAccount pAccount) {
452         /* Add account line */
453         addLine(new MoneyWiseQIFEventAccountLine(pAccount));
454     }
455 
456     /**
457      * record transfer account.
458      *
459      * @param pAccount the account
460      * @param pClasses the classes
461      */
462     protected void recordAccount(final MoneyWiseQIFAccount pAccount,
463                                  final List<MoneyWiseQIFClass> pClasses) {
464         /* Add account line */
465         addLine(new MoneyWiseQIFEventAccountLine(pAccount, pClasses));
466     }
467 
468     /**
469      * record category.
470      *
471      * @param pCategory the category
472      */
473     protected void recordCategory(final MoneyWiseQIFEventCategory pCategory) {
474         /* Add category line */
475         addLine(new MoneyWiseQIFEventCategoryLine(pCategory));
476     }
477 
478     /**
479      * record category.
480      *
481      * @param pCategory the category
482      * @param pClasses  the classes
483      */
484     protected void recordCategory(final MoneyWiseQIFEventCategory pCategory,
485                                   final List<MoneyWiseQIFClass> pClasses) {
486         /* Add category line */
487         addLine(new MoneyWiseQIFEventCategoryLine(pCategory, pClasses));
488     }
489 
490     /**
491      * record new Split record for transfer.
492      *
493      * @param pAccount the account
494      * @param pAmount  the amount
495      * @param pComment the comment
496      */
497     protected void recordSplitRecord(final MoneyWiseQIFAccount pAccount,
498                                      final OceanusMoney pAmount,
499                                      final String pComment) {
500         /* Create new split and add it */
501         final MoneyWiseQIFSplitEvent mySplit = new MoneyWiseQIFSplitEvent(pAccount);
502         mySplit.setSplitAmount(pAmount);
503         if (pComment != null) {
504             mySplit.setSplitComment(pComment);
505         }
506         addRecord(mySplit);
507     }
508 
509     /**
510      * record new Split record for transfer.
511      *
512      * @param pAccount the account
513      * @param pClasses the classes
514      * @param pAmount  the amount
515      * @param pComment the comment
516      */
517     protected void recordSplitRecord(final MoneyWiseQIFAccount pAccount,
518                                      final List<MoneyWiseQIFClass> pClasses,
519                                      final OceanusMoney pAmount,
520                                      final String pComment) {
521         /* Create new split and add it */
522         final MoneyWiseQIFSplitEvent mySplit = new MoneyWiseQIFSplitEvent(pAccount, pClasses);
523         mySplit.setSplitAmount(pAmount);
524         if (pComment != null) {
525             mySplit.setSplitComment(pComment);
526         }
527         addRecord(mySplit);
528     }
529 
530     /**
531      * record new Split record for category.
532      *
533      * @param pCategory the category
534      * @param pAmount   the amount
535      * @param pComment  the comment
536      */
537     protected void recordSplitRecord(final MoneyWiseQIFEventCategory pCategory,
538                                      final OceanusMoney pAmount,
539                                      final String pComment) {
540         /* Create new split and add it */
541         final MoneyWiseQIFSplitEvent mySplit = new MoneyWiseQIFSplitEvent(pCategory);
542         mySplit.setSplitAmount(pAmount);
543         if (pComment != null) {
544             mySplit.setSplitComment(pComment);
545         }
546         addRecord(mySplit);
547     }
548 
549     /**
550      * record new Split record for category.
551      *
552      * @param pCategory the category
553      * @param pClasses  the classes
554      * @param pAmount   the amount
555      * @param pComment  the comment
556      */
557     protected void recordSplitRecord(final MoneyWiseQIFEventCategory pCategory,
558                                      final List<MoneyWiseQIFClass> pClasses,
559                                      final OceanusMoney pAmount,
560                                      final String pComment) {
561         /* Create new split and add it */
562         final MoneyWiseQIFSplitEvent mySplit = new MoneyWiseQIFSplitEvent(pCategory, pClasses);
563         mySplit.setSplitAmount(pAmount);
564         if (pComment != null) {
565             mySplit.setSplitComment(pComment);
566         }
567         addRecord(mySplit);
568     }
569 
570     /**
571      * Convert Payee.
572      */
573     private void convertPayee() {
574         /* Look for a payee line */
575         final MoneyWiseQIFLine<MoneyWiseQEventLineType> myLine = getLine(MoneyWiseQEventLineType.PAYEE);
576         if (myLine instanceof MoneyWiseQIFEventPayeeDescLine myDesc) {
577             /* Access payee */
578             final String myName = myDesc.getValue();
579 
580             /* Register the payee */
581             final MoneyWiseQIFPayee myPayee = theRegister.registerPayee(myName);
582             addLine(new MoneyWiseQIFEventPayeeLine(myPayee));
583         }
584     }
585 
586     /**
587      * The Event Date line.
588      */
589     public static class MoneyWiseQIFEventDateLine
590             extends MoneyWiseQIFDateLine<MoneyWiseQEventLineType> {
591         /**
592          * Constructor.
593          *
594          * @param pDate the Date
595          */
596         protected MoneyWiseQIFEventDateLine(final OceanusDate pDate) {
597             /* Call super-constructor */
598             super(pDate);
599         }
600 
601         @Override
602         public MoneyWiseQEventLineType getLineType() {
603             return MoneyWiseQEventLineType.DATE;
604         }
605     }
606 
607     /**
608      * The Event Reference line.
609      */
610     public static class MoneyWiseQIFEventReferenceLine
611             extends MoneyWiseQIFStringLine<MoneyWiseQEventLineType> {
612         /**
613          * Constructor.
614          *
615          * @param pRef the Reference
616          */
617         protected MoneyWiseQIFEventReferenceLine(final String pRef) {
618             /* Call super-constructor */
619             super(pRef);
620         }
621 
622         @Override
623         public MoneyWiseQEventLineType getLineType() {
624             return MoneyWiseQEventLineType.REFERENCE;
625         }
626 
627         /**
628          * Obtain Reference.
629          *
630          * @return the reference
631          */
632         public String getReference() {
633             return getValue();
634         }
635     }
636 
637     /**
638      * The Event Comment line.
639      */
640     public static class MoneyWiseQIFEventCommentLine
641             extends MoneyWiseQIFStringLine<MoneyWiseQEventLineType> {
642         /**
643          * Constructor.
644          *
645          * @param pComment the comment
646          */
647         protected MoneyWiseQIFEventCommentLine(final String pComment) {
648             /* Call super-constructor */
649             super(pComment);
650         }
651 
652         @Override
653         public MoneyWiseQEventLineType getLineType() {
654             return MoneyWiseQEventLineType.COMMENT;
655         }
656 
657         /**
658          * Obtain Comment.
659          *
660          * @return the comment
661          */
662         public String getComment() {
663             return getValue();
664         }
665     }
666 
667     /**
668      * The Event Cleared line.
669      */
670     public static class MoneyWiseQIFEventClearedLine
671             extends MoneyWiseQIFClearedLine<MoneyWiseQEventLineType> {
672         /**
673          * Constructor.
674          *
675          * @param pCleared is the event cleared?
676          */
677         protected MoneyWiseQIFEventClearedLine(final Boolean pCleared) {
678             /* Call super-constructor */
679             super(pCleared);
680         }
681 
682         @Override
683         public MoneyWiseQEventLineType getLineType() {
684             return MoneyWiseQEventLineType.CLEARED;
685         }
686     }
687 
688     /**
689      * The Event Payee Account line.
690      */
691     public static class MoneyWiseQIFEventPayeeLine
692             extends MoneyWiseQIFPayeeLine<MoneyWiseQEventLineType> {
693         /**
694          * Constructor.
695          *
696          * @param pPayee the payee
697          */
698         protected MoneyWiseQIFEventPayeeLine(final MoneyWiseQIFPayee pPayee) {
699             /* Call super-constructor */
700             super(pPayee);
701         }
702 
703         @Override
704         public MoneyWiseQEventLineType getLineType() {
705             return MoneyWiseQEventLineType.PAYEE;
706         }
707     }
708 
709     /**
710      * The Event Payee Description line.
711      */
712     public static class MoneyWiseQIFEventPayeeDescLine
713             extends MoneyWiseQIFStringLine<MoneyWiseQEventLineType> {
714         /**
715          * Constructor.
716          *
717          * @param pPayee the payee description
718          */
719         protected MoneyWiseQIFEventPayeeDescLine(final String pPayee) {
720             /* Call super-constructor */
721             super(pPayee);
722         }
723 
724         @Override
725         public MoneyWiseQEventLineType getLineType() {
726             return MoneyWiseQEventLineType.PAYEE;
727         }
728     }
729 
730     /**
731      * The Event Amount line.
732      */
733     public static class MoneyWiseQIFEventAmountLine
734             extends MoneyWiseQIFMoneyLine<MoneyWiseQEventLineType> {
735         /**
736          * Constructor.
737          *
738          * @param pAmount the amount
739          */
740         protected MoneyWiseQIFEventAmountLine(final OceanusMoney pAmount) {
741             /* Call super-constructor */
742             super(pAmount);
743         }
744 
745         @Override
746         public MoneyWiseQEventLineType getLineType() {
747             return MoneyWiseQEventLineType.AMOUNT;
748         }
749 
750         /**
751          * Obtain Amount.
752          *
753          * @return the amount
754          */
755         public OceanusMoney getAmount() {
756             return getMoney();
757         }
758     }
759 
760     /**
761      * The Event Account line.
762      */
763     public static class MoneyWiseQIFEventAccountLine
764             extends MoneyWiseQIFXferAccountLine<MoneyWiseQEventLineType> {
765         /**
766          * Constructor.
767          *
768          * @param pAccount the account
769          */
770         protected MoneyWiseQIFEventAccountLine(final MoneyWiseQIFAccount pAccount) {
771             /* Call super-constructor */
772             super(pAccount);
773         }
774 
775         /**
776          * Constructor.
777          *
778          * @param pAccount the account
779          * @param pClasses the classes
780          */
781         protected MoneyWiseQIFEventAccountLine(final MoneyWiseQIFAccount pAccount,
782                                                final List<MoneyWiseQIFClass> pClasses) {
783             /* Call super-constructor */
784             super(pAccount, pClasses);
785         }
786 
787         @Override
788         public MoneyWiseQEventLineType getLineType() {
789             return MoneyWiseQEventLineType.CATEGORY;
790         }
791     }
792 
793     /**
794      * The Event Category line.
795      */
796     public static class MoneyWiseQIFEventCategoryLine
797             extends MoneyWiseQIFCategoryLine<MoneyWiseQEventLineType> {
798         /**
799          * Constructor.
800          *
801          * @param pCategory the category
802          */
803         protected MoneyWiseQIFEventCategoryLine(final MoneyWiseQIFEventCategory pCategory) {
804             /* Call super-constructor */
805             super(pCategory);
806         }
807 
808         /**
809          * Constructor.
810          *
811          * @param pCategory the category
812          * @param pClasses  the classes
813          */
814         protected MoneyWiseQIFEventCategoryLine(final MoneyWiseQIFEventCategory pCategory,
815                                                 final List<MoneyWiseQIFClass> pClasses) {
816             /* Call super-constructor */
817             super(pCategory, pClasses);
818         }
819 
820         @Override
821         public MoneyWiseQEventLineType getLineType() {
822             return MoneyWiseQEventLineType.CATEGORY;
823         }
824     }
825 }