You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Marianne Hagaseth <Ma...@marintek.sintef.no> on 2016/03/03 08:11:08 UTC
How to create a new object at the same time when adding it to a
list?
Hi,
How can I add new FreeTexts to the SOLAS object that currently does not exist?
I would like to press the Add FreeText button, then I do not want to choose between existing FreeText objects. Rather, I would like to create new FreeText objects on the fly, and then have this object linked to the SOLAS object (1:n between SOLAS and freetext).
Are there an example out there on how to do that?
Best,
Marianne.
[cid:image001.png@01D17524.2E312460]
Med vennlig hilsen / Best regards,
Marianne Hagaseth
Forsker - Maritime transportsystemer
Research Scientist - Maritime Transport Systems
MARINTEK (Norsk Marinteknisk Forskningsinstitutt AS)
Address: POB 4125 Valentinlyst, NO-7450 Trondheim, Norway
Mobile: +47 90 95 64 69 - Phone: +47 464 15 000
Web: www.marintek.sintef.no<http://www.marintek.sintef.no/>
Re: How to create a new object at the same time when adding it to a list?
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
container.removeIfNotAlready(someObject)
see [1]
[1]
http://isis.apache.org/guides/rgsvc.html#_rgsvc_api_DomainObjectContainer_object-persistence-api
On 4 March 2016 at 11:09, Marianne Hagaseth <
Marianne.Hagaseth@marintek.sintef.no> wrote:
> Thanks a lot! Worked on first try!
>
> But what do I have to add to delete the domain object at the same time as
> I am removing it from the collection?
>
> Med vennlig hilsen / Best regards,
> Marianne Hagaseth
> Forsker – Maritime transportsystemer
> Research Scientist – Maritime Transport Systems
>
> MARINTEK (Norsk Marinteknisk Forskningsinstitutt AS)
> Address: POB 4125 Valentinlyst, NO-7450 Trondheim, Norway
> Mobile: +47 90 95 64 69 - Phone: +47 464 15 000
> Web: www.marintek.sintef.no
>
> -----Original Message-----
> From: Stephen Cameron [mailto:steve.cameron.62@gmail.com]
> Sent: 3. mars 2016 12:09
> To: users@isis.apache.org
> Subject: Re: How to create a new object at the same time when adding it to
> a list?
>
> correction: 'participations' collection header
>
> On Thu, Mar 3, 2016 at 10:07 PM, Stephen Cameron <
> steve.cameron.62@gmail.com
> > wrote:
>
> > These two actions appear as buttons in the Participants collection
> > header.
> >
> > @Action()
> > @ActionLayout(named = "Add")
> > @MemberOrder(name = "participations", sequence = "1")
> > public Activity addParticipant(final Participant participant) {
> > if (findParticipation(participant) == null) {
> > participantsRepo.createParticipation(this, participant);
> > } else {
> > container.informUser("A Participant (" +
> > participant.getFullName() + ") is already participating in this
> Activity");
> > }
> > return this;
> > }
> >
> > @Action()
> > @ActionLayout(named = "Add New")
> > @MemberOrder(name = "participations", sequence = "2")
> > public Activity addNewParticipant(final @ParameterLayout(named =
> > "First name") String firstname, final @ParameterLayout(named =
> > "Surname") String surname,
> > final @ParameterLayout(named = "Date of Birth") LocalDate
> > dob) {
> > addParticipant(participantsRepo.newParticipant(firstname,
> > surname, dob));
> > return this;
> > }
> >
> > On Thu, Mar 3, 2016 at 9:44 PM, Marianne Hagaseth <
> > Marianne.Hagaseth@marintek.sintef.no> wrote:
> >
> >> Sorry,
> >> What I have is just a simple 1:n relationship with a list of object
> >> similar to for instance the todo-app: for the todoapp-admin, you can
> >> add a list of roles to each user. However, here the roles must have
> >> been already entered before a role can be added to the user.
> >> I just want to add an object (similar to the role) at the same time
> >> as I add it to the collection/set.
> >> In my example: I want to create the FreeText object and then add this
> >> FreeText object to the collection/set that is linked to the parent
> object.
> >> All in one operation. I do not want to first enter the FreeText
> >> object in a different window.
> >>
> >>
> >> Med vennlig hilsen / Best regards,
> >> Marianne Hagaseth
> >> Forsker – Maritime transportsystemer
> >> Research Scientist – Maritime Transport Systems
> >>
> >> MARINTEK (Norsk Marinteknisk Forskningsinstitutt AS)
> >> Address: POB 4125 Valentinlyst, NO-7450 Trondheim, Norway
> >> Mobile: +47 90 95 64 69 - Phone: +47 464 15 000
> >> Web: www.marintek.sintef.no
> >>
> >> -----Original Message-----
> >> From: Dan Haywood [mailto:dan@haywood-associates.co.uk]
> >> Sent: 3. mars 2016 09:42
> >> To: users
> >> Subject: Re: How to create a new object at the same time when adding
> >> it to a list?
> >>
> >> I'm struggling to follow.
> >> Can you show us some code (abbreviated if possible ) to explain what
> >> you have already.
> >> Thx, Dan
> >> On 3 Mar 2016 7:11 am, "Marianne Hagaseth" <
> >> Marianne.Hagaseth@marintek.sintef.no> wrote:
> >>
> >> > Hi,
> >> >
> >> > How can I add new FreeTexts to the SOLAS object that currently does
> >> > not exist?
> >> >
> >> > I would like to press the Add FreeText button, then I do not want
> >> > to choose between existing FreeText objects. Rather, I would like
> >> > to create new FreeText objects on the fly, and then have this
> >> > object linked to the SOLAS object (1:n between SOLAS and freetext).
> >> >
> >> > Are there an example out there on how to do that?
> >> >
> >> > Best,
> >> >
> >> > Marianne.
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > Med vennlig hilsen / Best regards,
> >> >
> >> > *Marianne Hagaseth*
> >> >
> >> > Forsker – Maritime transportsystemer
> >> >
> >> > Research Scientist – Maritime Transport Systems
> >> >
> >> >
> >> >
> >> > *MARINTEK* (Norsk Marinteknisk Forskningsinstitutt AS)
> >> >
> >> > Address: POB 4125 Valentinlyst, NO-7450 Trondheim, Norway
> >> >
> >> > Mobile: +47 90 95 64 69 - Phone: +47 464 15 000
> >> >
> >> > Web: www.marintek.sintef.no
> >> >
> >> >
> >> >
> >>
> >
> >
>
RE: How to create a new object at the same time when adding it to a
list?
Posted by Marianne Hagaseth <Ma...@marintek.sintef.no>.
Thanks a lot! Worked on first try!
But what do I have to add to delete the domain object at the same time as I am removing it from the collection?
Med vennlig hilsen / Best regards,
Marianne Hagaseth
Forsker – Maritime transportsystemer
Research Scientist – Maritime Transport Systems
MARINTEK (Norsk Marinteknisk Forskningsinstitutt AS)
Address: POB 4125 Valentinlyst, NO-7450 Trondheim, Norway
Mobile: +47 90 95 64 69 - Phone: +47 464 15 000
Web: www.marintek.sintef.no
-----Original Message-----
From: Stephen Cameron [mailto:steve.cameron.62@gmail.com]
Sent: 3. mars 2016 12:09
To: users@isis.apache.org
Subject: Re: How to create a new object at the same time when adding it to a list?
correction: 'participations' collection header
On Thu, Mar 3, 2016 at 10:07 PM, Stephen Cameron <steve.cameron.62@gmail.com
> wrote:
> These two actions appear as buttons in the Participants collection
> header.
>
> @Action()
> @ActionLayout(named = "Add")
> @MemberOrder(name = "participations", sequence = "1")
> public Activity addParticipant(final Participant participant) {
> if (findParticipation(participant) == null) {
> participantsRepo.createParticipation(this, participant);
> } else {
> container.informUser("A Participant (" +
> participant.getFullName() + ") is already participating in this Activity");
> }
> return this;
> }
>
> @Action()
> @ActionLayout(named = "Add New")
> @MemberOrder(name = "participations", sequence = "2")
> public Activity addNewParticipant(final @ParameterLayout(named =
> "First name") String firstname, final @ParameterLayout(named =
> "Surname") String surname,
> final @ParameterLayout(named = "Date of Birth") LocalDate
> dob) {
> addParticipant(participantsRepo.newParticipant(firstname,
> surname, dob));
> return this;
> }
>
> On Thu, Mar 3, 2016 at 9:44 PM, Marianne Hagaseth <
> Marianne.Hagaseth@marintek.sintef.no> wrote:
>
>> Sorry,
>> What I have is just a simple 1:n relationship with a list of object
>> similar to for instance the todo-app: for the todoapp-admin, you can
>> add a list of roles to each user. However, here the roles must have
>> been already entered before a role can be added to the user.
>> I just want to add an object (similar to the role) at the same time
>> as I add it to the collection/set.
>> In my example: I want to create the FreeText object and then add this
>> FreeText object to the collection/set that is linked to the parent object.
>> All in one operation. I do not want to first enter the FreeText
>> object in a different window.
>>
>>
>> Med vennlig hilsen / Best regards,
>> Marianne Hagaseth
>> Forsker – Maritime transportsystemer
>> Research Scientist – Maritime Transport Systems
>>
>> MARINTEK (Norsk Marinteknisk Forskningsinstitutt AS)
>> Address: POB 4125 Valentinlyst, NO-7450 Trondheim, Norway
>> Mobile: +47 90 95 64 69 - Phone: +47 464 15 000
>> Web: www.marintek.sintef.no
>>
>> -----Original Message-----
>> From: Dan Haywood [mailto:dan@haywood-associates.co.uk]
>> Sent: 3. mars 2016 09:42
>> To: users
>> Subject: Re: How to create a new object at the same time when adding
>> it to a list?
>>
>> I'm struggling to follow.
>> Can you show us some code (abbreviated if possible ) to explain what
>> you have already.
>> Thx, Dan
>> On 3 Mar 2016 7:11 am, "Marianne Hagaseth" <
>> Marianne.Hagaseth@marintek.sintef.no> wrote:
>>
>> > Hi,
>> >
>> > How can I add new FreeTexts to the SOLAS object that currently does
>> > not exist?
>> >
>> > I would like to press the Add FreeText button, then I do not want
>> > to choose between existing FreeText objects. Rather, I would like
>> > to create new FreeText objects on the fly, and then have this
>> > object linked to the SOLAS object (1:n between SOLAS and freetext).
>> >
>> > Are there an example out there on how to do that?
>> >
>> > Best,
>> >
>> > Marianne.
>> >
>> >
>> >
>> >
>> >
>> > Med vennlig hilsen / Best regards,
>> >
>> > *Marianne Hagaseth*
>> >
>> > Forsker – Maritime transportsystemer
>> >
>> > Research Scientist – Maritime Transport Systems
>> >
>> >
>> >
>> > *MARINTEK* (Norsk Marinteknisk Forskningsinstitutt AS)
>> >
>> > Address: POB 4125 Valentinlyst, NO-7450 Trondheim, Norway
>> >
>> > Mobile: +47 90 95 64 69 - Phone: +47 464 15 000
>> >
>> > Web: www.marintek.sintef.no
>> >
>> >
>> >
>>
>
>
Re: How to create a new object at the same time when adding it to a list?
Posted by Stephen Cameron <st...@gmail.com>.
correction: 'participations' collection header
On Thu, Mar 3, 2016 at 10:07 PM, Stephen Cameron <steve.cameron.62@gmail.com
> wrote:
> These two actions appear as buttons in the Participants collection
> header.
>
> @Action()
> @ActionLayout(named = "Add")
> @MemberOrder(name = "participations", sequence = "1")
> public Activity addParticipant(final Participant participant) {
> if (findParticipation(participant) == null) {
> participantsRepo.createParticipation(this, participant);
> } else {
> container.informUser("A Participant (" +
> participant.getFullName() + ") is already participating in this Activity");
> }
> return this;
> }
>
> @Action()
> @ActionLayout(named = "Add New")
> @MemberOrder(name = "participations", sequence = "2")
> public Activity addNewParticipant(final @ParameterLayout(named =
> "First name") String firstname, final @ParameterLayout(named = "Surname")
> String surname,
> final @ParameterLayout(named = "Date of Birth") LocalDate dob)
> {
> addParticipant(participantsRepo.newParticipant(firstname, surname,
> dob));
> return this;
> }
>
> On Thu, Mar 3, 2016 at 9:44 PM, Marianne Hagaseth <
> Marianne.Hagaseth@marintek.sintef.no> wrote:
>
>> Sorry,
>> What I have is just a simple 1:n relationship with a list of object
>> similar to for instance the todo-app: for the todoapp-admin, you can add a
>> list of roles to each user. However, here the roles must have been already
>> entered before a role can be added to the user.
>> I just want to add an object (similar to the role) at the same time as I
>> add it to the collection/set.
>> In my example: I want to create the FreeText object and then add this
>> FreeText object to the collection/set that is linked to the parent object.
>> All in one operation. I do not want to first enter the FreeText object in a
>> different window.
>>
>>
>> Med vennlig hilsen / Best regards,
>> Marianne Hagaseth
>> Forsker – Maritime transportsystemer
>> Research Scientist – Maritime Transport Systems
>>
>> MARINTEK (Norsk Marinteknisk Forskningsinstitutt AS)
>> Address: POB 4125 Valentinlyst, NO-7450 Trondheim, Norway
>> Mobile: +47 90 95 64 69 - Phone: +47 464 15 000
>> Web: www.marintek.sintef.no
>>
>> -----Original Message-----
>> From: Dan Haywood [mailto:dan@haywood-associates.co.uk]
>> Sent: 3. mars 2016 09:42
>> To: users
>> Subject: Re: How to create a new object at the same time when adding it
>> to a list?
>>
>> I'm struggling to follow.
>> Can you show us some code (abbreviated if possible ) to explain what you
>> have already.
>> Thx, Dan
>> On 3 Mar 2016 7:11 am, "Marianne Hagaseth" <
>> Marianne.Hagaseth@marintek.sintef.no> wrote:
>>
>> > Hi,
>> >
>> > How can I add new FreeTexts to the SOLAS object that currently does
>> > not exist?
>> >
>> > I would like to press the Add FreeText button, then I do not want to
>> > choose between existing FreeText objects. Rather, I would like to
>> > create new FreeText objects on the fly, and then have this object
>> > linked to the SOLAS object (1:n between SOLAS and freetext).
>> >
>> > Are there an example out there on how to do that?
>> >
>> > Best,
>> >
>> > Marianne.
>> >
>> >
>> >
>> >
>> >
>> > Med vennlig hilsen / Best regards,
>> >
>> > *Marianne Hagaseth*
>> >
>> > Forsker – Maritime transportsystemer
>> >
>> > Research Scientist – Maritime Transport Systems
>> >
>> >
>> >
>> > *MARINTEK* (Norsk Marinteknisk Forskningsinstitutt AS)
>> >
>> > Address: POB 4125 Valentinlyst, NO-7450 Trondheim, Norway
>> >
>> > Mobile: +47 90 95 64 69 - Phone: +47 464 15 000
>> >
>> > Web: www.marintek.sintef.no
>> >
>> >
>> >
>>
>
>
Re: How to create a new object at the same time when adding it to a list?
Posted by Stephen Cameron <st...@gmail.com>.
These two actions appear as buttons in the Participants collection
header.
@Action()
@ActionLayout(named = "Add")
@MemberOrder(name = "participations", sequence = "1")
public Activity addParticipant(final Participant participant) {
if (findParticipation(participant) == null) {
participantsRepo.createParticipation(this, participant);
} else {
container.informUser("A Participant (" +
participant.getFullName() + ") is already participating in this Activity");
}
return this;
}
@Action()
@ActionLayout(named = "Add New")
@MemberOrder(name = "participations", sequence = "2")
public Activity addNewParticipant(final @ParameterLayout(named = "First
name") String firstname, final @ParameterLayout(named = "Surname") String
surname,
final @ParameterLayout(named = "Date of Birth") LocalDate dob) {
addParticipant(participantsRepo.newParticipant(firstname, surname,
dob));
return this;
}
On Thu, Mar 3, 2016 at 9:44 PM, Marianne Hagaseth <
Marianne.Hagaseth@marintek.sintef.no> wrote:
> Sorry,
> What I have is just a simple 1:n relationship with a list of object
> similar to for instance the todo-app: for the todoapp-admin, you can add a
> list of roles to each user. However, here the roles must have been already
> entered before a role can be added to the user.
> I just want to add an object (similar to the role) at the same time as I
> add it to the collection/set.
> In my example: I want to create the FreeText object and then add this
> FreeText object to the collection/set that is linked to the parent object.
> All in one operation. I do not want to first enter the FreeText object in a
> different window.
>
>
> Med vennlig hilsen / Best regards,
> Marianne Hagaseth
> Forsker – Maritime transportsystemer
> Research Scientist – Maritime Transport Systems
>
> MARINTEK (Norsk Marinteknisk Forskningsinstitutt AS)
> Address: POB 4125 Valentinlyst, NO-7450 Trondheim, Norway
> Mobile: +47 90 95 64 69 - Phone: +47 464 15 000
> Web: www.marintek.sintef.no
>
> -----Original Message-----
> From: Dan Haywood [mailto:dan@haywood-associates.co.uk]
> Sent: 3. mars 2016 09:42
> To: users
> Subject: Re: How to create a new object at the same time when adding it to
> a list?
>
> I'm struggling to follow.
> Can you show us some code (abbreviated if possible ) to explain what you
> have already.
> Thx, Dan
> On 3 Mar 2016 7:11 am, "Marianne Hagaseth" <
> Marianne.Hagaseth@marintek.sintef.no> wrote:
>
> > Hi,
> >
> > How can I add new FreeTexts to the SOLAS object that currently does
> > not exist?
> >
> > I would like to press the Add FreeText button, then I do not want to
> > choose between existing FreeText objects. Rather, I would like to
> > create new FreeText objects on the fly, and then have this object
> > linked to the SOLAS object (1:n between SOLAS and freetext).
> >
> > Are there an example out there on how to do that?
> >
> > Best,
> >
> > Marianne.
> >
> >
> >
> >
> >
> > Med vennlig hilsen / Best regards,
> >
> > *Marianne Hagaseth*
> >
> > Forsker – Maritime transportsystemer
> >
> > Research Scientist – Maritime Transport Systems
> >
> >
> >
> > *MARINTEK* (Norsk Marinteknisk Forskningsinstitutt AS)
> >
> > Address: POB 4125 Valentinlyst, NO-7450 Trondheim, Norway
> >
> > Mobile: +47 90 95 64 69 - Phone: +47 464 15 000
> >
> > Web: www.marintek.sintef.no
> >
> >
> >
>
RE: How to create a new object at the same time when adding it to a
list?
Posted by Marianne Hagaseth <Ma...@marintek.sintef.no>.
Sorry,
What I have is just a simple 1:n relationship with a list of object similar to for instance the todo-app: for the todoapp-admin, you can add a list of roles to each user. However, here the roles must have been already entered before a role can be added to the user.
I just want to add an object (similar to the role) at the same time as I add it to the collection/set.
In my example: I want to create the FreeText object and then add this FreeText object to the collection/set that is linked to the parent object. All in one operation. I do not want to first enter the FreeText object in a different window.
Med vennlig hilsen / Best regards,
Marianne Hagaseth
Forsker – Maritime transportsystemer
Research Scientist – Maritime Transport Systems
MARINTEK (Norsk Marinteknisk Forskningsinstitutt AS)
Address: POB 4125 Valentinlyst, NO-7450 Trondheim, Norway
Mobile: +47 90 95 64 69 - Phone: +47 464 15 000
Web: www.marintek.sintef.no
-----Original Message-----
From: Dan Haywood [mailto:dan@haywood-associates.co.uk]
Sent: 3. mars 2016 09:42
To: users
Subject: Re: How to create a new object at the same time when adding it to a list?
I'm struggling to follow.
Can you show us some code (abbreviated if possible ) to explain what you have already.
Thx, Dan
On 3 Mar 2016 7:11 am, "Marianne Hagaseth" < Marianne.Hagaseth@marintek.sintef.no> wrote:
> Hi,
>
> How can I add new FreeTexts to the SOLAS object that currently does
> not exist?
>
> I would like to press the Add FreeText button, then I do not want to
> choose between existing FreeText objects. Rather, I would like to
> create new FreeText objects on the fly, and then have this object
> linked to the SOLAS object (1:n between SOLAS and freetext).
>
> Are there an example out there on how to do that?
>
> Best,
>
> Marianne.
>
>
>
>
>
> Med vennlig hilsen / Best regards,
>
> *Marianne Hagaseth*
>
> Forsker – Maritime transportsystemer
>
> Research Scientist – Maritime Transport Systems
>
>
>
> *MARINTEK* (Norsk Marinteknisk Forskningsinstitutt AS)
>
> Address: POB 4125 Valentinlyst, NO-7450 Trondheim, Norway
>
> Mobile: +47 90 95 64 69 - Phone: +47 464 15 000
>
> Web: www.marintek.sintef.no
>
>
>
Re: How to create a new object at the same time when adding it to a list?
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
I'm struggling to follow.
Can you show us some code (abbreviated if possible ) to explain what you
have already.
Thx, Dan
On 3 Mar 2016 7:11 am, "Marianne Hagaseth" <
Marianne.Hagaseth@marintek.sintef.no> wrote:
> Hi,
>
> How can I add new FreeTexts to the SOLAS object that currently does not
> exist?
>
> I would like to press the Add FreeText button, then I do not want to
> choose between existing FreeText objects. Rather, I would like to create
> new FreeText objects on the fly, and then have this object linked to the
> SOLAS object (1:n between SOLAS and freetext).
>
> Are there an example out there on how to do that?
>
> Best,
>
> Marianne.
>
>
>
>
>
> Med vennlig hilsen / Best regards,
>
> *Marianne Hagaseth*
>
> Forsker – Maritime transportsystemer
>
> Research Scientist – Maritime Transport Systems
>
>
>
> *MARINTEK* (Norsk Marinteknisk Forskningsinstitutt AS)
>
> Address: POB 4125 Valentinlyst, NO-7450 Trondheim, Norway
>
> Mobile: +47 90 95 64 69 - Phone: +47 464 15 000
>
> Web: www.marintek.sintef.no
>
>
>