Jira Legacy | ||||||
---|---|---|---|---|---|---|
|
...
Settings application UI preview:
Endpoints:
GET: /authority-source-files/{id}/hrid
Description: Endpoint returns current hrid value and increment it. Should be called once user clicked on the "create" button to put value in the 001 field.
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
{ "id": "cb58492d-018e-442d-9ce3-35aabfc524aa", "prefix": "loc", "hrid": "000000001" } |
POST: /authority-source-files
New query parameter: startNumber (default = 1)
...
Table with counter Approach
New table should be created:presented
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
CREATE TABLE IF NOT EXISTS hrid_authority_source_file ( authorityFileId UUID NOT NULL, hridSeq INT NOT NULL, CONSTRAINT hrid_authority_source_file_pkey PRIMARY KEY (authorityFileId), CONSTRAINT hrid_authority_source_file_fkey FOREIGN KEY (authorityFileId) REFERENCES authority_source_file (id) ); |
To work with table it's better to use SERIALIZABLE Isolation:
@Transactional(isolation = Isolation.SERIALIZABLE)
Select local authority file on the UI
...