use of de.metas.banking.BankStatementLineId in project metasfresh-webui-api by metasfresh.
the class BankStatementBasedProcess method checkSingleLineSelectedWhichIsNotReconciled.
protected final ProcessPreconditionsResolution checkSingleLineSelectedWhichIsNotReconciled(@NonNull final IProcessPreconditionsContext context) {
// there should be a single line selected
final Set<TableRecordReference> bankStatemementLineRefs = context.getSelectedIncludedRecords();
if (bankStatemementLineRefs.size() != 1) {
return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection();
}
final TableRecordReference bankStatemementLineRef = bankStatemementLineRefs.iterator().next();
final BankStatementLineId bankStatementLineId = BankStatementLineId.ofRepoId(bankStatemementLineRef.getRecord_ID());
final I_C_BankStatementLine line = bankStatementBL.getLineById(bankStatementLineId);
if (line.isReconciled()) {
return ProcessPreconditionsResolution.reject(msgBL.getTranslatableMsgText(MSG_LineIsAlreadyReconciled));
}
return ProcessPreconditionsResolution.accept();
}
use of de.metas.banking.BankStatementLineId in project metasfresh-webui-api by metasfresh.
the class C_BankStatement_UnReconcileLine method checkSingleLineSelectedWhichIsReconciled.
private final ProcessPreconditionsResolution checkSingleLineSelectedWhichIsReconciled(@NonNull final IProcessPreconditionsContext context) {
// there should be a single line selected
final Set<TableRecordReference> bankStatemementLineRefs = context.getSelectedIncludedRecords();
if (bankStatemementLineRefs.size() != 1) {
return ProcessPreconditionsResolution.rejectWithInternalReason("a single line shall be selected");
}
final TableRecordReference bankStatemementLineRef = bankStatemementLineRefs.iterator().next();
final BankStatementLineId bankStatementLineId = BankStatementLineId.ofRepoId(bankStatemementLineRef.getRecord_ID());
final I_C_BankStatementLine line = bankStatementBL.getLineById(bankStatementLineId);
if (!line.isReconciled()) {
return ProcessPreconditionsResolution.rejectWithInternalReason("line shall be reconciled");
}
return ProcessPreconditionsResolution.accept();
}
Aggregations