From version < 4.21 >
edited by Alexandru Colesnicov
on 2019/10/02 14:26
To version < 4.22 >
edited by Alexandru Colesnicov
on 2019/10/02 14:45
< >
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -2,10 +2,10 @@
2 2   import com.xpn.xwiki.*;
3 3   import com.xpn.xwiki.api.*;
4 4   import com.xpn.xwiki.doc.*;
5 - import org.apache.commons.io.FileUtils;
6 6   import java.io.File;
7 - import java.net.URL;
8 8  
7 + println ("***** Solution in 4 steps *****\n")
8 +
9 9   att = doc.getAttachment("TestingData.xls")
10 10   println ("att = doc.getAttachment(\"TestingData.xls\")")
11 11   println (" att: variable got its value")
... ... @@ -24,6 +24,13 @@
24 24   apa = sfi.getAbsolutePath()
25 25   println ("apa = sfi.getAbsolutePath()")
26 26   println (" apa: variable got its value = " + apa)
27 - println (" apa: Class is " + sfi.getClass().getSimpleName() + " (" + sfi.getClass().getName() + ")")
27 + println (" apa: Class is " + apa.getClass().getSimpleName() + " (" + apa.getClass().getName() + ")")
28 28  
29 + println ("***** Solution in 1 step *****\n")
30 +
31 + apa2 = doc.getAttachment("TestingData.xls").getAttachment().getAttachment_content().storageFile.getAbsolutePath()
32 + println ("apa2 = doc.getAttachment(\"TestingData.xls\").getAttachment().getAttachment_content().storageFile.getAbsolutePath()")
33 + println (" apa2: variable got its value = " + apa2)
34 + println (" apa2: Class is " + apa2.getClass().getSimpleName() + " (" + apa2.getClass().getName() + ")")
35 +
29 29  {{/groovy}}