It's all about the answers!

Ask a question

RAMClient: Creating new version contains bad content


Ryan Beeler (111) | asked Apr 19 '12, 2:16 p.m.
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.

Comments
Lin Lu commented Jan 04 '13, 6:45 a.m.

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
Gili Mendel (1.8k56) | answered Jan 04 '13, 10:33 a.m.
JAZZ DEVELOPER
What about:

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



Comments
Lin Lu commented Jan 05 '13, 10:12 p.m.

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




permanent link
Lin Lu (11) | answered Jan 05 '13, 10:17 p.m.
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);
        }

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.