Yes please do

Jacques

From: "Deyan Tsvetanov" <[email protected]>
Hi guys,
so - any comments on the suggested improvement ?

If no than probably I could open a jira enhancement issue and attach a
patch ?

-- deyan
On Mon, 2009-06-22 at 22:46 +0300, Deyan Tsvetanov wrote:
Hi David,
i am currently not referring only business organizations but government
organizations as well. Ridiculous but still organizations ( and
customers :)

I'll give you an example: documents management - each incoming document
MUST get an incoming number which MUST be sequential with no gaps ( so
they can track the order the docs were received and make sure nobody
fakes the date, or at least this was the way it was done 100 years ago
when all the registers were on paper :)

then you get outgoing documents - same thing.

Then you get support ticket numbers: the organization must issue an
incoming ticket number to the ticket creator - either on paper, signed
and stamped, or via e-mail - digitally signed. The number has to has no
gaps - in case it gets argued or goes to court ... or whatever.

I could quote hundreds of cases which no gaps are required by our lovely
government agencies and organizations. The country is called Bulgaria :)

So my current project is related to bailiffs. These guys in general are
a private business, but most of their activities are defined by the law.
So the law tells them how they should number their cases - I can't argue
- i'm just a programmer :) Neither could they - they'll loose their
license if they don't comply.
It's the same story with invoicing, it's the same story even with bus or
cinema tickets printing ! :)

Did I manage to answer your question ?


