Hide last authors
etvc developer 1.1 1 {{groovy}}
2 import com.xpn.xwiki.*;
3 import com.xpn.xwiki.api.*;
4 import com.xpn.xwiki.doc.*;
5 import java.io.File;
6
Alexandru Colesnicov 4.23 7 println ("* Solution in 4 steps\n")
Alexandru Colesnicov 4.22 8
Alexandru Colesnicov 4.5 9 att = doc.getAttachment("TestingData.xls")
Alexandru Colesnicov 4.21 10 println ("att = doc.getAttachment(\"TestingData.xls\")")
11 println (" att: variable got its value")
12 println (" att: Class is " + att.getClass().getSimpleName() + " (" + att.getClass().getName() + ")")
Alexandru Colesnicov 4.12 13
Alexandru Colesnicov 4.13 14 xwa = att.getAttachment()
Alexandru Colesnicov 4.21 15 println ("xwa = att.getAttachment()")
16 println (" xwa: variable got its value")
17 println (" xwa: Class is " + xwa.getClass().getSimpleName() + " (" + xwa.getClass().getName() + ")")
Alexandru Colesnicov 4.13 18
Alexandru Colesnicov 4.15 19 sfi = xwa.getAttachment_content().storageFile
Alexandru Colesnicov 4.21 20 println ("sfi = xwa.getAttachment_content().storageFile")
21 println (" sfi: variable got its value")
22 println (" sfi: Class is " + sfi.getClass().getSimpleName() + " (" + sfi.getClass().getName() + ")")
Alexandru Colesnicov 4.15 23
Alexandru Colesnicov 4.20 24 apa = sfi.getAbsolutePath()
Alexandru Colesnicov 4.21 25 println ("apa = sfi.getAbsolutePath()")
26 println (" apa: variable got its value = " + apa)
Alexandru Colesnicov 4.22 27 println (" apa: Class is " + apa.getClass().getSimpleName() + " (" + apa.getClass().getName() + ")")
Alexandru Colesnicov 4.19 28
Alexandru Colesnicov 4.23 29 println ("* Solution in 1 step\n")
Alexandru Colesnicov 4.22 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
etvc developer 1.1 36 {{/groovy}}