You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by John Huss <jo...@gmail.com> on 2013/03/14 17:49:54 UTC
CGen includeEntities attribute
I've been using CGen for a bit and one confusing aspect of it to me was the
way you specific which entities to include for generation. I expected a
simple comma-separated list, but it requires a regular expression. You can
sort of make it work like a comma-separated list by using something like
this:
includeEntities="Customer|Invoice"
The problem is that if you have entites whose names contain these
substrings, they will also be included - so an entity named InvoiceDetail
will also be generated. You can avoid it by using this:
includeEntities="Customer|^Invoice$"
While the vertical bar instead of a comma is unintuitive, but passable,
requiring this syntax is not friendly.
So my questions are:
1) Are people actually using the reg-ex here for useful, more complex
things?
2) Would it be reasonable to add another mutually-exclusive property that
just takes a comma-separated list of entity names?
John
Re: CGen includeEntities attribute
Posted by Andrus Adamchik <an...@objectstyle.org>.
Ah ok. I guess we just need to add "This is an Ant counterpart of "xyz" goal of maven-cayenne-plugin described above." to each Ant task.
Andrus
On Mar 19, 2013, at 6:48 PM, John Huss <jo...@gmail.com> wrote:
> Well, I use Ant and that section isn't filled in. :-P
>
> I think it would be better to not mention regular expressions and just to
> say something like:
>
> A comma-separated list of ObjEntity names to exclude from template
> generation. Wildcards may be used to match multiple entities, for example,
> 'Artist*'.
>
>
>
> On Tue, Mar 19, 2013 at 1:35 AM, Andrus Adamchik <an...@objectstyle.org>wrote:
>
>> I should've checked before answering :) Actually looking at 3.1 docs, it
>> seems to be there, and very explicit:
>>
>>
>> https://cayenne.apache.org/docs/3.1/cayenne-guide/including-cayenne-in-project.html#maven-projects
>>
>> "excludeEntities A comma-separated list of ObjEntity patterns
>> (expressed as a perl5 regex) to exclude from template generation. By
>> default none of the DataMap entities are excluded."
>>
>> "includeEntities A comma-separated list of ObjEntity patterns
>> (expressed as a perl5 regex) to include from template generation. By
>> default all DataMap entities are included."
>>
>> So where is it missing?
>>
>> (and we can update 3.0 docs as well)
>>
>> Andrus
>>
>> On Mar 19, 2013, at 12:15 AM, John Huss <jo...@gmail.com> wrote:
>>
>>> Well, surprise, it already works this way. I could have sworn I tried it
>>> and it didn't work, but it does. Regular comma-separated names work
>> fine.
>>> Wildcards are optional but can be used it desired.
>>>
>>> So I guess this is more of an issue with the docs - the page
>>> here<https://cayenne.apache.org/docs/3.0/cgen.html>doesn't say
>>> comma-separated values are allowed or wildcards, but rather
>>> regular expressions. This section is blank in the new docs, so whenever
>> it
>>> gets filled in it should be clarified and should include and example
>> with a
>>> comma separated list. I suppose I should make a JIRA issue.
>>>
>>> Thanks,
>>> John
>>>
>>>
>>> On Mon, Mar 18, 2013 at 1:40 PM, Andrus Adamchik <andrus@objectstyle.org
>>> wrote:
>>>
>>>> I tend to agree. I also find regexp confusing in this situation. Yeah,
>>>> let's deprecate it and replace with a differently named "include" and
>>>> "exclude" properties. Maybe still allow a "*" to be used to match more
>> than
>>>> one entity?
>>>>
>>>> Andrus
>>>>
>>>> On Mar 14, 2013, at 7:49 PM, John Huss <jo...@gmail.com> wrote:
>>>>> I've been using CGen for a bit and one confusing aspect of it to me was
>>>> the
>>>>> way you specific which entities to include for generation. I expected
>> a
>>>>> simple comma-separated list, but it requires a regular expression. You
>>>> can
>>>>> sort of make it work like a comma-separated list by using something
>> like
>>>>> this:
>>>>>
>>>>> includeEntities="Customer|Invoice"
>>>>>
>>>>> The problem is that if you have entites whose names contain these
>>>>> substrings, they will also be included - so an entity named
>> InvoiceDetail
>>>>> will also be generated. You can avoid it by using this:
>>>>>
>>>>> includeEntities="Customer|^Invoice$"
>>>>>
>>>>> While the vertical bar instead of a comma is unintuitive, but passable,
>>>>> requiring this syntax is not friendly.
>>>>>
>>>>> So my questions are:
>>>>>
>>>>> 1) Are people actually using the reg-ex here for useful, more complex
>>>>> things?
>>>>> 2) Would it be reasonable to add another mutually-exclusive property
>> that
>>>>> just takes a comma-separated list of entity names?
>>>>>
>>>>> John
>>>>
>>>>
>>
>>
Re: CGen includeEntities attribute
Posted by John Huss <jo...@gmail.com>.
Well, I use Ant and that section isn't filled in. :-P
I think it would be better to not mention regular expressions and just to
say something like:
A comma-separated list of ObjEntity names to exclude from template
generation. Wildcards may be used to match multiple entities, for example,
'Artist*'.
On Tue, Mar 19, 2013 at 1:35 AM, Andrus Adamchik <an...@objectstyle.org>wrote:
> I should've checked before answering :) Actually looking at 3.1 docs, it
> seems to be there, and very explicit:
>
>
> https://cayenne.apache.org/docs/3.1/cayenne-guide/including-cayenne-in-project.html#maven-projects
>
> "excludeEntities A comma-separated list of ObjEntity patterns
> (expressed as a perl5 regex) to exclude from template generation. By
> default none of the DataMap entities are excluded."
>
> "includeEntities A comma-separated list of ObjEntity patterns
> (expressed as a perl5 regex) to include from template generation. By
> default all DataMap entities are included."
>
> So where is it missing?
>
> (and we can update 3.0 docs as well)
>
> Andrus
>
> On Mar 19, 2013, at 12:15 AM, John Huss <jo...@gmail.com> wrote:
>
> > Well, surprise, it already works this way. I could have sworn I tried it
> > and it didn't work, but it does. Regular comma-separated names work
> fine.
> > Wildcards are optional but can be used it desired.
> >
> > So I guess this is more of an issue with the docs - the page
> > here<https://cayenne.apache.org/docs/3.0/cgen.html>doesn't say
> > comma-separated values are allowed or wildcards, but rather
> > regular expressions. This section is blank in the new docs, so whenever
> it
> > gets filled in it should be clarified and should include and example
> with a
> > comma separated list. I suppose I should make a JIRA issue.
> >
> > Thanks,
> > John
> >
> >
> > On Mon, Mar 18, 2013 at 1:40 PM, Andrus Adamchik <andrus@objectstyle.org
> >wrote:
> >
> >> I tend to agree. I also find regexp confusing in this situation. Yeah,
> >> let's deprecate it and replace with a differently named "include" and
> >> "exclude" properties. Maybe still allow a "*" to be used to match more
> than
> >> one entity?
> >>
> >> Andrus
> >>
> >> On Mar 14, 2013, at 7:49 PM, John Huss <jo...@gmail.com> wrote:
> >>> I've been using CGen for a bit and one confusing aspect of it to me was
> >> the
> >>> way you specific which entities to include for generation. I expected
> a
> >>> simple comma-separated list, but it requires a regular expression. You
> >> can
> >>> sort of make it work like a comma-separated list by using something
> like
> >>> this:
> >>>
> >>> includeEntities="Customer|Invoice"
> >>>
> >>> The problem is that if you have entites whose names contain these
> >>> substrings, they will also be included - so an entity named
> InvoiceDetail
> >>> will also be generated. You can avoid it by using this:
> >>>
> >>> includeEntities="Customer|^Invoice$"
> >>>
> >>> While the vertical bar instead of a comma is unintuitive, but passable,
> >>> requiring this syntax is not friendly.
> >>>
> >>> So my questions are:
> >>>
> >>> 1) Are people actually using the reg-ex here for useful, more complex
> >>> things?
> >>> 2) Would it be reasonable to add another mutually-exclusive property
> that
> >>> just takes a comma-separated list of entity names?
> >>>
> >>> John
> >>
> >>
>
>
Re: CGen includeEntities attribute
Posted by Andrus Adamchik <an...@objectstyle.org>.
I should've checked before answering :) Actually looking at 3.1 docs, it seems to be there, and very explicit:
https://cayenne.apache.org/docs/3.1/cayenne-guide/including-cayenne-in-project.html#maven-projects
"excludeEntities A comma-separated list of ObjEntity patterns (expressed as a perl5 regex) to exclude from template generation. By default none of the DataMap entities are excluded."
"includeEntities A comma-separated list of ObjEntity patterns (expressed as a perl5 regex) to include from template generation. By default all DataMap entities are included."
So where is it missing?
(and we can update 3.0 docs as well)
Andrus
On Mar 19, 2013, at 12:15 AM, John Huss <jo...@gmail.com> wrote:
> Well, surprise, it already works this way. I could have sworn I tried it
> and it didn't work, but it does. Regular comma-separated names work fine.
> Wildcards are optional but can be used it desired.
>
> So I guess this is more of an issue with the docs - the page
> here<https://cayenne.apache.org/docs/3.0/cgen.html>doesn't say
> comma-separated values are allowed or wildcards, but rather
> regular expressions. This section is blank in the new docs, so whenever it
> gets filled in it should be clarified and should include and example with a
> comma separated list. I suppose I should make a JIRA issue.
>
> Thanks,
> John
>
>
> On Mon, Mar 18, 2013 at 1:40 PM, Andrus Adamchik <an...@objectstyle.org>wrote:
>
>> I tend to agree. I also find regexp confusing in this situation. Yeah,
>> let's deprecate it and replace with a differently named "include" and
>> "exclude" properties. Maybe still allow a "*" to be used to match more than
>> one entity?
>>
>> Andrus
>>
>> On Mar 14, 2013, at 7:49 PM, John Huss <jo...@gmail.com> wrote:
>>> I've been using CGen for a bit and one confusing aspect of it to me was
>> the
>>> way you specific which entities to include for generation. I expected a
>>> simple comma-separated list, but it requires a regular expression. You
>> can
>>> sort of make it work like a comma-separated list by using something like
>>> this:
>>>
>>> includeEntities="Customer|Invoice"
>>>
>>> The problem is that if you have entites whose names contain these
>>> substrings, they will also be included - so an entity named InvoiceDetail
>>> will also be generated. You can avoid it by using this:
>>>
>>> includeEntities="Customer|^Invoice$"
>>>
>>> While the vertical bar instead of a comma is unintuitive, but passable,
>>> requiring this syntax is not friendly.
>>>
>>> So my questions are:
>>>
>>> 1) Are people actually using the reg-ex here for useful, more complex
>>> things?
>>> 2) Would it be reasonable to add another mutually-exclusive property that
>>> just takes a comma-separated list of entity names?
>>>
>>> John
>>
>>
Re: CGen includeEntities attribute
Posted by John Huss <jo...@gmail.com>.
Well, surprise, it already works this way. I could have sworn I tried it
and it didn't work, but it does. Regular comma-separated names work fine.
Wildcards are optional but can be used it desired.
So I guess this is more of an issue with the docs - the page
here<https://cayenne.apache.org/docs/3.0/cgen.html>doesn't say
comma-separated values are allowed or wildcards, but rather
regular expressions. This section is blank in the new docs, so whenever it
gets filled in it should be clarified and should include and example with a
comma separated list. I suppose I should make a JIRA issue.
Thanks,
John
On Mon, Mar 18, 2013 at 1:40 PM, Andrus Adamchik <an...@objectstyle.org>wrote:
> I tend to agree. I also find regexp confusing in this situation. Yeah,
> let's deprecate it and replace with a differently named "include" and
> "exclude" properties. Maybe still allow a "*" to be used to match more than
> one entity?
>
> Andrus
>
> On Mar 14, 2013, at 7:49 PM, John Huss <jo...@gmail.com> wrote:
> > I've been using CGen for a bit and one confusing aspect of it to me was
> the
> > way you specific which entities to include for generation. I expected a
> > simple comma-separated list, but it requires a regular expression. You
> can
> > sort of make it work like a comma-separated list by using something like
> > this:
> >
> > includeEntities="Customer|Invoice"
> >
> > The problem is that if you have entites whose names contain these
> > substrings, they will also be included - so an entity named InvoiceDetail
> > will also be generated. You can avoid it by using this:
> >
> > includeEntities="Customer|^Invoice$"
> >
> > While the vertical bar instead of a comma is unintuitive, but passable,
> > requiring this syntax is not friendly.
> >
> > So my questions are:
> >
> > 1) Are people actually using the reg-ex here for useful, more complex
> > things?
> > 2) Would it be reasonable to add another mutually-exclusive property that
> > just takes a comma-separated list of entity names?
> >
> > John
>
>
Re: CGen includeEntities attribute
Posted by Andrus Adamchik <an...@objectstyle.org>.
I tend to agree. I also find regexp confusing in this situation. Yeah, let's deprecate it and replace with a differently named "include" and "exclude" properties. Maybe still allow a "*" to be used to match more than one entity?
Andrus
On Mar 14, 2013, at 7:49 PM, John Huss <jo...@gmail.com> wrote:
> I've been using CGen for a bit and one confusing aspect of it to me was the
> way you specific which entities to include for generation. I expected a
> simple comma-separated list, but it requires a regular expression. You can
> sort of make it work like a comma-separated list by using something like
> this:
>
> includeEntities="Customer|Invoice"
>
> The problem is that if you have entites whose names contain these
> substrings, they will also be included - so an entity named InvoiceDetail
> will also be generated. You can avoid it by using this:
>
> includeEntities="Customer|^Invoice$"
>
> While the vertical bar instead of a comma is unintuitive, but passable,
> requiring this syntax is not friendly.
>
> So my questions are:
>
> 1) Are people actually using the reg-ex here for useful, more complex
> things?
> 2) Would it be reasonable to add another mutually-exclusive property that
> just takes a comma-separated list of entity names?
>
> John
Re: CGen includeEntities attribute
Posted by John Huss <jo...@gmail.com>.
Yes, I am actively using it. The basic reason is that I have different
applications using different and mostly distinct subsets of the DataMap. I
could split up the map and that would probably make things simpler, but
doing so would be somewhat artificial.
A use case I have had in the past is excluding one particular entity that
is an abstract base class and exists only in order to associate lifecycle
callbacks will all the other entities which inherit from it. The actual
code for that class resides in a different project from the rest of the
entities so I never want to generate source for it. I'm not sure if there
is a better way to handle that.
On Thu, Mar 14, 2013 at 12:52 PM, Michael Gentry <mg...@masslight.net>wrote:
> Hi John,
>
> I recently started using cgen, but didn't look at include (or exclude)
> entities because I generate the entire model. I'm not entirely certain
> they are useful in a typical build cycle/environment which builds entities
> from scratch. Is this something you are actively using or just pondering?
> If actively using it, what is your use-case? Just curious. Also, I think
> a comma-separated list would be fine, too.
>
> mrg
>
>
> On Thu, Mar 14, 2013 at 12:49 PM, John Huss <jo...@gmail.com> wrote:
>
> > I've been using CGen for a bit and one confusing aspect of it to me was
> the
> > way you specific which entities to include for generation. I expected a
> > simple comma-separated list, but it requires a regular expression. You
> can
> > sort of make it work like a comma-separated list by using something like
> > this:
> >
> > includeEntities="Customer|Invoice"
> >
> > The problem is that if you have entites whose names contain these
> > substrings, they will also be included - so an entity named InvoiceDetail
> > will also be generated. You can avoid it by using this:
> >
> > includeEntities="Customer|^Invoice$"
> >
> > While the vertical bar instead of a comma is unintuitive, but passable,
> > requiring this syntax is not friendly.
> >
> > So my questions are:
> >
> > 1) Are people actually using the reg-ex here for useful, more complex
> > things?
> > 2) Would it be reasonable to add another mutually-exclusive property that
> > just takes a comma-separated list of entity names?
> >
> > John
> >
>
Re: CGen includeEntities attribute
Posted by Michael Gentry <mg...@masslight.net>.
Hi John,
I recently started using cgen, but didn't look at include (or exclude)
entities because I generate the entire model. I'm not entirely certain
they are useful in a typical build cycle/environment which builds entities
from scratch. Is this something you are actively using or just pondering?
If actively using it, what is your use-case? Just curious. Also, I think
a comma-separated list would be fine, too.
mrg
On Thu, Mar 14, 2013 at 12:49 PM, John Huss <jo...@gmail.com> wrote:
> I've been using CGen for a bit and one confusing aspect of it to me was the
> way you specific which entities to include for generation. I expected a
> simple comma-separated list, but it requires a regular expression. You can
> sort of make it work like a comma-separated list by using something like
> this:
>
> includeEntities="Customer|Invoice"
>
> The problem is that if you have entites whose names contain these
> substrings, they will also be included - so an entity named InvoiceDetail
> will also be generated. You can avoid it by using this:
>
> includeEntities="Customer|^Invoice$"
>
> While the vertical bar instead of a comma is unintuitive, but passable,
> requiring this syntax is not friendly.
>
> So my questions are:
>
> 1) Are people actually using the reg-ex here for useful, more complex
> things?
> 2) Would it be reasonable to add another mutually-exclusive property that
> just takes a comma-separated list of entity names?
>
> John
>