On Mon, 2009-06-22 at 13:02 -0600, David E Jones wrote: > Deyan, > > I still can't figure out what you are trying to do. You mentioned > that countries have a requirement for no gaps in ID values, but which > ID values are you referring to? I know such requirements exist for > things like invoice IDs and even certain others like returns and > orders, and that is why code exists to take care of those cases. > > Which other cases are you trying to address? > > -David > > > On Jun 22, 2009, at 12:39 PM, Deyan Tsvetanov wrote: > > > well, > > it's easier for me to just copy+paste the getNextInvoiceSeq service, > > but i wanted to use a general sollution - less code to worry > > about :) and it thist feature would be definitelly used, lot of > > countries have the requirement for no gaps in ids.
> >
> > also there is an requirement to re-start the counter on certain > > periods. for example id should be year+sequence id.
> >
> > in getNextInvoiceId that's implemented. i thought of suggesting this > > feature as well, but theb i thought - it's pretty easy to make a > > service and schedule it yearly... so that goes away. but the > > SequenceBankSize prop i do think will be useful, so if you guyz > > agree than i'll go ahead and implement it. i'll do it anyway - i > > need this feature for a project :)
> >
> > -- deyan
> > ------- Original message -------
> >> From: David E Jones <[email protected]>
> >> To: [email protected]
> >> Cc: [email protected]
> >> Sent: 22.6.'09,  21:22
> >>
> >> an interesting idea, although it makes me wonder... why not just > >> use the same technique that the getNextInvoiceId service uses?
> >>
> >> -David
> >>
> >>
> >> On Jun 22, 2009, at 9:01 AM, Deyan Tsvetanov wrote:
> >>
> >>> I recall my comment about the sequences thread safety - in case we > >>> start
> >>> 2 ofbiz instances against the same database :)
> >>>
> >>> But the 1st issue remains - configuring the sequence bank size for
> >>> specific entities.
> >>>
> >>> I suggest adding a new column in SequenceValueItem - bank_size.
> >>> If it is set to 0 than SequenceUtil will not create a SequenceBank > >>> for > >>> that entity but will read the current seq_id from the database > >>> instead. > >>> This is needed to ensure there will be no gaps in the sequence IDs > >>> for > >>> entities that do require no gaps because of legal requirements in > >>> some
> >>> countries :)
> >>>
> >>> -- deyan
> >>>
> >>> On Mon, 2009-06-22 at 17:30 +0300, Deyan Tsvetanov wrote:
> >>>> Hi again,
> >>>>
> >>>> finally I used GenericDelegator.getNextSeqIdLong() when creating
> >>>> entities.
> >>>>
> >>>> It does increment the sequence by 1.
> >>>>
> >>>> However today I noticed, that in the database - sequence_value_item
> >>>> table  - the seq_id value gets incremented by 10.
> >>>>
> >>>> The reason is that the org.ofbiz.entity.util.SequenceUtil class > >>>> creates
> >>>> a SequenceBank with the default value ot 10 IDs.
> >>>>
> >>>> This is a MAJOR problem. It would appear if the server dies or > >>>> gets a > >>>> hard restart for some reason ( or even JVM error ) - we'll end > >>>> up with
> >>>> gaps.
> >>>>
> >>>> I couldn't find any API that forces the SequenceUtil to create a
> >>>> SequnenceBank sized to 1 . Is there a way to do it ?
> >>>>
> >>>>
> >>>> Also:
> >>>>
> >>>> I couldn't find any info in the mail threads regarding this > >>>> sequencing
> >>>> mechanism being thread safe.
> >>>> Although I ran several threads requesting next ID from the same > >>>> sequence > >>>> - and it works OK - I am not quite convinced what would happen > >>>> if we > >>>> have 2 ofbiz instances running against the same database. Is this > >>>> setup
> >>>> supported ?
> >>>>
> >>>> Thanks in advance,
> >>>> Deyan
> >>>>
> >>>> On Sat, 2009-06-13 at 15:27 +0200, Jacques Le Roux wrote:
> >>>>> This has been already dicussed many times. You may find > >>>>> information using MarMail or Nable, some threads are even very > >>>>> detailled
> >>>>>
> >>>>> Good luck
> >>>>>
> >>>>> Jacques
> >>>>>
> >>>>> From: "Deyan Tsvetanov" <[email protected]>
> >>>>>> Exactly, I knew I've seen it somewhere :)
> >>>>>> "Enforced Sequence (no gaps, per organization)"
> >>>>>>
> >>>>>> Thanks guys,
> >>>>>> I'll have a look at it.
> >>>>>>
> >>>>>> Another question: do you have any idea how this enforced > >>>>>> sequence might
> >>>>>> behave in case of two ofbiz servers - in a cluster or sharing a
> >>>>>> database ?
> >>>>>>
> >>>>>> My goal is to generate IDs without absolutely any gaps.
> >>>>>>
> >>>>>> Another very important requirement is that the order of the > >>>>>> record's > >>>>>> CREATED_DATE should match the order of the IDs. It is not > >>>>>> possible to go
> >>>>>> back and fill a gap.
> >>>>>>
> >>>>>> Example:
> >>>>>>
> >>>>>> A good example:
> >>>>>> ID          |           CREATED_DATE
> >>>>>> ---------------------------------------------
> >>>>>> 1          |            1 June  9:00 AM
> >>>>>> 2          |            1 June 10:00 AM
> >>>>>>
> >>>>>> A bad example:
> >>>>>>
> >>>>>> ID          |           CREATED_DATE
> >>>>>> ---------------------------------------------
> >>>>>> 1          |            1 June 10:00 AM
> >>>>>> 2          |            1 June  9:00 AM
> >>>>>>
> >>>>>>
> >>>>>> I already have an idea of a workaround,
> >>>>>> but I'll investigate the enforced sequence first.
> >>>>>>
> >>>>>> Thanks again,
> >>>>>> Deyan
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> On Sat, 2009-06-13 at 05:42 -0700, BJ Freeman wrote:
> >>>>>>> Organization GL Settings >Available Internal
> >>>>>>> Organizations>Company>Setup>Accounting Preferences
> >>>>>>>
> >>>>>>> David E Jones sent the following on 6/13/2009 5:15 AM:
> >>>>>>>>
> >>>>>>>> Take a look at the party/organization accounting preferences > >>>>>>>> in the > >>>>>>>> Accounting Manager. If you're looking for this sort of > >>>>>>>> sequencing for
> >>>>>>>> invoices, orders, etc then it is already supported.
> >>>>>>>>
> >>>>>>>> -David
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> On Jun 13, 2009, at 5:44 AM, Deyan Tsvetanov wrote:
> >>>>>>>>
> >>>>>>>>> Hi list,
> >>>>>>>>>
> >>>>>>>>> I'd like to use a custom ID generator - for instance rather > >>>>>>>>> to start > >>>>>>>>> from 10000 and increment by 10 I'd like to start from 0, > >>>>>>>>> increment by 1 > >>>>>>>>> leaving no empty values and probably append some other rules > >>>>>>>>> - like to > >>>>>>>>> reset to 0 in the beginning of each year and prefix the > >>>>>>>>> returned ID by
> >>>>>>>>> the current year.
> >>>>>>>>>
> >>>>>>>>> Example:
> >>>>>>>>>
> >>>>>>>>> 200900001
> >>>>>>>>> 200900002
> >>>>>>>>> ....
> >>>>>>>>> 200932110
> >>>>>>>>> ....
> >>>>>>>>> 201000001    <--- a new year starts.
> >>>>>>>>>
> >>>>>>>>> I know it may sound pretty dumb, but the law makers in some > >>>>>>>>> countries
> >>>>>>>>> are not so smart.
> >>>>>>>>>
> >>>>>>>>> So - could somebody give me some hints - is it possible to > >>>>>>>>> specify a > >>>>>>>>> custom ID generator per field typed "id-ne" in the > >>>>>>>>> entitymodel.xml ?
> >>>>>>>>>
> >>>>>>>>> Thanks in advance,
> >>>>>>>>> Deyan
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>
> >>>>
> >>>
> >>
> >
>


Reply via email to