jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Guggisberg <stefan.guggisb...@gmail.com>
Subject Re: (JCR-1.0) Restricting the length of a String property?
Date Fri, 27 Mar 2009 09:20:01 GMT
On Thu, Mar 26, 2009 at 11:40 PM, Daniel Manzke
<daniel.manzke@googlemail.com> wrote:
> Hi Nicolas thanks for your advice.
> I know the "problems" with the constraints. The only things I want to use
> them is for limiting Strings. In the JCR 1.0 SPEC there is no way to specify
> how long a String property could be.

that's not correct. constraints for String properties can be expressed as
regular expressions, e.g. the following expression limits the length of a
string to 1-5 characters: "^.{1,5}$"

cheers
stefan

> Due the fact that our backend has this
> feature, I'm searching for a way to achieve this.
>
>
> Bye,
> Daniel
>
> 2009/3/26 Nicolas Dufour <nrdufour@gmail.com>
>
>> Hey Daniel
>>
>> Just a piece of advice: try to not put too many constraints in jcr.
>> You will pay the price later on.
>> We used to do that and it's biting us hard now.
>> Unless you know for sure that piece of content will never ever change over
>> time.
>>
>> Otherwise try to stay away from constraints and/or implement them in
>> the software rather than in jcr itself.
>>
>> Regards
>>
>> Nicolas Dufour
>> nrdufour@gmail.com
>>
>>
>>
>> On Thu, Mar 19, 2009 at 1:28 PM, Stefan Guggisberg
>> <stefan.guggisberg@gmail.com> wrote:
>> > hi daniel,
>> >
>> > On Thu, Mar 19, 2009 at 5:28 PM, Daniel Manzke
>> > <daniel.manzke@googlemail.com> wrote:
>> >> Hi,
>> >> is there chance to restrict the length of a String property? I read that
>> >> there is [min, max] function for all "remaining types" and for String
>> there
>> >> is Regex and simple literals.
>> >>
>> >> Is it possible with something like .{8,10}? Does Jackrabbit support
>> this?
>> >
>> > no, that's currently not supported. jackrabbit does support regular
>> expressions
>> > by using java.util.regex.Pattern [1]. i am not exactly a regexp crack
>> > ;) but i guess
>> > it should be possible to specify an expression for restricting the
>> > length of a string.
>> >
>> > cheers
>> > stefan
>> >
>> > [1] http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
>> >
>> >>
>> >>
>> >>
>> >> Thanks and Best Regards,
>> >> Daniel
>> >>
>> >
>>
>
>
>
> --
> Mit freundlichen Grüßen
>
> Daniel Manzke
>

Mime
View raw message