You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Dan Haywood <da...@haywood-associates.co.uk> on 2015/06/08 15:28:10 UTC

Re: Modifying SimpleApp

On 28 May 2015 at 04:40, Stephen Cameron <st...@gmail.com> wrote:

>
>
> A question: I have a collection inside an entity, can I via the
> Wicket viewer show an action that creates a new entity member of the
> collection? In my case I have Activities and these have 0:N Clients as
> Participants, is it possible to create a new Client as I add Client
> Participants to an Activity? I have the list of exising Clients as my
> drop-down choose list, but want to make a new Client if its not in the
> list.
>
>
Sorry, missed this one.

Short answer is no, we don't have support for this.  But you could provide
a different action to create a new Client and associate them as a
Participant:

public class Activity {

    public SortedSet<Client> getParticipants() { ... }

    public Activity addParticipant(Client client) {
        getParticipants().add(client);
        return this;
    }
    public Collection<Client> autoComplete0AddParticipant() { ... }

    public Activity addNewClientAsParticipant( ...lot of args used to
create a client ... ) {
        Client newClient = container.newTransientInstance(Client.class)
         newClient.setThis(...);
         newClient.setThat(...);
         newClient.setTheOther(...);
         container.persist(newClient);
         return addParticipant(newClient);
    }
}

If you associate both the actions with the Participants collection it'll
probably provide a "good-enough" UI.

HTH
Dan









> Thanks
> Steve Cameron
>
>
> On Tue, May 26, 2015 at 5:54 PM, Dan Haywood <dan@haywood-associates.co.uk
> >
> wrote:
>
> > If you use the m2e plugin for Eclipse then it should reverse engineer the
> > .classpath and  .project file for you.
> >
> > Also be aware that you need to set up the DataNucleus enhancer; there's
> div
> > on the Isis website.
> >
> > HTH
> > Dan
> > On 26 May 2015 02:36, "Stephen Cameron" <st...@gmail.com>
> > wrote:
> >
> > > Hi Dan, You are close, but I think its simply that the class version in
> > the
> > > myapp-webapp project is not being replaced after I made the change you
> > > suggested, so when I try to run the app I get the runtime error
> message,
> > > and when I go to the webpage also. I think I have to make the
> > myapp-webapp
> > > dependant on the myapp-dom project in Eclipse itself, rather than
> > thinking
> > > Maven does everything when I change the dom.
> > >
> > > I'm trying to get someone interested in Isis with a demo, but I am a
> bit
> > > out of practice with Java :(
> > >
> > >
> > > On Mon, May 25, 2015 at 5:22 PM, Dan Haywood <
> > dan@haywood-associates.co.uk
> > > >
> > > wrote:
> > >
> > > > My guess is that it isn't a Maven error, but instead is an Isis one.
> > > >
> > > > The @DomainObject(objectType=..) annotation defines an alias for the
> > > Class
> > > > that is used in the Restful Objects REST API (as well as elsewhere);
> > Isis
> > > > requires that it is unique across all entities. So just change the
> > value
> > > of
> > > > this in your copy and try again.
> > > >
> > > > Cheers, Dan
> > > > On 25 May 2015 06:51, "Stephen Cameron" <st...@gmail.com>
> > > > wrote:
> > > >
> > > > > Hello,
> > > > >
> > > > > I am trying to modify the SimpleApp archetype in Eclipse, but I am
> > not
> > > > very
> > > > > familiar with Maven. When I modifiy the myapp-dom project, by
> copying
> > > the
> > > > > SimpleObject and renaming it I need to make the changes flow
> through
> > to
> > > > the
> > > > > webapp project. At the moment I am getting an Isis error message,
> in
> > > the
> > > > > jetty:run target, telling me I have two 'SIMPLE' objects.
> > > > >
> > > > > Sorry this is a basic question, but can someone please point  me
> to a
> > > > guide
> > > > > that explains how to work with Maven in this project group in
> > > > > Eclipse situation.
> > > > >
> > > > > Thanks
> > > > > Steve Cameron
> > > > >
> > > >
> > >
> >
>