createPerson and createPartyGroup services don't accept party Ids
starting with a number. I wonder what is the reason for this restriction? I suppose it is done to prevent users from entering numbers as partyId which may interfere with auto generated Ids. If this is the case I propose to change the logic, so instead of checking only the first character, it checks all the characters from the Id and refuse it ONLY IF all the characters are numbers. WDYT? I faced this problem while trying to import data in ofbiz, where the Ids start with number but contains also some letters. In this case it is not possible to interfere with auto generated Ids but still they are not accepted as valid Ids. Bilgin |
+1
Commons StringUtils has a method for this check if we don't have one of our own. Regards Scott HotWax Media http://www.hotwaxmedia.com On 17/03/2010, at 4:21 AM, Bilgin Ibryam wrote: > createPerson and createPartyGroup services don't accept party Ids starting with a number. I wonder what is the reason for this restriction? > > I suppose it is done to prevent users from entering numbers as partyId which may interfere with auto generated Ids. If this is the case I propose to change the logic, so instead of checking only the first character, it checks all the characters from the Id and refuse it ONLY IF all the characters are numbers. WDYT? > > I faced this problem while trying to import data in ofbiz, where the Ids start with number but contains also some letters. In this case it is not possible to interfere with auto generated Ids but still they are not accepted as valid Ids. > > Bilgin smime.p7s (3K) Download Attachment |
Scott Gray wrote:
> +1 > Commons StringUtils has a method for this check if we don't have one of our own. Do we really need a full on method call instead of just string.matches("\\d+")? > Regards > Scott > > HotWax Media > http://www.hotwaxmedia.com > > On 17/03/2010, at 4:21 AM, Bilgin Ibryam wrote: > >> createPerson and createPartyGroup services don't accept party Ids starting with a number. I wonder what is the reason for this restriction? >> >> I suppose it is done to prevent users from entering numbers as partyId which may interfere with auto generated Ids. If this is the case I propose to change the logic, so instead of checking only the first character, it checks all the characters from the Id and refuse it ONLY IF all the characters are numbers. WDYT? >> >> I faced this problem while trying to import data in ofbiz, where the Ids start with number but contains also some letters. In this case it is not possible to interfere with auto generated Ids but still they are not accepted as valid Ids. >> >> Bilgin |
On 17/03/2010, at 9:28 AM, Adam Heath wrote:
> Scott Gray wrote: >> +1 >> Commons StringUtils has a method for this check if we don't have one of our own. > > Do we really need a full on method call instead of just > string.matches("\\d+")? That also looks like a method call :-) StringUtils is null safe but I have no idea if that is required here. > >> Regards >> Scott >> >> HotWax Media >> http://www.hotwaxmedia.com >> >> On 17/03/2010, at 4:21 AM, Bilgin Ibryam wrote: >> >>> createPerson and createPartyGroup services don't accept party Ids starting with a number. I wonder what is the reason for this restriction? >>> >>> I suppose it is done to prevent users from entering numbers as partyId which may interfere with auto generated Ids. If this is the case I propose to change the logic, so instead of checking only the first character, it checks all the characters from the Id and refuse it ONLY IF all the characters are numbers. WDYT? >>> >>> I faced this problem while trying to import data in ofbiz, where the Ids start with number but contains also some letters. In this case it is not possible to interfere with auto generated Ids but still they are not accepted as valid Ids. >>> >>> Bilgin > smime.p7s (3K) Download Attachment |
In reply to this post by Adam Heath-2
We use a prefix for each instance, so our id's are of the format "\\d+-\d+".
So, looks like this kind of check, is a function of how your entityengine.xml file is configured. Marc Morin Emforium Group Inc. ALL-IN Software 519-772-6824 ext 201 [hidden email] ----- "Adam Heath" <[hidden email]> wrote: > Scott Gray wrote: > > +1 > > Commons StringUtils has a method for this check if we don't have one > of our own. > > Do we really need a full on method call instead of just > string.matches("\\d+")? > > > Regards > > Scott > > > > HotWax Media > > http://www.hotwaxmedia.com > > > > On 17/03/2010, at 4:21 AM, Bilgin Ibryam wrote: > > > >> createPerson and createPartyGroup services don't accept party Ids > starting with a number. I wonder what is the reason for this > restriction? > >> > >> I suppose it is done to prevent users from entering numbers as > partyId which may interfere with auto generated Ids. If this is the > case I propose to change the logic, so instead of checking only the > first character, it checks all the characters from the Id and refuse > it ONLY IF all the characters are numbers. WDYT? > >> > >> I faced this problem while trying to import data in ofbiz, where > the Ids start with number but contains also some letters. In this case > it is not possible to interfere with auto generated Ids but still they > are not accepted as valid Ids. > >> > >> Bilgin |
Marc Morin wrote:
> We use a prefix for each instance, so our id's are of the format "\\d+-\d+". > > So, looks like this kind of check, is a function of how your entityengine.xml file is configured. > > Scott, I can't find the method in StringUtil, but the regex proposed by Adam is enough. Marc, could you elaborate more on how these IDs are related to entityengine? Bilgin |
Administrator
|
Bilgin,
I guess Scott spoke about ContainsOnly at http://commons.apache.org/lang/api/org/apache/commons/lang/StringUtils.html Jacques From: "Bilgin Ibryam" <[hidden email]> > Marc Morin wrote: >> We use a prefix for each instance, so our id's are of the format "\\d+-\d+". >> >> So, looks like this kind of check, is a function of how your entityengine.xml file is configured. >> >> > Scott, I can't find the method in StringUtil, but the regex proposed by > Adam is enough. > > Marc, could you elaborate more on how these IDs are related to entityengine? > > Bilgin > |
On 17/03/2010, at 10:37 AM, Jacques Le Roux wrote:
> Bilgin, > > I guess Scott spoke about ContainsOnly at http://commons.apache.org/lang/api/org/apache/commons/lang/StringUtils.html That's the right class but I was talking about StringUtils.isNumeric(String) > > Jacques > > From: "Bilgin Ibryam" <[hidden email]> >> Marc Morin wrote: >>> We use a prefix for each instance, so our id's are of the format "\\d+-\d+". >>> >>> So, looks like this kind of check, is a function of how your entityengine.xml file is configured. >>> >>> >> Scott, I can't find the method in StringUtil, but the regex proposed by Adam is enough. >> Marc, could you elaborate more on how these IDs are related to entityengine? >> Bilgin >> > smime.p7s (3K) Download Attachment |
In reply to this post by Bilgin Ibryam-2
We configure the entityengine.xml to have sequenced-id-prefix="${instance}-" defined on the delegator configuration section. This causes the sequence id's that are generated for that delegator to have a prefix created, in our case, ${instance} is replaced with the unique id for the "tenant". This means that tenant 10342 will have all it's generated keys have the form 10342-10023...
This makes it easier to take data from one tenant or db instance and move it to another. We're essentially generating unique id's. In our case, the entityengine.xml file has been extended to have templates, but you can easily configure a delegator in stock ofbiz to have a constant prefix for each delegator. Marc Morin Emforium Group Inc. ALL-IN Software 519-772-6824 ext 201 [hidden email] ----- "Bilgin Ibryam" <[hidden email]> wrote: > Marc Morin wrote: > > We use a prefix for each instance, so our id's are of the format > "\\d+-\d+". > > > > So, looks like this kind of check, is a function of how your > entityengine.xml file is configured. > > > > > Scott, I can't find the method in StringUtil, but the regex proposed > by > Adam is enough. > > Marc, could you elaborate more on how these IDs are related to > entityengine? > > Bilgin |
In reply to this post by Scott Gray-2
Scott Gray wrote:
> On 17/03/2010, at 10:37 AM, Jacques Le Roux wrote: > > >> Bilgin, >> >> I guess Scott spoke about ContainsOnly at http://commons.apache.org/lang/api/org/apache/commons/lang/StringUtils.html >> > > That's the right class but I was talking about StringUtils.isNumeric(String) > > >> Jacques >> >> From: "Bilgin Ibryam" <[hidden email]> >> >>> Marc Morin wrote: >>> >>>> We use a prefix for each instance, so our id's are of the format "\\d+-\d+". >>>> >>>> So, looks like this kind of check, is a function of how your entityengine.xml file is configured. >>>> >>>> >>>> >>> Scott, I can't find the method in StringUtil, but the regex proposed by Adam is enough. >>> Marc, could you elaborate more on how these IDs are related to entityengine? >>> Bilgin >>> >>> > > Done in trunk rev 924685 |
Free forum by Nabble | Edit this page |