I'm looking to write a java program that looks at the asset with the given UID, takes the lastest version, clones it then removes all "Depend on" relationships and all the content and replaces both the given set of "Depend on" and the new content.
I'm looking for the examples of the code to address all or parts of the above.
|
4 answers
public static void main(String[] args) { RAMSession session = new RAMSession("http://localhost:8080/ram.ws", "admin", "admin"); Comments
Alex Seriy
commented Oct 05 '12, 2:19 p.m.
Thank you, Gili. So what was missing is that the new version must be committed before its content can be modified. This overall works now. The only issue I'm having is that the content for the new version comes from a zip file.
Alex Seriy
commented Oct 05 '12, 6:52 p.m.
Also, while putting the new version, I get the following error:
We'll need the stack trace from the host ramdebug.log for the actual failure.
Alex Seriy
commented Oct 10 '12, 10:12 a.m.
Richard, how can I get the log to you?
All we need is the stack trace that includes the error on the host. So just cut/paste from your ramdebug.log to here in the forum. It shouldn't be too big.
|
Thank you, Gili. So what was missing is that the new version must be committed before its content can be modified. This overall works now. The only issue I'm having is that the content for the new version comes from a zip file.
// Remove artifacts RAMFolderArtifact top = (RAMFolderArtifact)newVer.getArtifactsRoot(); Artifact[] artifacts = top.getChildren(); // Remove all artifacts from prev. version for (int i = 0; i < artifacts.length; i++) { println artifacts[i] top.removeArtifact(artifacts[i]); } // upload new content File file = new File(assetContent); LocalArchiveFolderArtifact artZip = new LocalArchiveFolderArtifact(file); top.addArtifact(artZip) This does uploads the content of the zip into the new version of the assets. However, it also creates an empty folder with the same name as the name of the zip file. Comments I don't think you need to commit it first. You should be able to remove the artifacts BEFORE the initial submit, at the same time you removed the dependencies.
Since you are already writing this as API, you can just extract the Zip yourself and add the directory structure. .... yes, need more disk space :-( / time, but from code point of view, it is quite small/simple.
Alex Seriy
commented Oct 10 '12, 10:22 a.m.
Thanks, Gili. I'll try that. In the meantime, as a workaround, I upload the zip and them remove the directory with the same name as the zip file, just clean up. It seems to work.
|
Is this the file name, ramDebugRAM1WebApplication.log?
|
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.