Groovy Documentation

services
Class PageService

java.lang.Object
  services.PageService

class PageService

Tasks related to page requests.


Property Summary
static Map conf

Config

def dependenciesService

Tasks related to Dependencies.

static def expose

Information needed for the GWT application to use this service.

def messageSource

get the spring message resource bundle

static ConfigurableMimeFileTypeMap mimeMapper

Spring MIME types mapper.

SandboxManager sandboxManager

SandboxManager bean (autowired by Spring).

def yamService

Tasks related to YAM files.

 
Constructor Summary
PageService()

 
Method Summary
boolean allowRawHtml(Map thisPage)

Checks whether this page is allowed to be served as raw html

Map analyse(Map params)

Analyse the request and return a map modelling this type of page.

void cancelEdit(Map flow)

Cancel an edit by deleting the staging files.

String checkName(String pageName, String id, String pathDir)

Check the name of a page before to create it.

String create(String pageName, String id, String pathDir)

Create a yam/html page or a directory.

boolean createDirectory(Map thisPage, Sandbox sandbox)

Create a new directory.

boolean createYamPage(Map thisPage, Sandbox sandbox, String seed)

Create a new YAM page.

String fckEscapesFix(String body)

FCKEditor strips cow-escape spans containing a single slash.

void fromStaging(Map flow)

Write or commit a successful edit from the staging area back to the origin.

List getDirList(File pageFile, Wiki wiki)

Get a directory listing.

File getIndexPage(File pageFile)

Get the index.html/index.htm if it exists.

Map getNavigationModel(File pageFileDir, Wiki pageWiki)

Get the navigation model for a page.

Map getNavigationModel(File pageFileDir, Wiki pageWiki, List navFiles)

Get the navigation model for a page relative to config.

void overwrite(YamFile yamFile, String text, boolean isYam)

Overwrite a YAM file from some text which may be YAM or HTML.

void overwrite(Map flow, File editFile, String text)

Overwrite a file from some text which may be TXT or HTML.

void prepareEdit(Map flow)

Prepare an edit.

void previewEdit(Map flow)

Set up preview of an edit.

void refreshEdit(Map flow)

Refresh an edit.

void saveEdit(Map flow)

Save an edit.

YamFile toStaging(Map flow, boolean regenerate)

Copy or checkout a YAM file to the staging area.

File toStaging(Map flow)

Copy or checkout a file to the staging area.

File toStaging(Map flow, String pagePath, File pageFile)

Copy or checkout a file to the staging area.

void unpackArchive(InputStream stream, String archiveFileName, File baseDir, List addedFiles, List messages, boolean overwrite)

Unpack the given archive file into the given directory.

boolean updateEditFiles(Map flow)

Update edit file(s).

boolean updateEditFiles(Map flow, File editFile)

Update a single file.

 
Methods inherited from class Object
wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll
 

Property Detail

conf

static Map conf
Config


dependenciesService

def dependenciesService
Tasks related to Dependencies.


expose

static def expose
Information needed for the GWT application to use this service.


messageSource

def messageSource
get the spring message resource bundle


mimeMapper

static ConfigurableMimeFileTypeMap mimeMapper
Spring MIME types mapper.


sandboxManager

SandboxManager sandboxManager
SandboxManager bean (autowired by Spring).


yamService

def yamService
Tasks related to YAM files.


 
Constructor Detail

PageService

PageService()


 
Method Detail

allowRawHtml

boolean allowRawHtml(Map thisPage)
Checks whether this page is allowed to be served as raw html


analyse

Map analyse(Map params)
Analyse the request and return a map modelling this type of page.


cancelEdit

void cancelEdit(Map flow)
Cancel an edit by deleting the staging files. This means that any subsequent edits of the same file will start again from a clean copy of the sandbox file.


checkName

String checkName(String pageName, String id, String pathDir)
Check the name of a page before to create it.


create

String create(String pageName, String id, String pathDir)
Create a yam/html page or a directory. To be used after {
link:
#checkName(String, String, String).


createDirectory

boolean createDirectory(Map thisPage, Sandbox sandbox)
Create a new directory. Returns false on error and sets thisPage.errMessage.


createYamPage

boolean createYamPage(Map thisPage, Sandbox sandbox, String seed)
Create a new YAM page. Returns false on error and sets thisPage.errMessage.


fckEscapesFix

String fckEscapesFix(String body)
FCKEditor strips cow-escape spans containing a single slash. It ignores the slash, and strips the empty element. So we escape the slash. These 2 slashes now need escaping for some (unknown?) process. And in the String, each of these 4 slashes needs escaping. Makes 8... When FCKEditor returns a string at the end of an edit, it will only return a single slash. NB backslashes problematic at the end of slashy strings


fromStaging

void fromStaging(Map flow)
Write or commit a successful edit from the staging area back to the origin.


getDirList

List getDirList(File pageFile, Wiki wiki)
Get a directory listing. If this is disallowed, returns null. Each item in the directory listing is a two-element list, the first element being the file name and the second element being a file type marker: ft_directory for directories, ft_htmlWithYam for HTML files that have a matching yam file, ft_xxx for a file whose extension following the last dot is xxx, and ft_unknown if this cannot be determined.


getIndexPage

File getIndexPage(File pageFile)
Get the index.html/index.htm if it exists.


getNavigationModel

Map getNavigationModel(File pageFileDir, Wiki pageWiki)
Get the navigation model for a page.


getNavigationModel

Map getNavigationModel(File pageFileDir, Wiki pageWiki, List navFiles)
Get the navigation model for a page relative to config.


overwrite

void overwrite(YamFile yamFile, String text, boolean isYam)
Overwrite a YAM file from some text which may be YAM or HTML. In the latter case convert back to YAM.


overwrite

void overwrite(Map flow, File editFile, String text)
Overwrite a file from some text which may be TXT or HTML.


prepareEdit

void prepareEdit(Map flow)
Prepare an edit. For w/s mode this is just a copy; for server mode we have to do a checkout.


previewEdit

void previewEdit(Map flow)
Set up preview of an edit.


refreshEdit

void refreshEdit(Map flow)
Refresh an edit. This is called when we've done an update and pulled in changes which need to be ok'd by the editor (including conflicts). The effect is to reset flow.editInput from the file on disk.


saveEdit

void saveEdit(Map flow)
Save an edit.


toStaging

YamFile toStaging(Map flow, boolean regenerate)
Copy or checkout a YAM file to the staging area.


toStaging

File toStaging(Map flow)
Copy or checkout a file to the staging area.


toStaging

File toStaging(Map flow, String pagePath, File pageFile)
Copy or checkout a file to the staging area.


unpackArchive

void unpackArchive(InputStream stream, String archiveFileName, File baseDir, List addedFiles, List messages, boolean overwrite)
Unpack the given archive file into the given directory.
param:
stream the input stream from which to read the archive
param:
archiveFileName the original file name of the archive, used to determine the archive type (.zip, .tar.gz, .tar.bz2)
param:
baseDir the directory into which the files are to be unpacked
param:
addedFiles a list to which the File objects corresponding to added files and directories will be added
param:
messages a list to which messages generated during processing will be added
param:
overwrite should we overwrite existing files?


updateEditFiles

boolean updateEditFiles(Map flow)
Update edit file(s). Return true and set flow.errMessage where appropriate if an update occurs.


updateEditFiles

boolean updateEditFiles(Map flow, File editFile)
Update a single file. Return true and set flow.errMessage where appropriate if an update occurs.


 

Groovy Documentation