The record we are getting the ID from is the new one, that just has been created. This is the copy that exists outside of the container. Therefore the newly created record in the container needs to have the same ID.
The procedure is:
- Get the ID of the record to be inserted.
- Create a new record with this ID and store its index.
- Copy the record to be inserted to that index.
Record Cloning
- sirherrbatka
- Posts: 2159
- Joined: 07 Aug 2011, 17:21
Re: Record Cloning
Ah, I see. I'm wonder why we are not simply inserting already created record directly.
Anyway: it seems that I need to create new method in collectionbase: clonerecord that will ask data containers to create copy of the record, change it's id and insert. Is that correct?
Anyway: it seems that I need to create new method in collectionbase: clonerecord that will ask data containers to create copy of the record, change it's id and insert. Is that correct?
Re: Record Cloning
To keep the RefIdData interface minimal. We would need a separate function to create a new non-empty record. With the current implementation this function is not needed.Ah, I see. I'm wonder why we are not simply inserting already created record directly.
Yes, that is the obvious way to do it. I was considering if it is possible to implement cloning without extending the interface of CollectionBase, but that is probably more trouble than it is worth.Anyway: it seems that I need to create new method in collectionbase: clonerecord that will ask data containers to create copy of the record, change it's id and insert. Is that correct?
- sirherrbatka
- Posts: 2159
- Joined: 07 Aug 2011, 17:21
Re: Record Cloning
Right! Sorry for those questions, I just don't feel quite selfconfident when facing OpenCS
- sirherrbatka
- Posts: 2159
- Joined: 07 Aug 2011, 17:21
Re: Record Cloning
hey, ArgumentType (in UniversalId) stores information if record is indexed or has any unique id, right?
- sirherrbatka
- Posts: 2159
- Joined: 07 Aug 2011, 17:21
Re: Record Cloning
Hello, I have another silly questions
Cloning works now for single record type collections, however I need to alter mId of References and Referencables (multi-type ) tables records and to that, It seems i have to cast those to appropariate classes. I can do this with simple if/else stairway, but I'm wonder if we have more convienient way of doing this.
PS
Also, where do we handle automatic index generation?
Cloning works now for single record type collections, however I need to alter mId of References and Referencables (multi-type ) tables records and to that, It seems i have to cast those to appropariate classes. I can do this with simple if/else stairway, but I'm wonder if we have more convienient way of doing this.
PS
Also, where do we handle automatic index generation?
Re: Record Cloning
References are not multi-type.
For referecenables RefIdAdpater might help. There is currently only a function for getting the ID, but you should be able to add one for setting the ID.
For referecenables RefIdAdpater might help. There is currently only a function for getting the ID, but you should be able to add one for setting the ID.
- sirherrbatka
- Posts: 2159
- Joined: 07 Aug 2011, 17:21
Re: Record Cloning
ok, thanks. Can you also provide any hint for the PS question?