Hi Adam, Thanks for this detailed description; comments within.
On 12 February 2013 07:24, Adam Howard <[email protected]> wrote: > All, > > > > I have an issue with a class acting as a wrapper around a few fields to > keep them together as they are passed around. The class in question is > RouteSpecification[2]. A RouteSpecification is made up of three fields: > origin location, destination location, and arrival date. > I see this as synonymous with creating a Name class to hold > firstName and lastName and then having a Person class have a Name field. > Could also apply to Address if Address was not a shareable entity. > Agreed; that's how I see it too. > > What I'd like to be able to do is define a method in my cargo > repository[3]: public Cargo bookNewCargo(RouteSpecification spec) {...} and > the page that gets generated includes fields for each of the > RouteSpecification properties. Here is a screenshot of the page in the > original dddsample[4]. I currently get a label with no fields next to > it[5]. > This is something that has come up before: the idea that the viewer should be able to recursively explode a value/aggregated/embedded object. It's feasible, just not implemented. As a workaround, I'd just overload the action, and hide the original: public Cargo bookNewCargo(Location origin, Location destination, Date deadline) { return bookNewCargo(new RouteSpecification(origin, destination, deadline)); } @Hidden public Cargo bookNewCargo(RouteSpecification rs) { .... } > Dan, is this another case of a @Value that holds references to persisted > entities (the two locations)? > Yup, I think it is. In Isis, it's probably closest to model as an immutable wholly contained entity. Dan > > Thanks. > -- > Adam > > [1] http://immense-brook-7613.herokuapp.com/wicket/ > [2] > > https://github.com/adamhoward/onaboat/blob/master/dom/src/main/java/onaboat/domain/model/cargo/RouteSpecification.java > [3] > > https://github.com/adamhoward/onaboat/blob/master/dom/src/main/java/onaboat/domain/model/cargo/CargoRepository.java > [4] https://www.dropbox.com/s/dqbzm6prgvfdiqv/book-new-cargo.png > [5] > > http://immense-brook-7613.herokuapp.com/wicket/wicket/bookmarkable/org.apache.isis.viewer.wicket.ui.pages.action.ActionPage?pageType=ACTION&actionSingleResultsMode=REDIRECT&objectOid=onaboat.domain.model.cargo.CargoRepository:1&actionType=USER&actionOwningSpec=onaboat.domain.model.cargo.CargoRepository&actionId=bookNewCargo%28onaboat.domain.model.cargo.TrackingId,onaboat.domain.model.cargo.RouteSpecification%29&pageTitle=Book+New+Cargo&actionMode=PARAMETERS > > > > On Mon, Feb 11, 2013 at 10:23 PM, Kevin Meyer <[email protected]> wrote: > > > Hi Christian, > > > > I was going to suggest the Process pattern... > > > > As a (perhpas required) hack, can you delete the unused execution plans > > after a user has made a choice? > > > > Of course, in a multi-user environment, you'd need some way of isolating > > one user's plans from other users... > > > > Does the process pattern require the execution plans to be persisted? I > > guess this is an issue with being stateless - you have persist the states > > somewhere... > > > > Christian Steinebach <[email protected]> wrote: > > > > >Hi Kevin! > > > > > >As mentioned in another post, I've uploaded a simplified version of > > >what I'm trying to do [1] > > > > > >The idea: > > > > > >A ToDoItem might have associated with it an execution plan with tasks. > > >The plan is something like > > > go somewhere > > > do that > > > go somewhere else > > > and do something else > > > > > >Several execution plans are generated and the user should select one to > > >fullfill the ToDoItem. For 'Buy Milk' it could be > > > > > >(1) - Go to the supermarket > > > get some milk > > > pay for the milk > > > go home > > > > > >(2) - Go to the farm > > > milk a cow > > > pay the farmer > > > go home > > > > > >etc. etc. > > > > > >In short: > > >class ExecutionPlan{ > > > List<ArrayList> getTasks(); > > >} > > >class Task{ > > > properties where and what > > >} > > >class ExecutionPlanService { > > > List<ExecutionPlan> getExecutionPlans(ToDoItem td); > > >// to generate candidates of execution plans > > >} > > >class ToDoItem{ > > > setExecutionPlan(executionPlan ep); > > > List<ExecutionPlan> choicesExecutionPlan(){ > > > return executionPlanService.getExecutionPlans(this); > > > } > > >} > > > > > >I've introduced another class > > >@NonPersistable > > >ExecutionPlanChooser{ > > >...... > > > public List<ExecutionPlan> choicesExecutionPlan(){ > > > return eps.getExecutionPlans(toDoItem); > > > } > > >..... > > >} > > > > > >trying to follow a Process Object Pattern (from Dan's book). > > >In ExecutionPlanChooser the choicesExecutionPlan() is called 34 times > > >before I even hit the drop-down list once. > > > > > >To run what is there: > > >- install the fixtures > > >- Select 'all not completed yet' > > >- Select a ToDoItem > > >- Click on 'Choose Execution Plan' (in the upper right corner) > > >- Edit the displayed ExecutionPlanChooser > > >- Select an execution plan from the drop down list (there are 34*3 now > > >already) > > >- click OK > > >- Click on 'Do It' in the upper right corner. That will attach the > > >selected execution plan to the ToDoItem. > > > > > >Next time someone tries to choose an execution plan, there will be 69*3 > > >execution plans to choose from. :-( > > >I'm obviously on the wrong track, but I'm out of ideas now. > > > > > > Any help is very much appreciated > > > > > > Christian > > > > > > > > > > > >[1] https://github.com/chris58/ToDoItemExecutionPlan.git > > > > > >________________________________________ > > >From: Kevin Meyer - KMZ [[email protected]] > > >Sent: Monday, February 11, 2013 8:39 PM > > >To: [email protected] > > >Subject: Re: Porting dddsample app > > > > > >Hi Christian, > > > > > >Is this [1] your git location? Have you recently commited what you've > > >got? > > > > > >I can take a look, but probably only tomorrow evening.. > > > > > >Regards, > > >Kevin > > > > > >[1] https://github.com/chris58/TPM.git > > > > > >On 11 Feb 2013 at 18:46, Christian Steinebach wrote: > > > > > >> Hi everybody! > > >> > > >> Is it possible (in isis) to achieve anything like the action > > >'Route-This-Cargo' in the dddsample application? > > >> > > >> If so, could you roughly outline how that behaviour could be > > >implemented? > > >> I've tried every solution I could imagine and some more, I'm getting > > >desperate. > > >> > > >> Christian > > >> > > > > -- > > Sent from my phone with K-9 Mail. Please excuse my brevity. > > >
