Class ReportFileTool
- All Implemented Interfaces:
com.nomagic.magicreport.engine.ITool
,com.nomagic.magicreport.IVariable
,Serializable
,Cloneable
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.nomagic.magicreport.engine.ConcurrentTool
com.nomagic.magicreport.engine.ConcurrentTool.ConsumeObject
Nested classes/interfaces inherited from interface com.nomagic.magicreport.engine.ITool
com.nomagic.magicreport.engine.ITool.HTMLString, com.nomagic.magicreport.engine.ITool.RetainedString, com.nomagic.magicreport.engine.ITool.Void
-
Field Summary
Fields inherited from class com.nomagic.magicreport.engine.Tool
context, properties
Fields inherited from interface com.nomagic.magicreport.engine.ITool
VOID
-
Constructor Summary
ConstructorDescriptionReportFileTool
(com.nomagic.magicreport.engine.ITemplateEngine engine) Constructor -
Method Summary
Modifier and TypeMethodDescriptionCopy the file that is extracted from attached file element to output file in binary format.Copy the file that is extracted from attached file element to output file in binary format.A shortcut to create file from specific element.
The output filename is same the extracted file name from attached element.
No import context objectA shortcut to create file from specific element.
The output filename is same the extracted file name from attached element.Generate the report output from given attached file element.createAndWait
(Element element) Invoke a new template engine to generate a report and return the path to output file.createAndWait
(Element element, Object contextValue) Invoke a new template engine to generate a report and return the path to output file.createAndWait
(Element element, String outputFileName, Object contextValue) Invoke a new template engine to generate a report and return the path to output file.createAndWait
(Element element, String outputFileName, String contextName, Object contextValue) Invoke a new template engine to generate a report and return the path to output file.Invoke a new template engine to generate a report and return the path to output file.createAndWait
(Element element, Map<String, Object> context) Invoke a new template engine to generate a report and return the path to output file.com.nomagic.magicreport.engine.ITool.Void
silentCreate
(Element element) A shortcut to create file from specific element.
The output filename is same the extracted file name from attached element.com.nomagic.magicreport.engine.ITool.Void
silentCreate
(Element element, Object importObject) A shortcut to create file from specific element.
The output filename is same the extracted file name from attached element.com.nomagic.magicreport.engine.ITool.Void
silentCreate
(Element element, String outputFileName, Object importObject) Generate the report output from given attached file element.Methods inherited from class com.nomagic.magicreport.engine.tools.FileTool
computeName, computeName, consume, copy, copy, copy, copy, copy, copy, create, create, create, create, create, create, create, create, create, create, createAndWait, createAndWait, createAndWait, createAndWait, createAndWait, createAndWait, createAndWait, createAndWait, createAndWait, createAndWait, createAndWait, createAndWait, createAndWait, createDir, exists, getResultPath, isEmpty, resolveOutputFileName, silentCreate, silentCreate, silentCreate, silentCreate, silentCreate, silentCreate, silentCreate
Methods inherited from class com.nomagic.magicreport.engine.ConcurrentTool
destroy, getCustomPoolSize, isNoSpaceException, isRunning, offer
Methods inherited from class com.nomagic.magicreport.engine.Tool
clone, getContext, getProperties, getProperty, getProperty, notifyObservers, setContext, setProperties
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, setChanged
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.nomagic.magicreport.engine.ITool
clearTool
-
Field Details
-
CONTEXT_NAME
- See Also:
-
-
Constructor Details
-
ReportFileTool
public ReportFileTool(com.nomagic.magicreport.engine.ITemplateEngine engine) Constructor- Parameters:
engine
- template engine
-
-
Method Details
-
silentCreate
public com.nomagic.magicreport.engine.ITool.Void silentCreate(Element element) throws com.nomagic.magicreport.ParseErrorException A shortcut to create file from specific element.
The output filename is same the extracted file name from attached element.For example:
$file.silentCreate($anAttachedFileElement)
- Parameters:
element
- an AttachedFile element- Returns:
- void
- Throws:
com.nomagic.magicreport.ParseErrorException
- when template has a syntax or other error which prevents it from being parsed.
-
silentCreate
public com.nomagic.magicreport.engine.ITool.Void silentCreate(Element element, Object importObject) throws com.nomagic.magicreport.ParseErrorException A shortcut to create file from specific element.
The output filename is same the extracted file name from attached element.For example:
$file.silentCreate($anAttachedFileElement,'')
If
importObject
is an instance ofjava.util.Map
, key-value of Map will be used as name-value of context.- Parameters:
element
- an AttachedFile elementimportObject
- the object reference, which will be DefaultElement in the template file. You can use DefaultElement variable in the template file for getting the data.- Returns:
- void
- Throws:
com.nomagic.magicreport.ParseErrorException
- when template has a syntax or other error which prevents it from being parsed.
-
silentCreate
public com.nomagic.magicreport.engine.ITool.Void silentCreate(Element element, String outputFileName, Object importObject) throws com.nomagic.magicreport.ParseErrorException Generate the report output from given attached file element.For example:
$file.silentCreate($anAttachedFileElement,'overview.html','')
If
importObject
is an instance ofjava.util.Map
, key-value of Map will be used as name-value of context.- Parameters:
element
- an AttachedFile elementoutputFileName
- the output file nameimportObject
- the object reference, which will be DefaultElement in the template file. You can use DefaultElement variable in the template file for getting the data.- Returns:
- void
- Throws:
com.nomagic.magicreport.ParseErrorException
- when template has a syntax or other error which prevents it from being parsed.
-
create
A shortcut to create file from specific element.
The output filename is same the extracted file name from attached element.
No import context objectFor example:
<a href="$file.create($anAttachedFileElement)">attachedFile.html</a>
- Parameters:
element
- an AttachedFile element- Returns:
- the output pathname. It will return empty string, if there is any error.
- Throws:
com.nomagic.magicreport.ParseErrorException
- when template has a syntax or other error which prevents it from being parsed.
-
create
public String create(Element element, Object importObject) throws com.nomagic.magicreport.ParseErrorException A shortcut to create file from specific element.
The output filename is same the extracted file name from attached element.For example:
<a href="$file.create($anAttachedFileElement,'')">attachedFile.html</a>
If
importObject
is an instance ofjava.util.Map
, key-value of Map will be used as name-value of context.- Parameters:
element
- an AttachedFile elementimportObject
- the object reference, which will be DefaultElement in the template file. You can use DefaultElement variable in the template file for getting the data.- Returns:
- the output pathname. It will return empty string, if there is any error.
- Throws:
com.nomagic.magicreport.ParseErrorException
- when template has a syntax or other error which prevents it from being parsed.
-
create
public String create(Element element, String outputFileName, Object importObject) throws com.nomagic.magicreport.ParseErrorException Generate the report output from given attached file element.For example:
<a href="$file.create($anAttachedFileElement,'attachedFile.html','')">attachedFile.html</a>
If
importObject
is an instance ofjava.util.Map
, key-value of Map will be used as name-value of context.- Parameters:
element
- an AttachedFile elementoutputFileName
- the output file nameimportObject
- the object reference, which will be DefaultElement in the template file. You can use DefaultElement variable in the template file for getting the data.- Returns:
- the output pathname. It will return empty string, if there is any error.
- Throws:
com.nomagic.magicreport.ParseErrorException
- when template has a syntax or other error which prevents it from being parsed.
-
copy
Copy the file that is extracted from attached file element to output file in binary format.For example:
<img src="$file.copy($anAttachedFileElement)">
- Parameters:
element
- an AttachedFile element- Returns:
- the output pathname. It will return empty string, if there is any error.
-
copy
Copy the file that is extracted from attached file element to output file in binary format.For example:
<img src="$file.copy($anAttachedFileElement,'icon.gif')">
- Parameters:
element
- an AttachedFile elementoutputFileName
- the output filename- Returns:
- the output pathname. It will return empty string, if there is any error.
-
createAndWait
Invoke a new template engine to generate a report and return the path to output file. The output report will be named by the extracted file from attached element.- Parameters:
element
- an AttachedFile element- Returns:
- an absolute path to output file.
-
createAndWait
Invoke a new template engine to generate a report and return the path to output file. The output report will be named by the extracted file from attached element.- Parameters:
element
- an AttachedFile elementcontextValue
- additional object adding to new template context with default $importer name.- Returns:
- an absolute path to output file.
-
createAndWait
Invoke a new template engine to generate a report and return the path to output file."importer" will be used as a name of context value.
- Parameters:
element
- an AttachedFile elementoutputFileName
- an output report file name.contextValue
- additional object adding to new template context with default $importer name.- Returns:
- an absolute path to output file.
-
createAndWait
public String createAndWait(Element element, String outputFileName, String contextName, Object contextValue) Invoke a new template engine to generate a report and return the path to output file.- Parameters:
element
- an AttachedFile elementoutputFileName
- an output report file name.contextName
- adding object context's name.contextValue
- additional object adding to new template context.- Returns:
- an absolute path to output file.
-
createAndWait
Invoke a new template engine to generate a report and return the path to output file. The output report will be named by template file name.- Parameters:
templateFile
- an input template file.context
- additional context adding to new template.- Returns:
- an absolute path to output file.
-
createAndWait
Invoke a new template engine to generate a report and return the path to output file.- Parameters:
element
- an AttachedFile elementoutputFileName
- an output report file name.context
- additional context adding to new template.- Returns:
- an absolute path to output file.
-