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

List of Artifacts

Hi,
how do I get a list of artifacts names from a given asset using RAM Client API?

Any sample code?

Thx

0 votes



3 answers

Permanent link
Hi,
how do I get a list of artifacts names from a given asset using RAM Client API?

Any sample code?

Thx


Here are two ways....

1) Convert the artifacts to a flat list and iterate over that....


RAMFolderArtifact root = (RAMFolderArtifact)asset.getArtifactsRoot();
Artifact[] artifacts = root.computeArtifactsAsFlatList(new RAMStatusMonitor());
for(Artifact artifact : artifacts){
String name = artifact.getName();
//Do something with the name
}


2) Recurse over the artifact tree...


FolderArtifact root = asset.getArtifactsRoot();
List<String> names = new ArrayList<String>();
collectArtifactNames(root, names);

private void collectArtifactNames(FolderArtifact folder, List<String> names){
for(Artifact artifact : folder.getChildren()){
if(artifact instanceof FolderArtifact){
collectArtifactNames((FolderArtifact)artifact, names);
}
else{
names.add(artifact.getName());
}
}
}

0 votes


Permanent link
The code worked fine, but now I am getting an extra artifact, a JPEG of the Fetured Content.
Is this correct? Since this asset was added by RAM and not by the user?

0 votes


Permanent link
Featured content is still considered part of the asset. It is so that if
someone pulls down the entire asset they will be able to see the
featured content also.

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 29 '10, 1:36 p.m.

Question was seen: 6,449 times

Last updated: Apr 29 '10, 1:36 p.m.

Confirmation Cancel Confirm