public interface GenerationContext extends GenerationScriptContext, Evaluator
BaseContext.Env
Modifier and Type | Field and Description |
---|---|
static String |
CONTEXT_VARIABLE_NAME
With this variable name one can get an instance of this class from a template:
GenerationContext gc =
(GenarationContext) |
CLASSLOADER_VARIABLE, GLOBAL_VARIABLE, MATH_CONTEXT_VARIABLE
Modifier and Type | Method and Description |
---|---|
void |
addCloseable(Closeable closeable) |
void |
addDataToContext(DataProvider provider) |
void |
close()
Close all registed closeables.
|
String |
getBasePath() |
CharacterReplacer |
getCharacterReplacer(boolean quote) |
Context |
getContext(String name) |
Dataset |
getDataset()
Returns the first
Dataset if this page is a content page, otherwise null . |
boolean |
getDebugMode()
If debug mode is switched on java stack traces are included in the template log.
|
boolean |
getDeleteDirectory() |
String |
getEncoding()
Get file encoding.
|
Evaluator |
getEvaluator() |
FileHandle |
getFileHandle(String path) |
Font |
getFont(String name) |
Language |
getLanguage()
The current generated language
|
Page |
getLanguageSpecificPage(Page page) |
IDProvider |
getNavigationContext()
Returns the origin node for relative urls.
|
ContentProducer |
getNode() |
Page |
getPage() |
Context |
getPageContext() |
int |
getPageIndex() |
PageParams |
getPageParams()
Get the page params of the page which is generated.
|
ScheduleContext |
getScheduleContext()
Get the actual schedule context - this is only set when the generate process is initiated from the scheduler.
|
Date |
getStartTime()
Start time of generate process.
|
TemplateSet |
getTemplateSet()
The current generated TemplateSet
|
String |
getTopStackElement()
The actual evaluated expression as string - for debugging.
|
UrlCreator |
getUrlCreator()
The actual used url creator instance.
|
UrlCreatorProvider |
getUrlCreatorProvider() |
boolean |
getUseMasterLanguageForData()
If a page is not
translated ,
the project master language is used
for data mapping. |
UserService |
getUserService() |
boolean |
isHtmlMode()
Returns whether or not the context is currently generating html code (default is
true ). |
boolean |
isPreview()
Is the actual generation is a preview generation?
|
boolean |
isRelease()
Generate current or release
|
void |
mediaReferenced(Media media,
Language language,
Resolution resolution) |
void |
setDebugMode(boolean value)
If debug mode is switched on java stack traces are included in the template log.
|
void |
setHtmlMode(boolean value)
Tells the generation context whether or not html code will be generated currently.
|
void |
setPage(Page value) |
void |
setUseMasterLanguageForData(boolean value) |
boolean |
showWebeditButtons()
Deprecated.
since 5.0.101 - no replacement.
|
getGenerationContext, toString
getProject
getConnection, getProperties, getProperty, logDebug, logError, logError, logInfo, logWarning, removeProperty, setProperty
is
requestSpecialist, requireSpecialist
getAttribute, getContext, getDefaultExpression, getLocale, getLocaleKey, getOut, getStack, getTemplate, getVariableValue, include, invokeMethod, isDebugging, logDebug, logError, logError, logError, logError, logInfo, logWarning, parse, parse, popContext, print, print, pushContext, pushContext, pushContext, pushContext, resolveReference, setDefaultExpression, setErrorOut, setErrorOut, setLocale, setLocaleKey, setMaxStackSize, setOut, setVariableValue
static final String CONTEXT_VARIABLE_NAME
GenerationContext gc =
(GenarationContext) Evaluator.getVariableValue(String)
evaluator.getVariableValue(GenerationContext.CONTEXT_VARIABLE_NAME);
UserService getUserService()
getUserService
in interface ProjectScriptContext
UrlCreator getUrlCreator()
UrlCreator
.UrlCreatorProvider getUrlCreatorProvider()
boolean isRelease()
GenerationScriptContext
isRelease
in interface GenerationScriptContext
Language getLanguage()
GenerationScriptContext
getLanguage
in interface GenerationScriptContext
boolean getUseMasterLanguageForData()
translated
,
the project master language
is used
for data mapping.void setUseMasterLanguageForData(boolean value)
getUseMasterLanguageForData()
TemplateSet getTemplateSet()
GenerationScriptContext
getTemplateSet
in interface GenerationScriptContext
ContentProducer getNode()
PageRef
@Nullable IDProvider getNavigationContext()
getNode()
, but this
may also be a Media
for references from a
parsed media
.@ApiDoc(comment="The actual page index (for multi-pages e.g. for content-store based pages)", since="4.0.0") int getPageIndex()
boolean isPreview()
isPreview
in interface GenerationScriptContext
true
if this is a preview generationEvaluator getEvaluator()
CharacterReplacer getCharacterReplacer(boolean quote)
void addDataToContext(DataProvider provider)
provider
- The data providing element.Page getPage()
void setPage(Page value)
@ApiDoc(comment="get file encoding (shortcut for \"getLanguage().getEncoding()\"), returns e.g. \"UTF-8\"", since="4.0") String getEncoding()
getLanguage()
.
Language.getHTMLEncoding()
, returns e.g. "UTF-8".String getTopStackElement()
getTopStackElement
in interface Evaluator
@Nullable @ApiDoc(comment="get the page context (if set)", since="4.0") Context getPageContext()
@Nullable @ApiDoc(comment="get a context by its name (e.g. \"PAGE\", \"SECTION\")", since="4.0") Context getContext(String name)
boolean getDeleteDirectory()
true
if directory should be deleted before generation, false
otherwisevoid addCloseable(Closeable closeable)
void close() throws IOException
IOException
- on errorString getBasePath()
@ApiDoc(comment="toggle debug mode - if switched on, error logging is more verbose", since="4.0.0") void setDebugMode(boolean value)
value
- toggle debug mode - if switched on, error logging is more verbosegetDebugMode()
@ApiDoc(comment="get debug mode - if switched on, error logging is more verbose", since="4.0.0") boolean getDebugMode()
setDebugMode(boolean)
@ApiDoc(comment="toggle html mode - if switched off, template inspection will be disabled", since="5.1.304") void setHtmlMode(boolean value)
TemplateSet.isTemplateInspectionEnabled()
,
to determine whether or not the generated html should be enhanced with template identifying
html attributes. It might be necessary to set this value for certain JSP or JavaScript fragments,
to avoid corrupt html on statements like out.println("<img ...");
.value
- no html@ApiDoc(comment="get html mode - if switched off, template inspection will be disabled", since="5.1.304") boolean isHtmlMode()
true
).
This value will be used in combination with TemplateSet.isTemplateInspectionEnabled()
,
to determine whether or not the generated html should be enhanced with template identifying
html attributes. It might be necessary to set this value for certain JSP or JavaScript fragments,
to avoid corrupt html on statements like out.println("<img ...");
.void mediaReferenced(@NotNull Media media, @Nullable Language language, @Nullable Resolution resolution) throws IOException
IOException
@Nullable FileHandle getFileHandle(String path) throws IOException
IOException
@ApiDoc(comment="start time of generate process", since="4.1") @NotNull Date getStartTime()
@Deprecated boolean showWebeditButtons()
false
.@ApiDoc(comment="Get the actual schedule context - delivers \'null\' in preview", since="4.1.42") @Nullable ScheduleContext getScheduleContext()
schedule context
or null
during preview@ApiDoc(comment="Get the page params of the page which is generated", since="5.0.3") @NotNull PageParams getPageParams()
Copyright © 2015 e-Spirit AG. All Rights Reserved. Build 5.1.408