You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Stephen Cameron <st...@gmail.com> on 2015/07/29 09:08:37 UTC
code-lists and administration thereof
Hi,
I want to do have some properties that are essentially String types, but
which have a limited range of values (code-lists or restricted
vocabularies). I want to allow these lists to be administered centrally, so
to add them to a single Administration menu item for admin users.
For most users these codes should appears as lists of strings not as
objects, but making them objects seems to be the logical OO way to deal
with them in Isis. So they are basically objects with one 'name' property
(and maybe an id added by datanucleus). All users need to see is the name
property, no icon is needed.
Also, if I make them objects I also will get referencial integrity
constraints applied in the database.
I wonder there is a simple recipe for this?
Re: code-lists and administration thereof
Posted by Stephen Cameron <st...@gmail.com>.
Hi David,
Seems like a good idea for an Isis addon. We used to have such a module in
a system I worked on years ago. There they differentiated between static
and dynamic data, static data were usually always such constrained lists of
values (names).
Regards
On Fri, Jul 31, 2015 at 7:07 AM, David Tildesley <da...@yahoo.co.nz>
wrote:
> Hi Stephen,
>
> A Description archetype object may or may not have domain behaviour
> however it would most likely have default behaviour. It caters for your
> values because your use-case was "constrained list of values". It has the
> advantage being an object that you can have both unique code, value (
> e.g.name), and tip (description) and sensible additions like
> "validFromDate", "validToDate", "version", ...
>
> Given that ISIS generates the viewer, perhaps there is a strong case for
> first class support for "Description" archetype in ISIS.
>
> I personally think that Eric Evans made an absolute hash of this area of
> his DDD - by demoting an important archetype to a "Value object". If he had
> taken the time to read Peter Coads works, I think DDD would have had far
> stronger influence on software development of business systems than it has.
>
> Regards,
> David.
>
>
>
>
>
> On Thursday, 30 July 2015 9:49 PM, Stephen Cameron <
> steve.cameron.62@gmail.com> wrote:
>
>
> Hi David, I was speaking of the values/entries not the catalog or
> code-list collection object, which as you say will have some behaviour.
>
> On Thu, Jul 30, 2015 at 3:53 PM, David Tildesley <da...@yahoo.co.nz>
> wrote:
>
> Hi Stephen,
> Notwithstanding any issues with ISIS, I disagree with your assertion
> <quote>In terms of
> domain modelling such code-lists are simple types that 'represent' things
> on the boundary of the domain of interest.</quote>
>
> When Peter Coad came up with the 4 domain archetypes and the DNC (Domain
> Neutral Component) [1],one of the archetypes was the "Description"
> archetype:
> The Description class archetype that models a catalog-entry-like
> description. It is a collection of values that apply again and again. It
> also provides behavior across the collection of all things that correspond
> to its description. [Coad99]. - See more at: Peter Coad's 'Modeling in
> Color'
>
> | |
> | | | | | | | |
> | Peter Coad's 'Modeling in Color'An object modeling technique, 'modeling
> in color' helps identify and define robust, extensible, problem domain
> classes for a software component, application, or sys... |
> | |
> | View on www.step-10.com | Preview by Yahoo |
> | |
> | |
>
>
>
> [1] http://www.step-10.com/SoftwareDesign/ModellingInColour/
>
> | |
> | | | | | |
> | Java Modeling In Color With UML: Enterprise Components and Process:
> Peter Coad, Jeff de Luca, Er...This is the first book to teach software
> design in color. Peter Coad and his co-authors use four colors to represent
> four "archetypes": forms that appear repeatedly in effective component and
> object models. Given a color, you'll know the kind of attributes, links,
> methods, and int... |
> | |
> | View on www.amazon.com | Preview by Yahoo |
> | |
> | |
>
>
>
>
> On Thursday, 30 July 2015 2:17 PM, Stephen Cameron <
> steve.cameron.62@gmail.com> wrote:
>
>
> Not so simple, as now the property cannot be updated.
>
> I have the following (@Hidden is deprecated)
>
> @Column(allowsNull = "true")
> @MemberOrder(sequence = "7")
> @PropertyLayout(hidden=Where.EVERYWHERE)
> public Region getRegion() {
> return this.region;
> }
>
> public void setRegion(Region region) {
> this.region = region;
> }
>
> public List<Region> choicesRegion(){
> List<Region> regions = container.allInstances(Region.class);
> return regions;
> }
>
> @MemberOrder(sequence = "7.1")
> public String getRegionName(){
> return (getRegion() != null) ? getRegion().getName() : null;
> }
>
> Sure enough getRegion doesn't appear in the UI but getRegionName does, but
> then setRegion and choiceRegion don't mean anything to the UI, so the
> Region property is read-only.
>
> This issue is maybe more significant than it appears at first, in terms of
> domain modelling such code-lists are simple types that 'represent' things
> on the boundary of the domain of interest. So we usually want to just
> represent them with a name. Presently it makes no sense to go to that thing
> via a hyperlink as all we'll find is that name, our model extends no
> further.
>
> However we just might like to allow users to leave the domain model and go
> to a resource outside. So, extending the suppressLink=true idea, I would
> add that each object could have an implicit link(URL),created by Isis, or
> an explicit one and if the explicit one is present it can optionally be
> used as an alternative to the implicit one.
>
> For example, you might create a database to log fish details, species is a
> boundary concept, we aren't likely to want to add a new species to the list
> of known species, but we'd like to keep such a list handy, but for each
> named species in that list, to provide an explicit link to a resource in a
> global fish database. It makes more sense to use this link than the
> implicit one, as if the implicit one is used we'd navigate to the domain
> object page displaying the name and URL, both of which items of data could
> have been in the explicit link.
>
> In the explicit case you might want to warn the user they are navigating
> outside the Isis domain application.
>
> Perhaps all this could be done simply if there was a URI type in Isis, that
> would allow it to create 'smart links' automatically.
>
>
>
>
>
> On Wed, Jul 29, 2015 at 9:37 PM, Stephen Cameron <
> steve.cameron.62@gmail.com
> > wrote:
>
> > Thanks Jeroen, seems simple enough :)
> >
> > On Wed, Jul 29, 2015 at 9:28 PM, Jeroen van der Wal <jeroen@stromboli.it
> >
> > wrote:
> >
> >> You could also hide the property and create a separate getter for
> display
> >> purposes only:
> >>
> >> private MyProperty myProperty;
> >>
> >> @Hidden
> >> public MyProperty getMyProperty() {...}
> >>
> >> public void setMyProperty(...) {...}
> >>
> >> public String getMyPropertyName() {
> >> getMyProperty.getName();
> >> }
> >>
> >> On 29 July 2015 at 13:18, Stephen Cameron <st...@gmail.com>
> >> wrote:
> >>
> >> > On Wed, Jul 29, 2015 at 6:38 PM, Dan Haywood <
> >> dan@haywood-associates.co.uk
> >> > >
> >> > wrote:
> >> >
> >> > > You are right, they will be displayed as links; there's no way to
> >> disable
> >> > > it currently.
> >> > >
> >> > > We could add a bit of metadata perhaps for this, eg
> >> > > @DomainObjectLayout(suppressLink=true) or similar.
> >> > >
> >> > > Please raise a ticket.
> >> > >
> >> >
> >> > OK https://issues.apache.org/jira/browse/ISIS-1180
> >> >
> >> > >
> >> > > Thx
> >> > > Dan
> >> > >
> >> > > PS: these entities wouldn't be value types, rather regular entities.
> >> But
> >> > > you are right... what we really want is full-class support for value
> >> > types.
> >> > > We're just not there yet...
> >> > >
> >> > >
> >> > >
> >> >
> >> > >
> >> > >
> >> > > On 29 July 2015 at 09:34, Stephen Cameron <
> steve.cameron.62@gmail.com
> >> >
> >> > > wrote:
> >> > >
> >> > > > Thanks, but surely such object properties always end up being
> >> displayed
> >> > > as
> >> > > > links? Clicking on the link to go to such an object page is
> >> > meaningless,
> >> > > as
> >> > > > it only has one name property, that was displayed in the link.
> Can I
> >> > > > disable that default behaviour for value types?
> >> > > >
> >> > > >
> >> > > >
> >> > > > On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <
> >> > > dan@haywood-associates.co.uk
> >> > > > >
> >> > > > wrote:
> >> > > >
> >> > > > > On 29 July 2015 at 08:08, Stephen Cameron <
> >> > steve.cameron.62@gmail.com>
> >>
> >> > > > > wrote:
> >> > > > >
> >> > > > > > Hi,
> >> > > > > >
> >> > > > > > I want to do have some properties that are essentially String
> >> > types,
> >> > > > but
> >> > > > > > which have a limited range of values (code-lists or restricted
> >> > > > > > vocabularies). I want to allow these lists to be administered
> >> > > > centrally,
> >> > > > > so
> >> > > > > > to add them to a single Administration menu item for admin
> >> users.
> >> > > > > >
> >> > > > > > For most users these codes should appears as lists of strings
> >> not
> >> > as
> >> > > > > > objects, but making them objects seems to be the logical OO
> way
> >> to
> >> > > deal
> >> > > > > > with them in Isis. So they are basically objects with one
> 'name'
> >> > > > property
> >> > > > > > (and maybe an id added by datanucleus). All users need to see
> is
> >> > the
> >> > > > name
> >> > > > > > property, no icon is needed.
> >> > > > > >
> >> > > > > > Also, if I make them objects I also will get referencial
> >> integrity
> >> > > > > > constraints applied in the database.
> >> > > > > >
> >> > > > > >
> >> > > > > +1, do it this way. That way they can also hold behaviour in
> the
> >> > > future.
> >> > > > >
> >> > > > >
> >> > > > >
> >> > > > >
> >> > > > > > I wonder there is a simple recipe for this?
> >> > > > > >
> >> > > > >
> >> > > > > No magic recipe for the domain entities... basically
> copy-n-paste
> >> the
> >> > > > > SimpleObject that's in our archetype as many times as needed,
> and
> >> > tweak
> >> > > > as
> >> > > > > required.
> >> > > > >
> >> > > > > If you want to use the code as the primary key, then use DN
> >> > application
> >> > > > > identity
> >> > > > >
> >> > > > > @javax.jdo.annotations.PersistenceCapable(
> >> > > > > identityType=IdentityType.APPLICATION,
> >> > > > > schema = "simple",
> >> > > > > table = "SimpleObject"
> >> > > > > )
> >> > > > >
> >> > > > > and add @PrimaryKey to the "name" property. Also add @Title to
> >> that
> >> > > > 'name'
> >> > > > > property (it is in SimpleObject already).
> >> > > > >
> >> > > > >
> >> > > > > You would probably want to remove the version column, ie remove:
> >> > > > >
> >> > > > > @javax.jdo.annotations.Version(
> >> > > > > strategy=VersionStrategy.VERSION_NUMBER,
> >> > > > > column="version")
> >> > > > >
> >> > > > >
> >> > > > > In addition, if you annotate the class as "bounded"
> >> > > > > (@DomainObject(bounded=true)) then you are telling the framework
> >> that
> >> > > > > there's a limited - ie bounded - set of instances, and so it
> will
> >> > > display
> >> > > > > all instances in a drop-down for you.
> >> > > > >
> >> > > > >
> >> > > > > HTH
> >> > > > > Dan
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
> >
> >
>
>
>
>
>
>
>
>
Re: code-lists and administration thereof
Posted by David Tildesley <da...@yahoo.co.nz>.
Hi Stephen,
A Description archetype object may or may not have domain behaviour however it would most likely have default behaviour. It caters for your values because your use-case was "constrained list of values". It has the advantage being an object that you can have both unique code, value (e.g.name), and tip (description) and sensible additions like "validFromDate", "validToDate", "version", ...
Given that ISIS generates the viewer, perhaps there is a strong case for first class support for "Description" archetype in ISIS.
I personally think that Eric Evans made an absolute hash of this area of his DDD - by demoting an important archetype to a "Value object". If he had taken the time to read Peter Coads works, I think DDD would have had far stronger influence on software development of business systems than it has.
Regards,David.
On Thursday, 30 July 2015 9:49 PM, Stephen Cameron <st...@gmail.com> wrote:
Hi David, I was speaking of the values/entries not the catalog or code-list collection object, which as you say will have some behaviour.
On Thu, Jul 30, 2015 at 3:53 PM, David Tildesley <da...@yahoo.co.nz> wrote:
Hi Stephen,
Notwithstanding any issues with ISIS, I disagree with your assertion
<quote>In terms of
domain modelling such code-lists are simple types that 'represent' things
on the boundary of the domain of interest.</quote>
When Peter Coad came up with the 4 domain archetypes and the DNC (Domain Neutral Component) [1],one of the archetypes was the "Description" archetype:
The Description class archetype that models a catalog-entry-like description. It is a collection of values that apply again and again. It also provides behavior across the collection of all things that correspond to its description. [Coad99]. - See more at: Peter Coad's 'Modeling in Color'
| |
| | | | | | | |
| Peter Coad's 'Modeling in Color'An object modeling technique, 'modeling in color' helps identify and define robust, extensible, problem domain classes for a software component, application, or sys... |
| |
| View on www.step-10.com | Preview by Yahoo |
| |
| |
[1] http://www.step-10.com/SoftwareDesign/ModellingInColour/
| |
| | | | | |
| Java Modeling In Color With UML: Enterprise Components and Process: Peter Coad, Jeff de Luca, Er...This is the first book to teach software design in color. Peter Coad and his co-authors use four colors to represent four "archetypes": forms that appear repeatedly in effective component and object models. Given a color, you'll know the kind of attributes, links, methods, and int... |
| |
| View on www.amazon.com | Preview by Yahoo |
| |
| |
On Thursday, 30 July 2015 2:17 PM, Stephen Cameron <st...@gmail.com> wrote:
Not so simple, as now the property cannot be updated.
I have the following (@Hidden is deprecated)
@Column(allowsNull = "true")
@MemberOrder(sequence = "7")
@PropertyLayout(hidden=Where.EVERYWHERE)
public Region getRegion() {
return this.region;
}
public void setRegion(Region region) {
this.region = region;
}
public List<Region> choicesRegion(){
List<Region> regions = container.allInstances(Region.class);
return regions;
}
@MemberOrder(sequence = "7.1")
public String getRegionName(){
return (getRegion() != null) ? getRegion().getName() : null;
}
Sure enough getRegion doesn't appear in the UI but getRegionName does, but
then setRegion and choiceRegion don't mean anything to the UI, so the
Region property is read-only.
This issue is maybe more significant than it appears at first, in terms of
domain modelling such code-lists are simple types that 'represent' things
on the boundary of the domain of interest. So we usually want to just
represent them with a name. Presently it makes no sense to go to that thing
via a hyperlink as all we'll find is that name, our model extends no
further.
However we just might like to allow users to leave the domain model and go
to a resource outside. So, extending the suppressLink=true idea, I would
add that each object could have an implicit link(URL),created by Isis, or
an explicit one and if the explicit one is present it can optionally be
used as an alternative to the implicit one.
For example, you might create a database to log fish details, species is a
boundary concept, we aren't likely to want to add a new species to the list
of known species, but we'd like to keep such a list handy, but for each
named species in that list, to provide an explicit link to a resource in a
global fish database. It makes more sense to use this link than the
implicit one, as if the implicit one is used we'd navigate to the domain
object page displaying the name and URL, both of which items of data could
have been in the explicit link.
In the explicit case you might want to warn the user they are navigating
outside the Isis domain application.
Perhaps all this could be done simply if there was a URI type in Isis, that
would allow it to create 'smart links' automatically.
On Wed, Jul 29, 2015 at 9:37 PM, Stephen Cameron <steve.cameron.62@gmail.com
> wrote:
> Thanks Jeroen, seems simple enough :)
>
> On Wed, Jul 29, 2015 at 9:28 PM, Jeroen van der Wal <je...@stromboli.it>
> wrote:
>
>> You could also hide the property and create a separate getter for display
>> purposes only:
>>
>> private MyProperty myProperty;
>>
>> @Hidden
>> public MyProperty getMyProperty() {...}
>>
>> public void setMyProperty(...) {...}
>>
>> public String getMyPropertyName() {
>> getMyProperty.getName();
>> }
>>
>> On 29 July 2015 at 13:18, Stephen Cameron <st...@gmail.com>
>> wrote:
>>
>> > On Wed, Jul 29, 2015 at 6:38 PM, Dan Haywood <
>> dan@haywood-associates.co.uk
>> > >
>> > wrote:
>> >
>> > > You are right, they will be displayed as links; there's no way to
>> disable
>> > > it currently.
>> > >
>> > > We could add a bit of metadata perhaps for this, eg
>> > > @DomainObjectLayout(suppressLink=true) or similar.
>> > >
>> > > Please raise a ticket.
>> > >
>> >
>> > OK https://issues.apache.org/jira/browse/ISIS-1180
>> >
>> > >
>> > > Thx
>> > > Dan
>> > >
>> > > PS: these entities wouldn't be value types, rather regular entities.
>> But
>> > > you are right... what we really want is full-class support for value
>> > types.
>> > > We're just not there yet...
>> > >
>> > >
>> > >
>> >
>> > >
>> > >
>> > > On 29 July 2015 at 09:34, Stephen Cameron <steve.cameron.62@gmail.com
>> >
>> > > wrote:
>> > >
>> > > > Thanks, but surely such object properties always end up being
>> displayed
>> > > as
>> > > > links? Clicking on the link to go to such an object page is
>> > meaningless,
>> > > as
>> > > > it only has one name property, that was displayed in the link. Can I
>> > > > disable that default behaviour for value types?
>> > > >
>> > > >
>> > > >
>> > > > On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <
>> > > dan@haywood-associates.co.uk
>> > > > >
>> > > > wrote:
>> > > >
>> > > > > On 29 July 2015 at 08:08, Stephen Cameron <
>> > steve.cameron.62@gmail.com>
>>
>> > > > > wrote:
>> > > > >
>> > > > > > Hi,
>> > > > > >
>> > > > > > I want to do have some properties that are essentially String
>> > types,
>> > > > but
>> > > > > > which have a limited range of values (code-lists or restricted
>> > > > > > vocabularies). I want to allow these lists to be administered
>> > > > centrally,
>> > > > > so
>> > > > > > to add them to a single Administration menu item for admin
>> users.
>> > > > > >
>> > > > > > For most users these codes should appears as lists of strings
>> not
>> > as
>> > > > > > objects, but making them objects seems to be the logical OO way
>> to
>> > > deal
>> > > > > > with them in Isis. So they are basically objects with one 'name'
>> > > > property
>> > > > > > (and maybe an id added by datanucleus). All users need to see is
>> > the
>> > > > name
>> > > > > > property, no icon is needed.
>> > > > > >
>> > > > > > Also, if I make them objects I also will get referencial
>> integrity
>> > > > > > constraints applied in the database.
>> > > > > >
>> > > > > >
>> > > > > +1, do it this way. That way they can also hold behaviour in the
>> > > future.
>> > > > >
>> > > > >
>> > > > >
>> > > > >
>> > > > > > I wonder there is a simple recipe for this?
>> > > > > >
>> > > > >
>> > > > > No magic recipe for the domain entities... basically copy-n-paste
>> the
>> > > > > SimpleObject that's in our archetype as many times as needed, and
>> > tweak
>> > > > as
>> > > > > required.
>> > > > >
>> > > > > If you want to use the code as the primary key, then use DN
>> > application
>> > > > > identity
>> > > > >
>> > > > > @javax.jdo.annotations.PersistenceCapable(
>> > > > > identityType=IdentityType.APPLICATION,
>> > > > > schema = "simple",
>> > > > > table = "SimpleObject"
>> > > > > )
>> > > > >
>> > > > > and add @PrimaryKey to the "name" property. Also add @Title to
>> that
>> > > > 'name'
>> > > > > property (it is in SimpleObject already).
>> > > > >
>> > > > >
>> > > > > You would probably want to remove the version column, ie remove:
>> > > > >
>> > > > > @javax.jdo.annotations.Version(
>> > > > > strategy=VersionStrategy.VERSION_NUMBER,
>> > > > > column="version")
>> > > > >
>> > > > >
>> > > > > In addition, if you annotate the class as "bounded"
>> > > > > (@DomainObject(bounded=true)) then you are telling the framework
>> that
>> > > > > there's a limited - ie bounded - set of instances, and so it will
>> > > display
>> > > > > all instances in a drop-down for you.
>> > > > >
>> > > > >
>> > > > > HTH
>> > > > > Dan
>> > > > >
>> > > >
>> > >
>> >
>>
>
>
Re: code-lists and administration thereof
Posted by Stephen Cameron <st...@gmail.com>.
Hi David, I was speaking of the values/entries not the catalog or code-list
collection object, which as you say will have some behaviour.
On Thu, Jul 30, 2015 at 3:53 PM, David Tildesley <da...@yahoo.co.nz>
wrote:
> Hi Stephen,
> Notwithstanding any issues with ISIS, I disagree with your assertion
> <quote>In terms of
> domain modelling such code-lists are simple types that 'represent' things
> on the boundary of the domain of interest.</quote>
>
> When Peter Coad came up with the 4 domain archetypes and the DNC (Domain
> Neutral Component) [1],one of the archetypes was the "Description"
> archetype:
> The Description class archetype that models a catalog-entry-like
> description. It is a collection of values that apply again and again. It
> also provides behavior across the collection of all things that correspond
> to its description. [Coad99]. - See more at: Peter Coad's 'Modeling in
> Color'
>
> | |
> | | | | | | | |
> | Peter Coad's 'Modeling in Color'An object modeling technique, 'modeling
> in color' helps identify and define robust, extensible, problem domain
> classes for a software component, application, or sys... |
> | |
> | View on www.step-10.com | Preview by Yahoo |
> | |
> | |
>
>
>
> [1] http://www.step-10.com/SoftwareDesign/ModellingInColour/
>
> | |
> | | | | | |
> | Java Modeling In Color With UML: Enterprise Components and Process:
> Peter Coad, Jeff de Luca, Er...This is the first book to teach software
> design in color. Peter Coad and his co-authors use four colors to represent
> four "archetypes": forms that appear repeatedly in effective component and
> object models. Given a color, you'll know the kind of attributes, links,
> methods, and int... |
> | |
> | View on www.amazon.com | Preview by Yahoo |
> | |
> | |
>
>
>
>
> On Thursday, 30 July 2015 2:17 PM, Stephen Cameron <
> steve.cameron.62@gmail.com> wrote:
>
>
> Not so simple, as now the property cannot be updated.
>
> I have the following (@Hidden is deprecated)
>
> @Column(allowsNull = "true")
> @MemberOrder(sequence = "7")
> @PropertyLayout(hidden=Where.EVERYWHERE)
> public Region getRegion() {
> return this.region;
> }
>
> public void setRegion(Region region) {
> this.region = region;
> }
>
> public List<Region> choicesRegion(){
> List<Region> regions = container.allInstances(Region.class);
> return regions;
> }
>
> @MemberOrder(sequence = "7.1")
> public String getRegionName(){
> return (getRegion() != null) ? getRegion().getName() : null;
> }
>
> Sure enough getRegion doesn't appear in the UI but getRegionName does, but
> then setRegion and choiceRegion don't mean anything to the UI, so the
> Region property is read-only.
>
> This issue is maybe more significant than it appears at first, in terms of
> domain modelling such code-lists are simple types that 'represent' things
> on the boundary of the domain of interest. So we usually want to just
> represent them with a name. Presently it makes no sense to go to that thing
> via a hyperlink as all we'll find is that name, our model extends no
> further.
>
> However we just might like to allow users to leave the domain model and go
> to a resource outside. So, extending the suppressLink=true idea, I would
> add that each object could have an implicit link(URL),created by Isis, or
> an explicit one and if the explicit one is present it can optionally be
> used as an alternative to the implicit one.
>
> For example, you might create a database to log fish details, species is a
> boundary concept, we aren't likely to want to add a new species to the list
> of known species, but we'd like to keep such a list handy, but for each
> named species in that list, to provide an explicit link to a resource in a
> global fish database. It makes more sense to use this link than the
> implicit one, as if the implicit one is used we'd navigate to the domain
> object page displaying the name and URL, both of which items of data could
> have been in the explicit link.
>
> In the explicit case you might want to warn the user they are navigating
> outside the Isis domain application.
>
> Perhaps all this could be done simply if there was a URI type in Isis, that
> would allow it to create 'smart links' automatically.
>
>
>
>
>
> On Wed, Jul 29, 2015 at 9:37 PM, Stephen Cameron <
> steve.cameron.62@gmail.com
> > wrote:
>
> > Thanks Jeroen, seems simple enough :)
> >
> > On Wed, Jul 29, 2015 at 9:28 PM, Jeroen van der Wal <jeroen@stromboli.it
> >
> > wrote:
> >
> >> You could also hide the property and create a separate getter for
> display
> >> purposes only:
> >>
> >> private MyProperty myProperty;
> >>
> >> @Hidden
> >> public MyProperty getMyProperty() {...}
> >>
> >> public void setMyProperty(...) {...}
> >>
> >> public String getMyPropertyName() {
> >> getMyProperty.getName();
> >> }
> >>
> >> On 29 July 2015 at 13:18, Stephen Cameron <st...@gmail.com>
> >> wrote:
> >>
> >> > On Wed, Jul 29, 2015 at 6:38 PM, Dan Haywood <
> >> dan@haywood-associates.co.uk
> >> > >
> >> > wrote:
> >> >
> >> > > You are right, they will be displayed as links; there's no way to
> >> disable
> >> > > it currently.
> >> > >
> >> > > We could add a bit of metadata perhaps for this, eg
> >> > > @DomainObjectLayout(suppressLink=true) or similar.
> >> > >
> >> > > Please raise a ticket.
> >> > >
> >> >
> >> > OK https://issues.apache.org/jira/browse/ISIS-1180
> >> >
> >> > >
> >> > > Thx
> >> > > Dan
> >> > >
> >> > > PS: these entities wouldn't be value types, rather regular entities.
> >> But
> >> > > you are right... what we really want is full-class support for value
> >> > types.
> >> > > We're just not there yet...
> >> > >
> >> > >
> >> > >
> >> >
> >> > >
> >> > >
> >> > > On 29 July 2015 at 09:34, Stephen Cameron <
> steve.cameron.62@gmail.com
> >> >
> >> > > wrote:
> >> > >
> >> > > > Thanks, but surely such object properties always end up being
> >> displayed
> >> > > as
> >> > > > links? Clicking on the link to go to such an object page is
> >> > meaningless,
> >> > > as
> >> > > > it only has one name property, that was displayed in the link.
> Can I
> >> > > > disable that default behaviour for value types?
> >> > > >
> >> > > >
> >> > > >
> >> > > > On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <
> >> > > dan@haywood-associates.co.uk
> >> > > > >
> >> > > > wrote:
> >> > > >
> >> > > > > On 29 July 2015 at 08:08, Stephen Cameron <
> >> > steve.cameron.62@gmail.com>
> >>
> >> > > > > wrote:
> >> > > > >
> >> > > > > > Hi,
> >> > > > > >
> >> > > > > > I want to do have some properties that are essentially String
> >> > types,
> >> > > > but
> >> > > > > > which have a limited range of values (code-lists or restricted
> >> > > > > > vocabularies). I want to allow these lists to be administered
> >> > > > centrally,
> >> > > > > so
> >> > > > > > to add them to a single Administration menu item for admin
> >> users.
> >> > > > > >
> >> > > > > > For most users these codes should appears as lists of strings
> >> not
> >> > as
> >> > > > > > objects, but making them objects seems to be the logical OO
> way
> >> to
> >> > > deal
> >> > > > > > with them in Isis. So they are basically objects with one
> 'name'
> >> > > > property
> >> > > > > > (and maybe an id added by datanucleus). All users need to see
> is
> >> > the
> >> > > > name
> >> > > > > > property, no icon is needed.
> >> > > > > >
> >> > > > > > Also, if I make them objects I also will get referencial
> >> integrity
> >> > > > > > constraints applied in the database.
> >> > > > > >
> >> > > > > >
> >> > > > > +1, do it this way. That way they can also hold behaviour in
> the
> >> > > future.
> >> > > > >
> >> > > > >
> >> > > > >
> >> > > > >
> >> > > > > > I wonder there is a simple recipe for this?
> >> > > > > >
> >> > > > >
> >> > > > > No magic recipe for the domain entities... basically
> copy-n-paste
> >> the
> >> > > > > SimpleObject that's in our archetype as many times as needed,
> and
> >> > tweak
> >> > > > as
> >> > > > > required.
> >> > > > >
> >> > > > > If you want to use the code as the primary key, then use DN
> >> > application
> >> > > > > identity
> >> > > > >
> >> > > > > @javax.jdo.annotations.PersistenceCapable(
> >> > > > > identityType=IdentityType.APPLICATION,
> >> > > > > schema = "simple",
> >> > > > > table = "SimpleObject"
> >> > > > > )
> >> > > > >
> >> > > > > and add @PrimaryKey to the "name" property. Also add @Title to
> >> that
> >> > > > 'name'
> >> > > > > property (it is in SimpleObject already).
> >> > > > >
> >> > > > >
> >> > > > > You would probably want to remove the version column, ie remove:
> >> > > > >
> >> > > > > @javax.jdo.annotations.Version(
> >> > > > > strategy=VersionStrategy.VERSION_NUMBER,
> >> > > > > column="version")
> >> > > > >
> >> > > > >
> >> > > > > In addition, if you annotate the class as "bounded"
> >> > > > > (@DomainObject(bounded=true)) then you are telling the framework
> >> that
> >> > > > > there's a limited - ie bounded - set of instances, and so it
> will
> >> > > display
> >> > > > > all instances in a drop-down for you.
> >> > > > >
> >> > > > >
> >> > > > > HTH
> >> > > > > Dan
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
> >
> >
>
>
>
>
Re: code-lists and administration thereof
Posted by David Tildesley <da...@yahoo.co.nz>.
Hi Stephen,
Notwithstanding any issues with ISIS, I disagree with your assertion
<quote>In terms of
domain modelling such code-lists are simple types that 'represent' things
on the boundary of the domain of interest.</quote>
When Peter Coad came up with the 4 domain archetypes and the DNC (Domain Neutral Component) [1],one of the archetypes was the "Description" archetype:
The Description class archetype that models a catalog-entry-like description. It is a collection of values that apply again and again. It also provides behavior across the collection of all things that correspond to its description. [Coad99]. - See more at: Peter Coad's 'Modeling in Color'
| |
| | | | | | | |
| Peter Coad's 'Modeling in Color'An object modeling technique, 'modeling in color' helps identify and define robust, extensible, problem domain classes for a software component, application, or sys... |
| |
| View on www.step-10.com | Preview by Yahoo |
| |
| |
[1] http://www.step-10.com/SoftwareDesign/ModellingInColour/
| |
| | | | | |
| Java Modeling In Color With UML: Enterprise Components and Process: Peter Coad, Jeff de Luca, Er...This is the first book to teach software design in color. Peter Coad and his co-authors use four colors to represent four "archetypes": forms that appear repeatedly in effective component and object models. Given a color, you'll know the kind of attributes, links, methods, and int... |
| |
| View on www.amazon.com | Preview by Yahoo |
| |
| |
On Thursday, 30 July 2015 2:17 PM, Stephen Cameron <st...@gmail.com> wrote:
Not so simple, as now the property cannot be updated.
I have the following (@Hidden is deprecated)
@Column(allowsNull = "true")
@MemberOrder(sequence = "7")
@PropertyLayout(hidden=Where.EVERYWHERE)
public Region getRegion() {
return this.region;
}
public void setRegion(Region region) {
this.region = region;
}
public List<Region> choicesRegion(){
List<Region> regions = container.allInstances(Region.class);
return regions;
}
@MemberOrder(sequence = "7.1")
public String getRegionName(){
return (getRegion() != null) ? getRegion().getName() : null;
}
Sure enough getRegion doesn't appear in the UI but getRegionName does, but
then setRegion and choiceRegion don't mean anything to the UI, so the
Region property is read-only.
This issue is maybe more significant than it appears at first, in terms of
domain modelling such code-lists are simple types that 'represent' things
on the boundary of the domain of interest. So we usually want to just
represent them with a name. Presently it makes no sense to go to that thing
via a hyperlink as all we'll find is that name, our model extends no
further.
However we just might like to allow users to leave the domain model and go
to a resource outside. So, extending the suppressLink=true idea, I would
add that each object could have an implicit link(URL),created by Isis, or
an explicit one and if the explicit one is present it can optionally be
used as an alternative to the implicit one.
For example, you might create a database to log fish details, species is a
boundary concept, we aren't likely to want to add a new species to the list
of known species, but we'd like to keep such a list handy, but for each
named species in that list, to provide an explicit link to a resource in a
global fish database. It makes more sense to use this link than the
implicit one, as if the implicit one is used we'd navigate to the domain
object page displaying the name and URL, both of which items of data could
have been in the explicit link.
In the explicit case you might want to warn the user they are navigating
outside the Isis domain application.
Perhaps all this could be done simply if there was a URI type in Isis, that
would allow it to create 'smart links' automatically.
On Wed, Jul 29, 2015 at 9:37 PM, Stephen Cameron <steve.cameron.62@gmail.com
> wrote:
> Thanks Jeroen, seems simple enough :)
>
> On Wed, Jul 29, 2015 at 9:28 PM, Jeroen van der Wal <je...@stromboli.it>
> wrote:
>
>> You could also hide the property and create a separate getter for display
>> purposes only:
>>
>> private MyProperty myProperty;
>>
>> @Hidden
>> public MyProperty getMyProperty() {...}
>>
>> public void setMyProperty(...) {...}
>>
>> public String getMyPropertyName() {
>> getMyProperty.getName();
>> }
>>
>> On 29 July 2015 at 13:18, Stephen Cameron <st...@gmail.com>
>> wrote:
>>
>> > On Wed, Jul 29, 2015 at 6:38 PM, Dan Haywood <
>> dan@haywood-associates.co.uk
>> > >
>> > wrote:
>> >
>> > > You are right, they will be displayed as links; there's no way to
>> disable
>> > > it currently.
>> > >
>> > > We could add a bit of metadata perhaps for this, eg
>> > > @DomainObjectLayout(suppressLink=true) or similar.
>> > >
>> > > Please raise a ticket.
>> > >
>> >
>> > OK https://issues.apache.org/jira/browse/ISIS-1180
>> >
>> > >
>> > > Thx
>> > > Dan
>> > >
>> > > PS: these entities wouldn't be value types, rather regular entities.
>> But
>> > > you are right... what we really want is full-class support for value
>> > types.
>> > > We're just not there yet...
>> > >
>> > >
>> > >
>> >
>> > >
>> > >
>> > > On 29 July 2015 at 09:34, Stephen Cameron <steve.cameron.62@gmail.com
>> >
>> > > wrote:
>> > >
>> > > > Thanks, but surely such object properties always end up being
>> displayed
>> > > as
>> > > > links? Clicking on the link to go to such an object page is
>> > meaningless,
>> > > as
>> > > > it only has one name property, that was displayed in the link. Can I
>> > > > disable that default behaviour for value types?
>> > > >
>> > > >
>> > > >
>> > > > On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <
>> > > dan@haywood-associates.co.uk
>> > > > >
>> > > > wrote:
>> > > >
>> > > > > On 29 July 2015 at 08:08, Stephen Cameron <
>> > steve.cameron.62@gmail.com>
>>
>> > > > > wrote:
>> > > > >
>> > > > > > Hi,
>> > > > > >
>> > > > > > I want to do have some properties that are essentially String
>> > types,
>> > > > but
>> > > > > > which have a limited range of values (code-lists or restricted
>> > > > > > vocabularies). I want to allow these lists to be administered
>> > > > centrally,
>> > > > > so
>> > > > > > to add them to a single Administration menu item for admin
>> users.
>> > > > > >
>> > > > > > For most users these codes should appears as lists of strings
>> not
>> > as
>> > > > > > objects, but making them objects seems to be the logical OO way
>> to
>> > > deal
>> > > > > > with them in Isis. So they are basically objects with one 'name'
>> > > > property
>> > > > > > (and maybe an id added by datanucleus). All users need to see is
>> > the
>> > > > name
>> > > > > > property, no icon is needed.
>> > > > > >
>> > > > > > Also, if I make them objects I also will get referencial
>> integrity
>> > > > > > constraints applied in the database.
>> > > > > >
>> > > > > >
>> > > > > +1, do it this way. That way they can also hold behaviour in the
>> > > future.
>> > > > >
>> > > > >
>> > > > >
>> > > > >
>> > > > > > I wonder there is a simple recipe for this?
>> > > > > >
>> > > > >
>> > > > > No magic recipe for the domain entities... basically copy-n-paste
>> the
>> > > > > SimpleObject that's in our archetype as many times as needed, and
>> > tweak
>> > > > as
>> > > > > required.
>> > > > >
>> > > > > If you want to use the code as the primary key, then use DN
>> > application
>> > > > > identity
>> > > > >
>> > > > > @javax.jdo.annotations.PersistenceCapable(
>> > > > > identityType=IdentityType.APPLICATION,
>> > > > > schema = "simple",
>> > > > > table = "SimpleObject"
>> > > > > )
>> > > > >
>> > > > > and add @PrimaryKey to the "name" property. Also add @Title to
>> that
>> > > > 'name'
>> > > > > property (it is in SimpleObject already).
>> > > > >
>> > > > >
>> > > > > You would probably want to remove the version column, ie remove:
>> > > > >
>> > > > > @javax.jdo.annotations.Version(
>> > > > > strategy=VersionStrategy.VERSION_NUMBER,
>> > > > > column="version")
>> > > > >
>> > > > >
>> > > > > In addition, if you annotate the class as "bounded"
>> > > > > (@DomainObject(bounded=true)) then you are telling the framework
>> that
>> > > > > there's a limited - ie bounded - set of instances, and so it will
>> > > display
>> > > > > all instances in a drop-down for you.
>> > > > >
>> > > > >
>> > > > > HTH
>> > > > > Dan
>> > > > >
>> > > >
>> > >
>> >
>>
>
>
Re: code-lists and administration thereof
Posted by Stephen Cameron <st...@gmail.com>.
Its officially called a 'derived' property.
On Thu, Jul 30, 2015 at 12:17 PM, Stephen Cameron <
steve.cameron.62@gmail.com> wrote:
> Not so simple, as now the property cannot be updated.
>
> I have the following (@Hidden is deprecated)
>
> @Column(allowsNull = "true")
> @MemberOrder(sequence = "7")
> @PropertyLayout(hidden=Where.EVERYWHERE)
> public Region getRegion() {
> return this.region;
> }
>
> public void setRegion(Region region) {
> this.region = region;
> }
>
> public List<Region> choicesRegion(){
> List<Region> regions = container.allInstances(Region.class);
> return regions;
> }
>
> @MemberOrder(sequence = "7.1")
> public String getRegionName(){
> return (getRegion() != null) ? getRegion().getName() : null;
> }
>
> Sure enough getRegion doesn't appear in the UI but getRegionName does, but
> then setRegion and choiceRegion don't mean anything to the UI, so the
> Region property is read-only.
>
> This issue is maybe more significant than it appears at first, in terms of
> domain modelling such code-lists are simple types that 'represent' things
> on the boundary of the domain of interest. So we usually want to just
> represent them with a name. Presently it makes no sense to go to that thing
> via a hyperlink as all we'll find is that name, our model extends no
> further.
>
> However we just might like to allow users to leave the domain model and go
> to a resource outside. So, extending the suppressLink=true idea, I would
> add that each object could have an implicit link(URL),created by Isis, or
> an explicit one and if the explicit one is present it can optionally be
> used as an alternative to the implicit one.
>
> For example, you might create a database to log fish details, species is a
> boundary concept, we aren't likely to want to add a new species to the list
> of known species, but we'd like to keep such a list handy, but for each
> named species in that list, to provide an explicit link to a resource in a
> global fish database. It makes more sense to use this link than the
> implicit one, as if the implicit one is used we'd navigate to the domain
> object page displaying the name and URL, both of which items of data could
> have been in the explicit link.
>
> In the explicit case you might want to warn the user they are navigating
> outside the Isis domain application.
>
> Perhaps all this could be done simply if there was a URI type in Isis,
> that would allow it to create 'smart links' automatically.
>
>
>
>
>
> On Wed, Jul 29, 2015 at 9:37 PM, Stephen Cameron <
> steve.cameron.62@gmail.com> wrote:
>
>> Thanks Jeroen, seems simple enough :)
>>
>> On Wed, Jul 29, 2015 at 9:28 PM, Jeroen van der Wal <je...@stromboli.it>
>> wrote:
>>
>>> You could also hide the property and create a separate getter for display
>>> purposes only:
>>>
>>> private MyProperty myProperty;
>>>
>>> @Hidden
>>> public MyProperty getMyProperty() {...}
>>>
>>> public void setMyProperty(...) {...}
>>>
>>> public String getMyPropertyName() {
>>> getMyProperty.getName();
>>> }
>>>
>>> On 29 July 2015 at 13:18, Stephen Cameron <st...@gmail.com>
>>> wrote:
>>>
>>> > On Wed, Jul 29, 2015 at 6:38 PM, Dan Haywood <
>>> dan@haywood-associates.co.uk
>>> > >
>>> > wrote:
>>> >
>>> > > You are right, they will be displayed as links; there's no way to
>>> disable
>>> > > it currently.
>>> > >
>>> > > We could add a bit of metadata perhaps for this, eg
>>> > > @DomainObjectLayout(suppressLink=true) or similar.
>>> > >
>>> > > Please raise a ticket.
>>> > >
>>> >
>>> > OK https://issues.apache.org/jira/browse/ISIS-1180
>>> >
>>> > >
>>> > > Thx
>>> > > Dan
>>> > >
>>> > > PS: these entities wouldn't be value types, rather regular
>>> entities. But
>>> > > you are right... what we really want is full-class support for value
>>> > types.
>>> > > We're just not there yet...
>>> > >
>>> > >
>>> > >
>>> >
>>> > >
>>> > >
>>> > > On 29 July 2015 at 09:34, Stephen Cameron <
>>> steve.cameron.62@gmail.com>
>>> > > wrote:
>>> > >
>>> > > > Thanks, but surely such object properties always end up being
>>> displayed
>>> > > as
>>> > > > links? Clicking on the link to go to such an object page is
>>> > meaningless,
>>> > > as
>>> > > > it only has one name property, that was displayed in the link. Can
>>> I
>>> > > > disable that default behaviour for value types?
>>> > > >
>>> > > >
>>> > > >
>>> > > > On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <
>>> > > dan@haywood-associates.co.uk
>>> > > > >
>>> > > > wrote:
>>> > > >
>>> > > > > On 29 July 2015 at 08:08, Stephen Cameron <
>>> > steve.cameron.62@gmail.com>
>>>
>>> > > > > wrote:
>>> > > > >
>>> > > > > > Hi,
>>> > > > > >
>>> > > > > > I want to do have some properties that are essentially String
>>> > types,
>>> > > > but
>>> > > > > > which have a limited range of values (code-lists or restricted
>>> > > > > > vocabularies). I want to allow these lists to be administered
>>> > > > centrally,
>>> > > > > so
>>> > > > > > to add them to a single Administration menu item for admin
>>> users.
>>> > > > > >
>>> > > > > > For most users these codes should appears as lists of strings
>>> not
>>> > as
>>> > > > > > objects, but making them objects seems to be the logical OO
>>> way to
>>> > > deal
>>> > > > > > with them in Isis. So they are basically objects with one
>>> 'name'
>>> > > > property
>>> > > > > > (and maybe an id added by datanucleus). All users need to see
>>> is
>>> > the
>>> > > > name
>>> > > > > > property, no icon is needed.
>>> > > > > >
>>> > > > > > Also, if I make them objects I also will get referencial
>>> integrity
>>> > > > > > constraints applied in the database.
>>> > > > > >
>>> > > > > >
>>> > > > > +1, do it this way. That way they can also hold behaviour in the
>>> > > future.
>>> > > > >
>>> > > > >
>>> > > > >
>>> > > > >
>>> > > > > > I wonder there is a simple recipe for this?
>>> > > > > >
>>> > > > >
>>> > > > > No magic recipe for the domain entities... basically
>>> copy-n-paste the
>>> > > > > SimpleObject that's in our archetype as many times as needed, and
>>> > tweak
>>> > > > as
>>> > > > > required.
>>> > > > >
>>> > > > > If you want to use the code as the primary key, then use DN
>>> > application
>>> > > > > identity
>>> > > > >
>>> > > > > @javax.jdo.annotations.PersistenceCapable(
>>> > > > > identityType=IdentityType.APPLICATION,
>>> > > > > schema = "simple",
>>> > > > > table = "SimpleObject"
>>> > > > > )
>>> > > > >
>>> > > > > and add @PrimaryKey to the "name" property. Also add @Title to
>>> that
>>> > > > 'name'
>>> > > > > property (it is in SimpleObject already).
>>> > > > >
>>> > > > >
>>> > > > > You would probably want to remove the version column, ie remove:
>>> > > > >
>>> > > > > @javax.jdo.annotations.Version(
>>> > > > > strategy=VersionStrategy.VERSION_NUMBER,
>>> > > > > column="version")
>>> > > > >
>>> > > > >
>>> > > > > In addition, if you annotate the class as "bounded"
>>> > > > > (@DomainObject(bounded=true)) then you are telling the framework
>>> that
>>> > > > > there's a limited - ie bounded - set of instances, and so it will
>>> > > display
>>> > > > > all instances in a drop-down for you.
>>> > > > >
>>> > > > >
>>> > > > > HTH
>>> > > > > Dan
>>> > > > >
>>> > > >
>>> > >
>>> >
>>>
>>
>>
>
Re: code-lists and administration thereof
Posted by Stephen Cameron <st...@gmail.com>.
Thx,
My Regions listAllNamesExclusive() code is wrong too, it should be
something like:
@Programmatic
public List<String> listAllNamesExclusive(Region region) {
List<Region> regions = listAllRegions();
List<String> names = new ArrayList<String>();
for (Region r : regions) {
if (region != null) {
if (r.getName().equals(region.getName())) {
names.add(r.getName());
}
}else{
names.add(r.getName());
}
}
return names;
}
which makes me think now that jdo entities should generally implement
Comparable?
Or, following David Tildesley's (and Coad's) thinking, for such catalogues,
make a singleton Catalogue 'manager' and load the entries into memory once
only, so == is a useful comparison.
On Thu, Jul 30, 2015 at 10:16 PM, Dan Haywood <da...@haywood-associates.co.uk>
wrote:
> looks right to me, so I'll take a look at in this eve or tomorrow.
>
> thx
> Dan
>
>
> On 30 July 2015 at 13:12, Stephen Cameron <st...@gmail.com>
> wrote:
>
> > Still no luck with this one.
> >
> > The derived RegionName appears as a non-editable property, so not sure
> what
> > was different before when I was getting an model validation error.
> >
> > My current code of interest is this:
> >
> > @Column(name = "region", allowsNull = "true")
> > //@MemberOrder(sequence = "7")
> > @Property(hidden=Where.EVERYWHERE)
> > public Region getRegion() {
> > return this.region;
> > }
> >
> > public void setRegion(Region region) {
> > this.region = region;
> > }
> >
> > public List<Region> choicesRegion() {
> > return regions.listAllRegions();
> > }
> >
> > @MemberOrder(sequence = "7")
> > public String getRegionName() {
> > return regions.nameForRegion(getRegion());
> > }
> >
> > public void setRegionName(String name) {
> > setRegion(regions.regionForName(name));
> > }
> >
> > public List<String> choicesRegionName(){
> > return regions.listAllNamesExclusive(getRegion());
> > }
> >
> > My Region class is this:
> >
> > package au.com.scds.chats.dom.modules.general.codes;
> >
> > import javax.jdo.annotations.Column;
> > import javax.jdo.annotations.IdentityType;
> > import javax.jdo.annotations.PrimaryKey;
> >
> > import org.apache.isis.applib.annotation.Action;
> > import org.apache.isis.applib.annotation.ActionLayout;
> > import org.apache.isis.applib.annotation.DomainServiceLayout;
> > import org.apache.isis.applib.annotation.DomainServiceLayout.MenuBar;
> > import org.apache.isis.applib.annotation.MemberOrder;
> > import org.apache.isis.applib.annotation.PropertyLayout;
> >
> > @javax.jdo.annotations.PersistenceCapable(
> > identityType=IdentityType.APPLICATION)
> > public class Region {
> >
> > public String title(){
> > return getName();
> > }
> >
> > private String name;
> >
> > @Column(name="region", allowsNull = "false")
> > @PrimaryKey()
> > @PropertyLayout(named="Region")
> > @MemberOrder(sequence="1")
> > public String getName() {
> > return name;
> > }
> >
> > public void setName(String name) {
> > this.name = name;
> > }
> > }
> >
> > My Regions repository class is this:
> >
> > package au.com.scds.chats.dom.modules.general.codes;
> >
> > import java.util.ArrayList;
> > import java.util.List;
> >
> > import org.apache.isis.applib.DomainObjectContainer;
> > import org.apache.isis.applib.annotation.Action;
> > import org.apache.isis.applib.annotation.ActionLayout;
> > import org.apache.isis.applib.annotation.BookmarkPolicy;
> > import org.apache.isis.applib.annotation.DomainService;
> > import org.apache.isis.applib.annotation.DomainServiceLayout;
> > import org.apache.isis.applib.annotation.DomainServiceLayout.MenuBar;
> > import org.apache.isis.applib.annotation.MemberOrder;
> > import org.apache.isis.applib.annotation.ParameterLayout;
> > import org.apache.isis.applib.annotation.Programmatic;
> > import org.apache.isis.applib.annotation.SemanticsOf;
> > import org.apache.isis.applib.query.QueryDefault;
> >
> > import au.com.scds.chats.dom.modules.participant.Participant;
> >
> > @DomainService(repositoryFor = Region.class)
> > @DomainServiceLayout(menuBar = MenuBar.SECONDARY, named =
> "Administration",
> > menuOrder = "100.1")
> > public class Regions {
> >
> > // region > listAll (action)
> > @Action(semantics = SemanticsOf.SAFE)
> > @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT)
> > @MemberOrder(sequence = "1")
> > public List<Region> listAllRegions() {
> > return container.allInstances(Region.class);
> > }
> >
> > // endregion
> >
> > // region > create (action)
> > @MemberOrder(sequence = "2")
> > public Region createRegion(
> > final @ParameterLayout(named = "Region Name") String name) {
> > final Region obj = container.newTransientInstance(Region.class);
> > obj.setName(name);
> > container.persistIfNotAlready(obj);
> > return obj;
> > }
> >
> > // endregion
> >
> > // region > injected services
> >
> > @javax.inject.Inject
> > DomainObjectContainer container;
> >
> > // endregion
> >
> > @Programmatic
> > public String nameForRegion(Region region) {
> > return (region != null) ? region.getName() : null;
> > }
> >
> >
> > @Programmatic
> > public List<String> listAllNamesExclusive(Region region) {
> > List<Region> regions = listAllRegions();
> > List<String> names = new ArrayList<String>();
> > for (Region r : regions) {
> > if (region != null && r != region) {
> > names.add(r.getName());
> > }
> > }
> > return names;
> > }
> >
> >
> > @Programmatic
> > public Region regionForName(String name) {
> > Region region = container.firstMatch(new QueryDefault<>(
> > Region.class,
> > "findRegion", "name", name));
> > return region;
> > }
> >
> > }
> >
> > Just maybe I there is something missing still?
> >
> > I added a @Property annotation to the getRegionName() method, but that
> gave
> > me a message saying it expected @javax.jdo.persistence.Column too.
> >
> > Note I couldn't use deprecated @Hidden in Isis 1.9.0.
> >
> >
> > On Thu, Jul 30, 2015 at 8:14 PM, Stephen Cameron <
> > steve.cameron.62@gmail.com
> > > wrote:
> >
> > > Hi Dan, When I tried this I got an model validation error message
> > relating
> > > to the choices method, I will have another go and if it fails, provide
> > the
> > > test case. Thanks for the tips.
> > >
> > > On Thu, Jul 30, 2015 at 7:57 PM, Dan Haywood <
> > dan@haywood-associates.co.uk
> > > > wrote:
> > >
> > >> You should be able to add a choicesXxx() for the derived property:
> > >>
> > >> public List<String> choicesRegionName(){
> > >> return
> Lists.newArrayList(Iterables.transform(choicesRegion(), x
> > >> ->
> > >> x.getName()));
> > >> }
> > >>
> > >> If that isn't sufficient, you might also need to add a setter:
> > >>
> > >> public void setRegionName(final String name) {
> > >> setRegion(Iterables.find(choicesRegion(), x ->
> > x.getName().equals(name)));
> > >> }
> > >>
> > >> Obviously, you might need to also add some error handling.
> > >>
> > >> ~~~
> > >>
> > >> Regarding the "external URL" idea, perhaps you could raise that as a
> > >> separate ticket, with a code sketch as to how you'd like this
> > information
> > >> specified?
> > >>
> > >> Thanks
> > >> Dan
> > >>
> > >>
> > >>
> > >>
> > >>
> > >> On 30 July 2015 at 03:17, Stephen Cameron <steve.cameron.62@gmail.com
> >
> > >> wrote:
> > >>
> > >> > Not so simple, as now the property cannot be updated.
> > >> >
> > >> > I have the following (@Hidden is deprecated)
> > >> >
> > >> > @Column(allowsNull = "true")
> > >> > @MemberOrder(sequence = "7")
> > >> > @PropertyLayout(hidden=Where.EVERYWHERE)
> > >> > public Region getRegion() {
> > >> > return this.region;
> > >> > }
> > >> >
> > >> > public void setRegion(Region region) {
> > >> > this.region = region;
> > >> > }
> > >> >
> > >> > public List<Region> choicesRegion(){
> > >> > List<Region> regions = container.allInstances(Region.class);
> > >> > return regions;
> > >> > }
> > >> >
> > >> > @MemberOrder(sequence = "7.1")
> > >> > public String getRegionName(){
> > >> > return (getRegion() != null) ? getRegion().getName() : null;
> > >> > }
> > >> >
> > >> > Sure enough getRegion doesn't appear in the UI but getRegionName
> does,
> > >> but
> > >> > then setRegion and choiceRegion don't mean anything to the UI, so
> the
> > >> > Region property is read-only.
> > >> >
> > >> > This issue is maybe more significant than it appears at first, in
> > terms
> > >> of
> > >> > domain modelling such code-lists are simple types that 'represent'
> > >> things
> > >> > on the boundary of the domain of interest. So we usually want to
> just
> > >> > represent them with a name. Presently it makes no sense to go to
> that
> > >> thing
> > >> > via a hyperlink as all we'll find is that name, our model extends no
> > >> > further.
> > >> >
> > >> > However we just might like to allow users to leave the domain model
> > and
> > >> go
> > >> > to a resource outside. So, extending the suppressLink=true idea, I
> > would
> > >> > add that each object could have an implicit link(URL),created by
> Isis,
> > >> or
> > >> > an explicit one and if the explicit one is present it can optionally
> > be
> > >> > used as an alternative to the implicit one.
> > >> >
> > >> > For example, you might create a database to log fish details,
> species
> > >> is a
> > >> > boundary concept, we aren't likely to want to add a new species to
> the
> > >> list
> > >> > of known species, but we'd like to keep such a list handy, but for
> > each
> > >> > named species in that list, to provide an explicit link to a
> resource
> > >> in a
> > >> > global fish database. It makes more sense to use this link than the
> > >> > implicit one, as if the implicit one is used we'd navigate to the
> > domain
> > >> > object page displaying the name and URL, both of which items of data
> > >> could
> > >> > have been in the explicit link.
> > >> >
> > >> > In the explicit case you might want to warn the user they are
> > navigating
> > >> > outside the Isis domain application.
> > >> >
> > >> > Perhaps all this could be done simply if there was a URI type in
> Isis,
> > >> that
> > >> > would allow it to create 'smart links' automatically.
> > >> >
> > >> >
> > >> >
> > >> >
> > >> >
> > >> > On Wed, Jul 29, 2015 at 9:37 PM, Stephen Cameron <
> > >> > steve.cameron.62@gmail.com
> > >> > > wrote:
> > >> >
> > >> > > Thanks Jeroen, seems simple enough :)
> > >> > >
> > >> > > On Wed, Jul 29, 2015 at 9:28 PM, Jeroen van der Wal <
> > >> jeroen@stromboli.it
> > >> > >
> > >> > > wrote:
> > >> > >
> > >> > >> You could also hide the property and create a separate getter for
> > >> > display
> > >> > >> purposes only:
> > >> > >>
> > >> > >> private MyProperty myProperty;
> > >> > >>
> > >> > >> @Hidden
> > >> > >> public MyProperty getMyProperty() {...}
> > >> > >>
> > >> > >> public void setMyProperty(...) {...}
> > >> > >>
> > >> > >> public String getMyPropertyName() {
> > >> > >> getMyProperty.getName();
> > >> > >> }
> > >> > >>
> > >> > >> On 29 July 2015 at 13:18, Stephen Cameron <
> > >> steve.cameron.62@gmail.com>
> > >> > >> wrote:
> > >> > >>
> > >> > >> > On Wed, Jul 29, 2015 at 6:38 PM, Dan Haywood <
> > >> > >> dan@haywood-associates.co.uk
> > >> > >> > >
> > >> > >> > wrote:
> > >> > >> >
> > >> > >> > > You are right, they will be displayed as links; there's no
> way
> > to
> > >> > >> disable
> > >> > >> > > it currently.
> > >> > >> > >
> > >> > >> > > We could add a bit of metadata perhaps for this, eg
> > >> > >> > > @DomainObjectLayout(suppressLink=true) or similar.
> > >> > >> > >
> > >> > >> > > Please raise a ticket.
> > >> > >> > >
> > >> > >> >
> > >> > >> > OK https://issues.apache.org/jira/browse/ISIS-1180
> > >> > >> >
> > >> > >> > >
> > >> > >> > > Thx
> > >> > >> > > Dan
> > >> > >> > >
> > >> > >> > > PS: these entities wouldn't be value types, rather regular
> > >> entities.
> > >> > >> But
> > >> > >> > > you are right... what we really want is full-class support
> for
> > >> value
> > >> > >> > types.
> > >> > >> > > We're just not there yet...
> > >> > >> > >
> > >> > >> > >
> > >> > >> > >
> > >> > >> >
> > >> > >> > >
> > >> > >> > >
> > >> > >> > > On 29 July 2015 at 09:34, Stephen Cameron <
> > >> > steve.cameron.62@gmail.com
> > >> > >> >
> > >> > >> > > wrote:
> > >> > >> > >
> > >> > >> > > > Thanks, but surely such object properties always end up
> being
> > >> > >> displayed
> > >> > >> > > as
> > >> > >> > > > links? Clicking on the link to go to such an object page is
> > >> > >> > meaningless,
> > >> > >> > > as
> > >> > >> > > > it only has one name property, that was displayed in the
> > link.
> > >> > Can I
> > >> > >> > > > disable that default behaviour for value types?
> > >> > >> > > >
> > >> > >> > > >
> > >> > >> > > >
> > >> > >> > > > On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <
> > >> > >> > > dan@haywood-associates.co.uk
> > >> > >> > > > >
> > >> > >> > > > wrote:
> > >> > >> > > >
> > >> > >> > > > > On 29 July 2015 at 08:08, Stephen Cameron <
> > >> > >> > steve.cameron.62@gmail.com>
> > >> > >>
> > >> > >> > > > > wrote:
> > >> > >> > > > >
> > >> > >> > > > > > Hi,
> > >> > >> > > > > >
> > >> > >> > > > > > I want to do have some properties that are essentially
> > >> String
> > >> > >> > types,
> > >> > >> > > > but
> > >> > >> > > > > > which have a limited range of values (code-lists or
> > >> restricted
> > >> > >> > > > > > vocabularies). I want to allow these lists to be
> > >> administered
> > >> > >> > > > centrally,
> > >> > >> > > > > so
> > >> > >> > > > > > to add them to a single Administration menu item for
> > admin
> > >> > >> users.
> > >> > >> > > > > >
> > >> > >> > > > > > For most users these codes should appears as lists of
> > >> strings
> > >> > >> not
> > >> > >> > as
> > >> > >> > > > > > objects, but making them objects seems to be the
> logical
> > OO
> > >> > way
> > >> > >> to
> > >> > >> > > deal
> > >> > >> > > > > > with them in Isis. So they are basically objects with
> one
> > >> > 'name'
> > >> > >> > > > property
> > >> > >> > > > > > (and maybe an id added by datanucleus). All users need
> to
> > >> see
> > >> > is
> > >> > >> > the
> > >> > >> > > > name
> > >> > >> > > > > > property, no icon is needed.
> > >> > >> > > > > >
> > >> > >> > > > > > Also, if I make them objects I also will get
> referencial
> > >> > >> integrity
> > >> > >> > > > > > constraints applied in the database.
> > >> > >> > > > > >
> > >> > >> > > > > >
> > >> > >> > > > > +1, do it this way. That way they can also hold
> behaviour
> > in
> > >> > the
> > >> > >> > > future.
> > >> > >> > > > >
> > >> > >> > > > >
> > >> > >> > > > >
> > >> > >> > > > >
> > >> > >> > > > > > I wonder there is a simple recipe for this?
> > >> > >> > > > > >
> > >> > >> > > > >
> > >> > >> > > > > No magic recipe for the domain entities... basically
> > >> > copy-n-paste
> > >> > >> the
> > >> > >> > > > > SimpleObject that's in our archetype as many times as
> > needed,
> > >> > and
> > >> > >> > tweak
> > >> > >> > > > as
> > >> > >> > > > > required.
> > >> > >> > > > >
> > >> > >> > > > > If you want to use the code as the primary key, then use
> DN
> > >> > >> > application
> > >> > >> > > > > identity
> > >> > >> > > > >
> > >> > >> > > > > @javax.jdo.annotations.PersistenceCapable(
> > >> > >> > > > > identityType=IdentityType.APPLICATION,
> > >> > >> > > > > schema = "simple",
> > >> > >> > > > > table = "SimpleObject"
> > >> > >> > > > > )
> > >> > >> > > > >
> > >> > >> > > > > and add @PrimaryKey to the "name" property. Also add
> > @Title
> > >> to
> > >> > >> that
> > >> > >> > > > 'name'
> > >> > >> > > > > property (it is in SimpleObject already).
> > >> > >> > > > >
> > >> > >> > > > >
> > >> > >> > > > > You would probably want to remove the version column, ie
> > >> remove:
> > >> > >> > > > >
> > >> > >> > > > > @javax.jdo.annotations.Version(
> > >> > >> > > > > strategy=VersionStrategy.VERSION_NUMBER,
> > >> > >> > > > > column="version")
> > >> > >> > > > >
> > >> > >> > > > >
> > >> > >> > > > > In addition, if you annotate the class as "bounded"
> > >> > >> > > > > (@DomainObject(bounded=true)) then you are telling the
> > >> framework
> > >> > >> that
> > >> > >> > > > > there's a limited - ie bounded - set of instances, and so
> > it
> > >> > will
> > >> > >> > > display
> > >> > >> > > > > all instances in a drop-down for you.
> > >> > >> > > > >
> > >> > >> > > > >
> > >> > >> > > > > HTH
> > >> > >> > > > > Dan
> > >> > >> > > > >
> > >> > >> > > >
> > >> > >> > >
> > >> > >> >
> > >> > >>
> > >> > >
> > >> > >
> > >> >
> > >>
> > >
> > >
> >
>
Re: code-lists and administration thereof
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
On 3 August 2015 at 10:51, Stephen Cameron <st...@gmail.com>
wrote:
> On Mon, Aug 3, 2015 at 7:32 PM, Dan Haywood <da...@haywood-associates.co.uk>
> wrote:
>
> > Glad you got this working for your own app.
> >
> > Re: kitchensink, did you pull down the latest? I fixed the issues for
> the
> > fixture script and the bad config, I believe.
> >
> Just tried to update my copy. Need to read up on that too!
>
>
Jeroen and I use SourceTree, free from Atlassian; it's a good tool that
makes this stuff easy. I tend to do a "fetch" and the merge afterwards;
all easy from the UI.
> >
> > I'll fix that error message talking about "isis.properties" instead of
> > "persistor_datanucleus.properties", though. (In Isis, it doesn't matter
> > which of those property files you use; it would be valid to just use
> > isis.properties for everything, in fact).
> >
>
> I am enjoying Isis, thinking of a project that I can make to sell as a
> customisable ERP type system, somewhat like Estatio. Just have to finish
> this one first, I have first demo for users on Friday, then hopefully into
> use by end of next week.
>
>
Jeroen and I plan to take factor out submodules of Estatio and make into
reusable (or semi-reusable components); our code name for this is UDO -
universal domain objects. For example, Parties (legal entities),
communication channels, invoices, geography, are probably all quite widely
reusable. The main entities in Estatio are illustrated at [1].
I expect we'll be getting onto that in a few months or so. It'll all end
up on github, just in different repos (analogous to isisaddons). If you're
interested in helping out, do say.
Cheers
Dan
[1]
https://github.com/estatio/estatio/blob/master/docs/application-tenancy-analysis/application-tenancy-analysis.pdf
Re: code-lists and administration thereof
Posted by Stephen Cameron <st...@gmail.com>.
On Mon, Aug 3, 2015 at 7:32 PM, Dan Haywood <da...@haywood-associates.co.uk>
wrote:
> Glad you got this working for your own app.
>
> Re: kitchensink, did you pull down the latest? I fixed the issues for the
> fixture script and the bad config, I believe.
>
Just tried to update my copy. Need to read up on that too!
>
> I'll fix that error message talking about "isis.properties" instead of
> "persistor_datanucleus.properties", though. (In Isis, it doesn't matter
> which of those property files you use; it would be valid to just use
> isis.properties for everything, in fact).
>
I am enjoying Isis, thinking of a project that I can make to sell as a
customisable ERP type system, somewhat like Estatio. Just have to finish
this one first, I have first demo for users on Friday, then hopefully into
use by end of next week.
>
>
>
> On 2 August 2015 at 21:54, Stephen Cameron <st...@gmail.com>
> wrote:
>
> > Hi,
> >
> > Just trying this now, with current version of kitchen sink I got an error
> > message starting the webapp, saying that no persistable classes could be
> > found and to check value of
> > isis.persistor.datanucleus.RegisterEntities.packagePrefix
> > in isis.properties, but that key is in isis_datanucleus.properties.
> >
> > Also errors in running fixture script :(
> >
> >
> > - org.apache.wicket.WicketRuntimeException
> > - Method onRequest of interface
> > org.apache.wicket.behavior.IBehaviorListener targeted at
> > org.apache.wicket.ajax.markup.html.AjaxLink$1@1ac79481 on component
> > [AjaxLink [Component id = menuLink]] threw an exception
> > -
> >
> org.apache.wicket.RequestListenerInterface#internalInvoke(RequestListenerInterface.java:268)
> >
> > -
> >
> org.apache.wicket.RequestListenerInterface#invoke(RequestListenerInterface.java:241)
> >
> > -
> >
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#invokeListener(ListenerInterfaceRequestHandler.java:250)
> >
> > -
> >
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#respond(ListenerInterfaceRequestHandler.java:236)
> >
> > -
> >
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor#respond(RequestCycle.java:862)
> >
> > -
> >
> org.apache.wicket.request.RequestHandlerStack#execute(RequestHandlerStack.java:64)
> >
> > -
> >
> org.apache.wicket.request.cycle.RequestCycle#execute(RequestCycle.java:261)
> >
> > -
> >
> org.apache.wicket.request.cycle.RequestCycle#processRequest(RequestCycle.java:218)
> >
> > -
> >
> org.apache.wicket.request.cycle.RequestCycle#processRequestAndDetach(RequestCycle.java:289)
> >
> > -
> >
> org.apache.wicket.protocol.http.WicketFilter#processRequestCycle(WicketFilter.java:259)
> >
> > -
> >
> org.apache.wicket.protocol.http.WicketFilter#processRequest(WicketFilter.java:201)
> >
> > -
> >
> org.apache.wicket.protocol.http.WicketFilter#doFilter(WicketFilter.java:282)
> >
> > -
> >
> org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
> >
> > -
> >
> org.apache.isis.core.webapp.diagnostics.IsisLogOnExceptionFilter#doFilter(IsisLogOnExceptionFilter.java:52)
> >
> > -
> >
> org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
> >
> > -
> >
> org.apache.shiro.web.servlet.AbstractShiroFilter#executeChain(AbstractShiroFilter.java:449)
> >
> > -
> >
> org.apache.shiro.web.servlet.AbstractShiroFilter$1#call(AbstractShiroFilter.java:365)
> >
> > -
> >
> org.apache.shiro.subject.support.SubjectCallable#doCall(SubjectCallable.java:90)
> >
> > -
> >
> org.apache.shiro.subject.support.SubjectCallable#call(SubjectCallable.java:83)
> >
> > -
> >
> org.apache.shiro.subject.support.DelegatingSubject#execute(DelegatingSubject.java:383)
> >
> > -
> >
> org.apache.shiro.web.servlet.AbstractShiroFilter#doFilterInternal(AbstractShiroFilter.java:362)
> >
> > -
> >
> org.apache.shiro.web.servlet.OncePerRequestFilter#doFilter(OncePerRequestFilter.java:125)
> >
> > -
> >
> org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
> >
> > -
> > org.mortbay.jetty.servlet.ServletHandler#handle(ServletHandler.java:399)
> >
> > -
> >
> org.mortbay.jetty.security.SecurityHandler#handle(SecurityHandler.java:216)
> >
> > -
> > org.mortbay.jetty.servlet.SessionHandler#handle(SessionHandler.java:182)
> >
> > -
> > org.mortbay.jetty.handler.ContextHandler#handle(ContextHandler.java:766)
> >
> > -
> org.mortbay.jetty.webapp.WebAppContext#handle(WebAppContext.java:450)
> > -
> >
> org.mortbay.jetty.handler.ContextHandlerCollection#handle(ContextHandlerCollection.java:230)
> >
> > -
> >
> org.mortbay.jetty.handler.HandlerCollection#handle(HandlerCollection.java:114)
> >
> > -
> > org.mortbay.jetty.handler.HandlerWrapper#handle(HandlerWrapper.java:152)
> >
> > - org.mortbay.jetty.Server#handle(Server.java:326)
> > -
> > org.mortbay.jetty.HttpConnection#handleRequest(HttpConnection.java:542)
> >
> > -
> >
> org.mortbay.jetty.HttpConnection$RequestHandler#headerComplete(HttpConnection.java:928)
> >
> > - org.mortbay.jetty.HttpParser#parseNext(HttpParser.java:549)
> > - org.mortbay.jetty.HttpParser#parseAvailable(HttpParser.java:212)
> > - org.mortbay.jetty.HttpConnection#handle(HttpConnection.java:404)
> > -
> >
> org.mortbay.io.nio.SelectChannelEndPoint#run(SelectChannelEndPoint.java:410)
> >
> > -
> >
> org.mortbay.thread.QueuedThreadPool$PoolThread#run(QueuedThreadPool.java:582)
> >
> > -
> > - Caused by:
> > -
> > - java.lang.reflect.InvocationTargetException
> > -
> > - sun.reflect.GeneratedMethodAccessor98#invoke(null:-1)
> > -
> >
> sun.reflect.DelegatingMethodAccessorImpl#invoke(DelegatingMethodAccessorImpl.java:43)
> >
> > - java.lang.reflect.Method#invoke(Method.java:497)
> > -
> >
> org.apache.wicket.RequestListenerInterface#internalInvoke(RequestListenerInterface.java:258)
> >
> > -
> >
> org.apache.wicket.RequestListenerInterface#invoke(RequestListenerInterface.java:241)
> >
> > -
> >
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#invokeListener(ListenerInterfaceRequestHandler.java:250)
> >
> > -
> >
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#respond(ListenerInterfaceRequestHandler.java:236)
> >
> > -
> >
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor#respond(RequestCycle.java:862)
> >
> > -
> >
> org.apache.wicket.request.RequestHandlerStack#execute(RequestHandlerStack.java:64)
> >
> > -
> >
> org.apache.wicket.request.cycle.RequestCycle#execute(RequestCycle.java:261)
> >
> > -
> >
> org.apache.wicket.request.cycle.RequestCycle#processRequest(RequestCycle.java:218)
> >
> > -
> >
> org.apache.wicket.request.cycle.RequestCycle#processRequestAndDetach(RequestCycle.java:289)
> >
> > -
> >
> org.apache.wicket.protocol.http.WicketFilter#processRequestCycle(WicketFilter.java:259)
> >
> > -
> >
> org.apache.wicket.protocol.http.WicketFilter#processRequest(WicketFilter.java:201)
> >
> > -
> >
> org.apache.wicket.protocol.http.WicketFilter#doFilter(WicketFilter.java:282)
> >
> > -
> >
> org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
> >
> > -
> >
> org.apache.isis.core.webapp.diagnostics.IsisLogOnExceptionFilter#doFilter(IsisLogOnExceptionFilter.java:52)
> >
> > -
> >
> org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
> >
> > -
> >
> org.apache.shiro.web.servlet.AbstractShiroFilter#executeChain(AbstractShiroFilter.java:449)
> >
> > -
> >
> org.apache.shiro.web.servlet.AbstractShiroFilter$1#call(AbstractShiroFilter.java:365)
> >
> > -
> >
> org.apache.shiro.subject.support.SubjectCallable#doCall(SubjectCallable.java:90)
> >
> > -
> >
> org.apache.shiro.subject.support.SubjectCallable#call(SubjectCallable.java:83)
> >
> > -
> >
> org.apache.shiro.subject.support.DelegatingSubject#execute(DelegatingSubject.java:383)
> >
> > -
> >
> org.apache.shiro.web.servlet.AbstractShiroFilter#doFilterInternal(AbstractShiroFilter.java:362)
> >
> > -
> >
> org.apache.shiro.web.servlet.OncePerRequestFilter#doFilter(OncePerRequestFilter.java:125)
> >
> > -
> >
> org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
> >
> > -
> > org.mortbay.jetty.servlet.ServletHandler#handle(ServletHandler.java:399)
> >
> > -
> >
> org.mortbay.jetty.security.SecurityHandler#handle(SecurityHandler.java:216)
> >
> > -
> > org.mortbay.jetty.servlet.SessionHandler#handle(SessionHandler.java:182)
> >
> > -
> > org.mortbay.jetty.handler.ContextHandler#handle(ContextHandler.java:766)
> >
> > -
> org.mortbay.jetty.webapp.WebAppContext#handle(WebAppContext.java:450)
> > -
> >
> org.mortbay.jetty.handler.ContextHandlerCollection#handle(ContextHandlerCollection.java:230)
> >
> > -
> >
> org.mortbay.jetty.handler.HandlerCollection#handle(HandlerCollection.java:114)
> >
> > -
> > org.mortbay.jetty.handler.HandlerWrapper#handle(HandlerWrapper.java:152)
> >
> > - org.mortbay.jetty.Server#handle(Server.java:326)
> > -
> > org.mortbay.jetty.HttpConnection#handleRequest(HttpConnection.java:542)
> >
> > -
> >
> org.mortbay.jetty.HttpConnection$RequestHandler#headerComplete(HttpConnection.java:928)
> >
> > - org.mortbay.jetty.HttpParser#parseNext(HttpParser.java:549)
> > - org.mortbay.jetty.HttpParser#parseAvailable(HttpParser.java:212)
> > - org.mortbay.jetty.HttpConnection#handle(HttpConnection.java:404)
> > -
> >
> org.mortbay.io.nio.SelectChannelEndPoint#run(SelectChannelEndPoint.java:410)
> >
> > -
> >
> org.mortbay.thread.QueuedThreadPool$PoolThread#run(QueuedThreadPool.java:582)
> >
> > -
> > - Caused by:
> > -
> > - java.lang.IllegalArgumentException
> > - argument type mismatch
> > -
> >
> sun.reflect.NativeMethodAccessorImpl#invoke0(NativeMethodAccessorImpl.java:-2)
> >
> > -
> >
> sun.reflect.NativeMethodAccessorImpl#invoke(NativeMethodAccessorImpl.java:62)
> >
> > -
> >
> sun.reflect.DelegatingMethodAccessorImpl#invoke(DelegatingMethodAccessorImpl.java:43)
> >
> > - java.lang.reflect.Method#invoke(Method.java:497)
> > -
> >
> org.apache.isis.applib.fixturescripts.FixtureScript#setParam(FixtureScript.java:689)
> >
> > -
> >
> org.apache.isis.applib.fixturescripts.FixtureScript#defaultParam(FixtureScript.java:631)
> >
> > -
> >
> org.isisaddons.app.kitchensink.fixture.primitive.PrimitiveObjectsFixture#execute(PrimitiveObjectsFixture.java:133)
> >
> > -
> >
> org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#executeChildIfNotAlready(FixtureScript.java:549)
> >
> > -
> >
> org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#executeChildT(FixtureScript.java:528)
> >
> > -
> >
> org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#executeChildT(FixtureScript.java:498)
> >
> > -
> >
> org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#executeChild(FixtureScript.java:487)
> >
> > -
> >
> org.isisaddons.app.kitchensink.fixture.KitchensinkSetupFixture#execute(KitchensinkSetupFixture.java:62)
> >
> > -
> >
> org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#executeChildIfNotAlready(FixtureScript.java:549)
> >
> > -
> >
> org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#access$200(FixtureScript.java:248)
> >
> > -
> >
> org.apache.isis.applib.fixturescripts.FixtureScript#run(FixtureScript.java:719)
> >
> > -
> >
> org.isisaddons.app.kitchensink.fixture.KitchensinkFixturesService#installFixturesAndReturnFirst(KitchensinkFixturesService.java:95)
> >
> > -
> >
> sun.reflect.NativeMethodAccessorImpl#invoke0(NativeMethodAccessorImpl.java:-2)
> >
> > -
> >
> sun.reflect.NativeMethodAccessorImpl#invoke(NativeMethodAccessorImpl.java:62)
> >
> > -
> >
> sun.reflect.DelegatingMethodAccessorImpl#invoke(DelegatingMethodAccessorImpl.java:43)
> >
> > - java.lang.reflect.Method#invoke(Method.java:497)
> > -
> >
> org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract#internalInvoke(ActionInvocationFacetForDomainEventAbstract.java:356)
> >
> > -
> >
> org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract#invoke(ActionInvocationFacetForDomainEventAbstract.java:196)
> >
> > -
> >
> org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1#execute(ActionInvocationFacetWrapTransaction.java:57)
> >
> > -
> >
> org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1#execute(ActionInvocationFacetWrapTransaction.java:54)
> >
> > -
> >
> org.apache.isis.core.runtime.system.transaction.IsisTransactionManager#executeWithinTransaction(IsisTransactionManager.java:205)
> >
> > -
> >
> org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction#invoke(ActionInvocationFacetWrapTransaction.java:54)
> >
> > -
> >
> org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionImpl#execute(ObjectActionImpl.java:367)
> >
> > -
> >
> org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionImpl#executeWithRuleChecking(ObjectActionImpl.java:358)
> >
> > -
> >
> org.apache.isis.viewer.wicket.model.models.ActionModel#executeAction(ActionModel.java:467)
> >
> > -
> >
> org.apache.isis.viewer.wicket.model.models.ActionModel#load(ActionModel.java:447)
> >
> > -
> >
> org.apache.isis.viewer.wicket.model.models.ActionModel#load(ActionModel.java:80)
> >
> > -
> >
> org.apache.wicket.model.LoadableDetachableModel#getObject(LoadableDetachableModel.java:121)
> >
> > -
> >
> org.apache.isis.viewer.wicket.model.models.ActionModel#executeHandlingApplicationExceptions(ActionModel.java:543)
> >
> > -
> >
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel#executeActionOnTargetAndProcessResults(ActionPanel.java:245)
> >
> > -
> >
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel#executeActionAndProcessResults(ActionPanel.java:193)
> >
> > -
> >
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel#buildGui(ActionPanel.java:104)
> >
> > -
> >
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel#<init>(ActionPanel.java:82)
> >
> > -
> >
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanelFactory#createComponent(ActionPanelFactory.java:49)
> >
> > -
> >
> org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault#createComponent(ComponentFactoryRegistryDefault.java:128)
> >
> > -
> >
> org.apache.isis.viewer.wicket.ui.components.widgets.linkandlabel.ActionLinkFactoryAbstract$1#onClick(ActionLinkFactoryAbstract.java:74)
> >
> > -
> > org.apache.wicket.ajax.markup.html.AjaxLink$1#onEvent(AjaxLink.java:86)
> >
> > -
> >
> org.apache.wicket.ajax.AjaxEventBehavior#respond(AjaxEventBehavior.java:124)
> >
> > -
> >
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#onRequest(AbstractDefaultAjaxBehavior.java:633)
> >
> > - sun.reflect.GeneratedMethodAccessor98#invoke(null:-1)
> > -
> >
> sun.reflect.DelegatingMethodAccessorImpl#invoke(DelegatingMethodAccessorImpl.java:43)
> >
> > - java.lang.reflect.Method#invoke(Method.java:497)
> > -
> >
> org.apache.wicket.RequestListenerInterface#internalInvoke(RequestListenerInterface.java:258)
> >
> > -
> >
> org.apache.wicket.RequestListenerInterface#invoke(RequestListenerInterface.java:241)
> >
> > -
> >
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#invokeListener(ListenerInterfaceRequestHandler.java:250)
> >
> > -
> >
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#respond(ListenerInterfaceRequestHandler.java:236)
> >
> > -
> >
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor#respond(RequestCycle.java:862)
> >
> > -
> >
> org.apache.wicket.request.RequestHandlerStack#execute(RequestHandlerStack.java:64)
> >
> > -
> >
> org.apache.wicket.request.cycle.RequestCycle#execute(RequestCycle.java:261)
> >
> > -
> >
> org.apache.wicket.request.cycle.RequestCycle#processRequest(RequestCycle.java:218)
> >
> > -
> >
> org.apache.wicket.request.cycle.RequestCycle#processRequestAndDetach(RequestCycle.java:289)
> >
> > -
> >
> org.apache.wicket.protocol.http.WicketFilter#processRequestCycle(WicketFilter.java:259)
> >
> > -
> >
> org.apache.wicket.protocol.http.WicketFilter#processRequest(WicketFilter.java:201)
> >
> > -
> >
> org.apache.wicket.protocol.http.WicketFilter#doFilter(WicketFilter.java:282)
> >
> > -
> >
> org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
> >
> > -
> >
> org.apache.isis.core.webapp.diagnostics.IsisLogOnExceptionFilter#doFilter(IsisLogOnExceptionFilter.java:52)
> >
> > -
> >
> org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
> >
> > -
> >
> org.apache.shiro.web.servlet.AbstractShiroFilter#executeChain(AbstractShiroFilter.java:449)
> >
> > -
> >
> org.apache.shiro.web.servlet.AbstractShiroFilter$1#call(AbstractShiroFilter.java:365)
> >
> > -
> >
> org.apache.shiro.subject.support.SubjectCallable#doCall(SubjectCallable.java:90)
> >
> > -
> >
> org.apache.shiro.subject.support.SubjectCallable#call(SubjectCallable.java:83)
> >
> > -
> >
> org.apache.shiro.subject.support.DelegatingSubject#execute(DelegatingSubject.java:383)
> >
> > -
> >
> org.apache.shiro.web.servlet.AbstractShiroFilter#doFilterInternal(AbstractShiroFilter.java:362)
> >
> > -
> >
> org.apache.shiro.web.servlet.OncePerRequestFilter#doFilter(OncePerRequestFilter.java:125)
> >
> > -
> >
> org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
> >
> > -
> > org.mortbay.jetty.servlet.ServletHandler#handle(ServletHandler.java:399)
> >
> > -
> >
> org.mortbay.jetty.security.SecurityHandler#handle(SecurityHandler.java:216)
> >
> > -
> > org.mortbay.jetty.servlet.SessionHandler#handle(SessionHandler.java:182)
> >
> > -
> > org.mortbay.jetty.handler.ContextHandler#handle(ContextHandler.java:766)
> >
> > -
> org.mortbay.jetty.webapp.WebAppContext#handle(WebAppContext.java:450)
> > -
> >
> org.mortbay.jetty.handler.ContextHandlerCollection#handle(ContextHandlerCollection.java:230)
> >
> > -
> >
> org.mortbay.jetty.handler.HandlerCollection#handle(HandlerCollection.java:114)
> >
> > -
> > org.mortbay.jetty.handler.HandlerWrapper#handle(HandlerWrapper.java:152)
> >
> > - org.mortbay.jetty.Server#handle(Server.java:326)
> > -
> > org.mortbay.jetty.HttpConnection#handleRequest(HttpConnection.java:542)
> >
> > -
> >
> org.mortbay.jetty.HttpConnection$RequestHandler#headerComplete(HttpConnection.java:928)
> >
> > - org.mortbay.jetty.HttpParser#parseNext(HttpParser.java:549)
> > - org.mortbay.jetty.HttpParser#parseAvailable(HttpParser.java:212)
> > - org.mortbay.jetty.HttpConnection#handle(HttpConnection.java:404)
> > -
> >
> org.mortbay.io.nio.SelectChannelEndPoint#run(SelectChannelEndPoint.java:410)
> >
> > -
> >
> org.mortbay.thread.QueuedThreadPool$PoolThread#run(QueuedThreadPool.java:582
> >
> >
> >
> >
> > On Sun, Aug 2, 2015 at 11:23 PM, Dan Haywood <
> dan@haywood-associates.co.uk
> > >
> > wrote:
> >
> > > Further to this, I've updated the kitchensink (against 1.9.0-SNAPSHOT)
> to
> > > demonstrate this technique....
> > >
> > > The code is in ReferenceObject, which you can get to from the "Data
> > Types"
> > > menu. Use the fixture scripts menu to create some sample data.
> > >
> > > The relevant code is below.
> > >
> > > Cheers
> > > Dan
> > >
> > > [1] https://github.com/isisaddons/isis-app-kitchensink
> > >
> > >
> > > private OtherObject someOtherObjectUsingName;
> > >
> > > @Property(hidden = Where.EVERYWHERE)
> > > @Column(allowsNull = "true")
> > > public OtherObject getSomeOtherObjectUsingName() {
> > > return someOtherObjectUsingName;
> > > }
> > >
> > > public void setSomeOtherObjectUsingName(final OtherObject
> > > someOtherObjectUsingName) {
> > > this.someOtherObjectUsingName = someOtherObjectUsingName;
> > > }
> > >
> > > @NotPersistent
> > > public String getSomeOtherObjectUsingNameName() {
> > > return getSomeOtherObjectUsingName() != null?
> > > getSomeOtherObjectUsingName().getName() : null;
> > > }
> > >
> > > public void setSomeOtherObjectUsingNameName(final String name) {
> > > OtherObject otherObject = name != null
> > > ? container.firstMatch(OtherObject.class,
> withName(name))
> > > : null;
> > > setSomeOtherObjectUsingName(otherObject);
> > > }
> > >
> > > public List<String> choicesSomeOtherObjectUsingNameName() {
> > > List<OtherObject> otherObjects =
> > > container.allInstances(OtherObject.class);
> > > return Lists.newArrayList(
> > > Iterables.transform(otherObjects, nameOf())
> > > );
> > > }
> > >
> > > private static Function<OtherObject, String> nameOf() {
> > > return new Function<OtherObject, String>() {
> > > @Nullable @Override public String apply(final OtherObject
> > > input) {
> > > return input.getName();
> > > }
> > > };
> > > }
> > >
> > > private static Predicate<OtherObject> withName(final String name) {
> > > return new Predicate<OtherObject>() {
> > > @Override public boolean apply(final OtherObject input) {
> > > return Objects.equal(input.getName(), name);
> > > }
> > > };
> > > }
> > >
> > >
> > >
> > >
> > >
> > > On 30 July 2015 at 13:16, Dan Haywood <da...@haywood-associates.co.uk>
> > > wrote:
> > >
> > > > looks right to me, so I'll take a look at in this eve or tomorrow.
> > > >
> > > > thx
> > > > Dan
> > > >
> > > >
> > > > On 30 July 2015 at 13:12, Stephen Cameron <
> steve.cameron.62@gmail.com>
> > > > wrote:
> > > >
> > > >> Still no luck with this one.
> > > >>
> > > >> The derived RegionName appears as a non-editable property, so not
> sure
> > > >> what
> > > >> was different before when I was getting an model validation error.
> > > >>
> > > >> My current code of interest is this:
> > > >>
> > > >> @Column(name = "region", allowsNull = "true")
> > > >> //@MemberOrder(sequence = "7")
> > > >> @Property(hidden=Where.EVERYWHERE)
> > > >> public Region getRegion() {
> > > >> return this.region;
> > > >> }
> > > >>
> > > >> public void setRegion(Region region) {
> > > >> this.region = region;
> > > >> }
> > > >>
> > > >> public List<Region> choicesRegion() {
> > > >> return regions.listAllRegions();
> > > >> }
> > > >>
> > > >> @MemberOrder(sequence = "7")
> > > >> public String getRegionName() {
> > > >> return regions.nameForRegion(getRegion());
> > > >> }
> > > >>
> > > >> public void setRegionName(String name) {
> > > >> setRegion(regions.regionForName(name));
> > > >> }
> > > >>
> > > >> public List<String> choicesRegionName(){
> > > >> return regions.listAllNamesExclusive(getRegion());
> > > >> }
> > > >>
> > > >> My Region class is this:
> > > >>
> > > >> package au.com.scds.chats.dom.modules.general.codes;
> > > >>
> > > >> import javax.jdo.annotations.Column;
> > > >> import javax.jdo.annotations.IdentityType;
> > > >> import javax.jdo.annotations.PrimaryKey;
> > > >>
> > > >> import org.apache.isis.applib.annotation.Action;
> > > >> import org.apache.isis.applib.annotation.ActionLayout;
> > > >> import org.apache.isis.applib.annotation.DomainServiceLayout;
> > > >> import
> org.apache.isis.applib.annotation.DomainServiceLayout.MenuBar;
> > > >> import org.apache.isis.applib.annotation.MemberOrder;
> > > >> import org.apache.isis.applib.annotation.PropertyLayout;
> > > >>
> > > >> @javax.jdo.annotations.PersistenceCapable(
> > > >> identityType=IdentityType.APPLICATION)
> > > >> public class Region {
> > > >>
> > > >> public String title(){
> > > >> return getName();
> > > >> }
> > > >>
> > > >> private String name;
> > > >>
> > > >> @Column(name="region", allowsNull = "false")
> > > >> @PrimaryKey()
> > > >> @PropertyLayout(named="Region")
> > > >> @MemberOrder(sequence="1")
> > > >> public String getName() {
> > > >> return name;
> > > >> }
> > > >>
> > > >> public void setName(String name) {
> > > >> this.name = name;
> > > >> }
> > > >> }
> > > >>
> > > >> My Regions repository class is this:
> > > >>
> > > >> package au.com.scds.chats.dom.modules.general.codes;
> > > >>
> > > >> import java.util.ArrayList;
> > > >> import java.util.List;
> > > >>
> > > >> import org.apache.isis.applib.DomainObjectContainer;
> > > >> import org.apache.isis.applib.annotation.Action;
> > > >> import org.apache.isis.applib.annotation.ActionLayout;
> > > >> import org.apache.isis.applib.annotation.BookmarkPolicy;
> > > >> import org.apache.isis.applib.annotation.DomainService;
> > > >> import org.apache.isis.applib.annotation.DomainServiceLayout;
> > > >> import
> org.apache.isis.applib.annotation.DomainServiceLayout.MenuBar;
> > > >> import org.apache.isis.applib.annotation.MemberOrder;
> > > >> import org.apache.isis.applib.annotation.ParameterLayout;
> > > >> import org.apache.isis.applib.annotation.Programmatic;
> > > >> import org.apache.isis.applib.annotation.SemanticsOf;
> > > >> import org.apache.isis.applib.query.QueryDefault;
> > > >>
> > > >> import au.com.scds.chats.dom.modules.participant.Participant;
> > > >>
> > > >> @DomainService(repositoryFor = Region.class)
> > > >> @DomainServiceLayout(menuBar = MenuBar.SECONDARY, named =
> > > >> "Administration",
> > > >> menuOrder = "100.1")
> > > >> public class Regions {
> > > >>
> > > >> // region > listAll (action)
> > > >> @Action(semantics = SemanticsOf.SAFE)
> > > >> @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT)
> > > >> @MemberOrder(sequence = "1")
> > > >> public List<Region> listAllRegions() {
> > > >> return container.allInstances(Region.class);
> > > >> }
> > > >>
> > > >> // endregion
> > > >>
> > > >> // region > create (action)
> > > >> @MemberOrder(sequence = "2")
> > > >> public Region createRegion(
> > > >> final @ParameterLayout(named = "Region Name") String
> > name) {
> > > >> final Region obj =
> > container.newTransientInstance(Region.class);
> > > >> obj.setName(name);
> > > >> container.persistIfNotAlready(obj);
> > > >> return obj;
> > > >> }
> > > >>
> > > >> // endregion
> > > >>
> > > >> // region > injected services
> > > >>
> > > >> @javax.inject.Inject
> > > >> DomainObjectContainer container;
> > > >>
> > > >> // endregion
> > > >>
> > > >> @Programmatic
> > > >> public String nameForRegion(Region region) {
> > > >> return (region != null) ? region.getName() : null;
> > > >> }
> > > >>
> > > >>
> > > >> @Programmatic
> > > >> public List<String> listAllNamesExclusive(Region region) {
> > > >> List<Region> regions = listAllRegions();
> > > >> List<String> names = new ArrayList<String>();
> > > >> for (Region r : regions) {
> > > >> if (region != null && r != region) {
> > > >> names.add(r.getName());
> > > >> }
> > > >> }
> > > >> return names;
> > > >> }
> > > >>
> > > >>
> > > >> @Programmatic
> > > >> public Region regionForName(String name) {
> > > >> Region region = container.firstMatch(new QueryDefault<>(
> > > >> Region.class,
> > > >> "findRegion", "name", name));
> > > >> return region;
> > > >> }
> > > >>
> > > >> }
> > > >>
> > > >> Just maybe I there is something missing still?
> > > >>
> > > >> I added a @Property annotation to the getRegionName() method, but
> that
> > > >> gave
> > > >> me a message saying it expected @javax.jdo.persistence.Column too.
> > > >>
> > > >> Note I couldn't use deprecated @Hidden in Isis 1.9.0.
> > > >>
> > > >>
> > > >> On Thu, Jul 30, 2015 at 8:14 PM, Stephen Cameron <
> > > >> steve.cameron.62@gmail.com
> > > >> > wrote:
> > > >>
> > > >> > Hi Dan, When I tried this I got an model validation error message
> > > >> relating
> > > >> > to the choices method, I will have another go and if it fails,
> > provide
> > > >> the
> > > >> > test case. Thanks for the tips.
> > > >> >
> > > >> > On Thu, Jul 30, 2015 at 7:57 PM, Dan Haywood <
> > > >> dan@haywood-associates.co.uk
> > > >> > > wrote:
> > > >> >
> > > >> >> You should be able to add a choicesXxx() for the derived
> property:
> > > >> >>
> > > >> >> public List<String> choicesRegionName(){
> > > >> >> return
> > > Lists.newArrayList(Iterables.transform(choicesRegion(),
> > > >> x
> > > >> >> ->
> > > >> >> x.getName()));
> > > >> >> }
> > > >> >>
> > > >> >> If that isn't sufficient, you might also need to add a setter:
> > > >> >>
> > > >> >> public void setRegionName(final String name) {
> > > >> >> setRegion(Iterables.find(choicesRegion(), x ->
> > > >> x.getName().equals(name)));
> > > >> >> }
> > > >> >>
> > > >> >> Obviously, you might need to also add some error handling.
> > > >> >>
> > > >> >> ~~~
> > > >> >>
> > > >> >> Regarding the "external URL" idea, perhaps you could raise that
> as
> > a
> > > >> >> separate ticket, with a code sketch as to how you'd like this
> > > >> information
> > > >> >> specified?
> > > >> >>
> > > >> >> Thanks
> > > >> >> Dan
> > > >> >>
> > > >> >>
> > > >> >>
> > > >> >>
> > > >> >>
> > > >> >> On 30 July 2015 at 03:17, Stephen Cameron <
> > > steve.cameron.62@gmail.com>
> > > >> >> wrote:
> > > >> >>
> > > >> >> > Not so simple, as now the property cannot be updated.
> > > >> >> >
> > > >> >> > I have the following (@Hidden is deprecated)
> > > >> >> >
> > > >> >> > @Column(allowsNull = "true")
> > > >> >> > @MemberOrder(sequence = "7")
> > > >> >> > @PropertyLayout(hidden=Where.EVERYWHERE)
> > > >> >> > public Region getRegion() {
> > > >> >> > return this.region;
> > > >> >> > }
> > > >> >> >
> > > >> >> > public void setRegion(Region region) {
> > > >> >> > this.region = region;
> > > >> >> > }
> > > >> >> >
> > > >> >> > public List<Region> choicesRegion(){
> > > >> >> > List<Region> regions =
> > > container.allInstances(Region.class);
> > > >> >> > return regions;
> > > >> >> > }
> > > >> >> >
> > > >> >> > @MemberOrder(sequence = "7.1")
> > > >> >> > public String getRegionName(){
> > > >> >> > return (getRegion() != null) ? getRegion().getName() :
> > > null;
> > > >> >> > }
> > > >> >> >
> > > >> >> > Sure enough getRegion doesn't appear in the UI but
> getRegionName
> > > >> does,
> > > >> >> but
> > > >> >> > then setRegion and choiceRegion don't mean anything to the UI,
> so
> > > the
> > > >> >> > Region property is read-only.
> > > >> >> >
> > > >> >> > This issue is maybe more significant than it appears at first,
> in
> > > >> terms
> > > >> >> of
> > > >> >> > domain modelling such code-lists are simple types that
> > 'represent'
> > > >> >> things
> > > >> >> > on the boundary of the domain of interest. So we usually want
> to
> > > just
> > > >> >> > represent them with a name. Presently it makes no sense to go
> to
> > > that
> > > >> >> thing
> > > >> >> > via a hyperlink as all we'll find is that name, our model
> extends
> > > no
> > > >> >> > further.
> > > >> >> >
> > > >> >> > However we just might like to allow users to leave the domain
> > model
> > > >> and
> > > >> >> go
> > > >> >> > to a resource outside. So, extending the suppressLink=true
> idea,
> > I
> > > >> would
> > > >> >> > add that each object could have an implicit link(URL),created
> by
> > > >> Isis,
> > > >> >> or
> > > >> >> > an explicit one and if the explicit one is present it can
> > > optionally
> > > >> be
> > > >> >> > used as an alternative to the implicit one.
> > > >> >> >
> > > >> >> > For example, you might create a database to log fish details,
> > > species
> > > >> >> is a
> > > >> >> > boundary concept, we aren't likely to want to add a new species
> > to
> > > >> the
> > > >> >> list
> > > >> >> > of known species, but we'd like to keep such a list handy, but
> > for
> > > >> each
> > > >> >> > named species in that list, to provide an explicit link to a
> > > resource
> > > >> >> in a
> > > >> >> > global fish database. It makes more sense to use this link than
> > the
> > > >> >> > implicit one, as if the implicit one is used we'd navigate to
> the
> > > >> domain
> > > >> >> > object page displaying the name and URL, both of which items of
> > > data
> > > >> >> could
> > > >> >> > have been in the explicit link.
> > > >> >> >
> > > >> >> > In the explicit case you might want to warn the user they are
> > > >> navigating
> > > >> >> > outside the Isis domain application.
> > > >> >> >
> > > >> >> > Perhaps all this could be done simply if there was a URI type
> in
> > > >> Isis,
> > > >> >> that
> > > >> >> > would allow it to create 'smart links' automatically.
> > > >> >> >
> > > >> >> >
> > > >> >> >
> > > >> >> >
> > > >> >> >
> > > >> >> > On Wed, Jul 29, 2015 at 9:37 PM, Stephen Cameron <
> > > >> >> > steve.cameron.62@gmail.com
> > > >> >> > > wrote:
> > > >> >> >
> > > >> >> > > Thanks Jeroen, seems simple enough :)
> > > >> >> > >
> > > >> >> > > On Wed, Jul 29, 2015 at 9:28 PM, Jeroen van der Wal <
> > > >> >> jeroen@stromboli.it
> > > >> >> > >
> > > >> >> > > wrote:
> > > >> >> > >
> > > >> >> > >> You could also hide the property and create a separate
> getter
> > > for
> > > >> >> > display
> > > >> >> > >> purposes only:
> > > >> >> > >>
> > > >> >> > >> private MyProperty myProperty;
> > > >> >> > >>
> > > >> >> > >> @Hidden
> > > >> >> > >> public MyProperty getMyProperty() {...}
> > > >> >> > >>
> > > >> >> > >> public void setMyProperty(...) {...}
> > > >> >> > >>
> > > >> >> > >> public String getMyPropertyName() {
> > > >> >> > >> getMyProperty.getName();
> > > >> >> > >> }
> > > >> >> > >>
> > > >> >> > >> On 29 July 2015 at 13:18, Stephen Cameron <
> > > >> >> steve.cameron.62@gmail.com>
> > > >> >> > >> wrote:
> > > >> >> > >>
> > > >> >> > >> > On Wed, Jul 29, 2015 at 6:38 PM, Dan Haywood <
> > > >> >> > >> dan@haywood-associates.co.uk
> > > >> >> > >> > >
> > > >> >> > >> > wrote:
> > > >> >> > >> >
> > > >> >> > >> > > You are right, they will be displayed as links; there's
> no
> > > >> way to
> > > >> >> > >> disable
> > > >> >> > >> > > it currently.
> > > >> >> > >> > >
> > > >> >> > >> > > We could add a bit of metadata perhaps for this, eg
> > > >> >> > >> > > @DomainObjectLayout(suppressLink=true) or similar.
> > > >> >> > >> > >
> > > >> >> > >> > > Please raise a ticket.
> > > >> >> > >> > >
> > > >> >> > >> >
> > > >> >> > >> > OK https://issues.apache.org/jira/browse/ISIS-1180
> > > >> >> > >> >
> > > >> >> > >> > >
> > > >> >> > >> > > Thx
> > > >> >> > >> > > Dan
> > > >> >> > >> > >
> > > >> >> > >> > > PS: these entities wouldn't be value types, rather
> regular
> > > >> >> entities.
> > > >> >> > >> But
> > > >> >> > >> > > you are right... what we really want is full-class
> support
> > > for
> > > >> >> value
> > > >> >> > >> > types.
> > > >> >> > >> > > We're just not there yet...
> > > >> >> > >> > >
> > > >> >> > >> > >
> > > >> >> > >> > >
> > > >> >> > >> >
> > > >> >> > >> > >
> > > >> >> > >> > >
> > > >> >> > >> > > On 29 July 2015 at 09:34, Stephen Cameron <
> > > >> >> > steve.cameron.62@gmail.com
> > > >> >> > >> >
> > > >> >> > >> > > wrote:
> > > >> >> > >> > >
> > > >> >> > >> > > > Thanks, but surely such object properties always end
> up
> > > >> being
> > > >> >> > >> displayed
> > > >> >> > >> > > as
> > > >> >> > >> > > > links? Clicking on the link to go to such an object
> page
> > > is
> > > >> >> > >> > meaningless,
> > > >> >> > >> > > as
> > > >> >> > >> > > > it only has one name property, that was displayed in
> the
> > > >> link.
> > > >> >> > Can I
> > > >> >> > >> > > > disable that default behaviour for value types?
> > > >> >> > >> > > >
> > > >> >> > >> > > >
> > > >> >> > >> > > >
> > > >> >> > >> > > > On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <
> > > >> >> > >> > > dan@haywood-associates.co.uk
> > > >> >> > >> > > > >
> > > >> >> > >> > > > wrote:
> > > >> >> > >> > > >
> > > >> >> > >> > > > > On 29 July 2015 at 08:08, Stephen Cameron <
> > > >> >> > >> > steve.cameron.62@gmail.com>
> > > >> >> > >>
> > > >> >> > >> > > > > wrote:
> > > >> >> > >> > > > >
> > > >> >> > >> > > > > > Hi,
> > > >> >> > >> > > > > >
> > > >> >> > >> > > > > > I want to do have some properties that are
> > essentially
> > > >> >> String
> > > >> >> > >> > types,
> > > >> >> > >> > > > but
> > > >> >> > >> > > > > > which have a limited range of values (code-lists
> or
> > > >> >> restricted
> > > >> >> > >> > > > > > vocabularies). I want to allow these lists to be
> > > >> >> administered
> > > >> >> > >> > > > centrally,
> > > >> >> > >> > > > > so
> > > >> >> > >> > > > > > to add them to a single Administration menu item
> for
> > > >> admin
> > > >> >> > >> users.
> > > >> >> > >> > > > > >
> > > >> >> > >> > > > > > For most users these codes should appears as lists
> > of
> > > >> >> strings
> > > >> >> > >> not
> > > >> >> > >> > as
> > > >> >> > >> > > > > > objects, but making them objects seems to be the
> > > >> logical OO
> > > >> >> > way
> > > >> >> > >> to
> > > >> >> > >> > > deal
> > > >> >> > >> > > > > > with them in Isis. So they are basically objects
> > with
> > > >> one
> > > >> >> > 'name'
> > > >> >> > >> > > > property
> > > >> >> > >> > > > > > (and maybe an id added by datanucleus). All users
> > need
> > > >> to
> > > >> >> see
> > > >> >> > is
> > > >> >> > >> > the
> > > >> >> > >> > > > name
> > > >> >> > >> > > > > > property, no icon is needed.
> > > >> >> > >> > > > > >
> > > >> >> > >> > > > > > Also, if I make them objects I also will get
> > > referencial
> > > >> >> > >> integrity
> > > >> >> > >> > > > > > constraints applied in the database.
> > > >> >> > >> > > > > >
> > > >> >> > >> > > > > >
> > > >> >> > >> > > > > +1, do it this way. That way they can also hold
> > > >> behaviour in
> > > >> >> > the
> > > >> >> > >> > > future.
> > > >> >> > >> > > > >
> > > >> >> > >> > > > >
> > > >> >> > >> > > > >
> > > >> >> > >> > > > >
> > > >> >> > >> > > > > > I wonder there is a simple recipe for this?
> > > >> >> > >> > > > > >
> > > >> >> > >> > > > >
> > > >> >> > >> > > > > No magic recipe for the domain entities... basically
> > > >> >> > copy-n-paste
> > > >> >> > >> the
> > > >> >> > >> > > > > SimpleObject that's in our archetype as many times
> as
> > > >> needed,
> > > >> >> > and
> > > >> >> > >> > tweak
> > > >> >> > >> > > > as
> > > >> >> > >> > > > > required.
> > > >> >> > >> > > > >
> > > >> >> > >> > > > > If you want to use the code as the primary key, then
> > use
> > > >> DN
> > > >> >> > >> > application
> > > >> >> > >> > > > > identity
> > > >> >> > >> > > > >
> > > >> >> > >> > > > > @javax.jdo.annotations.PersistenceCapable(
> > > >> >> > >> > > > > identityType=IdentityType.APPLICATION,
> > > >> >> > >> > > > > schema = "simple",
> > > >> >> > >> > > > > table = "SimpleObject"
> > > >> >> > >> > > > > )
> > > >> >> > >> > > > >
> > > >> >> > >> > > > > and add @PrimaryKey to the "name" property. Also
> add
> > > >> @Title
> > > >> >> to
> > > >> >> > >> that
> > > >> >> > >> > > > 'name'
> > > >> >> > >> > > > > property (it is in SimpleObject already).
> > > >> >> > >> > > > >
> > > >> >> > >> > > > >
> > > >> >> > >> > > > > You would probably want to remove the version
> column,
> > ie
> > > >> >> remove:
> > > >> >> > >> > > > >
> > > >> >> > >> > > > > @javax.jdo.annotations.Version(
> > > >> >> > >> > > > > strategy=VersionStrategy.VERSION_NUMBER,
> > > >> >> > >> > > > > column="version")
> > > >> >> > >> > > > >
> > > >> >> > >> > > > >
> > > >> >> > >> > > > > In addition, if you annotate the class as "bounded"
> > > >> >> > >> > > > > (@DomainObject(bounded=true)) then you are telling
> the
> > > >> >> framework
> > > >> >> > >> that
> > > >> >> > >> > > > > there's a limited - ie bounded - set of instances,
> and
> > > so
> > > >> it
> > > >> >> > will
> > > >> >> > >> > > display
> > > >> >> > >> > > > > all instances in a drop-down for you.
> > > >> >> > >> > > > >
> > > >> >> > >> > > > >
> > > >> >> > >> > > > > HTH
> > > >> >> > >> > > > > Dan
> > > >> >> > >> > > > >
> > > >> >> > >> > > >
> > > >> >> > >> > >
> > > >> >> > >> >
> > > >> >> > >>
> > > >> >> > >
> > > >> >> > >
> > > >> >> >
> > > >> >>
> > > >> >
> > > >> >
> > > >>
> > > >
> > > >
> > >
> >
>
Re: code-lists and administration thereof
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Glad you got this working for your own app.
Re: kitchensink, did you pull down the latest? I fixed the issues for the
fixture script and the bad config, I believe.
I'll fix that error message talking about "isis.properties" instead of
"persistor_datanucleus.properties", though. (In Isis, it doesn't matter
which of those property files you use; it would be valid to just use
isis.properties for everything, in fact).
On 2 August 2015 at 21:54, Stephen Cameron <st...@gmail.com>
wrote:
> Hi,
>
> Just trying this now, with current version of kitchen sink I got an error
> message starting the webapp, saying that no persistable classes could be
> found and to check value of
> isis.persistor.datanucleus.RegisterEntities.packagePrefix
> in isis.properties, but that key is in isis_datanucleus.properties.
>
> Also errors in running fixture script :(
>
>
> - org.apache.wicket.WicketRuntimeException
> - Method onRequest of interface
> org.apache.wicket.behavior.IBehaviorListener targeted at
> org.apache.wicket.ajax.markup.html.AjaxLink$1@1ac79481 on component
> [AjaxLink [Component id = menuLink]] threw an exception
> -
> org.apache.wicket.RequestListenerInterface#internalInvoke(RequestListenerInterface.java:268)
>
> -
> org.apache.wicket.RequestListenerInterface#invoke(RequestListenerInterface.java:241)
>
> -
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#invokeListener(ListenerInterfaceRequestHandler.java:250)
>
> -
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#respond(ListenerInterfaceRequestHandler.java:236)
>
> -
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor#respond(RequestCycle.java:862)
>
> -
> org.apache.wicket.request.RequestHandlerStack#execute(RequestHandlerStack.java:64)
>
> -
> org.apache.wicket.request.cycle.RequestCycle#execute(RequestCycle.java:261)
>
> -
> org.apache.wicket.request.cycle.RequestCycle#processRequest(RequestCycle.java:218)
>
> -
> org.apache.wicket.request.cycle.RequestCycle#processRequestAndDetach(RequestCycle.java:289)
>
> -
> org.apache.wicket.protocol.http.WicketFilter#processRequestCycle(WicketFilter.java:259)
>
> -
> org.apache.wicket.protocol.http.WicketFilter#processRequest(WicketFilter.java:201)
>
> -
> org.apache.wicket.protocol.http.WicketFilter#doFilter(WicketFilter.java:282)
>
> -
> org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
>
> -
> org.apache.isis.core.webapp.diagnostics.IsisLogOnExceptionFilter#doFilter(IsisLogOnExceptionFilter.java:52)
>
> -
> org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
>
> -
> org.apache.shiro.web.servlet.AbstractShiroFilter#executeChain(AbstractShiroFilter.java:449)
>
> -
> org.apache.shiro.web.servlet.AbstractShiroFilter$1#call(AbstractShiroFilter.java:365)
>
> -
> org.apache.shiro.subject.support.SubjectCallable#doCall(SubjectCallable.java:90)
>
> -
> org.apache.shiro.subject.support.SubjectCallable#call(SubjectCallable.java:83)
>
> -
> org.apache.shiro.subject.support.DelegatingSubject#execute(DelegatingSubject.java:383)
>
> -
> org.apache.shiro.web.servlet.AbstractShiroFilter#doFilterInternal(AbstractShiroFilter.java:362)
>
> -
> org.apache.shiro.web.servlet.OncePerRequestFilter#doFilter(OncePerRequestFilter.java:125)
>
> -
> org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
>
> -
> org.mortbay.jetty.servlet.ServletHandler#handle(ServletHandler.java:399)
>
> -
> org.mortbay.jetty.security.SecurityHandler#handle(SecurityHandler.java:216)
>
> -
> org.mortbay.jetty.servlet.SessionHandler#handle(SessionHandler.java:182)
>
> -
> org.mortbay.jetty.handler.ContextHandler#handle(ContextHandler.java:766)
>
> - org.mortbay.jetty.webapp.WebAppContext#handle(WebAppContext.java:450)
> -
> org.mortbay.jetty.handler.ContextHandlerCollection#handle(ContextHandlerCollection.java:230)
>
> -
> org.mortbay.jetty.handler.HandlerCollection#handle(HandlerCollection.java:114)
>
> -
> org.mortbay.jetty.handler.HandlerWrapper#handle(HandlerWrapper.java:152)
>
> - org.mortbay.jetty.Server#handle(Server.java:326)
> -
> org.mortbay.jetty.HttpConnection#handleRequest(HttpConnection.java:542)
>
> -
> org.mortbay.jetty.HttpConnection$RequestHandler#headerComplete(HttpConnection.java:928)
>
> - org.mortbay.jetty.HttpParser#parseNext(HttpParser.java:549)
> - org.mortbay.jetty.HttpParser#parseAvailable(HttpParser.java:212)
> - org.mortbay.jetty.HttpConnection#handle(HttpConnection.java:404)
> -
> org.mortbay.io.nio.SelectChannelEndPoint#run(SelectChannelEndPoint.java:410)
>
> -
> org.mortbay.thread.QueuedThreadPool$PoolThread#run(QueuedThreadPool.java:582)
>
> -
> - Caused by:
> -
> - java.lang.reflect.InvocationTargetException
> -
> - sun.reflect.GeneratedMethodAccessor98#invoke(null:-1)
> -
> sun.reflect.DelegatingMethodAccessorImpl#invoke(DelegatingMethodAccessorImpl.java:43)
>
> - java.lang.reflect.Method#invoke(Method.java:497)
> -
> org.apache.wicket.RequestListenerInterface#internalInvoke(RequestListenerInterface.java:258)
>
> -
> org.apache.wicket.RequestListenerInterface#invoke(RequestListenerInterface.java:241)
>
> -
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#invokeListener(ListenerInterfaceRequestHandler.java:250)
>
> -
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#respond(ListenerInterfaceRequestHandler.java:236)
>
> -
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor#respond(RequestCycle.java:862)
>
> -
> org.apache.wicket.request.RequestHandlerStack#execute(RequestHandlerStack.java:64)
>
> -
> org.apache.wicket.request.cycle.RequestCycle#execute(RequestCycle.java:261)
>
> -
> org.apache.wicket.request.cycle.RequestCycle#processRequest(RequestCycle.java:218)
>
> -
> org.apache.wicket.request.cycle.RequestCycle#processRequestAndDetach(RequestCycle.java:289)
>
> -
> org.apache.wicket.protocol.http.WicketFilter#processRequestCycle(WicketFilter.java:259)
>
> -
> org.apache.wicket.protocol.http.WicketFilter#processRequest(WicketFilter.java:201)
>
> -
> org.apache.wicket.protocol.http.WicketFilter#doFilter(WicketFilter.java:282)
>
> -
> org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
>
> -
> org.apache.isis.core.webapp.diagnostics.IsisLogOnExceptionFilter#doFilter(IsisLogOnExceptionFilter.java:52)
>
> -
> org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
>
> -
> org.apache.shiro.web.servlet.AbstractShiroFilter#executeChain(AbstractShiroFilter.java:449)
>
> -
> org.apache.shiro.web.servlet.AbstractShiroFilter$1#call(AbstractShiroFilter.java:365)
>
> -
> org.apache.shiro.subject.support.SubjectCallable#doCall(SubjectCallable.java:90)
>
> -
> org.apache.shiro.subject.support.SubjectCallable#call(SubjectCallable.java:83)
>
> -
> org.apache.shiro.subject.support.DelegatingSubject#execute(DelegatingSubject.java:383)
>
> -
> org.apache.shiro.web.servlet.AbstractShiroFilter#doFilterInternal(AbstractShiroFilter.java:362)
>
> -
> org.apache.shiro.web.servlet.OncePerRequestFilter#doFilter(OncePerRequestFilter.java:125)
>
> -
> org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
>
> -
> org.mortbay.jetty.servlet.ServletHandler#handle(ServletHandler.java:399)
>
> -
> org.mortbay.jetty.security.SecurityHandler#handle(SecurityHandler.java:216)
>
> -
> org.mortbay.jetty.servlet.SessionHandler#handle(SessionHandler.java:182)
>
> -
> org.mortbay.jetty.handler.ContextHandler#handle(ContextHandler.java:766)
>
> - org.mortbay.jetty.webapp.WebAppContext#handle(WebAppContext.java:450)
> -
> org.mortbay.jetty.handler.ContextHandlerCollection#handle(ContextHandlerCollection.java:230)
>
> -
> org.mortbay.jetty.handler.HandlerCollection#handle(HandlerCollection.java:114)
>
> -
> org.mortbay.jetty.handler.HandlerWrapper#handle(HandlerWrapper.java:152)
>
> - org.mortbay.jetty.Server#handle(Server.java:326)
> -
> org.mortbay.jetty.HttpConnection#handleRequest(HttpConnection.java:542)
>
> -
> org.mortbay.jetty.HttpConnection$RequestHandler#headerComplete(HttpConnection.java:928)
>
> - org.mortbay.jetty.HttpParser#parseNext(HttpParser.java:549)
> - org.mortbay.jetty.HttpParser#parseAvailable(HttpParser.java:212)
> - org.mortbay.jetty.HttpConnection#handle(HttpConnection.java:404)
> -
> org.mortbay.io.nio.SelectChannelEndPoint#run(SelectChannelEndPoint.java:410)
>
> -
> org.mortbay.thread.QueuedThreadPool$PoolThread#run(QueuedThreadPool.java:582)
>
> -
> - Caused by:
> -
> - java.lang.IllegalArgumentException
> - argument type mismatch
> -
> sun.reflect.NativeMethodAccessorImpl#invoke0(NativeMethodAccessorImpl.java:-2)
>
> -
> sun.reflect.NativeMethodAccessorImpl#invoke(NativeMethodAccessorImpl.java:62)
>
> -
> sun.reflect.DelegatingMethodAccessorImpl#invoke(DelegatingMethodAccessorImpl.java:43)
>
> - java.lang.reflect.Method#invoke(Method.java:497)
> -
> org.apache.isis.applib.fixturescripts.FixtureScript#setParam(FixtureScript.java:689)
>
> -
> org.apache.isis.applib.fixturescripts.FixtureScript#defaultParam(FixtureScript.java:631)
>
> -
> org.isisaddons.app.kitchensink.fixture.primitive.PrimitiveObjectsFixture#execute(PrimitiveObjectsFixture.java:133)
>
> -
> org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#executeChildIfNotAlready(FixtureScript.java:549)
>
> -
> org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#executeChildT(FixtureScript.java:528)
>
> -
> org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#executeChildT(FixtureScript.java:498)
>
> -
> org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#executeChild(FixtureScript.java:487)
>
> -
> org.isisaddons.app.kitchensink.fixture.KitchensinkSetupFixture#execute(KitchensinkSetupFixture.java:62)
>
> -
> org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#executeChildIfNotAlready(FixtureScript.java:549)
>
> -
> org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#access$200(FixtureScript.java:248)
>
> -
> org.apache.isis.applib.fixturescripts.FixtureScript#run(FixtureScript.java:719)
>
> -
> org.isisaddons.app.kitchensink.fixture.KitchensinkFixturesService#installFixturesAndReturnFirst(KitchensinkFixturesService.java:95)
>
> -
> sun.reflect.NativeMethodAccessorImpl#invoke0(NativeMethodAccessorImpl.java:-2)
>
> -
> sun.reflect.NativeMethodAccessorImpl#invoke(NativeMethodAccessorImpl.java:62)
>
> -
> sun.reflect.DelegatingMethodAccessorImpl#invoke(DelegatingMethodAccessorImpl.java:43)
>
> - java.lang.reflect.Method#invoke(Method.java:497)
> -
> org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract#internalInvoke(ActionInvocationFacetForDomainEventAbstract.java:356)
>
> -
> org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract#invoke(ActionInvocationFacetForDomainEventAbstract.java:196)
>
> -
> org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1#execute(ActionInvocationFacetWrapTransaction.java:57)
>
> -
> org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1#execute(ActionInvocationFacetWrapTransaction.java:54)
>
> -
> org.apache.isis.core.runtime.system.transaction.IsisTransactionManager#executeWithinTransaction(IsisTransactionManager.java:205)
>
> -
> org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction#invoke(ActionInvocationFacetWrapTransaction.java:54)
>
> -
> org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionImpl#execute(ObjectActionImpl.java:367)
>
> -
> org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionImpl#executeWithRuleChecking(ObjectActionImpl.java:358)
>
> -
> org.apache.isis.viewer.wicket.model.models.ActionModel#executeAction(ActionModel.java:467)
>
> -
> org.apache.isis.viewer.wicket.model.models.ActionModel#load(ActionModel.java:447)
>
> -
> org.apache.isis.viewer.wicket.model.models.ActionModel#load(ActionModel.java:80)
>
> -
> org.apache.wicket.model.LoadableDetachableModel#getObject(LoadableDetachableModel.java:121)
>
> -
> org.apache.isis.viewer.wicket.model.models.ActionModel#executeHandlingApplicationExceptions(ActionModel.java:543)
>
> -
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel#executeActionOnTargetAndProcessResults(ActionPanel.java:245)
>
> -
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel#executeActionAndProcessResults(ActionPanel.java:193)
>
> -
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel#buildGui(ActionPanel.java:104)
>
> -
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel#<init>(ActionPanel.java:82)
>
> -
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanelFactory#createComponent(ActionPanelFactory.java:49)
>
> -
> org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault#createComponent(ComponentFactoryRegistryDefault.java:128)
>
> -
> org.apache.isis.viewer.wicket.ui.components.widgets.linkandlabel.ActionLinkFactoryAbstract$1#onClick(ActionLinkFactoryAbstract.java:74)
>
> -
> org.apache.wicket.ajax.markup.html.AjaxLink$1#onEvent(AjaxLink.java:86)
>
> -
> org.apache.wicket.ajax.AjaxEventBehavior#respond(AjaxEventBehavior.java:124)
>
> -
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#onRequest(AbstractDefaultAjaxBehavior.java:633)
>
> - sun.reflect.GeneratedMethodAccessor98#invoke(null:-1)
> -
> sun.reflect.DelegatingMethodAccessorImpl#invoke(DelegatingMethodAccessorImpl.java:43)
>
> - java.lang.reflect.Method#invoke(Method.java:497)
> -
> org.apache.wicket.RequestListenerInterface#internalInvoke(RequestListenerInterface.java:258)
>
> -
> org.apache.wicket.RequestListenerInterface#invoke(RequestListenerInterface.java:241)
>
> -
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#invokeListener(ListenerInterfaceRequestHandler.java:250)
>
> -
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#respond(ListenerInterfaceRequestHandler.java:236)
>
> -
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor#respond(RequestCycle.java:862)
>
> -
> org.apache.wicket.request.RequestHandlerStack#execute(RequestHandlerStack.java:64)
>
> -
> org.apache.wicket.request.cycle.RequestCycle#execute(RequestCycle.java:261)
>
> -
> org.apache.wicket.request.cycle.RequestCycle#processRequest(RequestCycle.java:218)
>
> -
> org.apache.wicket.request.cycle.RequestCycle#processRequestAndDetach(RequestCycle.java:289)
>
> -
> org.apache.wicket.protocol.http.WicketFilter#processRequestCycle(WicketFilter.java:259)
>
> -
> org.apache.wicket.protocol.http.WicketFilter#processRequest(WicketFilter.java:201)
>
> -
> org.apache.wicket.protocol.http.WicketFilter#doFilter(WicketFilter.java:282)
>
> -
> org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
>
> -
> org.apache.isis.core.webapp.diagnostics.IsisLogOnExceptionFilter#doFilter(IsisLogOnExceptionFilter.java:52)
>
> -
> org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
>
> -
> org.apache.shiro.web.servlet.AbstractShiroFilter#executeChain(AbstractShiroFilter.java:449)
>
> -
> org.apache.shiro.web.servlet.AbstractShiroFilter$1#call(AbstractShiroFilter.java:365)
>
> -
> org.apache.shiro.subject.support.SubjectCallable#doCall(SubjectCallable.java:90)
>
> -
> org.apache.shiro.subject.support.SubjectCallable#call(SubjectCallable.java:83)
>
> -
> org.apache.shiro.subject.support.DelegatingSubject#execute(DelegatingSubject.java:383)
>
> -
> org.apache.shiro.web.servlet.AbstractShiroFilter#doFilterInternal(AbstractShiroFilter.java:362)
>
> -
> org.apache.shiro.web.servlet.OncePerRequestFilter#doFilter(OncePerRequestFilter.java:125)
>
> -
> org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
>
> -
> org.mortbay.jetty.servlet.ServletHandler#handle(ServletHandler.java:399)
>
> -
> org.mortbay.jetty.security.SecurityHandler#handle(SecurityHandler.java:216)
>
> -
> org.mortbay.jetty.servlet.SessionHandler#handle(SessionHandler.java:182)
>
> -
> org.mortbay.jetty.handler.ContextHandler#handle(ContextHandler.java:766)
>
> - org.mortbay.jetty.webapp.WebAppContext#handle(WebAppContext.java:450)
> -
> org.mortbay.jetty.handler.ContextHandlerCollection#handle(ContextHandlerCollection.java:230)
>
> -
> org.mortbay.jetty.handler.HandlerCollection#handle(HandlerCollection.java:114)
>
> -
> org.mortbay.jetty.handler.HandlerWrapper#handle(HandlerWrapper.java:152)
>
> - org.mortbay.jetty.Server#handle(Server.java:326)
> -
> org.mortbay.jetty.HttpConnection#handleRequest(HttpConnection.java:542)
>
> -
> org.mortbay.jetty.HttpConnection$RequestHandler#headerComplete(HttpConnection.java:928)
>
> - org.mortbay.jetty.HttpParser#parseNext(HttpParser.java:549)
> - org.mortbay.jetty.HttpParser#parseAvailable(HttpParser.java:212)
> - org.mortbay.jetty.HttpConnection#handle(HttpConnection.java:404)
> -
> org.mortbay.io.nio.SelectChannelEndPoint#run(SelectChannelEndPoint.java:410)
>
> -
> org.mortbay.thread.QueuedThreadPool$PoolThread#run(QueuedThreadPool.java:582
>
>
>
>
> On Sun, Aug 2, 2015 at 11:23 PM, Dan Haywood <dan@haywood-associates.co.uk
> >
> wrote:
>
> > Further to this, I've updated the kitchensink (against 1.9.0-SNAPSHOT) to
> > demonstrate this technique....
> >
> > The code is in ReferenceObject, which you can get to from the "Data
> Types"
> > menu. Use the fixture scripts menu to create some sample data.
> >
> > The relevant code is below.
> >
> > Cheers
> > Dan
> >
> > [1] https://github.com/isisaddons/isis-app-kitchensink
> >
> >
> > private OtherObject someOtherObjectUsingName;
> >
> > @Property(hidden = Where.EVERYWHERE)
> > @Column(allowsNull = "true")
> > public OtherObject getSomeOtherObjectUsingName() {
> > return someOtherObjectUsingName;
> > }
> >
> > public void setSomeOtherObjectUsingName(final OtherObject
> > someOtherObjectUsingName) {
> > this.someOtherObjectUsingName = someOtherObjectUsingName;
> > }
> >
> > @NotPersistent
> > public String getSomeOtherObjectUsingNameName() {
> > return getSomeOtherObjectUsingName() != null?
> > getSomeOtherObjectUsingName().getName() : null;
> > }
> >
> > public void setSomeOtherObjectUsingNameName(final String name) {
> > OtherObject otherObject = name != null
> > ? container.firstMatch(OtherObject.class, withName(name))
> > : null;
> > setSomeOtherObjectUsingName(otherObject);
> > }
> >
> > public List<String> choicesSomeOtherObjectUsingNameName() {
> > List<OtherObject> otherObjects =
> > container.allInstances(OtherObject.class);
> > return Lists.newArrayList(
> > Iterables.transform(otherObjects, nameOf())
> > );
> > }
> >
> > private static Function<OtherObject, String> nameOf() {
> > return new Function<OtherObject, String>() {
> > @Nullable @Override public String apply(final OtherObject
> > input) {
> > return input.getName();
> > }
> > };
> > }
> >
> > private static Predicate<OtherObject> withName(final String name) {
> > return new Predicate<OtherObject>() {
> > @Override public boolean apply(final OtherObject input) {
> > return Objects.equal(input.getName(), name);
> > }
> > };
> > }
> >
> >
> >
> >
> >
> > On 30 July 2015 at 13:16, Dan Haywood <da...@haywood-associates.co.uk>
> > wrote:
> >
> > > looks right to me, so I'll take a look at in this eve or tomorrow.
> > >
> > > thx
> > > Dan
> > >
> > >
> > > On 30 July 2015 at 13:12, Stephen Cameron <st...@gmail.com>
> > > wrote:
> > >
> > >> Still no luck with this one.
> > >>
> > >> The derived RegionName appears as a non-editable property, so not sure
> > >> what
> > >> was different before when I was getting an model validation error.
> > >>
> > >> My current code of interest is this:
> > >>
> > >> @Column(name = "region", allowsNull = "true")
> > >> //@MemberOrder(sequence = "7")
> > >> @Property(hidden=Where.EVERYWHERE)
> > >> public Region getRegion() {
> > >> return this.region;
> > >> }
> > >>
> > >> public void setRegion(Region region) {
> > >> this.region = region;
> > >> }
> > >>
> > >> public List<Region> choicesRegion() {
> > >> return regions.listAllRegions();
> > >> }
> > >>
> > >> @MemberOrder(sequence = "7")
> > >> public String getRegionName() {
> > >> return regions.nameForRegion(getRegion());
> > >> }
> > >>
> > >> public void setRegionName(String name) {
> > >> setRegion(regions.regionForName(name));
> > >> }
> > >>
> > >> public List<String> choicesRegionName(){
> > >> return regions.listAllNamesExclusive(getRegion());
> > >> }
> > >>
> > >> My Region class is this:
> > >>
> > >> package au.com.scds.chats.dom.modules.general.codes;
> > >>
> > >> import javax.jdo.annotations.Column;
> > >> import javax.jdo.annotations.IdentityType;
> > >> import javax.jdo.annotations.PrimaryKey;
> > >>
> > >> import org.apache.isis.applib.annotation.Action;
> > >> import org.apache.isis.applib.annotation.ActionLayout;
> > >> import org.apache.isis.applib.annotation.DomainServiceLayout;
> > >> import org.apache.isis.applib.annotation.DomainServiceLayout.MenuBar;
> > >> import org.apache.isis.applib.annotation.MemberOrder;
> > >> import org.apache.isis.applib.annotation.PropertyLayout;
> > >>
> > >> @javax.jdo.annotations.PersistenceCapable(
> > >> identityType=IdentityType.APPLICATION)
> > >> public class Region {
> > >>
> > >> public String title(){
> > >> return getName();
> > >> }
> > >>
> > >> private String name;
> > >>
> > >> @Column(name="region", allowsNull = "false")
> > >> @PrimaryKey()
> > >> @PropertyLayout(named="Region")
> > >> @MemberOrder(sequence="1")
> > >> public String getName() {
> > >> return name;
> > >> }
> > >>
> > >> public void setName(String name) {
> > >> this.name = name;
> > >> }
> > >> }
> > >>
> > >> My Regions repository class is this:
> > >>
> > >> package au.com.scds.chats.dom.modules.general.codes;
> > >>
> > >> import java.util.ArrayList;
> > >> import java.util.List;
> > >>
> > >> import org.apache.isis.applib.DomainObjectContainer;
> > >> import org.apache.isis.applib.annotation.Action;
> > >> import org.apache.isis.applib.annotation.ActionLayout;
> > >> import org.apache.isis.applib.annotation.BookmarkPolicy;
> > >> import org.apache.isis.applib.annotation.DomainService;
> > >> import org.apache.isis.applib.annotation.DomainServiceLayout;
> > >> import org.apache.isis.applib.annotation.DomainServiceLayout.MenuBar;
> > >> import org.apache.isis.applib.annotation.MemberOrder;
> > >> import org.apache.isis.applib.annotation.ParameterLayout;
> > >> import org.apache.isis.applib.annotation.Programmatic;
> > >> import org.apache.isis.applib.annotation.SemanticsOf;
> > >> import org.apache.isis.applib.query.QueryDefault;
> > >>
> > >> import au.com.scds.chats.dom.modules.participant.Participant;
> > >>
> > >> @DomainService(repositoryFor = Region.class)
> > >> @DomainServiceLayout(menuBar = MenuBar.SECONDARY, named =
> > >> "Administration",
> > >> menuOrder = "100.1")
> > >> public class Regions {
> > >>
> > >> // region > listAll (action)
> > >> @Action(semantics = SemanticsOf.SAFE)
> > >> @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT)
> > >> @MemberOrder(sequence = "1")
> > >> public List<Region> listAllRegions() {
> > >> return container.allInstances(Region.class);
> > >> }
> > >>
> > >> // endregion
> > >>
> > >> // region > create (action)
> > >> @MemberOrder(sequence = "2")
> > >> public Region createRegion(
> > >> final @ParameterLayout(named = "Region Name") String
> name) {
> > >> final Region obj =
> container.newTransientInstance(Region.class);
> > >> obj.setName(name);
> > >> container.persistIfNotAlready(obj);
> > >> return obj;
> > >> }
> > >>
> > >> // endregion
> > >>
> > >> // region > injected services
> > >>
> > >> @javax.inject.Inject
> > >> DomainObjectContainer container;
> > >>
> > >> // endregion
> > >>
> > >> @Programmatic
> > >> public String nameForRegion(Region region) {
> > >> return (region != null) ? region.getName() : null;
> > >> }
> > >>
> > >>
> > >> @Programmatic
> > >> public List<String> listAllNamesExclusive(Region region) {
> > >> List<Region> regions = listAllRegions();
> > >> List<String> names = new ArrayList<String>();
> > >> for (Region r : regions) {
> > >> if (region != null && r != region) {
> > >> names.add(r.getName());
> > >> }
> > >> }
> > >> return names;
> > >> }
> > >>
> > >>
> > >> @Programmatic
> > >> public Region regionForName(String name) {
> > >> Region region = container.firstMatch(new QueryDefault<>(
> > >> Region.class,
> > >> "findRegion", "name", name));
> > >> return region;
> > >> }
> > >>
> > >> }
> > >>
> > >> Just maybe I there is something missing still?
> > >>
> > >> I added a @Property annotation to the getRegionName() method, but that
> > >> gave
> > >> me a message saying it expected @javax.jdo.persistence.Column too.
> > >>
> > >> Note I couldn't use deprecated @Hidden in Isis 1.9.0.
> > >>
> > >>
> > >> On Thu, Jul 30, 2015 at 8:14 PM, Stephen Cameron <
> > >> steve.cameron.62@gmail.com
> > >> > wrote:
> > >>
> > >> > Hi Dan, When I tried this I got an model validation error message
> > >> relating
> > >> > to the choices method, I will have another go and if it fails,
> provide
> > >> the
> > >> > test case. Thanks for the tips.
> > >> >
> > >> > On Thu, Jul 30, 2015 at 7:57 PM, Dan Haywood <
> > >> dan@haywood-associates.co.uk
> > >> > > wrote:
> > >> >
> > >> >> You should be able to add a choicesXxx() for the derived property:
> > >> >>
> > >> >> public List<String> choicesRegionName(){
> > >> >> return
> > Lists.newArrayList(Iterables.transform(choicesRegion(),
> > >> x
> > >> >> ->
> > >> >> x.getName()));
> > >> >> }
> > >> >>
> > >> >> If that isn't sufficient, you might also need to add a setter:
> > >> >>
> > >> >> public void setRegionName(final String name) {
> > >> >> setRegion(Iterables.find(choicesRegion(), x ->
> > >> x.getName().equals(name)));
> > >> >> }
> > >> >>
> > >> >> Obviously, you might need to also add some error handling.
> > >> >>
> > >> >> ~~~
> > >> >>
> > >> >> Regarding the "external URL" idea, perhaps you could raise that as
> a
> > >> >> separate ticket, with a code sketch as to how you'd like this
> > >> information
> > >> >> specified?
> > >> >>
> > >> >> Thanks
> > >> >> Dan
> > >> >>
> > >> >>
> > >> >>
> > >> >>
> > >> >>
> > >> >> On 30 July 2015 at 03:17, Stephen Cameron <
> > steve.cameron.62@gmail.com>
> > >> >> wrote:
> > >> >>
> > >> >> > Not so simple, as now the property cannot be updated.
> > >> >> >
> > >> >> > I have the following (@Hidden is deprecated)
> > >> >> >
> > >> >> > @Column(allowsNull = "true")
> > >> >> > @MemberOrder(sequence = "7")
> > >> >> > @PropertyLayout(hidden=Where.EVERYWHERE)
> > >> >> > public Region getRegion() {
> > >> >> > return this.region;
> > >> >> > }
> > >> >> >
> > >> >> > public void setRegion(Region region) {
> > >> >> > this.region = region;
> > >> >> > }
> > >> >> >
> > >> >> > public List<Region> choicesRegion(){
> > >> >> > List<Region> regions =
> > container.allInstances(Region.class);
> > >> >> > return regions;
> > >> >> > }
> > >> >> >
> > >> >> > @MemberOrder(sequence = "7.1")
> > >> >> > public String getRegionName(){
> > >> >> > return (getRegion() != null) ? getRegion().getName() :
> > null;
> > >> >> > }
> > >> >> >
> > >> >> > Sure enough getRegion doesn't appear in the UI but getRegionName
> > >> does,
> > >> >> but
> > >> >> > then setRegion and choiceRegion don't mean anything to the UI, so
> > the
> > >> >> > Region property is read-only.
> > >> >> >
> > >> >> > This issue is maybe more significant than it appears at first, in
> > >> terms
> > >> >> of
> > >> >> > domain modelling such code-lists are simple types that
> 'represent'
> > >> >> things
> > >> >> > on the boundary of the domain of interest. So we usually want to
> > just
> > >> >> > represent them with a name. Presently it makes no sense to go to
> > that
> > >> >> thing
> > >> >> > via a hyperlink as all we'll find is that name, our model extends
> > no
> > >> >> > further.
> > >> >> >
> > >> >> > However we just might like to allow users to leave the domain
> model
> > >> and
> > >> >> go
> > >> >> > to a resource outside. So, extending the suppressLink=true idea,
> I
> > >> would
> > >> >> > add that each object could have an implicit link(URL),created by
> > >> Isis,
> > >> >> or
> > >> >> > an explicit one and if the explicit one is present it can
> > optionally
> > >> be
> > >> >> > used as an alternative to the implicit one.
> > >> >> >
> > >> >> > For example, you might create a database to log fish details,
> > species
> > >> >> is a
> > >> >> > boundary concept, we aren't likely to want to add a new species
> to
> > >> the
> > >> >> list
> > >> >> > of known species, but we'd like to keep such a list handy, but
> for
> > >> each
> > >> >> > named species in that list, to provide an explicit link to a
> > resource
> > >> >> in a
> > >> >> > global fish database. It makes more sense to use this link than
> the
> > >> >> > implicit one, as if the implicit one is used we'd navigate to the
> > >> domain
> > >> >> > object page displaying the name and URL, both of which items of
> > data
> > >> >> could
> > >> >> > have been in the explicit link.
> > >> >> >
> > >> >> > In the explicit case you might want to warn the user they are
> > >> navigating
> > >> >> > outside the Isis domain application.
> > >> >> >
> > >> >> > Perhaps all this could be done simply if there was a URI type in
> > >> Isis,
> > >> >> that
> > >> >> > would allow it to create 'smart links' automatically.
> > >> >> >
> > >> >> >
> > >> >> >
> > >> >> >
> > >> >> >
> > >> >> > On Wed, Jul 29, 2015 at 9:37 PM, Stephen Cameron <
> > >> >> > steve.cameron.62@gmail.com
> > >> >> > > wrote:
> > >> >> >
> > >> >> > > Thanks Jeroen, seems simple enough :)
> > >> >> > >
> > >> >> > > On Wed, Jul 29, 2015 at 9:28 PM, Jeroen van der Wal <
> > >> >> jeroen@stromboli.it
> > >> >> > >
> > >> >> > > wrote:
> > >> >> > >
> > >> >> > >> You could also hide the property and create a separate getter
> > for
> > >> >> > display
> > >> >> > >> purposes only:
> > >> >> > >>
> > >> >> > >> private MyProperty myProperty;
> > >> >> > >>
> > >> >> > >> @Hidden
> > >> >> > >> public MyProperty getMyProperty() {...}
> > >> >> > >>
> > >> >> > >> public void setMyProperty(...) {...}
> > >> >> > >>
> > >> >> > >> public String getMyPropertyName() {
> > >> >> > >> getMyProperty.getName();
> > >> >> > >> }
> > >> >> > >>
> > >> >> > >> On 29 July 2015 at 13:18, Stephen Cameron <
> > >> >> steve.cameron.62@gmail.com>
> > >> >> > >> wrote:
> > >> >> > >>
> > >> >> > >> > On Wed, Jul 29, 2015 at 6:38 PM, Dan Haywood <
> > >> >> > >> dan@haywood-associates.co.uk
> > >> >> > >> > >
> > >> >> > >> > wrote:
> > >> >> > >> >
> > >> >> > >> > > You are right, they will be displayed as links; there's no
> > >> way to
> > >> >> > >> disable
> > >> >> > >> > > it currently.
> > >> >> > >> > >
> > >> >> > >> > > We could add a bit of metadata perhaps for this, eg
> > >> >> > >> > > @DomainObjectLayout(suppressLink=true) or similar.
> > >> >> > >> > >
> > >> >> > >> > > Please raise a ticket.
> > >> >> > >> > >
> > >> >> > >> >
> > >> >> > >> > OK https://issues.apache.org/jira/browse/ISIS-1180
> > >> >> > >> >
> > >> >> > >> > >
> > >> >> > >> > > Thx
> > >> >> > >> > > Dan
> > >> >> > >> > >
> > >> >> > >> > > PS: these entities wouldn't be value types, rather regular
> > >> >> entities.
> > >> >> > >> But
> > >> >> > >> > > you are right... what we really want is full-class support
> > for
> > >> >> value
> > >> >> > >> > types.
> > >> >> > >> > > We're just not there yet...
> > >> >> > >> > >
> > >> >> > >> > >
> > >> >> > >> > >
> > >> >> > >> >
> > >> >> > >> > >
> > >> >> > >> > >
> > >> >> > >> > > On 29 July 2015 at 09:34, Stephen Cameron <
> > >> >> > steve.cameron.62@gmail.com
> > >> >> > >> >
> > >> >> > >> > > wrote:
> > >> >> > >> > >
> > >> >> > >> > > > Thanks, but surely such object properties always end up
> > >> being
> > >> >> > >> displayed
> > >> >> > >> > > as
> > >> >> > >> > > > links? Clicking on the link to go to such an object page
> > is
> > >> >> > >> > meaningless,
> > >> >> > >> > > as
> > >> >> > >> > > > it only has one name property, that was displayed in the
> > >> link.
> > >> >> > Can I
> > >> >> > >> > > > disable that default behaviour for value types?
> > >> >> > >> > > >
> > >> >> > >> > > >
> > >> >> > >> > > >
> > >> >> > >> > > > On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <
> > >> >> > >> > > dan@haywood-associates.co.uk
> > >> >> > >> > > > >
> > >> >> > >> > > > wrote:
> > >> >> > >> > > >
> > >> >> > >> > > > > On 29 July 2015 at 08:08, Stephen Cameron <
> > >> >> > >> > steve.cameron.62@gmail.com>
> > >> >> > >>
> > >> >> > >> > > > > wrote:
> > >> >> > >> > > > >
> > >> >> > >> > > > > > Hi,
> > >> >> > >> > > > > >
> > >> >> > >> > > > > > I want to do have some properties that are
> essentially
> > >> >> String
> > >> >> > >> > types,
> > >> >> > >> > > > but
> > >> >> > >> > > > > > which have a limited range of values (code-lists or
> > >> >> restricted
> > >> >> > >> > > > > > vocabularies). I want to allow these lists to be
> > >> >> administered
> > >> >> > >> > > > centrally,
> > >> >> > >> > > > > so
> > >> >> > >> > > > > > to add them to a single Administration menu item for
> > >> admin
> > >> >> > >> users.
> > >> >> > >> > > > > >
> > >> >> > >> > > > > > For most users these codes should appears as lists
> of
> > >> >> strings
> > >> >> > >> not
> > >> >> > >> > as
> > >> >> > >> > > > > > objects, but making them objects seems to be the
> > >> logical OO
> > >> >> > way
> > >> >> > >> to
> > >> >> > >> > > deal
> > >> >> > >> > > > > > with them in Isis. So they are basically objects
> with
> > >> one
> > >> >> > 'name'
> > >> >> > >> > > > property
> > >> >> > >> > > > > > (and maybe an id added by datanucleus). All users
> need
> > >> to
> > >> >> see
> > >> >> > is
> > >> >> > >> > the
> > >> >> > >> > > > name
> > >> >> > >> > > > > > property, no icon is needed.
> > >> >> > >> > > > > >
> > >> >> > >> > > > > > Also, if I make them objects I also will get
> > referencial
> > >> >> > >> integrity
> > >> >> > >> > > > > > constraints applied in the database.
> > >> >> > >> > > > > >
> > >> >> > >> > > > > >
> > >> >> > >> > > > > +1, do it this way. That way they can also hold
> > >> behaviour in
> > >> >> > the
> > >> >> > >> > > future.
> > >> >> > >> > > > >
> > >> >> > >> > > > >
> > >> >> > >> > > > >
> > >> >> > >> > > > >
> > >> >> > >> > > > > > I wonder there is a simple recipe for this?
> > >> >> > >> > > > > >
> > >> >> > >> > > > >
> > >> >> > >> > > > > No magic recipe for the domain entities... basically
> > >> >> > copy-n-paste
> > >> >> > >> the
> > >> >> > >> > > > > SimpleObject that's in our archetype as many times as
> > >> needed,
> > >> >> > and
> > >> >> > >> > tweak
> > >> >> > >> > > > as
> > >> >> > >> > > > > required.
> > >> >> > >> > > > >
> > >> >> > >> > > > > If you want to use the code as the primary key, then
> use
> > >> DN
> > >> >> > >> > application
> > >> >> > >> > > > > identity
> > >> >> > >> > > > >
> > >> >> > >> > > > > @javax.jdo.annotations.PersistenceCapable(
> > >> >> > >> > > > > identityType=IdentityType.APPLICATION,
> > >> >> > >> > > > > schema = "simple",
> > >> >> > >> > > > > table = "SimpleObject"
> > >> >> > >> > > > > )
> > >> >> > >> > > > >
> > >> >> > >> > > > > and add @PrimaryKey to the "name" property. Also add
> > >> @Title
> > >> >> to
> > >> >> > >> that
> > >> >> > >> > > > 'name'
> > >> >> > >> > > > > property (it is in SimpleObject already).
> > >> >> > >> > > > >
> > >> >> > >> > > > >
> > >> >> > >> > > > > You would probably want to remove the version column,
> ie
> > >> >> remove:
> > >> >> > >> > > > >
> > >> >> > >> > > > > @javax.jdo.annotations.Version(
> > >> >> > >> > > > > strategy=VersionStrategy.VERSION_NUMBER,
> > >> >> > >> > > > > column="version")
> > >> >> > >> > > > >
> > >> >> > >> > > > >
> > >> >> > >> > > > > In addition, if you annotate the class as "bounded"
> > >> >> > >> > > > > (@DomainObject(bounded=true)) then you are telling the
> > >> >> framework
> > >> >> > >> that
> > >> >> > >> > > > > there's a limited - ie bounded - set of instances, and
> > so
> > >> it
> > >> >> > will
> > >> >> > >> > > display
> > >> >> > >> > > > > all instances in a drop-down for you.
> > >> >> > >> > > > >
> > >> >> > >> > > > >
> > >> >> > >> > > > > HTH
> > >> >> > >> > > > > Dan
> > >> >> > >> > > > >
> > >> >> > >> > > >
> > >> >> > >> > >
> > >> >> > >> >
> > >> >> > >>
> > >> >> > >
> > >> >> > >
> > >> >> >
> > >> >>
> > >> >
> > >> >
> > >>
> > >
> > >
> >
>
Re: code-lists and administration thereof
Posted by Stephen Cameron <st...@gmail.com>.
This works nicely in my application.
Thanks Dan
On Mon, Aug 3, 2015 at 6:54 AM, Stephen Cameron <st...@gmail.com>
wrote:
> Hi,
>
> Just trying this now, with current version of kitchen sink I got an error
> message starting the webapp, saying that no persistable classes could be
> found and to check value of
> isis.persistor.datanucleus.RegisterEntities.packagePrefix
> in isis.properties, but that key is in isis_datanucleus.properties.
>
> Also errors in running fixture script :(
>
>
> - org.apache.wicket.WicketRuntimeException
> - Method onRequest of interface
> org.apache.wicket.behavior.IBehaviorListener targeted at
> org.apache.wicket.ajax.markup.html.AjaxLink$1@1ac79481 on component
> [AjaxLink [Component id = menuLink]] threw an exception
> - org.apache.wicket.RequestListenerInterface#internalInvoke(RequestListenerInterface.java:268)
>
> - org.apache.wicket.RequestListenerInterface#invoke(RequestListenerInterface.java:241)
>
> - org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#invokeListener(ListenerInterfaceRequestHandler.java:250)
>
> - org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#respond(ListenerInterfaceRequestHandler.java:236)
>
> - org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor#respond(RequestCycle.java:862)
>
> - org.apache.wicket.request.RequestHandlerStack#execute(RequestHandlerStack.java:64)
>
> - org.apache.wicket.request.cycle.RequestCycle#execute(RequestCycle.java:261)
>
> - org.apache.wicket.request.cycle.RequestCycle#processRequest(RequestCycle.java:218)
>
> - org.apache.wicket.request.cycle.RequestCycle#processRequestAndDetach(RequestCycle.java:289)
>
> - org.apache.wicket.protocol.http.WicketFilter#processRequestCycle(WicketFilter.java:259)
>
> - org.apache.wicket.protocol.http.WicketFilter#processRequest(WicketFilter.java:201)
>
> - org.apache.wicket.protocol.http.WicketFilter#doFilter(WicketFilter.java:282)
>
> - org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
>
> - org.apache.isis.core.webapp.diagnostics.IsisLogOnExceptionFilter#doFilter(IsisLogOnExceptionFilter.java:52)
>
> - org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
>
> - org.apache.shiro.web.servlet.AbstractShiroFilter#executeChain(AbstractShiroFilter.java:449)
>
> - org.apache.shiro.web.servlet.AbstractShiroFilter$1#call(AbstractShiroFilter.java:365)
>
> - org.apache.shiro.subject.support.SubjectCallable#doCall(SubjectCallable.java:90)
>
> - org.apache.shiro.subject.support.SubjectCallable#call(SubjectCallable.java:83)
>
> - org.apache.shiro.subject.support.DelegatingSubject#execute(DelegatingSubject.java:383)
>
> - org.apache.shiro.web.servlet.AbstractShiroFilter#doFilterInternal(AbstractShiroFilter.java:362)
>
> - org.apache.shiro.web.servlet.OncePerRequestFilter#doFilter(OncePerRequestFilter.java:125)
>
> - org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
>
> - org.mortbay.jetty.servlet.ServletHandler#handle(ServletHandler.java:399)
>
> - org.mortbay.jetty.security.SecurityHandler#handle(SecurityHandler.java:216)
>
> - org.mortbay.jetty.servlet.SessionHandler#handle(SessionHandler.java:182)
>
> - org.mortbay.jetty.handler.ContextHandler#handle(ContextHandler.java:766)
>
> - org.mortbay.jetty.webapp.WebAppContext#handle(WebAppContext.java:450)
>
> - org.mortbay.jetty.handler.ContextHandlerCollection#handle(ContextHandlerCollection.java:230)
>
> - org.mortbay.jetty.handler.HandlerCollection#handle(HandlerCollection.java:114)
>
> - org.mortbay.jetty.handler.HandlerWrapper#handle(HandlerWrapper.java:152)
>
> - org.mortbay.jetty.Server#handle(Server.java:326)
> - org.mortbay.jetty.HttpConnection#handleRequest(HttpConnection.java:542)
>
> - org.mortbay.jetty.HttpConnection$RequestHandler#headerComplete(HttpConnection.java:928)
>
> - org.mortbay.jetty.HttpParser#parseNext(HttpParser.java:549)
> - org.mortbay.jetty.HttpParser#parseAvailable(HttpParser.java:212)
> - org.mortbay.jetty.HttpConnection#handle(HttpConnection.java:404)
> - org.mortbay.io.nio.SelectChannelEndPoint#run(SelectChannelEndPoint.java:410)
>
> - org.mortbay.thread.QueuedThreadPool$PoolThread#run(QueuedThreadPool.java:582)
>
> -
> - Caused by:
> -
> - java.lang.reflect.InvocationTargetException
> -
> - sun.reflect.GeneratedMethodAccessor98#invoke(null:-1)
> - sun.reflect.DelegatingMethodAccessorImpl#invoke(DelegatingMethodAccessorImpl.java:43)
>
> - java.lang.reflect.Method#invoke(Method.java:497)
> - org.apache.wicket.RequestListenerInterface#internalInvoke(RequestListenerInterface.java:258)
>
> - org.apache.wicket.RequestListenerInterface#invoke(RequestListenerInterface.java:241)
>
> - org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#invokeListener(ListenerInterfaceRequestHandler.java:250)
>
> - org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#respond(ListenerInterfaceRequestHandler.java:236)
>
> - org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor#respond(RequestCycle.java:862)
>
> - org.apache.wicket.request.RequestHandlerStack#execute(RequestHandlerStack.java:64)
>
> - org.apache.wicket.request.cycle.RequestCycle#execute(RequestCycle.java:261)
>
> - org.apache.wicket.request.cycle.RequestCycle#processRequest(RequestCycle.java:218)
>
> - org.apache.wicket.request.cycle.RequestCycle#processRequestAndDetach(RequestCycle.java:289)
>
> - org.apache.wicket.protocol.http.WicketFilter#processRequestCycle(WicketFilter.java:259)
>
> - org.apache.wicket.protocol.http.WicketFilter#processRequest(WicketFilter.java:201)
>
> - org.apache.wicket.protocol.http.WicketFilter#doFilter(WicketFilter.java:282)
>
> - org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
>
> - org.apache.isis.core.webapp.diagnostics.IsisLogOnExceptionFilter#doFilter(IsisLogOnExceptionFilter.java:52)
>
> - org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
>
> - org.apache.shiro.web.servlet.AbstractShiroFilter#executeChain(AbstractShiroFilter.java:449)
>
> - org.apache.shiro.web.servlet.AbstractShiroFilter$1#call(AbstractShiroFilter.java:365)
>
> - org.apache.shiro.subject.support.SubjectCallable#doCall(SubjectCallable.java:90)
>
> - org.apache.shiro.subject.support.SubjectCallable#call(SubjectCallable.java:83)
>
> - org.apache.shiro.subject.support.DelegatingSubject#execute(DelegatingSubject.java:383)
>
> - org.apache.shiro.web.servlet.AbstractShiroFilter#doFilterInternal(AbstractShiroFilter.java:362)
>
> - org.apache.shiro.web.servlet.OncePerRequestFilter#doFilter(OncePerRequestFilter.java:125)
>
> - org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
>
> - org.mortbay.jetty.servlet.ServletHandler#handle(ServletHandler.java:399)
>
> - org.mortbay.jetty.security.SecurityHandler#handle(SecurityHandler.java:216)
>
> - org.mortbay.jetty.servlet.SessionHandler#handle(SessionHandler.java:182)
>
> - org.mortbay.jetty.handler.ContextHandler#handle(ContextHandler.java:766)
>
> - org.mortbay.jetty.webapp.WebAppContext#handle(WebAppContext.java:450)
>
> - org.mortbay.jetty.handler.ContextHandlerCollection#handle(ContextHandlerCollection.java:230)
>
> - org.mortbay.jetty.handler.HandlerCollection#handle(HandlerCollection.java:114)
>
> - org.mortbay.jetty.handler.HandlerWrapper#handle(HandlerWrapper.java:152)
>
> - org.mortbay.jetty.Server#handle(Server.java:326)
> - org.mortbay.jetty.HttpConnection#handleRequest(HttpConnection.java:542)
>
> - org.mortbay.jetty.HttpConnection$RequestHandler#headerComplete(HttpConnection.java:928)
>
> - org.mortbay.jetty.HttpParser#parseNext(HttpParser.java:549)
> - org.mortbay.jetty.HttpParser#parseAvailable(HttpParser.java:212)
> - org.mortbay.jetty.HttpConnection#handle(HttpConnection.java:404)
> - org.mortbay.io.nio.SelectChannelEndPoint#run(SelectChannelEndPoint.java:410)
>
> - org.mortbay.thread.QueuedThreadPool$PoolThread#run(QueuedThreadPool.java:582)
>
> -
> - Caused by:
> -
> - java.lang.IllegalArgumentException
> - argument type mismatch
> - sun.reflect.NativeMethodAccessorImpl#invoke0(NativeMethodAccessorImpl.java:-2)
>
> - sun.reflect.NativeMethodAccessorImpl#invoke(NativeMethodAccessorImpl.java:62)
>
> - sun.reflect.DelegatingMethodAccessorImpl#invoke(DelegatingMethodAccessorImpl.java:43)
>
> - java.lang.reflect.Method#invoke(Method.java:497)
> - org.apache.isis.applib.fixturescripts.FixtureScript#setParam(FixtureScript.java:689)
>
> - org.apache.isis.applib.fixturescripts.FixtureScript#defaultParam(FixtureScript.java:631)
>
> - org.isisaddons.app.kitchensink.fixture.primitive.PrimitiveObjectsFixture#execute(PrimitiveObjectsFixture.java:133)
>
> - org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#executeChildIfNotAlready(FixtureScript.java:549)
>
> - org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#executeChildT(FixtureScript.java:528)
>
> - org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#executeChildT(FixtureScript.java:498)
>
> - org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#executeChild(FixtureScript.java:487)
>
> - org.isisaddons.app.kitchensink.fixture.KitchensinkSetupFixture#execute(KitchensinkSetupFixture.java:62)
>
> - org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#executeChildIfNotAlready(FixtureScript.java:549)
>
> - org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#access$200(FixtureScript.java:248)
>
> - org.apache.isis.applib.fixturescripts.FixtureScript#run(FixtureScript.java:719)
>
> - org.isisaddons.app.kitchensink.fixture.KitchensinkFixturesService#installFixturesAndReturnFirst(KitchensinkFixturesService.java:95)
>
> - sun.reflect.NativeMethodAccessorImpl#invoke0(NativeMethodAccessorImpl.java:-2)
>
> - sun.reflect.NativeMethodAccessorImpl#invoke(NativeMethodAccessorImpl.java:62)
>
> - sun.reflect.DelegatingMethodAccessorImpl#invoke(DelegatingMethodAccessorImpl.java:43)
>
> - java.lang.reflect.Method#invoke(Method.java:497)
> - org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract#internalInvoke(ActionInvocationFacetForDomainEventAbstract.java:356)
>
> - org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract#invoke(ActionInvocationFacetForDomainEventAbstract.java:196)
>
> - org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1#execute(ActionInvocationFacetWrapTransaction.java:57)
>
> - org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1#execute(ActionInvocationFacetWrapTransaction.java:54)
>
> - org.apache.isis.core.runtime.system.transaction.IsisTransactionManager#executeWithinTransaction(IsisTransactionManager.java:205)
>
> - org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction#invoke(ActionInvocationFacetWrapTransaction.java:54)
>
> - org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionImpl#execute(ObjectActionImpl.java:367)
>
> - org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionImpl#executeWithRuleChecking(ObjectActionImpl.java:358)
>
> - org.apache.isis.viewer.wicket.model.models.ActionModel#executeAction(ActionModel.java:467)
>
> - org.apache.isis.viewer.wicket.model.models.ActionModel#load(ActionModel.java:447)
>
> - org.apache.isis.viewer.wicket.model.models.ActionModel#load(ActionModel.java:80)
>
> - org.apache.wicket.model.LoadableDetachableModel#getObject(LoadableDetachableModel.java:121)
>
> - org.apache.isis.viewer.wicket.model.models.ActionModel#executeHandlingApplicationExceptions(ActionModel.java:543)
>
> - org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel#executeActionOnTargetAndProcessResults(ActionPanel.java:245)
>
> - org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel#executeActionAndProcessResults(ActionPanel.java:193)
>
> - org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel#buildGui(ActionPanel.java:104)
>
> - org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel#<init>(ActionPanel.java:82)
>
> - org.apache.isis.viewer.wicket.ui.components.actions.ActionPanelFactory#createComponent(ActionPanelFactory.java:49)
>
> - org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault#createComponent(ComponentFactoryRegistryDefault.java:128)
>
> - org.apache.isis.viewer.wicket.ui.components.widgets.linkandlabel.ActionLinkFactoryAbstract$1#onClick(ActionLinkFactoryAbstract.java:74)
>
> - org.apache.wicket.ajax.markup.html.AjaxLink$1#onEvent(AjaxLink.java:86)
>
> - org.apache.wicket.ajax.AjaxEventBehavior#respond(AjaxEventBehavior.java:124)
>
> - org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#onRequest(AbstractDefaultAjaxBehavior.java:633)
>
> - sun.reflect.GeneratedMethodAccessor98#invoke(null:-1)
> - sun.reflect.DelegatingMethodAccessorImpl#invoke(DelegatingMethodAccessorImpl.java:43)
>
> - java.lang.reflect.Method#invoke(Method.java:497)
> - org.apache.wicket.RequestListenerInterface#internalInvoke(RequestListenerInterface.java:258)
>
> - org.apache.wicket.RequestListenerInterface#invoke(RequestListenerInterface.java:241)
>
> - org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#invokeListener(ListenerInterfaceRequestHandler.java:250)
>
> - org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#respond(ListenerInterfaceRequestHandler.java:236)
>
> - org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor#respond(RequestCycle.java:862)
>
> - org.apache.wicket.request.RequestHandlerStack#execute(RequestHandlerStack.java:64)
>
> - org.apache.wicket.request.cycle.RequestCycle#execute(RequestCycle.java:261)
>
> - org.apache.wicket.request.cycle.RequestCycle#processRequest(RequestCycle.java:218)
>
> - org.apache.wicket.request.cycle.RequestCycle#processRequestAndDetach(RequestCycle.java:289)
>
> - org.apache.wicket.protocol.http.WicketFilter#processRequestCycle(WicketFilter.java:259)
>
> - org.apache.wicket.protocol.http.WicketFilter#processRequest(WicketFilter.java:201)
>
> - org.apache.wicket.protocol.http.WicketFilter#doFilter(WicketFilter.java:282)
>
> - org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
>
> - org.apache.isis.core.webapp.diagnostics.IsisLogOnExceptionFilter#doFilter(IsisLogOnExceptionFilter.java:52)
>
> - org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
>
> - org.apache.shiro.web.servlet.AbstractShiroFilter#executeChain(AbstractShiroFilter.java:449)
>
> - org.apache.shiro.web.servlet.AbstractShiroFilter$1#call(AbstractShiroFilter.java:365)
>
> - org.apache.shiro.subject.support.SubjectCallable#doCall(SubjectCallable.java:90)
>
> - org.apache.shiro.subject.support.SubjectCallable#call(SubjectCallable.java:83)
>
> - org.apache.shiro.subject.support.DelegatingSubject#execute(DelegatingSubject.java:383)
>
> - org.apache.shiro.web.servlet.AbstractShiroFilter#doFilterInternal(AbstractShiroFilter.java:362)
>
> - org.apache.shiro.web.servlet.OncePerRequestFilter#doFilter(OncePerRequestFilter.java:125)
>
> - org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
>
> - org.mortbay.jetty.servlet.ServletHandler#handle(ServletHandler.java:399)
>
> - org.mortbay.jetty.security.SecurityHandler#handle(SecurityHandler.java:216)
>
> - org.mortbay.jetty.servlet.SessionHandler#handle(SessionHandler.java:182)
>
> - org.mortbay.jetty.handler.ContextHandler#handle(ContextHandler.java:766)
>
> - org.mortbay.jetty.webapp.WebAppContext#handle(WebAppContext.java:450)
>
> - org.mortbay.jetty.handler.ContextHandlerCollection#handle(ContextHandlerCollection.java:230)
>
> - org.mortbay.jetty.handler.HandlerCollection#handle(HandlerCollection.java:114)
>
> - org.mortbay.jetty.handler.HandlerWrapper#handle(HandlerWrapper.java:152)
>
> - org.mortbay.jetty.Server#handle(Server.java:326)
> - org.mortbay.jetty.HttpConnection#handleRequest(HttpConnection.java:542)
>
> - org.mortbay.jetty.HttpConnection$RequestHandler#headerComplete(HttpConnection.java:928)
>
> - org.mortbay.jetty.HttpParser#parseNext(HttpParser.java:549)
> - org.mortbay.jetty.HttpParser#parseAvailable(HttpParser.java:212)
> - org.mortbay.jetty.HttpConnection#handle(HttpConnection.java:404)
> - org.mortbay.io.nio.SelectChannelEndPoint#run(SelectChannelEndPoint.java:410)
>
> - org.mortbay.thread.QueuedThreadPool$PoolThread#run(QueuedThreadPool.java:582
>
>
>
>
> On Sun, Aug 2, 2015 at 11:23 PM, Dan Haywood <dan@haywood-associates.co.uk
> > wrote:
>
>> Further to this, I've updated the kitchensink (against 1.9.0-SNAPSHOT) to
>> demonstrate this technique....
>>
>> The code is in ReferenceObject, which you can get to from the "Data Types"
>> menu. Use the fixture scripts menu to create some sample data.
>>
>> The relevant code is below.
>>
>> Cheers
>> Dan
>>
>> [1] https://github.com/isisaddons/isis-app-kitchensink
>>
>>
>> private OtherObject someOtherObjectUsingName;
>>
>> @Property(hidden = Where.EVERYWHERE)
>> @Column(allowsNull = "true")
>> public OtherObject getSomeOtherObjectUsingName() {
>> return someOtherObjectUsingName;
>> }
>>
>> public void setSomeOtherObjectUsingName(final OtherObject
>> someOtherObjectUsingName) {
>> this.someOtherObjectUsingName = someOtherObjectUsingName;
>> }
>>
>> @NotPersistent
>> public String getSomeOtherObjectUsingNameName() {
>> return getSomeOtherObjectUsingName() != null?
>> getSomeOtherObjectUsingName().getName() : null;
>> }
>>
>> public void setSomeOtherObjectUsingNameName(final String name) {
>> OtherObject otherObject = name != null
>> ? container.firstMatch(OtherObject.class, withName(name))
>> : null;
>> setSomeOtherObjectUsingName(otherObject);
>> }
>>
>> public List<String> choicesSomeOtherObjectUsingNameName() {
>> List<OtherObject> otherObjects =
>> container.allInstances(OtherObject.class);
>> return Lists.newArrayList(
>> Iterables.transform(otherObjects, nameOf())
>> );
>> }
>>
>> private static Function<OtherObject, String> nameOf() {
>> return new Function<OtherObject, String>() {
>> @Nullable @Override public String apply(final OtherObject
>> input) {
>> return input.getName();
>> }
>> };
>> }
>>
>> private static Predicate<OtherObject> withName(final String name) {
>> return new Predicate<OtherObject>() {
>> @Override public boolean apply(final OtherObject input) {
>> return Objects.equal(input.getName(), name);
>> }
>> };
>> }
>>
>>
>>
>>
>>
>> On 30 July 2015 at 13:16, Dan Haywood <da...@haywood-associates.co.uk>
>> wrote:
>>
>> > looks right to me, so I'll take a look at in this eve or tomorrow.
>> >
>> > thx
>> > Dan
>> >
>> >
>> > On 30 July 2015 at 13:12, Stephen Cameron <st...@gmail.com>
>> > wrote:
>> >
>> >> Still no luck with this one.
>> >>
>> >> The derived RegionName appears as a non-editable property, so not sure
>> >> what
>> >> was different before when I was getting an model validation error.
>> >>
>> >> My current code of interest is this:
>> >>
>> >> @Column(name = "region", allowsNull = "true")
>> >> //@MemberOrder(sequence = "7")
>> >> @Property(hidden=Where.EVERYWHERE)
>> >> public Region getRegion() {
>> >> return this.region;
>> >> }
>> >>
>> >> public void setRegion(Region region) {
>> >> this.region = region;
>> >> }
>> >>
>> >> public List<Region> choicesRegion() {
>> >> return regions.listAllRegions();
>> >> }
>> >>
>> >> @MemberOrder(sequence = "7")
>> >> public String getRegionName() {
>> >> return regions.nameForRegion(getRegion());
>> >> }
>> >>
>> >> public void setRegionName(String name) {
>> >> setRegion(regions.regionForName(name));
>> >> }
>> >>
>> >> public List<String> choicesRegionName(){
>> >> return regions.listAllNamesExclusive(getRegion());
>> >> }
>> >>
>> >> My Region class is this:
>> >>
>> >> package au.com.scds.chats.dom.modules.general.codes;
>> >>
>> >> import javax.jdo.annotations.Column;
>> >> import javax.jdo.annotations.IdentityType;
>> >> import javax.jdo.annotations.PrimaryKey;
>> >>
>> >> import org.apache.isis.applib.annotation.Action;
>> >> import org.apache.isis.applib.annotation.ActionLayout;
>> >> import org.apache.isis.applib.annotation.DomainServiceLayout;
>> >> import org.apache.isis.applib.annotation.DomainServiceLayout.MenuBar;
>> >> import org.apache.isis.applib.annotation.MemberOrder;
>> >> import org.apache.isis.applib.annotation.PropertyLayout;
>> >>
>> >> @javax.jdo.annotations.PersistenceCapable(
>> >> identityType=IdentityType.APPLICATION)
>> >> public class Region {
>> >>
>> >> public String title(){
>> >> return getName();
>> >> }
>> >>
>> >> private String name;
>> >>
>> >> @Column(name="region", allowsNull = "false")
>> >> @PrimaryKey()
>> >> @PropertyLayout(named="Region")
>> >> @MemberOrder(sequence="1")
>> >> public String getName() {
>> >> return name;
>> >> }
>> >>
>> >> public void setName(String name) {
>> >> this.name = name;
>> >> }
>> >> }
>> >>
>> >> My Regions repository class is this:
>> >>
>> >> package au.com.scds.chats.dom.modules.general.codes;
>> >>
>> >> import java.util.ArrayList;
>> >> import java.util.List;
>> >>
>> >> import org.apache.isis.applib.DomainObjectContainer;
>> >> import org.apache.isis.applib.annotation.Action;
>> >> import org.apache.isis.applib.annotation.ActionLayout;
>> >> import org.apache.isis.applib.annotation.BookmarkPolicy;
>> >> import org.apache.isis.applib.annotation.DomainService;
>> >> import org.apache.isis.applib.annotation.DomainServiceLayout;
>> >> import org.apache.isis.applib.annotation.DomainServiceLayout.MenuBar;
>> >> import org.apache.isis.applib.annotation.MemberOrder;
>> >> import org.apache.isis.applib.annotation.ParameterLayout;
>> >> import org.apache.isis.applib.annotation.Programmatic;
>> >> import org.apache.isis.applib.annotation.SemanticsOf;
>> >> import org.apache.isis.applib.query.QueryDefault;
>> >>
>> >> import au.com.scds.chats.dom.modules.participant.Participant;
>> >>
>> >> @DomainService(repositoryFor = Region.class)
>> >> @DomainServiceLayout(menuBar = MenuBar.SECONDARY, named =
>> >> "Administration",
>> >> menuOrder = "100.1")
>> >> public class Regions {
>> >>
>> >> // region > listAll (action)
>> >> @Action(semantics = SemanticsOf.SAFE)
>> >> @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT)
>> >> @MemberOrder(sequence = "1")
>> >> public List<Region> listAllRegions() {
>> >> return container.allInstances(Region.class);
>> >> }
>> >>
>> >> // endregion
>> >>
>> >> // region > create (action)
>> >> @MemberOrder(sequence = "2")
>> >> public Region createRegion(
>> >> final @ParameterLayout(named = "Region Name") String name)
>> {
>> >> final Region obj =
>> container.newTransientInstance(Region.class);
>> >> obj.setName(name);
>> >> container.persistIfNotAlready(obj);
>> >> return obj;
>> >> }
>> >>
>> >> // endregion
>> >>
>> >> // region > injected services
>> >>
>> >> @javax.inject.Inject
>> >> DomainObjectContainer container;
>> >>
>> >> // endregion
>> >>
>> >> @Programmatic
>> >> public String nameForRegion(Region region) {
>> >> return (region != null) ? region.getName() : null;
>> >> }
>> >>
>> >>
>> >> @Programmatic
>> >> public List<String> listAllNamesExclusive(Region region) {
>> >> List<Region> regions = listAllRegions();
>> >> List<String> names = new ArrayList<String>();
>> >> for (Region r : regions) {
>> >> if (region != null && r != region) {
>> >> names.add(r.getName());
>> >> }
>> >> }
>> >> return names;
>> >> }
>> >>
>> >>
>> >> @Programmatic
>> >> public Region regionForName(String name) {
>> >> Region region = container.firstMatch(new QueryDefault<>(
>> >> Region.class,
>> >> "findRegion", "name", name));
>> >> return region;
>> >> }
>> >>
>> >> }
>> >>
>> >> Just maybe I there is something missing still?
>> >>
>> >> I added a @Property annotation to the getRegionName() method, but that
>> >> gave
>> >> me a message saying it expected @javax.jdo.persistence.Column too.
>> >>
>> >> Note I couldn't use deprecated @Hidden in Isis 1.9.0.
>> >>
>> >>
>> >> On Thu, Jul 30, 2015 at 8:14 PM, Stephen Cameron <
>> >> steve.cameron.62@gmail.com
>> >> > wrote:
>> >>
>> >> > Hi Dan, When I tried this I got an model validation error message
>> >> relating
>> >> > to the choices method, I will have another go and if it fails,
>> provide
>> >> the
>> >> > test case. Thanks for the tips.
>> >> >
>> >> > On Thu, Jul 30, 2015 at 7:57 PM, Dan Haywood <
>> >> dan@haywood-associates.co.uk
>> >> > > wrote:
>> >> >
>> >> >> You should be able to add a choicesXxx() for the derived property:
>> >> >>
>> >> >> public List<String> choicesRegionName(){
>> >> >> return
>> Lists.newArrayList(Iterables.transform(choicesRegion(),
>> >> x
>> >> >> ->
>> >> >> x.getName()));
>> >> >> }
>> >> >>
>> >> >> If that isn't sufficient, you might also need to add a setter:
>> >> >>
>> >> >> public void setRegionName(final String name) {
>> >> >> setRegion(Iterables.find(choicesRegion(), x ->
>> >> x.getName().equals(name)));
>> >> >> }
>> >> >>
>> >> >> Obviously, you might need to also add some error handling.
>> >> >>
>> >> >> ~~~
>> >> >>
>> >> >> Regarding the "external URL" idea, perhaps you could raise that as a
>> >> >> separate ticket, with a code sketch as to how you'd like this
>> >> information
>> >> >> specified?
>> >> >>
>> >> >> Thanks
>> >> >> Dan
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> On 30 July 2015 at 03:17, Stephen Cameron <
>> steve.cameron.62@gmail.com>
>> >> >> wrote:
>> >> >>
>> >> >> > Not so simple, as now the property cannot be updated.
>> >> >> >
>> >> >> > I have the following (@Hidden is deprecated)
>> >> >> >
>> >> >> > @Column(allowsNull = "true")
>> >> >> > @MemberOrder(sequence = "7")
>> >> >> > @PropertyLayout(hidden=Where.EVERYWHERE)
>> >> >> > public Region getRegion() {
>> >> >> > return this.region;
>> >> >> > }
>> >> >> >
>> >> >> > public void setRegion(Region region) {
>> >> >> > this.region = region;
>> >> >> > }
>> >> >> >
>> >> >> > public List<Region> choicesRegion(){
>> >> >> > List<Region> regions =
>> container.allInstances(Region.class);
>> >> >> > return regions;
>> >> >> > }
>> >> >> >
>> >> >> > @MemberOrder(sequence = "7.1")
>> >> >> > public String getRegionName(){
>> >> >> > return (getRegion() != null) ? getRegion().getName() :
>> null;
>> >> >> > }
>> >> >> >
>> >> >> > Sure enough getRegion doesn't appear in the UI but getRegionName
>> >> does,
>> >> >> but
>> >> >> > then setRegion and choiceRegion don't mean anything to the UI, so
>> the
>> >> >> > Region property is read-only.
>> >> >> >
>> >> >> > This issue is maybe more significant than it appears at first, in
>> >> terms
>> >> >> of
>> >> >> > domain modelling such code-lists are simple types that 'represent'
>> >> >> things
>> >> >> > on the boundary of the domain of interest. So we usually want to
>> just
>> >> >> > represent them with a name. Presently it makes no sense to go to
>> that
>> >> >> thing
>> >> >> > via a hyperlink as all we'll find is that name, our model extends
>> no
>> >> >> > further.
>> >> >> >
>> >> >> > However we just might like to allow users to leave the domain
>> model
>> >> and
>> >> >> go
>> >> >> > to a resource outside. So, extending the suppressLink=true idea, I
>> >> would
>> >> >> > add that each object could have an implicit link(URL),created by
>> >> Isis,
>> >> >> or
>> >> >> > an explicit one and if the explicit one is present it can
>> optionally
>> >> be
>> >> >> > used as an alternative to the implicit one.
>> >> >> >
>> >> >> > For example, you might create a database to log fish details,
>> species
>> >> >> is a
>> >> >> > boundary concept, we aren't likely to want to add a new species to
>> >> the
>> >> >> list
>> >> >> > of known species, but we'd like to keep such a list handy, but for
>> >> each
>> >> >> > named species in that list, to provide an explicit link to a
>> resource
>> >> >> in a
>> >> >> > global fish database. It makes more sense to use this link than
>> the
>> >> >> > implicit one, as if the implicit one is used we'd navigate to the
>> >> domain
>> >> >> > object page displaying the name and URL, both of which items of
>> data
>> >> >> could
>> >> >> > have been in the explicit link.
>> >> >> >
>> >> >> > In the explicit case you might want to warn the user they are
>> >> navigating
>> >> >> > outside the Isis domain application.
>> >> >> >
>> >> >> > Perhaps all this could be done simply if there was a URI type in
>> >> Isis,
>> >> >> that
>> >> >> > would allow it to create 'smart links' automatically.
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > On Wed, Jul 29, 2015 at 9:37 PM, Stephen Cameron <
>> >> >> > steve.cameron.62@gmail.com
>> >> >> > > wrote:
>> >> >> >
>> >> >> > > Thanks Jeroen, seems simple enough :)
>> >> >> > >
>> >> >> > > On Wed, Jul 29, 2015 at 9:28 PM, Jeroen van der Wal <
>> >> >> jeroen@stromboli.it
>> >> >> > >
>> >> >> > > wrote:
>> >> >> > >
>> >> >> > >> You could also hide the property and create a separate getter
>> for
>> >> >> > display
>> >> >> > >> purposes only:
>> >> >> > >>
>> >> >> > >> private MyProperty myProperty;
>> >> >> > >>
>> >> >> > >> @Hidden
>> >> >> > >> public MyProperty getMyProperty() {...}
>> >> >> > >>
>> >> >> > >> public void setMyProperty(...) {...}
>> >> >> > >>
>> >> >> > >> public String getMyPropertyName() {
>> >> >> > >> getMyProperty.getName();
>> >> >> > >> }
>> >> >> > >>
>> >> >> > >> On 29 July 2015 at 13:18, Stephen Cameron <
>> >> >> steve.cameron.62@gmail.com>
>> >> >> > >> wrote:
>> >> >> > >>
>> >> >> > >> > On Wed, Jul 29, 2015 at 6:38 PM, Dan Haywood <
>> >> >> > >> dan@haywood-associates.co.uk
>> >> >> > >> > >
>> >> >> > >> > wrote:
>> >> >> > >> >
>> >> >> > >> > > You are right, they will be displayed as links; there's no
>> >> way to
>> >> >> > >> disable
>> >> >> > >> > > it currently.
>> >> >> > >> > >
>> >> >> > >> > > We could add a bit of metadata perhaps for this, eg
>> >> >> > >> > > @DomainObjectLayout(suppressLink=true) or similar.
>> >> >> > >> > >
>> >> >> > >> > > Please raise a ticket.
>> >> >> > >> > >
>> >> >> > >> >
>> >> >> > >> > OK https://issues.apache.org/jira/browse/ISIS-1180
>> >> >> > >> >
>> >> >> > >> > >
>> >> >> > >> > > Thx
>> >> >> > >> > > Dan
>> >> >> > >> > >
>> >> >> > >> > > PS: these entities wouldn't be value types, rather regular
>> >> >> entities.
>> >> >> > >> But
>> >> >> > >> > > you are right... what we really want is full-class support
>> for
>> >> >> value
>> >> >> > >> > types.
>> >> >> > >> > > We're just not there yet...
>> >> >> > >> > >
>> >> >> > >> > >
>> >> >> > >> > >
>> >> >> > >> >
>> >> >> > >> > >
>> >> >> > >> > >
>> >> >> > >> > > On 29 July 2015 at 09:34, Stephen Cameron <
>> >> >> > steve.cameron.62@gmail.com
>> >> >> > >> >
>> >> >> > >> > > wrote:
>> >> >> > >> > >
>> >> >> > >> > > > Thanks, but surely such object properties always end up
>> >> being
>> >> >> > >> displayed
>> >> >> > >> > > as
>> >> >> > >> > > > links? Clicking on the link to go to such an object page
>> is
>> >> >> > >> > meaningless,
>> >> >> > >> > > as
>> >> >> > >> > > > it only has one name property, that was displayed in the
>> >> link.
>> >> >> > Can I
>> >> >> > >> > > > disable that default behaviour for value types?
>> >> >> > >> > > >
>> >> >> > >> > > >
>> >> >> > >> > > >
>> >> >> > >> > > > On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <
>> >> >> > >> > > dan@haywood-associates.co.uk
>> >> >> > >> > > > >
>> >> >> > >> > > > wrote:
>> >> >> > >> > > >
>> >> >> > >> > > > > On 29 July 2015 at 08:08, Stephen Cameron <
>> >> >> > >> > steve.cameron.62@gmail.com>
>> >> >> > >>
>> >> >> > >> > > > > wrote:
>> >> >> > >> > > > >
>> >> >> > >> > > > > > Hi,
>> >> >> > >> > > > > >
>> >> >> > >> > > > > > I want to do have some properties that are
>> essentially
>> >> >> String
>> >> >> > >> > types,
>> >> >> > >> > > > but
>> >> >> > >> > > > > > which have a limited range of values (code-lists or
>> >> >> restricted
>> >> >> > >> > > > > > vocabularies). I want to allow these lists to be
>> >> >> administered
>> >> >> > >> > > > centrally,
>> >> >> > >> > > > > so
>> >> >> > >> > > > > > to add them to a single Administration menu item for
>> >> admin
>> >> >> > >> users.
>> >> >> > >> > > > > >
>> >> >> > >> > > > > > For most users these codes should appears as lists of
>> >> >> strings
>> >> >> > >> not
>> >> >> > >> > as
>> >> >> > >> > > > > > objects, but making them objects seems to be the
>> >> logical OO
>> >> >> > way
>> >> >> > >> to
>> >> >> > >> > > deal
>> >> >> > >> > > > > > with them in Isis. So they are basically objects with
>> >> one
>> >> >> > 'name'
>> >> >> > >> > > > property
>> >> >> > >> > > > > > (and maybe an id added by datanucleus). All users
>> need
>> >> to
>> >> >> see
>> >> >> > is
>> >> >> > >> > the
>> >> >> > >> > > > name
>> >> >> > >> > > > > > property, no icon is needed.
>> >> >> > >> > > > > >
>> >> >> > >> > > > > > Also, if I make them objects I also will get
>> referencial
>> >> >> > >> integrity
>> >> >> > >> > > > > > constraints applied in the database.
>> >> >> > >> > > > > >
>> >> >> > >> > > > > >
>> >> >> > >> > > > > +1, do it this way. That way they can also hold
>> >> behaviour in
>> >> >> > the
>> >> >> > >> > > future.
>> >> >> > >> > > > >
>> >> >> > >> > > > >
>> >> >> > >> > > > >
>> >> >> > >> > > > >
>> >> >> > >> > > > > > I wonder there is a simple recipe for this?
>> >> >> > >> > > > > >
>> >> >> > >> > > > >
>> >> >> > >> > > > > No magic recipe for the domain entities... basically
>> >> >> > copy-n-paste
>> >> >> > >> the
>> >> >> > >> > > > > SimpleObject that's in our archetype as many times as
>> >> needed,
>> >> >> > and
>> >> >> > >> > tweak
>> >> >> > >> > > > as
>> >> >> > >> > > > > required.
>> >> >> > >> > > > >
>> >> >> > >> > > > > If you want to use the code as the primary key, then
>> use
>> >> DN
>> >> >> > >> > application
>> >> >> > >> > > > > identity
>> >> >> > >> > > > >
>> >> >> > >> > > > > @javax.jdo.annotations.PersistenceCapable(
>> >> >> > >> > > > > identityType=IdentityType.APPLICATION,
>> >> >> > >> > > > > schema = "simple",
>> >> >> > >> > > > > table = "SimpleObject"
>> >> >> > >> > > > > )
>> >> >> > >> > > > >
>> >> >> > >> > > > > and add @PrimaryKey to the "name" property. Also add
>> >> @Title
>> >> >> to
>> >> >> > >> that
>> >> >> > >> > > > 'name'
>> >> >> > >> > > > > property (it is in SimpleObject already).
>> >> >> > >> > > > >
>> >> >> > >> > > > >
>> >> >> > >> > > > > You would probably want to remove the version column,
>> ie
>> >> >> remove:
>> >> >> > >> > > > >
>> >> >> > >> > > > > @javax.jdo.annotations.Version(
>> >> >> > >> > > > > strategy=VersionStrategy.VERSION_NUMBER,
>> >> >> > >> > > > > column="version")
>> >> >> > >> > > > >
>> >> >> > >> > > > >
>> >> >> > >> > > > > In addition, if you annotate the class as "bounded"
>> >> >> > >> > > > > (@DomainObject(bounded=true)) then you are telling the
>> >> >> framework
>> >> >> > >> that
>> >> >> > >> > > > > there's a limited - ie bounded - set of instances, and
>> so
>> >> it
>> >> >> > will
>> >> >> > >> > > display
>> >> >> > >> > > > > all instances in a drop-down for you.
>> >> >> > >> > > > >
>> >> >> > >> > > > >
>> >> >> > >> > > > > HTH
>> >> >> > >> > > > > Dan
>> >> >> > >> > > > >
>> >> >> > >> > > >
>> >> >> > >> > >
>> >> >> > >> >
>> >> >> > >>
>> >> >> > >
>> >> >> > >
>> >> >> >
>> >> >>
>> >> >
>> >> >
>> >>
>> >
>> >
>>
>
>
Re: code-lists and administration thereof
Posted by Stephen Cameron <st...@gmail.com>.
Hi,
Just trying this now, with current version of kitchen sink I got an error
message starting the webapp, saying that no persistable classes could be
found and to check value of
isis.persistor.datanucleus.RegisterEntities.packagePrefix
in isis.properties, but that key is in isis_datanucleus.properties.
Also errors in running fixture script :(
- org.apache.wicket.WicketRuntimeException
- Method onRequest of interface
org.apache.wicket.behavior.IBehaviorListener targeted at
org.apache.wicket.ajax.markup.html.AjaxLink$1@1ac79481 on component
[AjaxLink [Component id = menuLink]] threw an exception
- org.apache.wicket.RequestListenerInterface#internalInvoke(RequestListenerInterface.java:268)
- org.apache.wicket.RequestListenerInterface#invoke(RequestListenerInterface.java:241)
- org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#invokeListener(ListenerInterfaceRequestHandler.java:250)
- org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#respond(ListenerInterfaceRequestHandler.java:236)
- org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor#respond(RequestCycle.java:862)
- org.apache.wicket.request.RequestHandlerStack#execute(RequestHandlerStack.java:64)
- org.apache.wicket.request.cycle.RequestCycle#execute(RequestCycle.java:261)
- org.apache.wicket.request.cycle.RequestCycle#processRequest(RequestCycle.java:218)
- org.apache.wicket.request.cycle.RequestCycle#processRequestAndDetach(RequestCycle.java:289)
- org.apache.wicket.protocol.http.WicketFilter#processRequestCycle(WicketFilter.java:259)
- org.apache.wicket.protocol.http.WicketFilter#processRequest(WicketFilter.java:201)
- org.apache.wicket.protocol.http.WicketFilter#doFilter(WicketFilter.java:282)
- org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
- org.apache.isis.core.webapp.diagnostics.IsisLogOnExceptionFilter#doFilter(IsisLogOnExceptionFilter.java:52)
- org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
- org.apache.shiro.web.servlet.AbstractShiroFilter#executeChain(AbstractShiroFilter.java:449)
- org.apache.shiro.web.servlet.AbstractShiroFilter$1#call(AbstractShiroFilter.java:365)
- org.apache.shiro.subject.support.SubjectCallable#doCall(SubjectCallable.java:90)
- org.apache.shiro.subject.support.SubjectCallable#call(SubjectCallable.java:83)
- org.apache.shiro.subject.support.DelegatingSubject#execute(DelegatingSubject.java:383)
- org.apache.shiro.web.servlet.AbstractShiroFilter#doFilterInternal(AbstractShiroFilter.java:362)
- org.apache.shiro.web.servlet.OncePerRequestFilter#doFilter(OncePerRequestFilter.java:125)
- org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
- org.mortbay.jetty.servlet.ServletHandler#handle(ServletHandler.java:399)
- org.mortbay.jetty.security.SecurityHandler#handle(SecurityHandler.java:216)
- org.mortbay.jetty.servlet.SessionHandler#handle(SessionHandler.java:182)
- org.mortbay.jetty.handler.ContextHandler#handle(ContextHandler.java:766)
- org.mortbay.jetty.webapp.WebAppContext#handle(WebAppContext.java:450)
- org.mortbay.jetty.handler.ContextHandlerCollection#handle(ContextHandlerCollection.java:230)
- org.mortbay.jetty.handler.HandlerCollection#handle(HandlerCollection.java:114)
- org.mortbay.jetty.handler.HandlerWrapper#handle(HandlerWrapper.java:152)
- org.mortbay.jetty.Server#handle(Server.java:326)
- org.mortbay.jetty.HttpConnection#handleRequest(HttpConnection.java:542)
- org.mortbay.jetty.HttpConnection$RequestHandler#headerComplete(HttpConnection.java:928)
- org.mortbay.jetty.HttpParser#parseNext(HttpParser.java:549)
- org.mortbay.jetty.HttpParser#parseAvailable(HttpParser.java:212)
- org.mortbay.jetty.HttpConnection#handle(HttpConnection.java:404)
- org.mortbay.io.nio.SelectChannelEndPoint#run(SelectChannelEndPoint.java:410)
- org.mortbay.thread.QueuedThreadPool$PoolThread#run(QueuedThreadPool.java:582)
-
- Caused by:
-
- java.lang.reflect.InvocationTargetException
-
- sun.reflect.GeneratedMethodAccessor98#invoke(null:-1)
- sun.reflect.DelegatingMethodAccessorImpl#invoke(DelegatingMethodAccessorImpl.java:43)
- java.lang.reflect.Method#invoke(Method.java:497)
- org.apache.wicket.RequestListenerInterface#internalInvoke(RequestListenerInterface.java:258)
- org.apache.wicket.RequestListenerInterface#invoke(RequestListenerInterface.java:241)
- org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#invokeListener(ListenerInterfaceRequestHandler.java:250)
- org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#respond(ListenerInterfaceRequestHandler.java:236)
- org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor#respond(RequestCycle.java:862)
- org.apache.wicket.request.RequestHandlerStack#execute(RequestHandlerStack.java:64)
- org.apache.wicket.request.cycle.RequestCycle#execute(RequestCycle.java:261)
- org.apache.wicket.request.cycle.RequestCycle#processRequest(RequestCycle.java:218)
- org.apache.wicket.request.cycle.RequestCycle#processRequestAndDetach(RequestCycle.java:289)
- org.apache.wicket.protocol.http.WicketFilter#processRequestCycle(WicketFilter.java:259)
- org.apache.wicket.protocol.http.WicketFilter#processRequest(WicketFilter.java:201)
- org.apache.wicket.protocol.http.WicketFilter#doFilter(WicketFilter.java:282)
- org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
- org.apache.isis.core.webapp.diagnostics.IsisLogOnExceptionFilter#doFilter(IsisLogOnExceptionFilter.java:52)
- org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
- org.apache.shiro.web.servlet.AbstractShiroFilter#executeChain(AbstractShiroFilter.java:449)
- org.apache.shiro.web.servlet.AbstractShiroFilter$1#call(AbstractShiroFilter.java:365)
- org.apache.shiro.subject.support.SubjectCallable#doCall(SubjectCallable.java:90)
- org.apache.shiro.subject.support.SubjectCallable#call(SubjectCallable.java:83)
- org.apache.shiro.subject.support.DelegatingSubject#execute(DelegatingSubject.java:383)
- org.apache.shiro.web.servlet.AbstractShiroFilter#doFilterInternal(AbstractShiroFilter.java:362)
- org.apache.shiro.web.servlet.OncePerRequestFilter#doFilter(OncePerRequestFilter.java:125)
- org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
- org.mortbay.jetty.servlet.ServletHandler#handle(ServletHandler.java:399)
- org.mortbay.jetty.security.SecurityHandler#handle(SecurityHandler.java:216)
- org.mortbay.jetty.servlet.SessionHandler#handle(SessionHandler.java:182)
- org.mortbay.jetty.handler.ContextHandler#handle(ContextHandler.java:766)
- org.mortbay.jetty.webapp.WebAppContext#handle(WebAppContext.java:450)
- org.mortbay.jetty.handler.ContextHandlerCollection#handle(ContextHandlerCollection.java:230)
- org.mortbay.jetty.handler.HandlerCollection#handle(HandlerCollection.java:114)
- org.mortbay.jetty.handler.HandlerWrapper#handle(HandlerWrapper.java:152)
- org.mortbay.jetty.Server#handle(Server.java:326)
- org.mortbay.jetty.HttpConnection#handleRequest(HttpConnection.java:542)
- org.mortbay.jetty.HttpConnection$RequestHandler#headerComplete(HttpConnection.java:928)
- org.mortbay.jetty.HttpParser#parseNext(HttpParser.java:549)
- org.mortbay.jetty.HttpParser#parseAvailable(HttpParser.java:212)
- org.mortbay.jetty.HttpConnection#handle(HttpConnection.java:404)
- org.mortbay.io.nio.SelectChannelEndPoint#run(SelectChannelEndPoint.java:410)
- org.mortbay.thread.QueuedThreadPool$PoolThread#run(QueuedThreadPool.java:582)
-
- Caused by:
-
- java.lang.IllegalArgumentException
- argument type mismatch
- sun.reflect.NativeMethodAccessorImpl#invoke0(NativeMethodAccessorImpl.java:-2)
- sun.reflect.NativeMethodAccessorImpl#invoke(NativeMethodAccessorImpl.java:62)
- sun.reflect.DelegatingMethodAccessorImpl#invoke(DelegatingMethodAccessorImpl.java:43)
- java.lang.reflect.Method#invoke(Method.java:497)
- org.apache.isis.applib.fixturescripts.FixtureScript#setParam(FixtureScript.java:689)
- org.apache.isis.applib.fixturescripts.FixtureScript#defaultParam(FixtureScript.java:631)
- org.isisaddons.app.kitchensink.fixture.primitive.PrimitiveObjectsFixture#execute(PrimitiveObjectsFixture.java:133)
- org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#executeChildIfNotAlready(FixtureScript.java:549)
- org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#executeChildT(FixtureScript.java:528)
- org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#executeChildT(FixtureScript.java:498)
- org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#executeChild(FixtureScript.java:487)
- org.isisaddons.app.kitchensink.fixture.KitchensinkSetupFixture#execute(KitchensinkSetupFixture.java:62)
- org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#executeChildIfNotAlready(FixtureScript.java:549)
- org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext#access$200(FixtureScript.java:248)
- org.apache.isis.applib.fixturescripts.FixtureScript#run(FixtureScript.java:719)
- org.isisaddons.app.kitchensink.fixture.KitchensinkFixturesService#installFixturesAndReturnFirst(KitchensinkFixturesService.java:95)
- sun.reflect.NativeMethodAccessorImpl#invoke0(NativeMethodAccessorImpl.java:-2)
- sun.reflect.NativeMethodAccessorImpl#invoke(NativeMethodAccessorImpl.java:62)
- sun.reflect.DelegatingMethodAccessorImpl#invoke(DelegatingMethodAccessorImpl.java:43)
- java.lang.reflect.Method#invoke(Method.java:497)
- org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract#internalInvoke(ActionInvocationFacetForDomainEventAbstract.java:356)
- org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract#invoke(ActionInvocationFacetForDomainEventAbstract.java:196)
- org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1#execute(ActionInvocationFacetWrapTransaction.java:57)
- org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1#execute(ActionInvocationFacetWrapTransaction.java:54)
- org.apache.isis.core.runtime.system.transaction.IsisTransactionManager#executeWithinTransaction(IsisTransactionManager.java:205)
- org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction#invoke(ActionInvocationFacetWrapTransaction.java:54)
- org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionImpl#execute(ObjectActionImpl.java:367)
- org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionImpl#executeWithRuleChecking(ObjectActionImpl.java:358)
- org.apache.isis.viewer.wicket.model.models.ActionModel#executeAction(ActionModel.java:467)
- org.apache.isis.viewer.wicket.model.models.ActionModel#load(ActionModel.java:447)
- org.apache.isis.viewer.wicket.model.models.ActionModel#load(ActionModel.java:80)
- org.apache.wicket.model.LoadableDetachableModel#getObject(LoadableDetachableModel.java:121)
- org.apache.isis.viewer.wicket.model.models.ActionModel#executeHandlingApplicationExceptions(ActionModel.java:543)
- org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel#executeActionOnTargetAndProcessResults(ActionPanel.java:245)
- org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel#executeActionAndProcessResults(ActionPanel.java:193)
- org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel#buildGui(ActionPanel.java:104)
- org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel#<init>(ActionPanel.java:82)
- org.apache.isis.viewer.wicket.ui.components.actions.ActionPanelFactory#createComponent(ActionPanelFactory.java:49)
- org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault#createComponent(ComponentFactoryRegistryDefault.java:128)
- org.apache.isis.viewer.wicket.ui.components.widgets.linkandlabel.ActionLinkFactoryAbstract$1#onClick(ActionLinkFactoryAbstract.java:74)
- org.apache.wicket.ajax.markup.html.AjaxLink$1#onEvent(AjaxLink.java:86)
- org.apache.wicket.ajax.AjaxEventBehavior#respond(AjaxEventBehavior.java:124)
- org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#onRequest(AbstractDefaultAjaxBehavior.java:633)
- sun.reflect.GeneratedMethodAccessor98#invoke(null:-1)
- sun.reflect.DelegatingMethodAccessorImpl#invoke(DelegatingMethodAccessorImpl.java:43)
- java.lang.reflect.Method#invoke(Method.java:497)
- org.apache.wicket.RequestListenerInterface#internalInvoke(RequestListenerInterface.java:258)
- org.apache.wicket.RequestListenerInterface#invoke(RequestListenerInterface.java:241)
- org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#invokeListener(ListenerInterfaceRequestHandler.java:250)
- org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler#respond(ListenerInterfaceRequestHandler.java:236)
- org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor#respond(RequestCycle.java:862)
- org.apache.wicket.request.RequestHandlerStack#execute(RequestHandlerStack.java:64)
- org.apache.wicket.request.cycle.RequestCycle#execute(RequestCycle.java:261)
- org.apache.wicket.request.cycle.RequestCycle#processRequest(RequestCycle.java:218)
- org.apache.wicket.request.cycle.RequestCycle#processRequestAndDetach(RequestCycle.java:289)
- org.apache.wicket.protocol.http.WicketFilter#processRequestCycle(WicketFilter.java:259)
- org.apache.wicket.protocol.http.WicketFilter#processRequest(WicketFilter.java:201)
- org.apache.wicket.protocol.http.WicketFilter#doFilter(WicketFilter.java:282)
- org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
- org.apache.isis.core.webapp.diagnostics.IsisLogOnExceptionFilter#doFilter(IsisLogOnExceptionFilter.java:52)
- org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
- org.apache.shiro.web.servlet.AbstractShiroFilter#executeChain(AbstractShiroFilter.java:449)
- org.apache.shiro.web.servlet.AbstractShiroFilter$1#call(AbstractShiroFilter.java:365)
- org.apache.shiro.subject.support.SubjectCallable#doCall(SubjectCallable.java:90)
- org.apache.shiro.subject.support.SubjectCallable#call(SubjectCallable.java:83)
- org.apache.shiro.subject.support.DelegatingSubject#execute(DelegatingSubject.java:383)
- org.apache.shiro.web.servlet.AbstractShiroFilter#doFilterInternal(AbstractShiroFilter.java:362)
- org.apache.shiro.web.servlet.OncePerRequestFilter#doFilter(OncePerRequestFilter.java:125)
- org.mortbay.jetty.servlet.ServletHandler$CachedChain#doFilter(ServletHandler.java:1212)
- org.mortbay.jetty.servlet.ServletHandler#handle(ServletHandler.java:399)
- org.mortbay.jetty.security.SecurityHandler#handle(SecurityHandler.java:216)
- org.mortbay.jetty.servlet.SessionHandler#handle(SessionHandler.java:182)
- org.mortbay.jetty.handler.ContextHandler#handle(ContextHandler.java:766)
- org.mortbay.jetty.webapp.WebAppContext#handle(WebAppContext.java:450)
- org.mortbay.jetty.handler.ContextHandlerCollection#handle(ContextHandlerCollection.java:230)
- org.mortbay.jetty.handler.HandlerCollection#handle(HandlerCollection.java:114)
- org.mortbay.jetty.handler.HandlerWrapper#handle(HandlerWrapper.java:152)
- org.mortbay.jetty.Server#handle(Server.java:326)
- org.mortbay.jetty.HttpConnection#handleRequest(HttpConnection.java:542)
- org.mortbay.jetty.HttpConnection$RequestHandler#headerComplete(HttpConnection.java:928)
- org.mortbay.jetty.HttpParser#parseNext(HttpParser.java:549)
- org.mortbay.jetty.HttpParser#parseAvailable(HttpParser.java:212)
- org.mortbay.jetty.HttpConnection#handle(HttpConnection.java:404)
- org.mortbay.io.nio.SelectChannelEndPoint#run(SelectChannelEndPoint.java:410)
- org.mortbay.thread.QueuedThreadPool$PoolThread#run(QueuedThreadPool.java:582
On Sun, Aug 2, 2015 at 11:23 PM, Dan Haywood <da...@haywood-associates.co.uk>
wrote:
> Further to this, I've updated the kitchensink (against 1.9.0-SNAPSHOT) to
> demonstrate this technique....
>
> The code is in ReferenceObject, which you can get to from the "Data Types"
> menu. Use the fixture scripts menu to create some sample data.
>
> The relevant code is below.
>
> Cheers
> Dan
>
> [1] https://github.com/isisaddons/isis-app-kitchensink
>
>
> private OtherObject someOtherObjectUsingName;
>
> @Property(hidden = Where.EVERYWHERE)
> @Column(allowsNull = "true")
> public OtherObject getSomeOtherObjectUsingName() {
> return someOtherObjectUsingName;
> }
>
> public void setSomeOtherObjectUsingName(final OtherObject
> someOtherObjectUsingName) {
> this.someOtherObjectUsingName = someOtherObjectUsingName;
> }
>
> @NotPersistent
> public String getSomeOtherObjectUsingNameName() {
> return getSomeOtherObjectUsingName() != null?
> getSomeOtherObjectUsingName().getName() : null;
> }
>
> public void setSomeOtherObjectUsingNameName(final String name) {
> OtherObject otherObject = name != null
> ? container.firstMatch(OtherObject.class, withName(name))
> : null;
> setSomeOtherObjectUsingName(otherObject);
> }
>
> public List<String> choicesSomeOtherObjectUsingNameName() {
> List<OtherObject> otherObjects =
> container.allInstances(OtherObject.class);
> return Lists.newArrayList(
> Iterables.transform(otherObjects, nameOf())
> );
> }
>
> private static Function<OtherObject, String> nameOf() {
> return new Function<OtherObject, String>() {
> @Nullable @Override public String apply(final OtherObject
> input) {
> return input.getName();
> }
> };
> }
>
> private static Predicate<OtherObject> withName(final String name) {
> return new Predicate<OtherObject>() {
> @Override public boolean apply(final OtherObject input) {
> return Objects.equal(input.getName(), name);
> }
> };
> }
>
>
>
>
>
> On 30 July 2015 at 13:16, Dan Haywood <da...@haywood-associates.co.uk>
> wrote:
>
> > looks right to me, so I'll take a look at in this eve or tomorrow.
> >
> > thx
> > Dan
> >
> >
> > On 30 July 2015 at 13:12, Stephen Cameron <st...@gmail.com>
> > wrote:
> >
> >> Still no luck with this one.
> >>
> >> The derived RegionName appears as a non-editable property, so not sure
> >> what
> >> was different before when I was getting an model validation error.
> >>
> >> My current code of interest is this:
> >>
> >> @Column(name = "region", allowsNull = "true")
> >> //@MemberOrder(sequence = "7")
> >> @Property(hidden=Where.EVERYWHERE)
> >> public Region getRegion() {
> >> return this.region;
> >> }
> >>
> >> public void setRegion(Region region) {
> >> this.region = region;
> >> }
> >>
> >> public List<Region> choicesRegion() {
> >> return regions.listAllRegions();
> >> }
> >>
> >> @MemberOrder(sequence = "7")
> >> public String getRegionName() {
> >> return regions.nameForRegion(getRegion());
> >> }
> >>
> >> public void setRegionName(String name) {
> >> setRegion(regions.regionForName(name));
> >> }
> >>
> >> public List<String> choicesRegionName(){
> >> return regions.listAllNamesExclusive(getRegion());
> >> }
> >>
> >> My Region class is this:
> >>
> >> package au.com.scds.chats.dom.modules.general.codes;
> >>
> >> import javax.jdo.annotations.Column;
> >> import javax.jdo.annotations.IdentityType;
> >> import javax.jdo.annotations.PrimaryKey;
> >>
> >> import org.apache.isis.applib.annotation.Action;
> >> import org.apache.isis.applib.annotation.ActionLayout;
> >> import org.apache.isis.applib.annotation.DomainServiceLayout;
> >> import org.apache.isis.applib.annotation.DomainServiceLayout.MenuBar;
> >> import org.apache.isis.applib.annotation.MemberOrder;
> >> import org.apache.isis.applib.annotation.PropertyLayout;
> >>
> >> @javax.jdo.annotations.PersistenceCapable(
> >> identityType=IdentityType.APPLICATION)
> >> public class Region {
> >>
> >> public String title(){
> >> return getName();
> >> }
> >>
> >> private String name;
> >>
> >> @Column(name="region", allowsNull = "false")
> >> @PrimaryKey()
> >> @PropertyLayout(named="Region")
> >> @MemberOrder(sequence="1")
> >> public String getName() {
> >> return name;
> >> }
> >>
> >> public void setName(String name) {
> >> this.name = name;
> >> }
> >> }
> >>
> >> My Regions repository class is this:
> >>
> >> package au.com.scds.chats.dom.modules.general.codes;
> >>
> >> import java.util.ArrayList;
> >> import java.util.List;
> >>
> >> import org.apache.isis.applib.DomainObjectContainer;
> >> import org.apache.isis.applib.annotation.Action;
> >> import org.apache.isis.applib.annotation.ActionLayout;
> >> import org.apache.isis.applib.annotation.BookmarkPolicy;
> >> import org.apache.isis.applib.annotation.DomainService;
> >> import org.apache.isis.applib.annotation.DomainServiceLayout;
> >> import org.apache.isis.applib.annotation.DomainServiceLayout.MenuBar;
> >> import org.apache.isis.applib.annotation.MemberOrder;
> >> import org.apache.isis.applib.annotation.ParameterLayout;
> >> import org.apache.isis.applib.annotation.Programmatic;
> >> import org.apache.isis.applib.annotation.SemanticsOf;
> >> import org.apache.isis.applib.query.QueryDefault;
> >>
> >> import au.com.scds.chats.dom.modules.participant.Participant;
> >>
> >> @DomainService(repositoryFor = Region.class)
> >> @DomainServiceLayout(menuBar = MenuBar.SECONDARY, named =
> >> "Administration",
> >> menuOrder = "100.1")
> >> public class Regions {
> >>
> >> // region > listAll (action)
> >> @Action(semantics = SemanticsOf.SAFE)
> >> @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT)
> >> @MemberOrder(sequence = "1")
> >> public List<Region> listAllRegions() {
> >> return container.allInstances(Region.class);
> >> }
> >>
> >> // endregion
> >>
> >> // region > create (action)
> >> @MemberOrder(sequence = "2")
> >> public Region createRegion(
> >> final @ParameterLayout(named = "Region Name") String name) {
> >> final Region obj = container.newTransientInstance(Region.class);
> >> obj.setName(name);
> >> container.persistIfNotAlready(obj);
> >> return obj;
> >> }
> >>
> >> // endregion
> >>
> >> // region > injected services
> >>
> >> @javax.inject.Inject
> >> DomainObjectContainer container;
> >>
> >> // endregion
> >>
> >> @Programmatic
> >> public String nameForRegion(Region region) {
> >> return (region != null) ? region.getName() : null;
> >> }
> >>
> >>
> >> @Programmatic
> >> public List<String> listAllNamesExclusive(Region region) {
> >> List<Region> regions = listAllRegions();
> >> List<String> names = new ArrayList<String>();
> >> for (Region r : regions) {
> >> if (region != null && r != region) {
> >> names.add(r.getName());
> >> }
> >> }
> >> return names;
> >> }
> >>
> >>
> >> @Programmatic
> >> public Region regionForName(String name) {
> >> Region region = container.firstMatch(new QueryDefault<>(
> >> Region.class,
> >> "findRegion", "name", name));
> >> return region;
> >> }
> >>
> >> }
> >>
> >> Just maybe I there is something missing still?
> >>
> >> I added a @Property annotation to the getRegionName() method, but that
> >> gave
> >> me a message saying it expected @javax.jdo.persistence.Column too.
> >>
> >> Note I couldn't use deprecated @Hidden in Isis 1.9.0.
> >>
> >>
> >> On Thu, Jul 30, 2015 at 8:14 PM, Stephen Cameron <
> >> steve.cameron.62@gmail.com
> >> > wrote:
> >>
> >> > Hi Dan, When I tried this I got an model validation error message
> >> relating
> >> > to the choices method, I will have another go and if it fails, provide
> >> the
> >> > test case. Thanks for the tips.
> >> >
> >> > On Thu, Jul 30, 2015 at 7:57 PM, Dan Haywood <
> >> dan@haywood-associates.co.uk
> >> > > wrote:
> >> >
> >> >> You should be able to add a choicesXxx() for the derived property:
> >> >>
> >> >> public List<String> choicesRegionName(){
> >> >> return
> Lists.newArrayList(Iterables.transform(choicesRegion(),
> >> x
> >> >> ->
> >> >> x.getName()));
> >> >> }
> >> >>
> >> >> If that isn't sufficient, you might also need to add a setter:
> >> >>
> >> >> public void setRegionName(final String name) {
> >> >> setRegion(Iterables.find(choicesRegion(), x ->
> >> x.getName().equals(name)));
> >> >> }
> >> >>
> >> >> Obviously, you might need to also add some error handling.
> >> >>
> >> >> ~~~
> >> >>
> >> >> Regarding the "external URL" idea, perhaps you could raise that as a
> >> >> separate ticket, with a code sketch as to how you'd like this
> >> information
> >> >> specified?
> >> >>
> >> >> Thanks
> >> >> Dan
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> On 30 July 2015 at 03:17, Stephen Cameron <
> steve.cameron.62@gmail.com>
> >> >> wrote:
> >> >>
> >> >> > Not so simple, as now the property cannot be updated.
> >> >> >
> >> >> > I have the following (@Hidden is deprecated)
> >> >> >
> >> >> > @Column(allowsNull = "true")
> >> >> > @MemberOrder(sequence = "7")
> >> >> > @PropertyLayout(hidden=Where.EVERYWHERE)
> >> >> > public Region getRegion() {
> >> >> > return this.region;
> >> >> > }
> >> >> >
> >> >> > public void setRegion(Region region) {
> >> >> > this.region = region;
> >> >> > }
> >> >> >
> >> >> > public List<Region> choicesRegion(){
> >> >> > List<Region> regions =
> container.allInstances(Region.class);
> >> >> > return regions;
> >> >> > }
> >> >> >
> >> >> > @MemberOrder(sequence = "7.1")
> >> >> > public String getRegionName(){
> >> >> > return (getRegion() != null) ? getRegion().getName() :
> null;
> >> >> > }
> >> >> >
> >> >> > Sure enough getRegion doesn't appear in the UI but getRegionName
> >> does,
> >> >> but
> >> >> > then setRegion and choiceRegion don't mean anything to the UI, so
> the
> >> >> > Region property is read-only.
> >> >> >
> >> >> > This issue is maybe more significant than it appears at first, in
> >> terms
> >> >> of
> >> >> > domain modelling such code-lists are simple types that 'represent'
> >> >> things
> >> >> > on the boundary of the domain of interest. So we usually want to
> just
> >> >> > represent them with a name. Presently it makes no sense to go to
> that
> >> >> thing
> >> >> > via a hyperlink as all we'll find is that name, our model extends
> no
> >> >> > further.
> >> >> >
> >> >> > However we just might like to allow users to leave the domain model
> >> and
> >> >> go
> >> >> > to a resource outside. So, extending the suppressLink=true idea, I
> >> would
> >> >> > add that each object could have an implicit link(URL),created by
> >> Isis,
> >> >> or
> >> >> > an explicit one and if the explicit one is present it can
> optionally
> >> be
> >> >> > used as an alternative to the implicit one.
> >> >> >
> >> >> > For example, you might create a database to log fish details,
> species
> >> >> is a
> >> >> > boundary concept, we aren't likely to want to add a new species to
> >> the
> >> >> list
> >> >> > of known species, but we'd like to keep such a list handy, but for
> >> each
> >> >> > named species in that list, to provide an explicit link to a
> resource
> >> >> in a
> >> >> > global fish database. It makes more sense to use this link than the
> >> >> > implicit one, as if the implicit one is used we'd navigate to the
> >> domain
> >> >> > object page displaying the name and URL, both of which items of
> data
> >> >> could
> >> >> > have been in the explicit link.
> >> >> >
> >> >> > In the explicit case you might want to warn the user they are
> >> navigating
> >> >> > outside the Isis domain application.
> >> >> >
> >> >> > Perhaps all this could be done simply if there was a URI type in
> >> Isis,
> >> >> that
> >> >> > would allow it to create 'smart links' automatically.
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > On Wed, Jul 29, 2015 at 9:37 PM, Stephen Cameron <
> >> >> > steve.cameron.62@gmail.com
> >> >> > > wrote:
> >> >> >
> >> >> > > Thanks Jeroen, seems simple enough :)
> >> >> > >
> >> >> > > On Wed, Jul 29, 2015 at 9:28 PM, Jeroen van der Wal <
> >> >> jeroen@stromboli.it
> >> >> > >
> >> >> > > wrote:
> >> >> > >
> >> >> > >> You could also hide the property and create a separate getter
> for
> >> >> > display
> >> >> > >> purposes only:
> >> >> > >>
> >> >> > >> private MyProperty myProperty;
> >> >> > >>
> >> >> > >> @Hidden
> >> >> > >> public MyProperty getMyProperty() {...}
> >> >> > >>
> >> >> > >> public void setMyProperty(...) {...}
> >> >> > >>
> >> >> > >> public String getMyPropertyName() {
> >> >> > >> getMyProperty.getName();
> >> >> > >> }
> >> >> > >>
> >> >> > >> On 29 July 2015 at 13:18, Stephen Cameron <
> >> >> steve.cameron.62@gmail.com>
> >> >> > >> wrote:
> >> >> > >>
> >> >> > >> > On Wed, Jul 29, 2015 at 6:38 PM, Dan Haywood <
> >> >> > >> dan@haywood-associates.co.uk
> >> >> > >> > >
> >> >> > >> > wrote:
> >> >> > >> >
> >> >> > >> > > You are right, they will be displayed as links; there's no
> >> way to
> >> >> > >> disable
> >> >> > >> > > it currently.
> >> >> > >> > >
> >> >> > >> > > We could add a bit of metadata perhaps for this, eg
> >> >> > >> > > @DomainObjectLayout(suppressLink=true) or similar.
> >> >> > >> > >
> >> >> > >> > > Please raise a ticket.
> >> >> > >> > >
> >> >> > >> >
> >> >> > >> > OK https://issues.apache.org/jira/browse/ISIS-1180
> >> >> > >> >
> >> >> > >> > >
> >> >> > >> > > Thx
> >> >> > >> > > Dan
> >> >> > >> > >
> >> >> > >> > > PS: these entities wouldn't be value types, rather regular
> >> >> entities.
> >> >> > >> But
> >> >> > >> > > you are right... what we really want is full-class support
> for
> >> >> value
> >> >> > >> > types.
> >> >> > >> > > We're just not there yet...
> >> >> > >> > >
> >> >> > >> > >
> >> >> > >> > >
> >> >> > >> >
> >> >> > >> > >
> >> >> > >> > >
> >> >> > >> > > On 29 July 2015 at 09:34, Stephen Cameron <
> >> >> > steve.cameron.62@gmail.com
> >> >> > >> >
> >> >> > >> > > wrote:
> >> >> > >> > >
> >> >> > >> > > > Thanks, but surely such object properties always end up
> >> being
> >> >> > >> displayed
> >> >> > >> > > as
> >> >> > >> > > > links? Clicking on the link to go to such an object page
> is
> >> >> > >> > meaningless,
> >> >> > >> > > as
> >> >> > >> > > > it only has one name property, that was displayed in the
> >> link.
> >> >> > Can I
> >> >> > >> > > > disable that default behaviour for value types?
> >> >> > >> > > >
> >> >> > >> > > >
> >> >> > >> > > >
> >> >> > >> > > > On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <
> >> >> > >> > > dan@haywood-associates.co.uk
> >> >> > >> > > > >
> >> >> > >> > > > wrote:
> >> >> > >> > > >
> >> >> > >> > > > > On 29 July 2015 at 08:08, Stephen Cameron <
> >> >> > >> > steve.cameron.62@gmail.com>
> >> >> > >>
> >> >> > >> > > > > wrote:
> >> >> > >> > > > >
> >> >> > >> > > > > > Hi,
> >> >> > >> > > > > >
> >> >> > >> > > > > > I want to do have some properties that are essentially
> >> >> String
> >> >> > >> > types,
> >> >> > >> > > > but
> >> >> > >> > > > > > which have a limited range of values (code-lists or
> >> >> restricted
> >> >> > >> > > > > > vocabularies). I want to allow these lists to be
> >> >> administered
> >> >> > >> > > > centrally,
> >> >> > >> > > > > so
> >> >> > >> > > > > > to add them to a single Administration menu item for
> >> admin
> >> >> > >> users.
> >> >> > >> > > > > >
> >> >> > >> > > > > > For most users these codes should appears as lists of
> >> >> strings
> >> >> > >> not
> >> >> > >> > as
> >> >> > >> > > > > > objects, but making them objects seems to be the
> >> logical OO
> >> >> > way
> >> >> > >> to
> >> >> > >> > > deal
> >> >> > >> > > > > > with them in Isis. So they are basically objects with
> >> one
> >> >> > 'name'
> >> >> > >> > > > property
> >> >> > >> > > > > > (and maybe an id added by datanucleus). All users need
> >> to
> >> >> see
> >> >> > is
> >> >> > >> > the
> >> >> > >> > > > name
> >> >> > >> > > > > > property, no icon is needed.
> >> >> > >> > > > > >
> >> >> > >> > > > > > Also, if I make them objects I also will get
> referencial
> >> >> > >> integrity
> >> >> > >> > > > > > constraints applied in the database.
> >> >> > >> > > > > >
> >> >> > >> > > > > >
> >> >> > >> > > > > +1, do it this way. That way they can also hold
> >> behaviour in
> >> >> > the
> >> >> > >> > > future.
> >> >> > >> > > > >
> >> >> > >> > > > >
> >> >> > >> > > > >
> >> >> > >> > > > >
> >> >> > >> > > > > > I wonder there is a simple recipe for this?
> >> >> > >> > > > > >
> >> >> > >> > > > >
> >> >> > >> > > > > No magic recipe for the domain entities... basically
> >> >> > copy-n-paste
> >> >> > >> the
> >> >> > >> > > > > SimpleObject that's in our archetype as many times as
> >> needed,
> >> >> > and
> >> >> > >> > tweak
> >> >> > >> > > > as
> >> >> > >> > > > > required.
> >> >> > >> > > > >
> >> >> > >> > > > > If you want to use the code as the primary key, then use
> >> DN
> >> >> > >> > application
> >> >> > >> > > > > identity
> >> >> > >> > > > >
> >> >> > >> > > > > @javax.jdo.annotations.PersistenceCapable(
> >> >> > >> > > > > identityType=IdentityType.APPLICATION,
> >> >> > >> > > > > schema = "simple",
> >> >> > >> > > > > table = "SimpleObject"
> >> >> > >> > > > > )
> >> >> > >> > > > >
> >> >> > >> > > > > and add @PrimaryKey to the "name" property. Also add
> >> @Title
> >> >> to
> >> >> > >> that
> >> >> > >> > > > 'name'
> >> >> > >> > > > > property (it is in SimpleObject already).
> >> >> > >> > > > >
> >> >> > >> > > > >
> >> >> > >> > > > > You would probably want to remove the version column, ie
> >> >> remove:
> >> >> > >> > > > >
> >> >> > >> > > > > @javax.jdo.annotations.Version(
> >> >> > >> > > > > strategy=VersionStrategy.VERSION_NUMBER,
> >> >> > >> > > > > column="version")
> >> >> > >> > > > >
> >> >> > >> > > > >
> >> >> > >> > > > > In addition, if you annotate the class as "bounded"
> >> >> > >> > > > > (@DomainObject(bounded=true)) then you are telling the
> >> >> framework
> >> >> > >> that
> >> >> > >> > > > > there's a limited - ie bounded - set of instances, and
> so
> >> it
> >> >> > will
> >> >> > >> > > display
> >> >> > >> > > > > all instances in a drop-down for you.
> >> >> > >> > > > >
> >> >> > >> > > > >
> >> >> > >> > > > > HTH
> >> >> > >> > > > > Dan
> >> >> > >> > > > >
> >> >> > >> > > >
> >> >> > >> > >
> >> >> > >> >
> >> >> > >>
> >> >> > >
> >> >> > >
> >> >> >
> >> >>
> >> >
> >> >
> >>
> >
> >
>
Re: code-lists and administration thereof
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Further to this, I've updated the kitchensink (against 1.9.0-SNAPSHOT) to
demonstrate this technique....
The code is in ReferenceObject, which you can get to from the "Data Types"
menu. Use the fixture scripts menu to create some sample data.
The relevant code is below.
Cheers
Dan
[1] https://github.com/isisaddons/isis-app-kitchensink
private OtherObject someOtherObjectUsingName;
@Property(hidden = Where.EVERYWHERE)
@Column(allowsNull = "true")
public OtherObject getSomeOtherObjectUsingName() {
return someOtherObjectUsingName;
}
public void setSomeOtherObjectUsingName(final OtherObject
someOtherObjectUsingName) {
this.someOtherObjectUsingName = someOtherObjectUsingName;
}
@NotPersistent
public String getSomeOtherObjectUsingNameName() {
return getSomeOtherObjectUsingName() != null?
getSomeOtherObjectUsingName().getName() : null;
}
public void setSomeOtherObjectUsingNameName(final String name) {
OtherObject otherObject = name != null
? container.firstMatch(OtherObject.class, withName(name))
: null;
setSomeOtherObjectUsingName(otherObject);
}
public List<String> choicesSomeOtherObjectUsingNameName() {
List<OtherObject> otherObjects =
container.allInstances(OtherObject.class);
return Lists.newArrayList(
Iterables.transform(otherObjects, nameOf())
);
}
private static Function<OtherObject, String> nameOf() {
return new Function<OtherObject, String>() {
@Nullable @Override public String apply(final OtherObject input) {
return input.getName();
}
};
}
private static Predicate<OtherObject> withName(final String name) {
return new Predicate<OtherObject>() {
@Override public boolean apply(final OtherObject input) {
return Objects.equal(input.getName(), name);
}
};
}
On 30 July 2015 at 13:16, Dan Haywood <da...@haywood-associates.co.uk> wrote:
> looks right to me, so I'll take a look at in this eve or tomorrow.
>
> thx
> Dan
>
>
> On 30 July 2015 at 13:12, Stephen Cameron <st...@gmail.com>
> wrote:
>
>> Still no luck with this one.
>>
>> The derived RegionName appears as a non-editable property, so not sure
>> what
>> was different before when I was getting an model validation error.
>>
>> My current code of interest is this:
>>
>> @Column(name = "region", allowsNull = "true")
>> //@MemberOrder(sequence = "7")
>> @Property(hidden=Where.EVERYWHERE)
>> public Region getRegion() {
>> return this.region;
>> }
>>
>> public void setRegion(Region region) {
>> this.region = region;
>> }
>>
>> public List<Region> choicesRegion() {
>> return regions.listAllRegions();
>> }
>>
>> @MemberOrder(sequence = "7")
>> public String getRegionName() {
>> return regions.nameForRegion(getRegion());
>> }
>>
>> public void setRegionName(String name) {
>> setRegion(regions.regionForName(name));
>> }
>>
>> public List<String> choicesRegionName(){
>> return regions.listAllNamesExclusive(getRegion());
>> }
>>
>> My Region class is this:
>>
>> package au.com.scds.chats.dom.modules.general.codes;
>>
>> import javax.jdo.annotations.Column;
>> import javax.jdo.annotations.IdentityType;
>> import javax.jdo.annotations.PrimaryKey;
>>
>> import org.apache.isis.applib.annotation.Action;
>> import org.apache.isis.applib.annotation.ActionLayout;
>> import org.apache.isis.applib.annotation.DomainServiceLayout;
>> import org.apache.isis.applib.annotation.DomainServiceLayout.MenuBar;
>> import org.apache.isis.applib.annotation.MemberOrder;
>> import org.apache.isis.applib.annotation.PropertyLayout;
>>
>> @javax.jdo.annotations.PersistenceCapable(
>> identityType=IdentityType.APPLICATION)
>> public class Region {
>>
>> public String title(){
>> return getName();
>> }
>>
>> private String name;
>>
>> @Column(name="region", allowsNull = "false")
>> @PrimaryKey()
>> @PropertyLayout(named="Region")
>> @MemberOrder(sequence="1")
>> public String getName() {
>> return name;
>> }
>>
>> public void setName(String name) {
>> this.name = name;
>> }
>> }
>>
>> My Regions repository class is this:
>>
>> package au.com.scds.chats.dom.modules.general.codes;
>>
>> import java.util.ArrayList;
>> import java.util.List;
>>
>> import org.apache.isis.applib.DomainObjectContainer;
>> import org.apache.isis.applib.annotation.Action;
>> import org.apache.isis.applib.annotation.ActionLayout;
>> import org.apache.isis.applib.annotation.BookmarkPolicy;
>> import org.apache.isis.applib.annotation.DomainService;
>> import org.apache.isis.applib.annotation.DomainServiceLayout;
>> import org.apache.isis.applib.annotation.DomainServiceLayout.MenuBar;
>> import org.apache.isis.applib.annotation.MemberOrder;
>> import org.apache.isis.applib.annotation.ParameterLayout;
>> import org.apache.isis.applib.annotation.Programmatic;
>> import org.apache.isis.applib.annotation.SemanticsOf;
>> import org.apache.isis.applib.query.QueryDefault;
>>
>> import au.com.scds.chats.dom.modules.participant.Participant;
>>
>> @DomainService(repositoryFor = Region.class)
>> @DomainServiceLayout(menuBar = MenuBar.SECONDARY, named =
>> "Administration",
>> menuOrder = "100.1")
>> public class Regions {
>>
>> // region > listAll (action)
>> @Action(semantics = SemanticsOf.SAFE)
>> @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT)
>> @MemberOrder(sequence = "1")
>> public List<Region> listAllRegions() {
>> return container.allInstances(Region.class);
>> }
>>
>> // endregion
>>
>> // region > create (action)
>> @MemberOrder(sequence = "2")
>> public Region createRegion(
>> final @ParameterLayout(named = "Region Name") String name) {
>> final Region obj = container.newTransientInstance(Region.class);
>> obj.setName(name);
>> container.persistIfNotAlready(obj);
>> return obj;
>> }
>>
>> // endregion
>>
>> // region > injected services
>>
>> @javax.inject.Inject
>> DomainObjectContainer container;
>>
>> // endregion
>>
>> @Programmatic
>> public String nameForRegion(Region region) {
>> return (region != null) ? region.getName() : null;
>> }
>>
>>
>> @Programmatic
>> public List<String> listAllNamesExclusive(Region region) {
>> List<Region> regions = listAllRegions();
>> List<String> names = new ArrayList<String>();
>> for (Region r : regions) {
>> if (region != null && r != region) {
>> names.add(r.getName());
>> }
>> }
>> return names;
>> }
>>
>>
>> @Programmatic
>> public Region regionForName(String name) {
>> Region region = container.firstMatch(new QueryDefault<>(
>> Region.class,
>> "findRegion", "name", name));
>> return region;
>> }
>>
>> }
>>
>> Just maybe I there is something missing still?
>>
>> I added a @Property annotation to the getRegionName() method, but that
>> gave
>> me a message saying it expected @javax.jdo.persistence.Column too.
>>
>> Note I couldn't use deprecated @Hidden in Isis 1.9.0.
>>
>>
>> On Thu, Jul 30, 2015 at 8:14 PM, Stephen Cameron <
>> steve.cameron.62@gmail.com
>> > wrote:
>>
>> > Hi Dan, When I tried this I got an model validation error message
>> relating
>> > to the choices method, I will have another go and if it fails, provide
>> the
>> > test case. Thanks for the tips.
>> >
>> > On Thu, Jul 30, 2015 at 7:57 PM, Dan Haywood <
>> dan@haywood-associates.co.uk
>> > > wrote:
>> >
>> >> You should be able to add a choicesXxx() for the derived property:
>> >>
>> >> public List<String> choicesRegionName(){
>> >> return Lists.newArrayList(Iterables.transform(choicesRegion(),
>> x
>> >> ->
>> >> x.getName()));
>> >> }
>> >>
>> >> If that isn't sufficient, you might also need to add a setter:
>> >>
>> >> public void setRegionName(final String name) {
>> >> setRegion(Iterables.find(choicesRegion(), x ->
>> x.getName().equals(name)));
>> >> }
>> >>
>> >> Obviously, you might need to also add some error handling.
>> >>
>> >> ~~~
>> >>
>> >> Regarding the "external URL" idea, perhaps you could raise that as a
>> >> separate ticket, with a code sketch as to how you'd like this
>> information
>> >> specified?
>> >>
>> >> Thanks
>> >> Dan
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> On 30 July 2015 at 03:17, Stephen Cameron <st...@gmail.com>
>> >> wrote:
>> >>
>> >> > Not so simple, as now the property cannot be updated.
>> >> >
>> >> > I have the following (@Hidden is deprecated)
>> >> >
>> >> > @Column(allowsNull = "true")
>> >> > @MemberOrder(sequence = "7")
>> >> > @PropertyLayout(hidden=Where.EVERYWHERE)
>> >> > public Region getRegion() {
>> >> > return this.region;
>> >> > }
>> >> >
>> >> > public void setRegion(Region region) {
>> >> > this.region = region;
>> >> > }
>> >> >
>> >> > public List<Region> choicesRegion(){
>> >> > List<Region> regions = container.allInstances(Region.class);
>> >> > return regions;
>> >> > }
>> >> >
>> >> > @MemberOrder(sequence = "7.1")
>> >> > public String getRegionName(){
>> >> > return (getRegion() != null) ? getRegion().getName() : null;
>> >> > }
>> >> >
>> >> > Sure enough getRegion doesn't appear in the UI but getRegionName
>> does,
>> >> but
>> >> > then setRegion and choiceRegion don't mean anything to the UI, so the
>> >> > Region property is read-only.
>> >> >
>> >> > This issue is maybe more significant than it appears at first, in
>> terms
>> >> of
>> >> > domain modelling such code-lists are simple types that 'represent'
>> >> things
>> >> > on the boundary of the domain of interest. So we usually want to just
>> >> > represent them with a name. Presently it makes no sense to go to that
>> >> thing
>> >> > via a hyperlink as all we'll find is that name, our model extends no
>> >> > further.
>> >> >
>> >> > However we just might like to allow users to leave the domain model
>> and
>> >> go
>> >> > to a resource outside. So, extending the suppressLink=true idea, I
>> would
>> >> > add that each object could have an implicit link(URL),created by
>> Isis,
>> >> or
>> >> > an explicit one and if the explicit one is present it can optionally
>> be
>> >> > used as an alternative to the implicit one.
>> >> >
>> >> > For example, you might create a database to log fish details, species
>> >> is a
>> >> > boundary concept, we aren't likely to want to add a new species to
>> the
>> >> list
>> >> > of known species, but we'd like to keep such a list handy, but for
>> each
>> >> > named species in that list, to provide an explicit link to a resource
>> >> in a
>> >> > global fish database. It makes more sense to use this link than the
>> >> > implicit one, as if the implicit one is used we'd navigate to the
>> domain
>> >> > object page displaying the name and URL, both of which items of data
>> >> could
>> >> > have been in the explicit link.
>> >> >
>> >> > In the explicit case you might want to warn the user they are
>> navigating
>> >> > outside the Isis domain application.
>> >> >
>> >> > Perhaps all this could be done simply if there was a URI type in
>> Isis,
>> >> that
>> >> > would allow it to create 'smart links' automatically.
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > On Wed, Jul 29, 2015 at 9:37 PM, Stephen Cameron <
>> >> > steve.cameron.62@gmail.com
>> >> > > wrote:
>> >> >
>> >> > > Thanks Jeroen, seems simple enough :)
>> >> > >
>> >> > > On Wed, Jul 29, 2015 at 9:28 PM, Jeroen van der Wal <
>> >> jeroen@stromboli.it
>> >> > >
>> >> > > wrote:
>> >> > >
>> >> > >> You could also hide the property and create a separate getter for
>> >> > display
>> >> > >> purposes only:
>> >> > >>
>> >> > >> private MyProperty myProperty;
>> >> > >>
>> >> > >> @Hidden
>> >> > >> public MyProperty getMyProperty() {...}
>> >> > >>
>> >> > >> public void setMyProperty(...) {...}
>> >> > >>
>> >> > >> public String getMyPropertyName() {
>> >> > >> getMyProperty.getName();
>> >> > >> }
>> >> > >>
>> >> > >> On 29 July 2015 at 13:18, Stephen Cameron <
>> >> steve.cameron.62@gmail.com>
>> >> > >> wrote:
>> >> > >>
>> >> > >> > On Wed, Jul 29, 2015 at 6:38 PM, Dan Haywood <
>> >> > >> dan@haywood-associates.co.uk
>> >> > >> > >
>> >> > >> > wrote:
>> >> > >> >
>> >> > >> > > You are right, they will be displayed as links; there's no
>> way to
>> >> > >> disable
>> >> > >> > > it currently.
>> >> > >> > >
>> >> > >> > > We could add a bit of metadata perhaps for this, eg
>> >> > >> > > @DomainObjectLayout(suppressLink=true) or similar.
>> >> > >> > >
>> >> > >> > > Please raise a ticket.
>> >> > >> > >
>> >> > >> >
>> >> > >> > OK https://issues.apache.org/jira/browse/ISIS-1180
>> >> > >> >
>> >> > >> > >
>> >> > >> > > Thx
>> >> > >> > > Dan
>> >> > >> > >
>> >> > >> > > PS: these entities wouldn't be value types, rather regular
>> >> entities.
>> >> > >> But
>> >> > >> > > you are right... what we really want is full-class support for
>> >> value
>> >> > >> > types.
>> >> > >> > > We're just not there yet...
>> >> > >> > >
>> >> > >> > >
>> >> > >> > >
>> >> > >> >
>> >> > >> > >
>> >> > >> > >
>> >> > >> > > On 29 July 2015 at 09:34, Stephen Cameron <
>> >> > steve.cameron.62@gmail.com
>> >> > >> >
>> >> > >> > > wrote:
>> >> > >> > >
>> >> > >> > > > Thanks, but surely such object properties always end up
>> being
>> >> > >> displayed
>> >> > >> > > as
>> >> > >> > > > links? Clicking on the link to go to such an object page is
>> >> > >> > meaningless,
>> >> > >> > > as
>> >> > >> > > > it only has one name property, that was displayed in the
>> link.
>> >> > Can I
>> >> > >> > > > disable that default behaviour for value types?
>> >> > >> > > >
>> >> > >> > > >
>> >> > >> > > >
>> >> > >> > > > On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <
>> >> > >> > > dan@haywood-associates.co.uk
>> >> > >> > > > >
>> >> > >> > > > wrote:
>> >> > >> > > >
>> >> > >> > > > > On 29 July 2015 at 08:08, Stephen Cameron <
>> >> > >> > steve.cameron.62@gmail.com>
>> >> > >>
>> >> > >> > > > > wrote:
>> >> > >> > > > >
>> >> > >> > > > > > Hi,
>> >> > >> > > > > >
>> >> > >> > > > > > I want to do have some properties that are essentially
>> >> String
>> >> > >> > types,
>> >> > >> > > > but
>> >> > >> > > > > > which have a limited range of values (code-lists or
>> >> restricted
>> >> > >> > > > > > vocabularies). I want to allow these lists to be
>> >> administered
>> >> > >> > > > centrally,
>> >> > >> > > > > so
>> >> > >> > > > > > to add them to a single Administration menu item for
>> admin
>> >> > >> users.
>> >> > >> > > > > >
>> >> > >> > > > > > For most users these codes should appears as lists of
>> >> strings
>> >> > >> not
>> >> > >> > as
>> >> > >> > > > > > objects, but making them objects seems to be the
>> logical OO
>> >> > way
>> >> > >> to
>> >> > >> > > deal
>> >> > >> > > > > > with them in Isis. So they are basically objects with
>> one
>> >> > 'name'
>> >> > >> > > > property
>> >> > >> > > > > > (and maybe an id added by datanucleus). All users need
>> to
>> >> see
>> >> > is
>> >> > >> > the
>> >> > >> > > > name
>> >> > >> > > > > > property, no icon is needed.
>> >> > >> > > > > >
>> >> > >> > > > > > Also, if I make them objects I also will get referencial
>> >> > >> integrity
>> >> > >> > > > > > constraints applied in the database.
>> >> > >> > > > > >
>> >> > >> > > > > >
>> >> > >> > > > > +1, do it this way. That way they can also hold
>> behaviour in
>> >> > the
>> >> > >> > > future.
>> >> > >> > > > >
>> >> > >> > > > >
>> >> > >> > > > >
>> >> > >> > > > >
>> >> > >> > > > > > I wonder there is a simple recipe for this?
>> >> > >> > > > > >
>> >> > >> > > > >
>> >> > >> > > > > No magic recipe for the domain entities... basically
>> >> > copy-n-paste
>> >> > >> the
>> >> > >> > > > > SimpleObject that's in our archetype as many times as
>> needed,
>> >> > and
>> >> > >> > tweak
>> >> > >> > > > as
>> >> > >> > > > > required.
>> >> > >> > > > >
>> >> > >> > > > > If you want to use the code as the primary key, then use
>> DN
>> >> > >> > application
>> >> > >> > > > > identity
>> >> > >> > > > >
>> >> > >> > > > > @javax.jdo.annotations.PersistenceCapable(
>> >> > >> > > > > identityType=IdentityType.APPLICATION,
>> >> > >> > > > > schema = "simple",
>> >> > >> > > > > table = "SimpleObject"
>> >> > >> > > > > )
>> >> > >> > > > >
>> >> > >> > > > > and add @PrimaryKey to the "name" property. Also add
>> @Title
>> >> to
>> >> > >> that
>> >> > >> > > > 'name'
>> >> > >> > > > > property (it is in SimpleObject already).
>> >> > >> > > > >
>> >> > >> > > > >
>> >> > >> > > > > You would probably want to remove the version column, ie
>> >> remove:
>> >> > >> > > > >
>> >> > >> > > > > @javax.jdo.annotations.Version(
>> >> > >> > > > > strategy=VersionStrategy.VERSION_NUMBER,
>> >> > >> > > > > column="version")
>> >> > >> > > > >
>> >> > >> > > > >
>> >> > >> > > > > In addition, if you annotate the class as "bounded"
>> >> > >> > > > > (@DomainObject(bounded=true)) then you are telling the
>> >> framework
>> >> > >> that
>> >> > >> > > > > there's a limited - ie bounded - set of instances, and so
>> it
>> >> > will
>> >> > >> > > display
>> >> > >> > > > > all instances in a drop-down for you.
>> >> > >> > > > >
>> >> > >> > > > >
>> >> > >> > > > > HTH
>> >> > >> > > > > Dan
>> >> > >> > > > >
>> >> > >> > > >
>> >> > >> > >
>> >> > >> >
>> >> > >>
>> >> > >
>> >> > >
>> >> >
>> >>
>> >
>> >
>>
>
>
Re: code-lists and administration thereof
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
looks right to me, so I'll take a look at in this eve or tomorrow.
thx
Dan
On 30 July 2015 at 13:12, Stephen Cameron <st...@gmail.com>
wrote:
> Still no luck with this one.
>
> The derived RegionName appears as a non-editable property, so not sure what
> was different before when I was getting an model validation error.
>
> My current code of interest is this:
>
> @Column(name = "region", allowsNull = "true")
> //@MemberOrder(sequence = "7")
> @Property(hidden=Where.EVERYWHERE)
> public Region getRegion() {
> return this.region;
> }
>
> public void setRegion(Region region) {
> this.region = region;
> }
>
> public List<Region> choicesRegion() {
> return regions.listAllRegions();
> }
>
> @MemberOrder(sequence = "7")
> public String getRegionName() {
> return regions.nameForRegion(getRegion());
> }
>
> public void setRegionName(String name) {
> setRegion(regions.regionForName(name));
> }
>
> public List<String> choicesRegionName(){
> return regions.listAllNamesExclusive(getRegion());
> }
>
> My Region class is this:
>
> package au.com.scds.chats.dom.modules.general.codes;
>
> import javax.jdo.annotations.Column;
> import javax.jdo.annotations.IdentityType;
> import javax.jdo.annotations.PrimaryKey;
>
> import org.apache.isis.applib.annotation.Action;
> import org.apache.isis.applib.annotation.ActionLayout;
> import org.apache.isis.applib.annotation.DomainServiceLayout;
> import org.apache.isis.applib.annotation.DomainServiceLayout.MenuBar;
> import org.apache.isis.applib.annotation.MemberOrder;
> import org.apache.isis.applib.annotation.PropertyLayout;
>
> @javax.jdo.annotations.PersistenceCapable(
> identityType=IdentityType.APPLICATION)
> public class Region {
>
> public String title(){
> return getName();
> }
>
> private String name;
>
> @Column(name="region", allowsNull = "false")
> @PrimaryKey()
> @PropertyLayout(named="Region")
> @MemberOrder(sequence="1")
> public String getName() {
> return name;
> }
>
> public void setName(String name) {
> this.name = name;
> }
> }
>
> My Regions repository class is this:
>
> package au.com.scds.chats.dom.modules.general.codes;
>
> import java.util.ArrayList;
> import java.util.List;
>
> import org.apache.isis.applib.DomainObjectContainer;
> import org.apache.isis.applib.annotation.Action;
> import org.apache.isis.applib.annotation.ActionLayout;
> import org.apache.isis.applib.annotation.BookmarkPolicy;
> import org.apache.isis.applib.annotation.DomainService;
> import org.apache.isis.applib.annotation.DomainServiceLayout;
> import org.apache.isis.applib.annotation.DomainServiceLayout.MenuBar;
> import org.apache.isis.applib.annotation.MemberOrder;
> import org.apache.isis.applib.annotation.ParameterLayout;
> import org.apache.isis.applib.annotation.Programmatic;
> import org.apache.isis.applib.annotation.SemanticsOf;
> import org.apache.isis.applib.query.QueryDefault;
>
> import au.com.scds.chats.dom.modules.participant.Participant;
>
> @DomainService(repositoryFor = Region.class)
> @DomainServiceLayout(menuBar = MenuBar.SECONDARY, named = "Administration",
> menuOrder = "100.1")
> public class Regions {
>
> // region > listAll (action)
> @Action(semantics = SemanticsOf.SAFE)
> @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT)
> @MemberOrder(sequence = "1")
> public List<Region> listAllRegions() {
> return container.allInstances(Region.class);
> }
>
> // endregion
>
> // region > create (action)
> @MemberOrder(sequence = "2")
> public Region createRegion(
> final @ParameterLayout(named = "Region Name") String name) {
> final Region obj = container.newTransientInstance(Region.class);
> obj.setName(name);
> container.persistIfNotAlready(obj);
> return obj;
> }
>
> // endregion
>
> // region > injected services
>
> @javax.inject.Inject
> DomainObjectContainer container;
>
> // endregion
>
> @Programmatic
> public String nameForRegion(Region region) {
> return (region != null) ? region.getName() : null;
> }
>
>
> @Programmatic
> public List<String> listAllNamesExclusive(Region region) {
> List<Region> regions = listAllRegions();
> List<String> names = new ArrayList<String>();
> for (Region r : regions) {
> if (region != null && r != region) {
> names.add(r.getName());
> }
> }
> return names;
> }
>
>
> @Programmatic
> public Region regionForName(String name) {
> Region region = container.firstMatch(new QueryDefault<>(
> Region.class,
> "findRegion", "name", name));
> return region;
> }
>
> }
>
> Just maybe I there is something missing still?
>
> I added a @Property annotation to the getRegionName() method, but that gave
> me a message saying it expected @javax.jdo.persistence.Column too.
>
> Note I couldn't use deprecated @Hidden in Isis 1.9.0.
>
>
> On Thu, Jul 30, 2015 at 8:14 PM, Stephen Cameron <
> steve.cameron.62@gmail.com
> > wrote:
>
> > Hi Dan, When I tried this I got an model validation error message
> relating
> > to the choices method, I will have another go and if it fails, provide
> the
> > test case. Thanks for the tips.
> >
> > On Thu, Jul 30, 2015 at 7:57 PM, Dan Haywood <
> dan@haywood-associates.co.uk
> > > wrote:
> >
> >> You should be able to add a choicesXxx() for the derived property:
> >>
> >> public List<String> choicesRegionName(){
> >> return Lists.newArrayList(Iterables.transform(choicesRegion(), x
> >> ->
> >> x.getName()));
> >> }
> >>
> >> If that isn't sufficient, you might also need to add a setter:
> >>
> >> public void setRegionName(final String name) {
> >> setRegion(Iterables.find(choicesRegion(), x ->
> x.getName().equals(name)));
> >> }
> >>
> >> Obviously, you might need to also add some error handling.
> >>
> >> ~~~
> >>
> >> Regarding the "external URL" idea, perhaps you could raise that as a
> >> separate ticket, with a code sketch as to how you'd like this
> information
> >> specified?
> >>
> >> Thanks
> >> Dan
> >>
> >>
> >>
> >>
> >>
> >> On 30 July 2015 at 03:17, Stephen Cameron <st...@gmail.com>
> >> wrote:
> >>
> >> > Not so simple, as now the property cannot be updated.
> >> >
> >> > I have the following (@Hidden is deprecated)
> >> >
> >> > @Column(allowsNull = "true")
> >> > @MemberOrder(sequence = "7")
> >> > @PropertyLayout(hidden=Where.EVERYWHERE)
> >> > public Region getRegion() {
> >> > return this.region;
> >> > }
> >> >
> >> > public void setRegion(Region region) {
> >> > this.region = region;
> >> > }
> >> >
> >> > public List<Region> choicesRegion(){
> >> > List<Region> regions = container.allInstances(Region.class);
> >> > return regions;
> >> > }
> >> >
> >> > @MemberOrder(sequence = "7.1")
> >> > public String getRegionName(){
> >> > return (getRegion() != null) ? getRegion().getName() : null;
> >> > }
> >> >
> >> > Sure enough getRegion doesn't appear in the UI but getRegionName does,
> >> but
> >> > then setRegion and choiceRegion don't mean anything to the UI, so the
> >> > Region property is read-only.
> >> >
> >> > This issue is maybe more significant than it appears at first, in
> terms
> >> of
> >> > domain modelling such code-lists are simple types that 'represent'
> >> things
> >> > on the boundary of the domain of interest. So we usually want to just
> >> > represent them with a name. Presently it makes no sense to go to that
> >> thing
> >> > via a hyperlink as all we'll find is that name, our model extends no
> >> > further.
> >> >
> >> > However we just might like to allow users to leave the domain model
> and
> >> go
> >> > to a resource outside. So, extending the suppressLink=true idea, I
> would
> >> > add that each object could have an implicit link(URL),created by Isis,
> >> or
> >> > an explicit one and if the explicit one is present it can optionally
> be
> >> > used as an alternative to the implicit one.
> >> >
> >> > For example, you might create a database to log fish details, species
> >> is a
> >> > boundary concept, we aren't likely to want to add a new species to the
> >> list
> >> > of known species, but we'd like to keep such a list handy, but for
> each
> >> > named species in that list, to provide an explicit link to a resource
> >> in a
> >> > global fish database. It makes more sense to use this link than the
> >> > implicit one, as if the implicit one is used we'd navigate to the
> domain
> >> > object page displaying the name and URL, both of which items of data
> >> could
> >> > have been in the explicit link.
> >> >
> >> > In the explicit case you might want to warn the user they are
> navigating
> >> > outside the Isis domain application.
> >> >
> >> > Perhaps all this could be done simply if there was a URI type in Isis,
> >> that
> >> > would allow it to create 'smart links' automatically.
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > On Wed, Jul 29, 2015 at 9:37 PM, Stephen Cameron <
> >> > steve.cameron.62@gmail.com
> >> > > wrote:
> >> >
> >> > > Thanks Jeroen, seems simple enough :)
> >> > >
> >> > > On Wed, Jul 29, 2015 at 9:28 PM, Jeroen van der Wal <
> >> jeroen@stromboli.it
> >> > >
> >> > > wrote:
> >> > >
> >> > >> You could also hide the property and create a separate getter for
> >> > display
> >> > >> purposes only:
> >> > >>
> >> > >> private MyProperty myProperty;
> >> > >>
> >> > >> @Hidden
> >> > >> public MyProperty getMyProperty() {...}
> >> > >>
> >> > >> public void setMyProperty(...) {...}
> >> > >>
> >> > >> public String getMyPropertyName() {
> >> > >> getMyProperty.getName();
> >> > >> }
> >> > >>
> >> > >> On 29 July 2015 at 13:18, Stephen Cameron <
> >> steve.cameron.62@gmail.com>
> >> > >> wrote:
> >> > >>
> >> > >> > On Wed, Jul 29, 2015 at 6:38 PM, Dan Haywood <
> >> > >> dan@haywood-associates.co.uk
> >> > >> > >
> >> > >> > wrote:
> >> > >> >
> >> > >> > > You are right, they will be displayed as links; there's no way
> to
> >> > >> disable
> >> > >> > > it currently.
> >> > >> > >
> >> > >> > > We could add a bit of metadata perhaps for this, eg
> >> > >> > > @DomainObjectLayout(suppressLink=true) or similar.
> >> > >> > >
> >> > >> > > Please raise a ticket.
> >> > >> > >
> >> > >> >
> >> > >> > OK https://issues.apache.org/jira/browse/ISIS-1180
> >> > >> >
> >> > >> > >
> >> > >> > > Thx
> >> > >> > > Dan
> >> > >> > >
> >> > >> > > PS: these entities wouldn't be value types, rather regular
> >> entities.
> >> > >> But
> >> > >> > > you are right... what we really want is full-class support for
> >> value
> >> > >> > types.
> >> > >> > > We're just not there yet...
> >> > >> > >
> >> > >> > >
> >> > >> > >
> >> > >> >
> >> > >> > >
> >> > >> > >
> >> > >> > > On 29 July 2015 at 09:34, Stephen Cameron <
> >> > steve.cameron.62@gmail.com
> >> > >> >
> >> > >> > > wrote:
> >> > >> > >
> >> > >> > > > Thanks, but surely such object properties always end up being
> >> > >> displayed
> >> > >> > > as
> >> > >> > > > links? Clicking on the link to go to such an object page is
> >> > >> > meaningless,
> >> > >> > > as
> >> > >> > > > it only has one name property, that was displayed in the
> link.
> >> > Can I
> >> > >> > > > disable that default behaviour for value types?
> >> > >> > > >
> >> > >> > > >
> >> > >> > > >
> >> > >> > > > On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <
> >> > >> > > dan@haywood-associates.co.uk
> >> > >> > > > >
> >> > >> > > > wrote:
> >> > >> > > >
> >> > >> > > > > On 29 July 2015 at 08:08, Stephen Cameron <
> >> > >> > steve.cameron.62@gmail.com>
> >> > >>
> >> > >> > > > > wrote:
> >> > >> > > > >
> >> > >> > > > > > Hi,
> >> > >> > > > > >
> >> > >> > > > > > I want to do have some properties that are essentially
> >> String
> >> > >> > types,
> >> > >> > > > but
> >> > >> > > > > > which have a limited range of values (code-lists or
> >> restricted
> >> > >> > > > > > vocabularies). I want to allow these lists to be
> >> administered
> >> > >> > > > centrally,
> >> > >> > > > > so
> >> > >> > > > > > to add them to a single Administration menu item for
> admin
> >> > >> users.
> >> > >> > > > > >
> >> > >> > > > > > For most users these codes should appears as lists of
> >> strings
> >> > >> not
> >> > >> > as
> >> > >> > > > > > objects, but making them objects seems to be the logical
> OO
> >> > way
> >> > >> to
> >> > >> > > deal
> >> > >> > > > > > with them in Isis. So they are basically objects with one
> >> > 'name'
> >> > >> > > > property
> >> > >> > > > > > (and maybe an id added by datanucleus). All users need to
> >> see
> >> > is
> >> > >> > the
> >> > >> > > > name
> >> > >> > > > > > property, no icon is needed.
> >> > >> > > > > >
> >> > >> > > > > > Also, if I make them objects I also will get referencial
> >> > >> integrity
> >> > >> > > > > > constraints applied in the database.
> >> > >> > > > > >
> >> > >> > > > > >
> >> > >> > > > > +1, do it this way. That way they can also hold behaviour
> in
> >> > the
> >> > >> > > future.
> >> > >> > > > >
> >> > >> > > > >
> >> > >> > > > >
> >> > >> > > > >
> >> > >> > > > > > I wonder there is a simple recipe for this?
> >> > >> > > > > >
> >> > >> > > > >
> >> > >> > > > > No magic recipe for the domain entities... basically
> >> > copy-n-paste
> >> > >> the
> >> > >> > > > > SimpleObject that's in our archetype as many times as
> needed,
> >> > and
> >> > >> > tweak
> >> > >> > > > as
> >> > >> > > > > required.
> >> > >> > > > >
> >> > >> > > > > If you want to use the code as the primary key, then use DN
> >> > >> > application
> >> > >> > > > > identity
> >> > >> > > > >
> >> > >> > > > > @javax.jdo.annotations.PersistenceCapable(
> >> > >> > > > > identityType=IdentityType.APPLICATION,
> >> > >> > > > > schema = "simple",
> >> > >> > > > > table = "SimpleObject"
> >> > >> > > > > )
> >> > >> > > > >
> >> > >> > > > > and add @PrimaryKey to the "name" property. Also add
> @Title
> >> to
> >> > >> that
> >> > >> > > > 'name'
> >> > >> > > > > property (it is in SimpleObject already).
> >> > >> > > > >
> >> > >> > > > >
> >> > >> > > > > You would probably want to remove the version column, ie
> >> remove:
> >> > >> > > > >
> >> > >> > > > > @javax.jdo.annotations.Version(
> >> > >> > > > > strategy=VersionStrategy.VERSION_NUMBER,
> >> > >> > > > > column="version")
> >> > >> > > > >
> >> > >> > > > >
> >> > >> > > > > In addition, if you annotate the class as "bounded"
> >> > >> > > > > (@DomainObject(bounded=true)) then you are telling the
> >> framework
> >> > >> that
> >> > >> > > > > there's a limited - ie bounded - set of instances, and so
> it
> >> > will
> >> > >> > > display
> >> > >> > > > > all instances in a drop-down for you.
> >> > >> > > > >
> >> > >> > > > >
> >> > >> > > > > HTH
> >> > >> > > > > Dan
> >> > >> > > > >
> >> > >> > > >
> >> > >> > >
> >> > >> >
> >> > >>
> >> > >
> >> > >
> >> >
> >>
> >
> >
>
Re: code-lists and administration thereof
Posted by Stephen Cameron <st...@gmail.com>.
Still no luck with this one.
The derived RegionName appears as a non-editable property, so not sure what
was different before when I was getting an model validation error.
My current code of interest is this:
@Column(name = "region", allowsNull = "true")
//@MemberOrder(sequence = "7")
@Property(hidden=Where.EVERYWHERE)
public Region getRegion() {
return this.region;
}
public void setRegion(Region region) {
this.region = region;
}
public List<Region> choicesRegion() {
return regions.listAllRegions();
}
@MemberOrder(sequence = "7")
public String getRegionName() {
return regions.nameForRegion(getRegion());
}
public void setRegionName(String name) {
setRegion(regions.regionForName(name));
}
public List<String> choicesRegionName(){
return regions.listAllNamesExclusive(getRegion());
}
My Region class is this:
package au.com.scds.chats.dom.modules.general.codes;
import javax.jdo.annotations.Column;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PrimaryKey;
import org.apache.isis.applib.annotation.Action;
import org.apache.isis.applib.annotation.ActionLayout;
import org.apache.isis.applib.annotation.DomainServiceLayout;
import org.apache.isis.applib.annotation.DomainServiceLayout.MenuBar;
import org.apache.isis.applib.annotation.MemberOrder;
import org.apache.isis.applib.annotation.PropertyLayout;
@javax.jdo.annotations.PersistenceCapable(
identityType=IdentityType.APPLICATION)
public class Region {
public String title(){
return getName();
}
private String name;
@Column(name="region", allowsNull = "false")
@PrimaryKey()
@PropertyLayout(named="Region")
@MemberOrder(sequence="1")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
My Regions repository class is this:
package au.com.scds.chats.dom.modules.general.codes;
import java.util.ArrayList;
import java.util.List;
import org.apache.isis.applib.DomainObjectContainer;
import org.apache.isis.applib.annotation.Action;
import org.apache.isis.applib.annotation.ActionLayout;
import org.apache.isis.applib.annotation.BookmarkPolicy;
import org.apache.isis.applib.annotation.DomainService;
import org.apache.isis.applib.annotation.DomainServiceLayout;
import org.apache.isis.applib.annotation.DomainServiceLayout.MenuBar;
import org.apache.isis.applib.annotation.MemberOrder;
import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.Programmatic;
import org.apache.isis.applib.annotation.SemanticsOf;
import org.apache.isis.applib.query.QueryDefault;
import au.com.scds.chats.dom.modules.participant.Participant;
@DomainService(repositoryFor = Region.class)
@DomainServiceLayout(menuBar = MenuBar.SECONDARY, named = "Administration",
menuOrder = "100.1")
public class Regions {
// region > listAll (action)
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT)
@MemberOrder(sequence = "1")
public List<Region> listAllRegions() {
return container.allInstances(Region.class);
}
// endregion
// region > create (action)
@MemberOrder(sequence = "2")
public Region createRegion(
final @ParameterLayout(named = "Region Name") String name) {
final Region obj = container.newTransientInstance(Region.class);
obj.setName(name);
container.persistIfNotAlready(obj);
return obj;
}
// endregion
// region > injected services
@javax.inject.Inject
DomainObjectContainer container;
// endregion
@Programmatic
public String nameForRegion(Region region) {
return (region != null) ? region.getName() : null;
}
@Programmatic
public List<String> listAllNamesExclusive(Region region) {
List<Region> regions = listAllRegions();
List<String> names = new ArrayList<String>();
for (Region r : regions) {
if (region != null && r != region) {
names.add(r.getName());
}
}
return names;
}
@Programmatic
public Region regionForName(String name) {
Region region = container.firstMatch(new QueryDefault<>(
Region.class,
"findRegion", "name", name));
return region;
}
}
Just maybe I there is something missing still?
I added a @Property annotation to the getRegionName() method, but that gave
me a message saying it expected @javax.jdo.persistence.Column too.
Note I couldn't use deprecated @Hidden in Isis 1.9.0.
On Thu, Jul 30, 2015 at 8:14 PM, Stephen Cameron <steve.cameron.62@gmail.com
> wrote:
> Hi Dan, When I tried this I got an model validation error message relating
> to the choices method, I will have another go and if it fails, provide the
> test case. Thanks for the tips.
>
> On Thu, Jul 30, 2015 at 7:57 PM, Dan Haywood <dan@haywood-associates.co.uk
> > wrote:
>
>> You should be able to add a choicesXxx() for the derived property:
>>
>> public List<String> choicesRegionName(){
>> return Lists.newArrayList(Iterables.transform(choicesRegion(), x
>> ->
>> x.getName()));
>> }
>>
>> If that isn't sufficient, you might also need to add a setter:
>>
>> public void setRegionName(final String name) {
>> setRegion(Iterables.find(choicesRegion(), x -> x.getName().equals(name)));
>> }
>>
>> Obviously, you might need to also add some error handling.
>>
>> ~~~
>>
>> Regarding the "external URL" idea, perhaps you could raise that as a
>> separate ticket, with a code sketch as to how you'd like this information
>> specified?
>>
>> Thanks
>> Dan
>>
>>
>>
>>
>>
>> On 30 July 2015 at 03:17, Stephen Cameron <st...@gmail.com>
>> wrote:
>>
>> > Not so simple, as now the property cannot be updated.
>> >
>> > I have the following (@Hidden is deprecated)
>> >
>> > @Column(allowsNull = "true")
>> > @MemberOrder(sequence = "7")
>> > @PropertyLayout(hidden=Where.EVERYWHERE)
>> > public Region getRegion() {
>> > return this.region;
>> > }
>> >
>> > public void setRegion(Region region) {
>> > this.region = region;
>> > }
>> >
>> > public List<Region> choicesRegion(){
>> > List<Region> regions = container.allInstances(Region.class);
>> > return regions;
>> > }
>> >
>> > @MemberOrder(sequence = "7.1")
>> > public String getRegionName(){
>> > return (getRegion() != null) ? getRegion().getName() : null;
>> > }
>> >
>> > Sure enough getRegion doesn't appear in the UI but getRegionName does,
>> but
>> > then setRegion and choiceRegion don't mean anything to the UI, so the
>> > Region property is read-only.
>> >
>> > This issue is maybe more significant than it appears at first, in terms
>> of
>> > domain modelling such code-lists are simple types that 'represent'
>> things
>> > on the boundary of the domain of interest. So we usually want to just
>> > represent them with a name. Presently it makes no sense to go to that
>> thing
>> > via a hyperlink as all we'll find is that name, our model extends no
>> > further.
>> >
>> > However we just might like to allow users to leave the domain model and
>> go
>> > to a resource outside. So, extending the suppressLink=true idea, I would
>> > add that each object could have an implicit link(URL),created by Isis,
>> or
>> > an explicit one and if the explicit one is present it can optionally be
>> > used as an alternative to the implicit one.
>> >
>> > For example, you might create a database to log fish details, species
>> is a
>> > boundary concept, we aren't likely to want to add a new species to the
>> list
>> > of known species, but we'd like to keep such a list handy, but for each
>> > named species in that list, to provide an explicit link to a resource
>> in a
>> > global fish database. It makes more sense to use this link than the
>> > implicit one, as if the implicit one is used we'd navigate to the domain
>> > object page displaying the name and URL, both of which items of data
>> could
>> > have been in the explicit link.
>> >
>> > In the explicit case you might want to warn the user they are navigating
>> > outside the Isis domain application.
>> >
>> > Perhaps all this could be done simply if there was a URI type in Isis,
>> that
>> > would allow it to create 'smart links' automatically.
>> >
>> >
>> >
>> >
>> >
>> > On Wed, Jul 29, 2015 at 9:37 PM, Stephen Cameron <
>> > steve.cameron.62@gmail.com
>> > > wrote:
>> >
>> > > Thanks Jeroen, seems simple enough :)
>> > >
>> > > On Wed, Jul 29, 2015 at 9:28 PM, Jeroen van der Wal <
>> jeroen@stromboli.it
>> > >
>> > > wrote:
>> > >
>> > >> You could also hide the property and create a separate getter for
>> > display
>> > >> purposes only:
>> > >>
>> > >> private MyProperty myProperty;
>> > >>
>> > >> @Hidden
>> > >> public MyProperty getMyProperty() {...}
>> > >>
>> > >> public void setMyProperty(...) {...}
>> > >>
>> > >> public String getMyPropertyName() {
>> > >> getMyProperty.getName();
>> > >> }
>> > >>
>> > >> On 29 July 2015 at 13:18, Stephen Cameron <
>> steve.cameron.62@gmail.com>
>> > >> wrote:
>> > >>
>> > >> > On Wed, Jul 29, 2015 at 6:38 PM, Dan Haywood <
>> > >> dan@haywood-associates.co.uk
>> > >> > >
>> > >> > wrote:
>> > >> >
>> > >> > > You are right, they will be displayed as links; there's no way to
>> > >> disable
>> > >> > > it currently.
>> > >> > >
>> > >> > > We could add a bit of metadata perhaps for this, eg
>> > >> > > @DomainObjectLayout(suppressLink=true) or similar.
>> > >> > >
>> > >> > > Please raise a ticket.
>> > >> > >
>> > >> >
>> > >> > OK https://issues.apache.org/jira/browse/ISIS-1180
>> > >> >
>> > >> > >
>> > >> > > Thx
>> > >> > > Dan
>> > >> > >
>> > >> > > PS: these entities wouldn't be value types, rather regular
>> entities.
>> > >> But
>> > >> > > you are right... what we really want is full-class support for
>> value
>> > >> > types.
>> > >> > > We're just not there yet...
>> > >> > >
>> > >> > >
>> > >> > >
>> > >> >
>> > >> > >
>> > >> > >
>> > >> > > On 29 July 2015 at 09:34, Stephen Cameron <
>> > steve.cameron.62@gmail.com
>> > >> >
>> > >> > > wrote:
>> > >> > >
>> > >> > > > Thanks, but surely such object properties always end up being
>> > >> displayed
>> > >> > > as
>> > >> > > > links? Clicking on the link to go to such an object page is
>> > >> > meaningless,
>> > >> > > as
>> > >> > > > it only has one name property, that was displayed in the link.
>> > Can I
>> > >> > > > disable that default behaviour for value types?
>> > >> > > >
>> > >> > > >
>> > >> > > >
>> > >> > > > On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <
>> > >> > > dan@haywood-associates.co.uk
>> > >> > > > >
>> > >> > > > wrote:
>> > >> > > >
>> > >> > > > > On 29 July 2015 at 08:08, Stephen Cameron <
>> > >> > steve.cameron.62@gmail.com>
>> > >>
>> > >> > > > > wrote:
>> > >> > > > >
>> > >> > > > > > Hi,
>> > >> > > > > >
>> > >> > > > > > I want to do have some properties that are essentially
>> String
>> > >> > types,
>> > >> > > > but
>> > >> > > > > > which have a limited range of values (code-lists or
>> restricted
>> > >> > > > > > vocabularies). I want to allow these lists to be
>> administered
>> > >> > > > centrally,
>> > >> > > > > so
>> > >> > > > > > to add them to a single Administration menu item for admin
>> > >> users.
>> > >> > > > > >
>> > >> > > > > > For most users these codes should appears as lists of
>> strings
>> > >> not
>> > >> > as
>> > >> > > > > > objects, but making them objects seems to be the logical OO
>> > way
>> > >> to
>> > >> > > deal
>> > >> > > > > > with them in Isis. So they are basically objects with one
>> > 'name'
>> > >> > > > property
>> > >> > > > > > (and maybe an id added by datanucleus). All users need to
>> see
>> > is
>> > >> > the
>> > >> > > > name
>> > >> > > > > > property, no icon is needed.
>> > >> > > > > >
>> > >> > > > > > Also, if I make them objects I also will get referencial
>> > >> integrity
>> > >> > > > > > constraints applied in the database.
>> > >> > > > > >
>> > >> > > > > >
>> > >> > > > > +1, do it this way. That way they can also hold behaviour in
>> > the
>> > >> > > future.
>> > >> > > > >
>> > >> > > > >
>> > >> > > > >
>> > >> > > > >
>> > >> > > > > > I wonder there is a simple recipe for this?
>> > >> > > > > >
>> > >> > > > >
>> > >> > > > > No magic recipe for the domain entities... basically
>> > copy-n-paste
>> > >> the
>> > >> > > > > SimpleObject that's in our archetype as many times as needed,
>> > and
>> > >> > tweak
>> > >> > > > as
>> > >> > > > > required.
>> > >> > > > >
>> > >> > > > > If you want to use the code as the primary key, then use DN
>> > >> > application
>> > >> > > > > identity
>> > >> > > > >
>> > >> > > > > @javax.jdo.annotations.PersistenceCapable(
>> > >> > > > > identityType=IdentityType.APPLICATION,
>> > >> > > > > schema = "simple",
>> > >> > > > > table = "SimpleObject"
>> > >> > > > > )
>> > >> > > > >
>> > >> > > > > and add @PrimaryKey to the "name" property. Also add @Title
>> to
>> > >> that
>> > >> > > > 'name'
>> > >> > > > > property (it is in SimpleObject already).
>> > >> > > > >
>> > >> > > > >
>> > >> > > > > You would probably want to remove the version column, ie
>> remove:
>> > >> > > > >
>> > >> > > > > @javax.jdo.annotations.Version(
>> > >> > > > > strategy=VersionStrategy.VERSION_NUMBER,
>> > >> > > > > column="version")
>> > >> > > > >
>> > >> > > > >
>> > >> > > > > In addition, if you annotate the class as "bounded"
>> > >> > > > > (@DomainObject(bounded=true)) then you are telling the
>> framework
>> > >> that
>> > >> > > > > there's a limited - ie bounded - set of instances, and so it
>> > will
>> > >> > > display
>> > >> > > > > all instances in a drop-down for you.
>> > >> > > > >
>> > >> > > > >
>> > >> > > > > HTH
>> > >> > > > > Dan
>> > >> > > > >
>> > >> > > >
>> > >> > >
>> > >> >
>> > >>
>> > >
>> > >
>> >
>>
>
>
Re: code-lists and administration thereof
Posted by Stephen Cameron <st...@gmail.com>.
Hi Dan, When I tried this I got an model validation error message relating
to the choices method, I will have another go and if it fails, provide the
test case. Thanks for the tips.
On Thu, Jul 30, 2015 at 7:57 PM, Dan Haywood <da...@haywood-associates.co.uk>
wrote:
> You should be able to add a choicesXxx() for the derived property:
>
> public List<String> choicesRegionName(){
> return Lists.newArrayList(Iterables.transform(choicesRegion(), x ->
> x.getName()));
> }
>
> If that isn't sufficient, you might also need to add a setter:
>
> public void setRegionName(final String name) {
> setRegion(Iterables.find(choicesRegion(), x -> x.getName().equals(name)));
> }
>
> Obviously, you might need to also add some error handling.
>
> ~~~
>
> Regarding the "external URL" idea, perhaps you could raise that as a
> separate ticket, with a code sketch as to how you'd like this information
> specified?
>
> Thanks
> Dan
>
>
>
>
>
> On 30 July 2015 at 03:17, Stephen Cameron <st...@gmail.com>
> wrote:
>
> > Not so simple, as now the property cannot be updated.
> >
> > I have the following (@Hidden is deprecated)
> >
> > @Column(allowsNull = "true")
> > @MemberOrder(sequence = "7")
> > @PropertyLayout(hidden=Where.EVERYWHERE)
> > public Region getRegion() {
> > return this.region;
> > }
> >
> > public void setRegion(Region region) {
> > this.region = region;
> > }
> >
> > public List<Region> choicesRegion(){
> > List<Region> regions = container.allInstances(Region.class);
> > return regions;
> > }
> >
> > @MemberOrder(sequence = "7.1")
> > public String getRegionName(){
> > return (getRegion() != null) ? getRegion().getName() : null;
> > }
> >
> > Sure enough getRegion doesn't appear in the UI but getRegionName does,
> but
> > then setRegion and choiceRegion don't mean anything to the UI, so the
> > Region property is read-only.
> >
> > This issue is maybe more significant than it appears at first, in terms
> of
> > domain modelling such code-lists are simple types that 'represent' things
> > on the boundary of the domain of interest. So we usually want to just
> > represent them with a name. Presently it makes no sense to go to that
> thing
> > via a hyperlink as all we'll find is that name, our model extends no
> > further.
> >
> > However we just might like to allow users to leave the domain model and
> go
> > to a resource outside. So, extending the suppressLink=true idea, I would
> > add that each object could have an implicit link(URL),created by Isis, or
> > an explicit one and if the explicit one is present it can optionally be
> > used as an alternative to the implicit one.
> >
> > For example, you might create a database to log fish details, species is
> a
> > boundary concept, we aren't likely to want to add a new species to the
> list
> > of known species, but we'd like to keep such a list handy, but for each
> > named species in that list, to provide an explicit link to a resource in
> a
> > global fish database. It makes more sense to use this link than the
> > implicit one, as if the implicit one is used we'd navigate to the domain
> > object page displaying the name and URL, both of which items of data
> could
> > have been in the explicit link.
> >
> > In the explicit case you might want to warn the user they are navigating
> > outside the Isis domain application.
> >
> > Perhaps all this could be done simply if there was a URI type in Isis,
> that
> > would allow it to create 'smart links' automatically.
> >
> >
> >
> >
> >
> > On Wed, Jul 29, 2015 at 9:37 PM, Stephen Cameron <
> > steve.cameron.62@gmail.com
> > > wrote:
> >
> > > Thanks Jeroen, seems simple enough :)
> > >
> > > On Wed, Jul 29, 2015 at 9:28 PM, Jeroen van der Wal <
> jeroen@stromboli.it
> > >
> > > wrote:
> > >
> > >> You could also hide the property and create a separate getter for
> > display
> > >> purposes only:
> > >>
> > >> private MyProperty myProperty;
> > >>
> > >> @Hidden
> > >> public MyProperty getMyProperty() {...}
> > >>
> > >> public void setMyProperty(...) {...}
> > >>
> > >> public String getMyPropertyName() {
> > >> getMyProperty.getName();
> > >> }
> > >>
> > >> On 29 July 2015 at 13:18, Stephen Cameron <steve.cameron.62@gmail.com
> >
> > >> wrote:
> > >>
> > >> > On Wed, Jul 29, 2015 at 6:38 PM, Dan Haywood <
> > >> dan@haywood-associates.co.uk
> > >> > >
> > >> > wrote:
> > >> >
> > >> > > You are right, they will be displayed as links; there's no way to
> > >> disable
> > >> > > it currently.
> > >> > >
> > >> > > We could add a bit of metadata perhaps for this, eg
> > >> > > @DomainObjectLayout(suppressLink=true) or similar.
> > >> > >
> > >> > > Please raise a ticket.
> > >> > >
> > >> >
> > >> > OK https://issues.apache.org/jira/browse/ISIS-1180
> > >> >
> > >> > >
> > >> > > Thx
> > >> > > Dan
> > >> > >
> > >> > > PS: these entities wouldn't be value types, rather regular
> entities.
> > >> But
> > >> > > you are right... what we really want is full-class support for
> value
> > >> > types.
> > >> > > We're just not there yet...
> > >> > >
> > >> > >
> > >> > >
> > >> >
> > >> > >
> > >> > >
> > >> > > On 29 July 2015 at 09:34, Stephen Cameron <
> > steve.cameron.62@gmail.com
> > >> >
> > >> > > wrote:
> > >> > >
> > >> > > > Thanks, but surely such object properties always end up being
> > >> displayed
> > >> > > as
> > >> > > > links? Clicking on the link to go to such an object page is
> > >> > meaningless,
> > >> > > as
> > >> > > > it only has one name property, that was displayed in the link.
> > Can I
> > >> > > > disable that default behaviour for value types?
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > > > On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <
> > >> > > dan@haywood-associates.co.uk
> > >> > > > >
> > >> > > > wrote:
> > >> > > >
> > >> > > > > On 29 July 2015 at 08:08, Stephen Cameron <
> > >> > steve.cameron.62@gmail.com>
> > >>
> > >> > > > > wrote:
> > >> > > > >
> > >> > > > > > Hi,
> > >> > > > > >
> > >> > > > > > I want to do have some properties that are essentially
> String
> > >> > types,
> > >> > > > but
> > >> > > > > > which have a limited range of values (code-lists or
> restricted
> > >> > > > > > vocabularies). I want to allow these lists to be
> administered
> > >> > > > centrally,
> > >> > > > > so
> > >> > > > > > to add them to a single Administration menu item for admin
> > >> users.
> > >> > > > > >
> > >> > > > > > For most users these codes should appears as lists of
> strings
> > >> not
> > >> > as
> > >> > > > > > objects, but making them objects seems to be the logical OO
> > way
> > >> to
> > >> > > deal
> > >> > > > > > with them in Isis. So they are basically objects with one
> > 'name'
> > >> > > > property
> > >> > > > > > (and maybe an id added by datanucleus). All users need to
> see
> > is
> > >> > the
> > >> > > > name
> > >> > > > > > property, no icon is needed.
> > >> > > > > >
> > >> > > > > > Also, if I make them objects I also will get referencial
> > >> integrity
> > >> > > > > > constraints applied in the database.
> > >> > > > > >
> > >> > > > > >
> > >> > > > > +1, do it this way. That way they can also hold behaviour in
> > the
> > >> > > future.
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > > > I wonder there is a simple recipe for this?
> > >> > > > > >
> > >> > > > >
> > >> > > > > No magic recipe for the domain entities... basically
> > copy-n-paste
> > >> the
> > >> > > > > SimpleObject that's in our archetype as many times as needed,
> > and
> > >> > tweak
> > >> > > > as
> > >> > > > > required.
> > >> > > > >
> > >> > > > > If you want to use the code as the primary key, then use DN
> > >> > application
> > >> > > > > identity
> > >> > > > >
> > >> > > > > @javax.jdo.annotations.PersistenceCapable(
> > >> > > > > identityType=IdentityType.APPLICATION,
> > >> > > > > schema = "simple",
> > >> > > > > table = "SimpleObject"
> > >> > > > > )
> > >> > > > >
> > >> > > > > and add @PrimaryKey to the "name" property. Also add @Title
> to
> > >> that
> > >> > > > 'name'
> > >> > > > > property (it is in SimpleObject already).
> > >> > > > >
> > >> > > > >
> > >> > > > > You would probably want to remove the version column, ie
> remove:
> > >> > > > >
> > >> > > > > @javax.jdo.annotations.Version(
> > >> > > > > strategy=VersionStrategy.VERSION_NUMBER,
> > >> > > > > column="version")
> > >> > > > >
> > >> > > > >
> > >> > > > > In addition, if you annotate the class as "bounded"
> > >> > > > > (@DomainObject(bounded=true)) then you are telling the
> framework
> > >> that
> > >> > > > > there's a limited - ie bounded - set of instances, and so it
> > will
> > >> > > display
> > >> > > > > all instances in a drop-down for you.
> > >> > > > >
> > >> > > > >
> > >> > > > > HTH
> > >> > > > > Dan
> > >> > > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> > >
> > >
> >
>
Re: code-lists and administration thereof
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
You should be able to add a choicesXxx() for the derived property:
public List<String> choicesRegionName(){
return Lists.newArrayList(Iterables.transform(choicesRegion(), x ->
x.getName()));
}
If that isn't sufficient, you might also need to add a setter:
public void setRegionName(final String name) {
setRegion(Iterables.find(choicesRegion(), x -> x.getName().equals(name)));
}
Obviously, you might need to also add some error handling.
~~~
Regarding the "external URL" idea, perhaps you could raise that as a
separate ticket, with a code sketch as to how you'd like this information
specified?
Thanks
Dan
On 30 July 2015 at 03:17, Stephen Cameron <st...@gmail.com>
wrote:
> Not so simple, as now the property cannot be updated.
>
> I have the following (@Hidden is deprecated)
>
> @Column(allowsNull = "true")
> @MemberOrder(sequence = "7")
> @PropertyLayout(hidden=Where.EVERYWHERE)
> public Region getRegion() {
> return this.region;
> }
>
> public void setRegion(Region region) {
> this.region = region;
> }
>
> public List<Region> choicesRegion(){
> List<Region> regions = container.allInstances(Region.class);
> return regions;
> }
>
> @MemberOrder(sequence = "7.1")
> public String getRegionName(){
> return (getRegion() != null) ? getRegion().getName() : null;
> }
>
> Sure enough getRegion doesn't appear in the UI but getRegionName does, but
> then setRegion and choiceRegion don't mean anything to the UI, so the
> Region property is read-only.
>
> This issue is maybe more significant than it appears at first, in terms of
> domain modelling such code-lists are simple types that 'represent' things
> on the boundary of the domain of interest. So we usually want to just
> represent them with a name. Presently it makes no sense to go to that thing
> via a hyperlink as all we'll find is that name, our model extends no
> further.
>
> However we just might like to allow users to leave the domain model and go
> to a resource outside. So, extending the suppressLink=true idea, I would
> add that each object could have an implicit link(URL),created by Isis, or
> an explicit one and if the explicit one is present it can optionally be
> used as an alternative to the implicit one.
>
> For example, you might create a database to log fish details, species is a
> boundary concept, we aren't likely to want to add a new species to the list
> of known species, but we'd like to keep such a list handy, but for each
> named species in that list, to provide an explicit link to a resource in a
> global fish database. It makes more sense to use this link than the
> implicit one, as if the implicit one is used we'd navigate to the domain
> object page displaying the name and URL, both of which items of data could
> have been in the explicit link.
>
> In the explicit case you might want to warn the user they are navigating
> outside the Isis domain application.
>
> Perhaps all this could be done simply if there was a URI type in Isis, that
> would allow it to create 'smart links' automatically.
>
>
>
>
>
> On Wed, Jul 29, 2015 at 9:37 PM, Stephen Cameron <
> steve.cameron.62@gmail.com
> > wrote:
>
> > Thanks Jeroen, seems simple enough :)
> >
> > On Wed, Jul 29, 2015 at 9:28 PM, Jeroen van der Wal <jeroen@stromboli.it
> >
> > wrote:
> >
> >> You could also hide the property and create a separate getter for
> display
> >> purposes only:
> >>
> >> private MyProperty myProperty;
> >>
> >> @Hidden
> >> public MyProperty getMyProperty() {...}
> >>
> >> public void setMyProperty(...) {...}
> >>
> >> public String getMyPropertyName() {
> >> getMyProperty.getName();
> >> }
> >>
> >> On 29 July 2015 at 13:18, Stephen Cameron <st...@gmail.com>
> >> wrote:
> >>
> >> > On Wed, Jul 29, 2015 at 6:38 PM, Dan Haywood <
> >> dan@haywood-associates.co.uk
> >> > >
> >> > wrote:
> >> >
> >> > > You are right, they will be displayed as links; there's no way to
> >> disable
> >> > > it currently.
> >> > >
> >> > > We could add a bit of metadata perhaps for this, eg
> >> > > @DomainObjectLayout(suppressLink=true) or similar.
> >> > >
> >> > > Please raise a ticket.
> >> > >
> >> >
> >> > OK https://issues.apache.org/jira/browse/ISIS-1180
> >> >
> >> > >
> >> > > Thx
> >> > > Dan
> >> > >
> >> > > PS: these entities wouldn't be value types, rather regular entities.
> >> But
> >> > > you are right... what we really want is full-class support for value
> >> > types.
> >> > > We're just not there yet...
> >> > >
> >> > >
> >> > >
> >> >
> >> > >
> >> > >
> >> > > On 29 July 2015 at 09:34, Stephen Cameron <
> steve.cameron.62@gmail.com
> >> >
> >> > > wrote:
> >> > >
> >> > > > Thanks, but surely such object properties always end up being
> >> displayed
> >> > > as
> >> > > > links? Clicking on the link to go to such an object page is
> >> > meaningless,
> >> > > as
> >> > > > it only has one name property, that was displayed in the link.
> Can I
> >> > > > disable that default behaviour for value types?
> >> > > >
> >> > > >
> >> > > >
> >> > > > On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <
> >> > > dan@haywood-associates.co.uk
> >> > > > >
> >> > > > wrote:
> >> > > >
> >> > > > > On 29 July 2015 at 08:08, Stephen Cameron <
> >> > steve.cameron.62@gmail.com>
> >>
> >> > > > > wrote:
> >> > > > >
> >> > > > > > Hi,
> >> > > > > >
> >> > > > > > I want to do have some properties that are essentially String
> >> > types,
> >> > > > but
> >> > > > > > which have a limited range of values (code-lists or restricted
> >> > > > > > vocabularies). I want to allow these lists to be administered
> >> > > > centrally,
> >> > > > > so
> >> > > > > > to add them to a single Administration menu item for admin
> >> users.
> >> > > > > >
> >> > > > > > For most users these codes should appears as lists of strings
> >> not
> >> > as
> >> > > > > > objects, but making them objects seems to be the logical OO
> way
> >> to
> >> > > deal
> >> > > > > > with them in Isis. So they are basically objects with one
> 'name'
> >> > > > property
> >> > > > > > (and maybe an id added by datanucleus). All users need to see
> is
> >> > the
> >> > > > name
> >> > > > > > property, no icon is needed.
> >> > > > > >
> >> > > > > > Also, if I make them objects I also will get referencial
> >> integrity
> >> > > > > > constraints applied in the database.
> >> > > > > >
> >> > > > > >
> >> > > > > +1, do it this way. That way they can also hold behaviour in
> the
> >> > > future.
> >> > > > >
> >> > > > >
> >> > > > >
> >> > > > >
> >> > > > > > I wonder there is a simple recipe for this?
> >> > > > > >
> >> > > > >
> >> > > > > No magic recipe for the domain entities... basically
> copy-n-paste
> >> the
> >> > > > > SimpleObject that's in our archetype as many times as needed,
> and
> >> > tweak
> >> > > > as
> >> > > > > required.
> >> > > > >
> >> > > > > If you want to use the code as the primary key, then use DN
> >> > application
> >> > > > > identity
> >> > > > >
> >> > > > > @javax.jdo.annotations.PersistenceCapable(
> >> > > > > identityType=IdentityType.APPLICATION,
> >> > > > > schema = "simple",
> >> > > > > table = "SimpleObject"
> >> > > > > )
> >> > > > >
> >> > > > > and add @PrimaryKey to the "name" property. Also add @Title to
> >> that
> >> > > > 'name'
> >> > > > > property (it is in SimpleObject already).
> >> > > > >
> >> > > > >
> >> > > > > You would probably want to remove the version column, ie remove:
> >> > > > >
> >> > > > > @javax.jdo.annotations.Version(
> >> > > > > strategy=VersionStrategy.VERSION_NUMBER,
> >> > > > > column="version")
> >> > > > >
> >> > > > >
> >> > > > > In addition, if you annotate the class as "bounded"
> >> > > > > (@DomainObject(bounded=true)) then you are telling the framework
> >> that
> >> > > > > there's a limited - ie bounded - set of instances, and so it
> will
> >> > > display
> >> > > > > all instances in a drop-down for you.
> >> > > > >
> >> > > > >
> >> > > > > HTH
> >> > > > > Dan
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
> >
> >
>
Re: code-lists and administration thereof
Posted by Stephen Cameron <st...@gmail.com>.
Not so simple, as now the property cannot be updated.
I have the following (@Hidden is deprecated)
@Column(allowsNull = "true")
@MemberOrder(sequence = "7")
@PropertyLayout(hidden=Where.EVERYWHERE)
public Region getRegion() {
return this.region;
}
public void setRegion(Region region) {
this.region = region;
}
public List<Region> choicesRegion(){
List<Region> regions = container.allInstances(Region.class);
return regions;
}
@MemberOrder(sequence = "7.1")
public String getRegionName(){
return (getRegion() != null) ? getRegion().getName() : null;
}
Sure enough getRegion doesn't appear in the UI but getRegionName does, but
then setRegion and choiceRegion don't mean anything to the UI, so the
Region property is read-only.
This issue is maybe more significant than it appears at first, in terms of
domain modelling such code-lists are simple types that 'represent' things
on the boundary of the domain of interest. So we usually want to just
represent them with a name. Presently it makes no sense to go to that thing
via a hyperlink as all we'll find is that name, our model extends no
further.
However we just might like to allow users to leave the domain model and go
to a resource outside. So, extending the suppressLink=true idea, I would
add that each object could have an implicit link(URL),created by Isis, or
an explicit one and if the explicit one is present it can optionally be
used as an alternative to the implicit one.
For example, you might create a database to log fish details, species is a
boundary concept, we aren't likely to want to add a new species to the list
of known species, but we'd like to keep such a list handy, but for each
named species in that list, to provide an explicit link to a resource in a
global fish database. It makes more sense to use this link than the
implicit one, as if the implicit one is used we'd navigate to the domain
object page displaying the name and URL, both of which items of data could
have been in the explicit link.
In the explicit case you might want to warn the user they are navigating
outside the Isis domain application.
Perhaps all this could be done simply if there was a URI type in Isis, that
would allow it to create 'smart links' automatically.
On Wed, Jul 29, 2015 at 9:37 PM, Stephen Cameron <steve.cameron.62@gmail.com
> wrote:
> Thanks Jeroen, seems simple enough :)
>
> On Wed, Jul 29, 2015 at 9:28 PM, Jeroen van der Wal <je...@stromboli.it>
> wrote:
>
>> You could also hide the property and create a separate getter for display
>> purposes only:
>>
>> private MyProperty myProperty;
>>
>> @Hidden
>> public MyProperty getMyProperty() {...}
>>
>> public void setMyProperty(...) {...}
>>
>> public String getMyPropertyName() {
>> getMyProperty.getName();
>> }
>>
>> On 29 July 2015 at 13:18, Stephen Cameron <st...@gmail.com>
>> wrote:
>>
>> > On Wed, Jul 29, 2015 at 6:38 PM, Dan Haywood <
>> dan@haywood-associates.co.uk
>> > >
>> > wrote:
>> >
>> > > You are right, they will be displayed as links; there's no way to
>> disable
>> > > it currently.
>> > >
>> > > We could add a bit of metadata perhaps for this, eg
>> > > @DomainObjectLayout(suppressLink=true) or similar.
>> > >
>> > > Please raise a ticket.
>> > >
>> >
>> > OK https://issues.apache.org/jira/browse/ISIS-1180
>> >
>> > >
>> > > Thx
>> > > Dan
>> > >
>> > > PS: these entities wouldn't be value types, rather regular entities.
>> But
>> > > you are right... what we really want is full-class support for value
>> > types.
>> > > We're just not there yet...
>> > >
>> > >
>> > >
>> >
>> > >
>> > >
>> > > On 29 July 2015 at 09:34, Stephen Cameron <steve.cameron.62@gmail.com
>> >
>> > > wrote:
>> > >
>> > > > Thanks, but surely such object properties always end up being
>> displayed
>> > > as
>> > > > links? Clicking on the link to go to such an object page is
>> > meaningless,
>> > > as
>> > > > it only has one name property, that was displayed in the link. Can I
>> > > > disable that default behaviour for value types?
>> > > >
>> > > >
>> > > >
>> > > > On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <
>> > > dan@haywood-associates.co.uk
>> > > > >
>> > > > wrote:
>> > > >
>> > > > > On 29 July 2015 at 08:08, Stephen Cameron <
>> > steve.cameron.62@gmail.com>
>>
>> > > > > wrote:
>> > > > >
>> > > > > > Hi,
>> > > > > >
>> > > > > > I want to do have some properties that are essentially String
>> > types,
>> > > > but
>> > > > > > which have a limited range of values (code-lists or restricted
>> > > > > > vocabularies). I want to allow these lists to be administered
>> > > > centrally,
>> > > > > so
>> > > > > > to add them to a single Administration menu item for admin
>> users.
>> > > > > >
>> > > > > > For most users these codes should appears as lists of strings
>> not
>> > as
>> > > > > > objects, but making them objects seems to be the logical OO way
>> to
>> > > deal
>> > > > > > with them in Isis. So they are basically objects with one 'name'
>> > > > property
>> > > > > > (and maybe an id added by datanucleus). All users need to see is
>> > the
>> > > > name
>> > > > > > property, no icon is needed.
>> > > > > >
>> > > > > > Also, if I make them objects I also will get referencial
>> integrity
>> > > > > > constraints applied in the database.
>> > > > > >
>> > > > > >
>> > > > > +1, do it this way. That way they can also hold behaviour in the
>> > > future.
>> > > > >
>> > > > >
>> > > > >
>> > > > >
>> > > > > > I wonder there is a simple recipe for this?
>> > > > > >
>> > > > >
>> > > > > No magic recipe for the domain entities... basically copy-n-paste
>> the
>> > > > > SimpleObject that's in our archetype as many times as needed, and
>> > tweak
>> > > > as
>> > > > > required.
>> > > > >
>> > > > > If you want to use the code as the primary key, then use DN
>> > application
>> > > > > identity
>> > > > >
>> > > > > @javax.jdo.annotations.PersistenceCapable(
>> > > > > identityType=IdentityType.APPLICATION,
>> > > > > schema = "simple",
>> > > > > table = "SimpleObject"
>> > > > > )
>> > > > >
>> > > > > and add @PrimaryKey to the "name" property. Also add @Title to
>> that
>> > > > 'name'
>> > > > > property (it is in SimpleObject already).
>> > > > >
>> > > > >
>> > > > > You would probably want to remove the version column, ie remove:
>> > > > >
>> > > > > @javax.jdo.annotations.Version(
>> > > > > strategy=VersionStrategy.VERSION_NUMBER,
>> > > > > column="version")
>> > > > >
>> > > > >
>> > > > > In addition, if you annotate the class as "bounded"
>> > > > > (@DomainObject(bounded=true)) then you are telling the framework
>> that
>> > > > > there's a limited - ie bounded - set of instances, and so it will
>> > > display
>> > > > > all instances in a drop-down for you.
>> > > > >
>> > > > >
>> > > > > HTH
>> > > > > Dan
>> > > > >
>> > > >
>> > >
>> >
>>
>
>
Re: code-lists and administration thereof
Posted by Stephen Cameron <st...@gmail.com>.
Thanks Jeroen, seems simple enough :)
On Wed, Jul 29, 2015 at 9:28 PM, Jeroen van der Wal <je...@stromboli.it>
wrote:
> You could also hide the property and create a separate getter for display
> purposes only:
>
> private MyProperty myProperty;
>
> @Hidden
> public MyProperty getMyProperty() {...}
>
> public void setMyProperty(...) {...}
>
> public String getMyPropertyName() {
> getMyProperty.getName();
> }
>
> On 29 July 2015 at 13:18, Stephen Cameron <st...@gmail.com>
> wrote:
>
> > On Wed, Jul 29, 2015 at 6:38 PM, Dan Haywood <
> dan@haywood-associates.co.uk
> > >
> > wrote:
> >
> > > You are right, they will be displayed as links; there's no way to
> disable
> > > it currently.
> > >
> > > We could add a bit of metadata perhaps for this, eg
> > > @DomainObjectLayout(suppressLink=true) or similar.
> > >
> > > Please raise a ticket.
> > >
> >
> > OK https://issues.apache.org/jira/browse/ISIS-1180
> >
> > >
> > > Thx
> > > Dan
> > >
> > > PS: these entities wouldn't be value types, rather regular entities.
> But
> > > you are right... what we really want is full-class support for value
> > types.
> > > We're just not there yet...
> > >
> > >
> > >
> >
> > >
> > >
> > > On 29 July 2015 at 09:34, Stephen Cameron <st...@gmail.com>
> > > wrote:
> > >
> > > > Thanks, but surely such object properties always end up being
> displayed
> > > as
> > > > links? Clicking on the link to go to such an object page is
> > meaningless,
> > > as
> > > > it only has one name property, that was displayed in the link. Can I
> > > > disable that default behaviour for value types?
> > > >
> > > >
> > > >
> > > > On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <
> > > dan@haywood-associates.co.uk
> > > > >
> > > > wrote:
> > > >
> > > > > On 29 July 2015 at 08:08, Stephen Cameron <
> > steve.cameron.62@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > I want to do have some properties that are essentially String
> > types,
> > > > but
> > > > > > which have a limited range of values (code-lists or restricted
> > > > > > vocabularies). I want to allow these lists to be administered
> > > > centrally,
> > > > > so
> > > > > > to add them to a single Administration menu item for admin users.
> > > > > >
> > > > > > For most users these codes should appears as lists of strings not
> > as
> > > > > > objects, but making them objects seems to be the logical OO way
> to
> > > deal
> > > > > > with them in Isis. So they are basically objects with one 'name'
> > > > property
> > > > > > (and maybe an id added by datanucleus). All users need to see is
> > the
> > > > name
> > > > > > property, no icon is needed.
> > > > > >
> > > > > > Also, if I make them objects I also will get referencial
> integrity
> > > > > > constraints applied in the database.
> > > > > >
> > > > > >
> > > > > +1, do it this way. That way they can also hold behaviour in the
> > > future.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > > I wonder there is a simple recipe for this?
> > > > > >
> > > > >
> > > > > No magic recipe for the domain entities... basically copy-n-paste
> the
> > > > > SimpleObject that's in our archetype as many times as needed, and
> > tweak
> > > > as
> > > > > required.
> > > > >
> > > > > If you want to use the code as the primary key, then use DN
> > application
> > > > > identity
> > > > >
> > > > > @javax.jdo.annotations.PersistenceCapable(
> > > > > identityType=IdentityType.APPLICATION,
> > > > > schema = "simple",
> > > > > table = "SimpleObject"
> > > > > )
> > > > >
> > > > > and add @PrimaryKey to the "name" property. Also add @Title to
> that
> > > > 'name'
> > > > > property (it is in SimpleObject already).
> > > > >
> > > > >
> > > > > You would probably want to remove the version column, ie remove:
> > > > >
> > > > > @javax.jdo.annotations.Version(
> > > > > strategy=VersionStrategy.VERSION_NUMBER,
> > > > > column="version")
> > > > >
> > > > >
> > > > > In addition, if you annotate the class as "bounded"
> > > > > (@DomainObject(bounded=true)) then you are telling the framework
> that
> > > > > there's a limited - ie bounded - set of instances, and so it will
> > > display
> > > > > all instances in a drop-down for you.
> > > > >
> > > > >
> > > > > HTH
> > > > > Dan
> > > > >
> > > >
> > >
> >
>
Re: code-lists and administration thereof
Posted by Jeroen van der Wal <je...@stromboli.it>.
You could also hide the property and create a separate getter for display
purposes only:
private MyProperty myProperty;
@Hidden
public MyProperty getMyProperty() {...}
public void setMyProperty(...) {...}
public String getMyPropertyName() {
getMyProperty.getName();
}
On 29 July 2015 at 13:18, Stephen Cameron <st...@gmail.com>
wrote:
> On Wed, Jul 29, 2015 at 6:38 PM, Dan Haywood <dan@haywood-associates.co.uk
> >
> wrote:
>
> > You are right, they will be displayed as links; there's no way to disable
> > it currently.
> >
> > We could add a bit of metadata perhaps for this, eg
> > @DomainObjectLayout(suppressLink=true) or similar.
> >
> > Please raise a ticket.
> >
>
> OK https://issues.apache.org/jira/browse/ISIS-1180
>
> >
> > Thx
> > Dan
> >
> > PS: these entities wouldn't be value types, rather regular entities. But
> > you are right... what we really want is full-class support for value
> types.
> > We're just not there yet...
> >
> >
> >
>
> >
> >
> > On 29 July 2015 at 09:34, Stephen Cameron <st...@gmail.com>
> > wrote:
> >
> > > Thanks, but surely such object properties always end up being displayed
> > as
> > > links? Clicking on the link to go to such an object page is
> meaningless,
> > as
> > > it only has one name property, that was displayed in the link. Can I
> > > disable that default behaviour for value types?
> > >
> > >
> > >
> > > On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <
> > dan@haywood-associates.co.uk
> > > >
> > > wrote:
> > >
> > > > On 29 July 2015 at 08:08, Stephen Cameron <
> steve.cameron.62@gmail.com>
> > > > wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I want to do have some properties that are essentially String
> types,
> > > but
> > > > > which have a limited range of values (code-lists or restricted
> > > > > vocabularies). I want to allow these lists to be administered
> > > centrally,
> > > > so
> > > > > to add them to a single Administration menu item for admin users.
> > > > >
> > > > > For most users these codes should appears as lists of strings not
> as
> > > > > objects, but making them objects seems to be the logical OO way to
> > deal
> > > > > with them in Isis. So they are basically objects with one 'name'
> > > property
> > > > > (and maybe an id added by datanucleus). All users need to see is
> the
> > > name
> > > > > property, no icon is needed.
> > > > >
> > > > > Also, if I make them objects I also will get referencial integrity
> > > > > constraints applied in the database.
> > > > >
> > > > >
> > > > +1, do it this way. That way they can also hold behaviour in the
> > future.
> > > >
> > > >
> > > >
> > > >
> > > > > I wonder there is a simple recipe for this?
> > > > >
> > > >
> > > > No magic recipe for the domain entities... basically copy-n-paste the
> > > > SimpleObject that's in our archetype as many times as needed, and
> tweak
> > > as
> > > > required.
> > > >
> > > > If you want to use the code as the primary key, then use DN
> application
> > > > identity
> > > >
> > > > @javax.jdo.annotations.PersistenceCapable(
> > > > identityType=IdentityType.APPLICATION,
> > > > schema = "simple",
> > > > table = "SimpleObject"
> > > > )
> > > >
> > > > and add @PrimaryKey to the "name" property. Also add @Title to that
> > > 'name'
> > > > property (it is in SimpleObject already).
> > > >
> > > >
> > > > You would probably want to remove the version column, ie remove:
> > > >
> > > > @javax.jdo.annotations.Version(
> > > > strategy=VersionStrategy.VERSION_NUMBER,
> > > > column="version")
> > > >
> > > >
> > > > In addition, if you annotate the class as "bounded"
> > > > (@DomainObject(bounded=true)) then you are telling the framework that
> > > > there's a limited - ie bounded - set of instances, and so it will
> > display
> > > > all instances in a drop-down for you.
> > > >
> > > >
> > > > HTH
> > > > Dan
> > > >
> > >
> >
>
Re: code-lists and administration thereof
Posted by Stephen Cameron <st...@gmail.com>.
On Wed, Jul 29, 2015 at 6:38 PM, Dan Haywood <da...@haywood-associates.co.uk>
wrote:
> You are right, they will be displayed as links; there's no way to disable
> it currently.
>
> We could add a bit of metadata perhaps for this, eg
> @DomainObjectLayout(suppressLink=true) or similar.
>
> Please raise a ticket.
>
OK https://issues.apache.org/jira/browse/ISIS-1180
>
> Thx
> Dan
>
> PS: these entities wouldn't be value types, rather regular entities. But
> you are right... what we really want is full-class support for value types.
> We're just not there yet...
>
>
>
>
>
> On 29 July 2015 at 09:34, Stephen Cameron <st...@gmail.com>
> wrote:
>
> > Thanks, but surely such object properties always end up being displayed
> as
> > links? Clicking on the link to go to such an object page is meaningless,
> as
> > it only has one name property, that was displayed in the link. Can I
> > disable that default behaviour for value types?
> >
> >
> >
> > On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <
> dan@haywood-associates.co.uk
> > >
> > wrote:
> >
> > > On 29 July 2015 at 08:08, Stephen Cameron <st...@gmail.com>
> > > wrote:
> > >
> > > > Hi,
> > > >
> > > > I want to do have some properties that are essentially String types,
> > but
> > > > which have a limited range of values (code-lists or restricted
> > > > vocabularies). I want to allow these lists to be administered
> > centrally,
> > > so
> > > > to add them to a single Administration menu item for admin users.
> > > >
> > > > For most users these codes should appears as lists of strings not as
> > > > objects, but making them objects seems to be the logical OO way to
> deal
> > > > with them in Isis. So they are basically objects with one 'name'
> > property
> > > > (and maybe an id added by datanucleus). All users need to see is the
> > name
> > > > property, no icon is needed.
> > > >
> > > > Also, if I make them objects I also will get referencial integrity
> > > > constraints applied in the database.
> > > >
> > > >
> > > +1, do it this way. That way they can also hold behaviour in the
> future.
> > >
> > >
> > >
> > >
> > > > I wonder there is a simple recipe for this?
> > > >
> > >
> > > No magic recipe for the domain entities... basically copy-n-paste the
> > > SimpleObject that's in our archetype as many times as needed, and tweak
> > as
> > > required.
> > >
> > > If you want to use the code as the primary key, then use DN application
> > > identity
> > >
> > > @javax.jdo.annotations.PersistenceCapable(
> > > identityType=IdentityType.APPLICATION,
> > > schema = "simple",
> > > table = "SimpleObject"
> > > )
> > >
> > > and add @PrimaryKey to the "name" property. Also add @Title to that
> > 'name'
> > > property (it is in SimpleObject already).
> > >
> > >
> > > You would probably want to remove the version column, ie remove:
> > >
> > > @javax.jdo.annotations.Version(
> > > strategy=VersionStrategy.VERSION_NUMBER,
> > > column="version")
> > >
> > >
> > > In addition, if you annotate the class as "bounded"
> > > (@DomainObject(bounded=true)) then you are telling the framework that
> > > there's a limited - ie bounded - set of instances, and so it will
> display
> > > all instances in a drop-down for you.
> > >
> > >
> > > HTH
> > > Dan
> > >
> >
>
Re: code-lists and administration thereof
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
You are right, they will be displayed as links; there's no way to disable
it currently.
We could add a bit of metadata perhaps for this, eg
@DomainObjectLayout(suppressLink=true) or similar.
Please raise a ticket.
Thx
Dan
PS: these entities wouldn't be value types, rather regular entities. But
you are right... what we really want is full-class support for value types.
We're just not there yet...
On 29 July 2015 at 09:34, Stephen Cameron <st...@gmail.com>
wrote:
> Thanks, but surely such object properties always end up being displayed as
> links? Clicking on the link to go to such an object page is meaningless, as
> it only has one name property, that was displayed in the link. Can I
> disable that default behaviour for value types?
>
>
>
> On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <dan@haywood-associates.co.uk
> >
> wrote:
>
> > On 29 July 2015 at 08:08, Stephen Cameron <st...@gmail.com>
> > wrote:
> >
> > > Hi,
> > >
> > > I want to do have some properties that are essentially String types,
> but
> > > which have a limited range of values (code-lists or restricted
> > > vocabularies). I want to allow these lists to be administered
> centrally,
> > so
> > > to add them to a single Administration menu item for admin users.
> > >
> > > For most users these codes should appears as lists of strings not as
> > > objects, but making them objects seems to be the logical OO way to deal
> > > with them in Isis. So they are basically objects with one 'name'
> property
> > > (and maybe an id added by datanucleus). All users need to see is the
> name
> > > property, no icon is needed.
> > >
> > > Also, if I make them objects I also will get referencial integrity
> > > constraints applied in the database.
> > >
> > >
> > +1, do it this way. That way they can also hold behaviour in the future.
> >
> >
> >
> >
> > > I wonder there is a simple recipe for this?
> > >
> >
> > No magic recipe for the domain entities... basically copy-n-paste the
> > SimpleObject that's in our archetype as many times as needed, and tweak
> as
> > required.
> >
> > If you want to use the code as the primary key, then use DN application
> > identity
> >
> > @javax.jdo.annotations.PersistenceCapable(
> > identityType=IdentityType.APPLICATION,
> > schema = "simple",
> > table = "SimpleObject"
> > )
> >
> > and add @PrimaryKey to the "name" property. Also add @Title to that
> 'name'
> > property (it is in SimpleObject already).
> >
> >
> > You would probably want to remove the version column, ie remove:
> >
> > @javax.jdo.annotations.Version(
> > strategy=VersionStrategy.VERSION_NUMBER,
> > column="version")
> >
> >
> > In addition, if you annotate the class as "bounded"
> > (@DomainObject(bounded=true)) then you are telling the framework that
> > there's a limited - ie bounded - set of instances, and so it will display
> > all instances in a drop-down for you.
> >
> >
> > HTH
> > Dan
> >
>
Re: code-lists and administration thereof
Posted by Stephen Cameron <st...@gmail.com>.
Thanks, but surely such object properties always end up being displayed as
links? Clicking on the link to go to such an object page is meaningless, as
it only has one name property, that was displayed in the link. Can I
disable that default behaviour for value types?
On Wed, Jul 29, 2015 at 5:47 PM, Dan Haywood <da...@haywood-associates.co.uk>
wrote:
> On 29 July 2015 at 08:08, Stephen Cameron <st...@gmail.com>
> wrote:
>
> > Hi,
> >
> > I want to do have some properties that are essentially String types, but
> > which have a limited range of values (code-lists or restricted
> > vocabularies). I want to allow these lists to be administered centrally,
> so
> > to add them to a single Administration menu item for admin users.
> >
> > For most users these codes should appears as lists of strings not as
> > objects, but making them objects seems to be the logical OO way to deal
> > with them in Isis. So they are basically objects with one 'name' property
> > (and maybe an id added by datanucleus). All users need to see is the name
> > property, no icon is needed.
> >
> > Also, if I make them objects I also will get referencial integrity
> > constraints applied in the database.
> >
> >
> +1, do it this way. That way they can also hold behaviour in the future.
>
>
>
>
> > I wonder there is a simple recipe for this?
> >
>
> No magic recipe for the domain entities... basically copy-n-paste the
> SimpleObject that's in our archetype as many times as needed, and tweak as
> required.
>
> If you want to use the code as the primary key, then use DN application
> identity
>
> @javax.jdo.annotations.PersistenceCapable(
> identityType=IdentityType.APPLICATION,
> schema = "simple",
> table = "SimpleObject"
> )
>
> and add @PrimaryKey to the "name" property. Also add @Title to that 'name'
> property (it is in SimpleObject already).
>
>
> You would probably want to remove the version column, ie remove:
>
> @javax.jdo.annotations.Version(
> strategy=VersionStrategy.VERSION_NUMBER,
> column="version")
>
>
> In addition, if you annotate the class as "bounded"
> (@DomainObject(bounded=true)) then you are telling the framework that
> there's a limited - ie bounded - set of instances, and so it will display
> all instances in a drop-down for you.
>
>
> HTH
> Dan
>
Re: code-lists and administration thereof
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
On 29 July 2015 at 08:08, Stephen Cameron <st...@gmail.com>
wrote:
> Hi,
>
> I want to do have some properties that are essentially String types, but
> which have a limited range of values (code-lists or restricted
> vocabularies). I want to allow these lists to be administered centrally, so
> to add them to a single Administration menu item for admin users.
>
> For most users these codes should appears as lists of strings not as
> objects, but making them objects seems to be the logical OO way to deal
> with them in Isis. So they are basically objects with one 'name' property
> (and maybe an id added by datanucleus). All users need to see is the name
> property, no icon is needed.
>
> Also, if I make them objects I also will get referencial integrity
> constraints applied in the database.
>
>
+1, do it this way. That way they can also hold behaviour in the future.
> I wonder there is a simple recipe for this?
>
No magic recipe for the domain entities... basically copy-n-paste the
SimpleObject that's in our archetype as many times as needed, and tweak as
required.
If you want to use the code as the primary key, then use DN application
identity
@javax.jdo.annotations.PersistenceCapable(
identityType=IdentityType.APPLICATION,
schema = "simple",
table = "SimpleObject"
)
and add @PrimaryKey to the "name" property. Also add @Title to that 'name'
property (it is in SimpleObject already).
You would probably want to remove the version column, ie remove:
@javax.jdo.annotations.Version(
strategy=VersionStrategy.VERSION_NUMBER,
column="version")
In addition, if you annotate the class as "bounded"
(@DomainObject(bounded=true)) then you are telling the framework that
there's a limited - ie bounded - set of instances, and so it will display
all instances in a drop-down for you.
HTH
Dan
Re: code-lists and administration thereof
Posted by GESCONSULTOR - Óscar Bou <o....@gesconsultor.com>.
Hi Stephen.
For me, as you mention, from your Domain perspective, those current strings would be top Domain Entities with one “name” property.
With that you will benefit of all support given by Apache Isis (and DataNucleus) to them, which some of them you mention.
HTH,
Oscar
> El 29/7/2015, a las 9:08, Stephen Cameron <st...@gmail.com> escribió:
>
> Hi,
>
> I want to do have some properties that are essentially String types, but
> which have a limited range of values (code-lists or restricted
> vocabularies). I want to allow these lists to be administered centrally, so
> to add them to a single Administration menu item for admin users.
>
> For most users these codes should appears as lists of strings not as
> objects, but making them objects seems to be the logical OO way to deal
> with them in Isis. So they are basically objects with one 'name' property
> (and maybe an id added by datanucleus). All users need to see is the name
> property, no icon is needed.
>
> Also, if I make them objects I also will get referencial integrity
> constraints applied in the database.
>
> I wonder there is a simple recipe for this?
Óscar Bou Bou
Responsable de Producto
Auditor Jefe de Certificación ISO 27001 en BSI
CISA, CRISC, APMG ISO 20000, ITIL-F
902 900 231 / 620 267 520
http://www.twitter.com/oscarbou <http://www.twitter.com/oscarbou>
http://es.linkedin.com/in/oscarbou <http://es.linkedin.com/in/oscarbou>
http://www.GesConsultor.com <http://www.gesconsultor.com/>
Este mensaje y los ficheros anexos son confidenciales. Los mismos contienen información reservada que no puede ser difundida. Si usted ha recibido este correo por error, tenga la amabilidad de eliminarlo de su sistema y avisar al remitente mediante reenvío a su dirección electrónica; no deberá copiar el mensaje ni divulgar su contenido a ninguna persona.
Su dirección de correo electrónico junto a sus datos personales constan en un fichero titularidad de Gesdatos Software, S.L. cuya finalidad es la de mantener el contacto con Ud. Si quiere saber de qué información disponemos de Ud., modificarla, y en su caso, cancelarla, puede hacerlo enviando un escrito al efecto, acompañado de una fotocopia de su D.N.I. a la siguiente dirección: Gesdatos Software, S.L. , Paseo de la Castellana, 153 bajo - 28046 (Madrid), y Avda. Cortes Valencianas num. 50, 1ºC - 46015 (Valencia). Asimismo, es su responsabilidad comprobar que este mensaje o sus archivos adjuntos no contengan virus informáticos, y en caso que los tuvieran eliminarlos.