accounts icon indicating copy to clipboard operation
accounts copied to clipboard

Make AccountInfo.identifier.externalId more usable

Open manosbatsis opened this issue 4 years ago • 0 comments

Needed to add/link more data with a Corda Account. After looking at issues, i found https://github.com/corda/accounts/issues/77 where @roger3cev naturally makes the reasonable proposal of using the linearId's externalId to map with client application concerns.

However, an AccountInfo's externalId is impossible to use with the current version of master, mainly because:

  • CreateAccount flow doesn't allow setting an (optional) externalId.
  • The field is not available for queries in PersistentAccountInfo.

This PR tries to accommodate users that need to utilise externalId accordingly with the following minimal changes:

  • Added PersistentAccountInfo.externalId to allow creating VaultCustomQueryCriteria with it .
  • Added database migration changesets per RDBMS vendor for the above which seems somewhat redundant but in accordance to my understanding of current project conventions (without adding even more files though). Tested on CE 4.6.1.
  • Added AccountInfoByExternalId flow on par with AccountInfoByXX flows that already exist.
  • Added an alternative constructor to CreateAccount flow to set linearId.externalId when creating accounts.
  • Added an AccountService.accountInfoByExternalId method, had to break the convention and add a suffix as the accountInfo(String) signature is already used for querying by name.
  • Added an accountExternalIdCriteria utility method per what seems as a convention within the workflows module.
  • Added Create and query accounts by externalId in AccountInfoTests, to ensure users can query by externalId after creating, receiving or requesting accounts.
  • Added RequestHostedAccountInfoByExternalId... flow variants.

I state that this PR is in accordance with the Developer's Certificate of Origin.

manosbatsis avatar Dec 22 '20 00:12 manosbatsis