Package de.japrost.jabudget.repository
Interface AccountRepository
-
- All Known Implementing Classes:
InMemoryAccountRepository
public interface AccountRepositoryThe repository forAccounts.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description de.japrost.jabudget.domain.account.Accountcreate(de.japrost.jabudget.domain.account.Account account)Create a newAccountwith the given values.de.japrost.jabudget.domain.account.Entrycreate(de.japrost.jabudget.domain.account.Entry entry)Create a newEntrywith the given values.java.lang.Booleandelete(java.lang.String accountId)Delete anAccountby its id.java.util.Set<de.japrost.jabudget.domain.account.Account>findAll()Find allAccounts.java.util.Optional<de.japrost.jabudget.domain.account.Account>findById(java.lang.String id)Find anAccountby id.voidreplaceAll(java.util.Set<de.japrost.jabudget.domain.account.Account> accounts)Replace allAccounts with the given.de.japrost.jabudget.domain.account.Accountupdate(de.japrost.jabudget.domain.account.Account account)Update an existingAccount.
-
-
-
Method Detail
-
create
de.japrost.jabudget.domain.account.Account create(de.japrost.jabudget.domain.account.Account account) throws de.japrost.jabudget.domain.DomainExceptionCreate a newAccountwith the given values.- Parameters:
account- theAccountto create.- Returns:
- The account as stored in the repository.
- Throws:
de.japrost.jabudget.domain.DomainException- withDomainFailure.DUPLICATE_ENTITYif the given account already exists.
-
update
de.japrost.jabudget.domain.account.Account update(de.japrost.jabudget.domain.account.Account account) throws de.japrost.jabudget.domain.DomainExceptionUpdate an existingAccount.- Parameters:
account- theAccountto update.- Returns:
- The account as stored in the repository.
- Throws:
de.japrost.jabudget.domain.DomainException- withDomainFailure.MISSING_ENTITYif the given account does not exist.
-
replaceAll
void replaceAll(java.util.Set<de.japrost.jabudget.domain.account.Account> accounts)
Replace allAccounts with the given. Intended for imports.
Also replaces clears theEntrys of all accounts.- Parameters:
accounts- theAccounts to fill the repository.
-
findAll
java.util.Set<de.japrost.jabudget.domain.account.Account> findAll()
Find allAccounts.- Returns:
- all available
Accounts.
-
findById
java.util.Optional<de.japrost.jabudget.domain.account.Account> findById(java.lang.String id)
Find anAccountby id.- Parameters:
id- theAccountid.- Returns:
- the
Accountwith the id. An emptyOptionalif noAccountis available for the given id.
-
delete
java.lang.Boolean delete(java.lang.String accountId)
Delete anAccountby its id.- Parameters:
accountId- the id of theAccountto delete.- Returns:
Boolean.TRUEif the Account does not exist after this operation. It does not indicate that the entity to delete did exist. ReturnsBoolean.FALSEif the entity could not be deleted.
-
create
de.japrost.jabudget.domain.account.Entry create(de.japrost.jabudget.domain.account.Entry entry) throws de.japrost.jabudget.domain.DomainExceptionCreate a newEntrywith the given values.- Parameters:
entry- the entry to create.- Returns:
- The entry as stored in the repository.
- Throws:
de.japrost.jabudget.domain.DomainException- withDomainFailure.DUPLICATE_ENTITYif the given entry already exists.de.japrost.jabudget.domain.DomainException- withDomainFailure.MISSING_ENTITY_REFERENCEif the account for the entry does not exists.
-
-