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

RAM- delete artifact from asset

 Is there any way to delete an artifact in the policy plugin or through OSLC?

0 votes


Accepted answer

Permanent link

 Hi Eric,


You can modify an asset( add/delete artifacts) by using the JAVA API or even the REST API's. Please find below the references for the same.
Rest API :

JAVA API:
RAMFolderArtifact.removeArtifact can be used for artifact removal.

Hope it helps.

Eric Ballance selected this answer as the correct answer

0 votes

Comments

Thank you for responding. I have a .doc file attached to an asset and am using the code below. It does not remove the .doc file from the asset. Any ideas what is wrong?

for (Artifact artifact : srcArtifacts) {
RAMArtifact ramArtifact = (RAMArtifact) artifact;
String nm = ramArtifact.getName();
if (nm.endsWith(".doc") || nm.endsWith(".docx")) {
status.addDetail(new ResultDetail(ResultDetail.INFO,
"processing artifact : " + nm));
boolean removed = root.removeArtifact(artifact);
status.addDetail(new ResultDetail(ResultDetail.INFO, "removed : " + removed));
}

 Nevermind. I had to add the logic to update the asset.

RAMSession session = this.getPolicyContext()
.getRAMSession();
session.queueAssetForPut(currentAsset);
session.putAssets(new NullProgressMonitor());

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
× 10,953

Question asked: Feb 28 '18, 5:17 p.m.

Question was seen: 1,633 times

Last updated: Mar 03 '18, 12:50 p.m.

Confirmation Cancel Confirm