if (ph.getTransactionDescriptionMatchGroup() == null)
header.setTransactionDescription(ph.getTransactionDescription());
else
- header.setTransactionDescriptionMatchGroup(ph.getTransactionDescriptionMatchGroup());
+ header.setTransactionDescriptionMatchGroup(
+ ph.getTransactionDescriptionMatchGroup());
if (ph.getTransactionCommentMatchGroup() == null)
header.setTransactionComment(ph.getTransactionComment());
else
header.setTransactionCommentMatchGroup(ph.getTransactionCommentMatchGroup());
- header.setDateDayMatchGroup(ph.getDateDayMatchGroup());
- header.setDateMonthMatchGroup(ph.getDateMonthMatchGroup());
- header.setDateYearMatchGroup(ph.getDateYearMatchGroup());
+ if (ph.getDateDayMatchGroup() == null)
+ header.setDateDay(ph.getDateDay());
+ else
+ header.setDateDayMatchGroup(ph.getDateDayMatchGroup());
+
+ if (ph.getDateMonthMatchGroup() == null)
+ header.setDateMonth(ph.getDateMonth());
+ else
+ header.setDateMonthMatchGroup(ph.getDateMonthMatchGroup());
+
+ if (ph.getDateYearMatchGroup() == null)
+ header.setDateYear(ph.getDateYear());
+ else
+ header.setDateYearMatchGroup(ph.getDateYearMatchGroup());
return header;
}
acc.setCurrencyMatchGroup(pa.getCurrencyMatchGroup());
final Integer amountMatchGroup = pa.getAmountMatchGroup();
- if (amountMatchGroup != null && amountMatchGroup > 0)
+ if (amountMatchGroup != null && amountMatchGroup > 0) {
acc.setAmountMatchGroup(amountMatchGroup);
+ final Boolean negateAmount = pa.getNegateAmount();
+ acc.setNegateAmount(negateAmount != null && negateAmount);
+ }
else
acc.setAmount(pa.getAmount());
private final PossiblyMatchedValue<Float> amount =
PossiblyMatchedValue.withLiteralFloat(0f);
private final PossiblyMatchedValue<Currency> currency = new PossiblyMatchedValue<>();
+ private boolean negateAmount;
private AccountRow() {
super(Type.ACCOUNT_ITEM);
}
+ public boolean isNegateAmount() {
+ return negateAmount;
+ }
+ public void setNegateAmount(boolean negateAmount) {
+ this.negateAmount = negateAmount;
+ }
public int getAccountCommentMatchGroup() {
return accountComment.getMatchGroup();
}
}
public boolean equalContents(AccountRow o) {
return amount.equals(o.amount) && accountName.equals(o.accountName) &&
- accountComment.equals(o.accountComment);
+ accountComment.equals(o.accountComment) && negateAmount == o.negateAmount;
}
public void switchToLiteralAmount() {
amount.switchToLiteral();
else
result.setAccountCommentMatchGroup(accountComment.getMatchGroup());
- if (amount.hasLiteralValue())
+ if (amount.hasLiteralValue()) {
result.setAmount(amount.getValue());
- else
+ result.setNegateAmount(null);
+ }
+ else {
result.setAmountMatchGroup(amount.getMatchGroup());
+ result.setNegateAmount(negateAmount ? true : null);
+ }
return result;
}