A simple sequence generator.
Meaning sequence in Japanese, junjo is a microservice that returns the next code in, well, a sequence or series.
junjo keeps a collection of sequence definitions that can be invoked in order to obtain one or more values from a specific sequence, identified by its sequenceId.
A typical sequence pattern may look like SKU-{AAA}-{NNNN}-{YYYY}, where:
- SKU is a text literal.
- {AAA} represents an alphanumeric sequence [ABC, ABD, ABE, ABF, etc.]
- {NNNN} represents a numeric sequence [0001, 0002, 0003, 0004, etc.] (left padded with zeroes)
- {YYYY} represents the current year. [2022]
So, a value generated by the above example, would look like: SKU-UEJ-0432-2022
https://github.com/pmarquez/junjo-kt/issues
https://github.com/pmarquez/junjo-kt/blob/main/junjoAPI.yaml
docker pull pmarquezh/junjo
/junjoAPI/1.0/sequences
POST
The endpoint expects a DTO with the following internal structure:
{
"sequenceName": "SKUs",
"pattern": "{AAA}-{NNNN}",
"currentNumericSequence": 0,
"currentAlphaSequence": 0,
"currentAlphaRepresentation": "AAA",
"priorityType": "numeric"
}
Where...
"sequenceName" is the human readable name of the sequence to create. Must be unique.
"pattern" is the format of the sequence elements, more on it on the "patterns" section
"currentNumericSequence" is the current value of the numeric segment of the pattern (if any). This value, when used to generate an element in a sequence, will be left-padded with zeroes ("0") to match the length of the pattern segment.
"currentAlphaSequence" even though the alpha segment of a pattern will return, well, an alpha sequence, it's internal representation will be a number.
"currentAlphaRepresentation" the currentAlphaRepresentation is a nicety for us humans to see at a glance what the currentAlphaSequence means in terms of its alpha representation.
"priorityType", what will increment first? numeric? alpha? if "numeric", a sequence with a {AAA}-{NNN} pattern and a current value of "AAA-999", will return "AAB-000" as the next value, if "alpha", the next value would be "AAB-999".
This endpoint will return, in the "Location" header, the sequenceId id of the newly created sequence, which is a UUID of the form: "4a0316d6-2c1a-4a68-b904-5fba89a4f346"
* SequenceServiceImpl cleanup.
* MySQL repository - First Blood
* Reviewed code in SequenceRestController, many new things learned since last time, code improvements, many more to come.
* Updated dependencies in preparation to integrate with nsOmnistore
* A bit of cleanup and db schema added to project
- Numeric rollover fixed.
- Constraint Validations now working
- Filters now done the KOTLIN way
- Kotlin port