talk@lists.collectionspace.org

WE HAVE SUNSET THIS LISTSERV - Join us at collectionspace@lyrasislists.org

View all threads

Number generator configuration

JM
Jesse Martinez
Tue, Jun 23, 2015 2:35 AM

Is there a way to configure the number generator pattern to increment a
digit other than the last digit in a string? In other words, for LO2015.1.1
I'd like the next incrementing number to be LO2015.2.1 rather than
LO2015.1.2

My first attempt at this was to alter the load_id_generator.sql file to add
a new generator script where the last portion of the id generator xml was
changed from

<org.collectionspace.services.id.NumericIDGeneratorPart>
<maxLength>6</maxLength>
<initialValue>1</initialValue>
<currentValue>-1</currentValue>
</org.collectionspace.services.id.NumericIDGeneratorPart>

to

<org.collectionspace.services.id.StringIDGeneratorPart>
<initialValue>1</initialValue>
<currentValue>1</currentValue>
</org.collectionspace.services.id.StringIDGeneratorPart>

(and changed base-other-idgenerator.xml and base-procedure-foo.xml
appropriately)

But when I use the new id generator in the UI I get the same number
returned. This makes sense since the StringIDGenerator newID method returns
the currentValue string.

What is the proper way of accomplishing this change? Would it be easier to
have the id generator return a binomial pattern, LO2015.2, and have the UI
append the ".1" suffix?

Thanks,

Jesse

Is there a way to configure the number generator pattern to increment a digit other than the last digit in a string? In other words, for LO2015.1.1 I'd like the next incrementing number to be LO2015.2.1 rather than LO2015.1.2 My first attempt at this was to alter the load_id_generator.sql file to add a new generator script where the last portion of the id generator xml was changed from <org.collectionspace.services.id.NumericIDGeneratorPart> <maxLength>6</maxLength> <initialValue>1</initialValue> <currentValue>-1</currentValue> </org.collectionspace.services.id.NumericIDGeneratorPart> to <org.collectionspace.services.id.StringIDGeneratorPart> <initialValue>1</initialValue> <currentValue>1</currentValue> </org.collectionspace.services.id.StringIDGeneratorPart> (and changed base-other-idgenerator.xml and base-procedure-foo.xml appropriately) But when I use the new id generator in the UI I get the same number returned. This makes sense since the StringIDGenerator newID method returns the currentValue string. What is the proper way of accomplishing this change? Would it be easier to have the id generator return a binomial pattern, LO2015.2, and have the UI append the ".1" suffix? Thanks, Jesse
AR
Aron Roberts
Tue, Jun 23, 2015 2:54 AM

There's no intrinsic way to do this at the moment, using the number pattern
generator alone (i.e. not without help from the UI or otherwise). That is,
the capability to increment one arbitrary part of the number pattern - not
just the last part - was always an intention, but hasn't yet been
implemented.

Interestingly, Megan emailed me in January 2010 with a similar use case:

"Some of the numbers currently used on the demo site are not “incrementing”
correctly – e.g. when an accession number is added to an object record, it
should actually be the middle and not the last digit that goes up one with
each new record. It’s kind of a weird use case, but technically correct. I
have added to each old user stories how each number should increment, but
am happy to gather all these notes together into one email or user story if
that’s easier."

She noted that this is a requirement that we'll want to eventually support.
(Even if you do come up with a workaround before this happens ...)

Would you like to make the JIRA for this, or shall I? :-) I couldn't find
one, at least in a cursory search ...

Aron

On Mon, Jun 22, 2015 at 7:35 PM, Jesse Martinez mjesse@gmail.com wrote:

Is there a way to configure the number generator pattern to increment a

digit other than the last digit in a string? In other words, for LO2015.1.1
I'd like the next incrementing number to be LO2015.2.1 rather than
LO2015.1.2

My first attempt at this was to alter the load_id_generator.sql file to

add a new generator script where the last portion of the id generator xml
was changed from

<org.collectionspace.services.id.NumericIDGeneratorPart>
<maxLength>6</maxLength>
<initialValue>1</initialValue>
<currentValue>-1</currentValue>
</org.collectionspace.services.id.NumericIDGeneratorPart>

to

<org.collectionspace.services.id.StringIDGeneratorPart>
<initialValue>1</initialValue>
<currentValue>1</currentValue>
</org.collectionspace.services.id.StringIDGeneratorPart>

(and changed base-other-idgenerator.xml and base-procedure-foo.xml

appropriately)

But when I use the new id generator in the UI I get the same number

returned. This makes sense since the StringIDGenerator newID method returns
the currentValue string.

What is the proper way of accomplishing this change? Would it be easier

to have the id generator return a binomial pattern, LO2015.2, and have the
UI append the ".1" suffix?

Thanks,

Jesse


Talk mailing list
Talk@lists.collectionspace.org

There's no intrinsic way to do this at the moment, using the number pattern generator alone (i.e. not without help from the UI or otherwise). That is, the capability to increment one arbitrary part of the number pattern - not just the last part - was always an intention, but hasn't yet been implemented. Interestingly, Megan emailed me in January 2010 with a similar use case: "Some of the numbers currently used on the demo site are not “incrementing” correctly – e.g. when an accession number is added to an object record, it should actually be the middle and not the last digit that goes up one with each new record. It’s kind of a weird use case, but technically correct. I have added to each old user stories how each number should increment, but am happy to gather all these notes together into one email or user story if that’s easier." She noted that this is a requirement that we'll want to eventually support. (Even if you do come up with a workaround before this happens ...) Would you like to make the JIRA for this, or shall I? :-) I couldn't find one, at least in a cursory search ... Aron On Mon, Jun 22, 2015 at 7:35 PM, Jesse Martinez <mjesse@gmail.com> wrote: > > Is there a way to configure the number generator pattern to increment a digit other than the last digit in a string? In other words, for LO2015.1.1 I'd like the next incrementing number to be LO2015.2.1 rather than LO2015.1.2 > > My first attempt at this was to alter the load_id_generator.sql file to add a new generator script where the last portion of the id generator xml was changed from > > <org.collectionspace.services.id.NumericIDGeneratorPart> > <maxLength>6</maxLength> > <initialValue>1</initialValue> > <currentValue>-1</currentValue> > </org.collectionspace.services.id.NumericIDGeneratorPart> > > to > > <org.collectionspace.services.id.StringIDGeneratorPart> > <initialValue>1</initialValue> > <currentValue>1</currentValue> > </org.collectionspace.services.id.StringIDGeneratorPart> > > (and changed base-other-idgenerator.xml and base-procedure-foo.xml appropriately) > > But when I use the new id generator in the UI I get the same number returned. This makes sense since the StringIDGenerator newID method returns the currentValue string. > > What is the proper way of accomplishing this change? Would it be easier to have the id generator return a binomial pattern, LO2015.2, and have the UI append the ".1" suffix? > > Thanks, > > Jesse > > _______________________________________________ > Talk mailing list > Talk@lists.collectionspace.org > http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org >