Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

RAMClient: Creating new version contains bad content

Currently, I am using the RAM Client against a v7.2.0.2 server. I am attempting to do the following:


RAMAsset newAsset = session.createAssetNewVersion(existingAsset, "1.1", statusMonitor);

LocalFolderArtfact folderArtifact = new LocalFolderArtifact("./newContent");
newAsset.setArtifactsRoot(folderArtifact);
...
session.putAssets(...);


The existingAsset is "1.0" and has one file: testv1.pdf.
The newAsset has one or more files in "./newContent" none of them are testv1.pdf.

This code is successful as a new asset v1.1 is created with all of the expected attributes and categories. However, when I look at the content of v1.1, there is also a testv1.pdf. When I click on testv1.pdf from the web client, I get the following:

"Artifact testv1.pdf not found in asset "Test Asset" version 1.0"

If I try to go to the General Details for v1.1, I get an exception:


jvax.faces.el.EvaluationException: Error getting property 'showAssetContents" from bean of type pagecode.assetDetail.GeneralDetails: NullPointerException
(Unfortunately, this is on another system so I don't have the full trace.)

Why does the newAsset.setArtifactsRoot(folderArtifact); not remove all of the existing content from the cloned asset? Essentially, I want to create a new version of the asset and keep all attributes and categories, but wipe out the entire contents.

0 votes

Comments

Hi,
when newAsset.setArtifactsRoot(folderArtifact) called it will copy some info including artifactes from old version asset to new. I think the problem you met it's a defect we have fixed in ram's later release.



2 answers

Permanent link
What about:

FolderArtifact root = newAsset.getArtifactsRoot();
root.setChildren(new Artifact[0]);


0 votes

Comments

Hi Gili,
I was told setChildren() is not not executable, when I tried with your answer. Here is the exception:




Permanent link
Here is a another way to remove all artifacts in asset, maybe not that effective.

RAMFolderArtifact root = (RAMFolderArtifact) newAsset.getArtifactsRoot();
        for(Artifact art:root.getChildren()){
            root.removeArtifact(art);
        }

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Apr 19 '12, 2:16 p.m.

Question was seen: 7,361 times

Last updated: Jan 05 '13, 10:17 p.m.

Confirmation Cancel Confirm