It's all about the answers!

Ask a question

How to Delete the contents of the Component programatically using RTC plain API.

Jazzuser user (68849) | asked Mar 01 '18, 3:24 a.m.

Hello Team,

I have a usecase that whenever i add new data to the component, the component should be empty.
I need to delete all the contents of the component programatically.

Is there a RTC API, given a component it deletes the contents of the component ?


2 answers

permanent link
Ralph Schoon (63.2k33646) | answered Mar 01 '18, 3:43 a.m.

No, this is not how components are supposed to be used in RTC.

Jazzuser user commented Mar 01 '18, 4:00 a.m.

Thanks Ralph,
This is required for us for the following scenario, i explain in detail :
We have a legacy source code system, where users are working and they freeze with checkpoints. We need to migrate this data in the checkpoints from this legacy system to RTC. it should also be in checkpoints wise migration.
For the first time we migrate the checkpoint data(programatically checkin all files/folders ) and baseline it in RTC.
But when migrating the second checkpoint similar way and baselined it, on checking the contents of the baseline2, we get the contents of baseline 1 as well.

so this is the issue, we need a clean contents in the component checkpoint wise.
So we are planning to delete the content of the component and then migrating the checkpoint.

Is there any other way to delete the contents ?
We are also thinking of an another way : Load the Repo WS, delete all the files/folders in the component, checkin the changeset with deleted contents, this will clear the component. Is this approach better ?

to delete all the files/folders checkedIn

Is there any other ways to do this ?

permanent link
Ralph Schoon (63.2k33646) | answered Mar 01 '18, 4:25 a.m.
edited Mar 01 '18, 4:25 a.m.

As far as I understand the question, what you want to do is to setup a stream with components in a way that
You initially share the oldest baseline (call it BS0) and then you want to share newer baselines over that repeatedly.

The way I would approach this is as follows:

  1. Create a Stream with the initial components you want
  2. Create a repository workspace from the stream (that flows with the stream)
  3. x=0
  4. Do
    1. Import the baseline Bx data into an RTC client sandbox/workspace.
    2. Share the data with the repository workspace, partitioning it into the components they are supposed to go
    3. Create a Snapshot/baseline for all components
    4. Deliver everything
    5. Unload the repository workspace with deleting the local content
    6. X++
    7. If additional baseline exists loop to 4
  5. done

Ralph Schoon commented Mar 01 '18, 4:32 a.m.

Note, this is done to be able to create some kind of history and to actually be able to diff and merge later development.
If you have branching or other parallel versions, you would rebase the workspace and stream (or use a different set of them based on the common ancestor baseline) and than share the next version on top of that.

If you create an initial baseline on the component that is pretty much empty and start with that baseline over and over,

as far as I know you will never ever ever be able to compare/merge the elements associated to the unconnected histories.

You obviously want to try this out on a test system until the process works and has proven you can use the data.

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.