|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object info.magnolia.module.admininterface.SaveHandlerImpl
public class SaveHandlerImpl
This class handles the saving in the dialogs. It uses the mgnlSaveInfo parameters sent from the browser to store
the data in the node.The structure of the parameter is the following:
name, type, valueType, isRichEditValue, encoding
To find the consts see ControlImpl
name | the name of the field |
type | string, boolean, ... |
valueType | single, multiple |
isRichEditValue | value from an editor |
encoding | base64, unix, none |
You can specify a custom save handled (a class that implements info.magnolia.module.admininterface.CustomSaveHandler) by adding a "saveHandler" property to a dialog field configuration.
Field Summary | |
---|---|
static org.slf4j.Logger |
log
Logger |
Constructor Summary | |
---|---|
SaveHandlerImpl()
Call init to initialize the object |
Method Summary | |
---|---|
protected String |
cleanLineBreaks(String valueStr,
int isRichEditValue)
Clean up the linebreaks and |
protected String |
cleanupLinkPrefix(info.magnolia.cms.core.Content filesNode,
String link,
String prefixRepo)
|
info.magnolia.cms.core.ItemType |
getCreationItemType()
Defines the node type to create if isCreate is true |
protected info.magnolia.cms.beans.runtime.MultipartForm |
getForm()
|
String |
getNodeCollectionName()
|
String |
getNodeName()
|
protected info.magnolia.cms.core.Content |
getPageNode(info.magnolia.cms.core.HierarchyManager hm)
Returns the page. |
String |
getParagraph()
|
String |
getPath()
|
String |
getRepository()
get the name of thre repository saving to |
protected info.magnolia.cms.core.Content |
getSaveNode(info.magnolia.cms.core.HierarchyManager hm,
info.magnolia.cms.core.Content rootNode)
Gets or creates the node saving to. |
javax.jcr.Value |
getValue(long l)
Get the long value |
javax.jcr.Value |
getValue(String s)
Get a string value |
javax.jcr.Value |
getValue(String valueStr,
int type)
Get the value for saving in jcr |
void |
init(info.magnolia.cms.beans.runtime.MultipartForm form)
Initialize the SaveHandlerImpl control. |
boolean |
isCreate()
True if a not existing path should get created during the save process |
protected void |
processBinary(info.magnolia.cms.core.Content node,
String name)
Process binary data. |
protected void |
processCommon(info.magnolia.cms.core.Content node,
String name,
int type,
int valueType,
int encoding,
String[] values)
Process a common value |
protected void |
processDate(info.magnolia.cms.core.Content node,
String name,
int type,
int valueType,
int encoding,
String[] values)
|
protected void |
processMultiple(info.magnolia.cms.core.Content node,
String name,
int type,
String[] values)
Process a multiple value field |
protected void |
processRemoveCommon(info.magnolia.cms.core.Content node,
String name)
Remove the specified property on the node. |
protected void |
processRichEdit(info.magnolia.cms.core.Content node,
String name,
int type,
int isRichEditValue,
int encoding,
String[] values)
Parse the value returned by a rich text editor and update the links and linebreaks. |
protected void |
processSaveInfo(info.magnolia.cms.core.Content node,
String saveInfo)
This method cares about one mgnlSaveInfo. |
protected void |
processString(info.magnolia.cms.core.Content node,
String name,
int type,
int encoding,
String[] values,
String valueStr)
Process a string. |
protected void |
processWriteCommon(info.magnolia.cms.core.Content node,
String name,
String valueStr,
int type)
Writes a property value. |
protected static String |
replacePByBr(String value,
String tagName)
|
boolean |
save()
Save the data passed by init. |
static void |
saveDocument(info.magnolia.cms.core.Content node,
info.magnolia.cms.beans.runtime.Document doc,
String name,
String fileName,
String template)
Saves a uploaded file in the magnolia way. |
void |
setCreate(boolean create)
Set true if a not existing node should get created during the save process |
void |
setCreationItemType(info.magnolia.cms.core.ItemType creationItemType)
Defines the node type to create if isCreate is true |
protected void |
setForm(info.magnolia.cms.beans.runtime.MultipartForm form)
set the from |
void |
setNodeCollectionName(String nodeCollectionName)
|
void |
setNodeName(String nodeName)
|
void |
setParagraph(String paragraph)
|
void |
setPath(String path)
|
void |
setRepository(String repository)
set the name of the repository saving to |
protected String |
updateLinks(info.magnolia.cms.core.Content node,
String name,
String valueStr)
Update the links in a string returned by a rich text editor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static org.slf4j.Logger log
Constructor Detail |
---|
public SaveHandlerImpl()
Method Detail |
---|
public void init(info.magnolia.cms.beans.runtime.MultipartForm form)
init
in interface SaveHandler
form
- the form generated from the request due to handle multipart formspublic boolean save()
SaveHandler
save
in interface SaveHandler
SaveHandler.save()
protected void processSaveInfo(info.magnolia.cms.core.Content node, String saveInfo) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException, info.magnolia.cms.security.AccessDeniedException
node
- node to add datasaveInfo
- name, type, valueType, isRichEditValue, encoding
javax.jcr.PathNotFoundException
- exception
javax.jcr.RepositoryException
- exception
info.magnolia.cms.security.AccessDeniedException
- no accessprotected void processDate(info.magnolia.cms.core.Content node, String name, int type, int valueType, int encoding, String[] values)
protected void processRichEdit(info.magnolia.cms.core.Content node, String name, int type, int isRichEditValue, int encoding, String[] values) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException, info.magnolia.cms.security.AccessDeniedException
node
- name
- type
- isRichEditValue
- encoding
- values
-
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
info.magnolia.cms.security.AccessDeniedException
protected String cleanLineBreaks(String valueStr, int isRichEditValue)
,
tags returned by the rich text editors
valueStr
-
protected String updateLinks(info.magnolia.cms.core.Content node, String name, String valueStr) throws info.magnolia.cms.security.AccessDeniedException, javax.jcr.RepositoryException, javax.jcr.PathNotFoundException
node
- node saving to. used to save the files and fileinfod toname
- the name of the field. used to make a subnode for the filesvalueStr
- the value containing the links
info.magnolia.cms.security.AccessDeniedException
javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
protected String cleanupLinkPrefix(info.magnolia.cms.core.Content filesNode, String link, String prefixRepo)
protected void processCommon(info.magnolia.cms.core.Content node, String name, int type, int valueType, int encoding, String[] values) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException, info.magnolia.cms.security.AccessDeniedException
node
- node where the data must be storedname
- name of the fieldtype
- typevalueType
- internal value type (according to ControlImpl)encoding
- must we encode (base64)values
- all values belonging to this field
javax.jcr.PathNotFoundException
- exception
javax.jcr.RepositoryException
- exception
info.magnolia.cms.security.AccessDeniedException
- exceptionprotected void processString(info.magnolia.cms.core.Content node, String name, int type, int encoding, String[] values, String valueStr) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException, info.magnolia.cms.security.AccessDeniedException
node
- name
- type
- encoding
- values
- valueStr
-
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
info.magnolia.cms.security.AccessDeniedException
protected void processRemoveCommon(info.magnolia.cms.core.Content node, String name) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
protected void processWriteCommon(info.magnolia.cms.core.Content node, String name, String valueStr, int type) throws info.magnolia.cms.security.AccessDeniedException, javax.jcr.RepositoryException
node
- the nodename
- the property name to be writtenvalueStr
- the value of the property
info.magnolia.cms.security.AccessDeniedException
- thrown if the write access is not granted
javax.jcr.RepositoryException
- thrown if other repository exception is thrownprotected void processMultiple(info.magnolia.cms.core.Content node, String name, int type, String[] values) throws javax.jcr.RepositoryException, javax.jcr.PathNotFoundException, info.magnolia.cms.security.AccessDeniedException
node
- name
- type
- values
-
javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
info.magnolia.cms.security.AccessDeniedException
protected void processBinary(info.magnolia.cms.core.Content node, String name) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException, info.magnolia.cms.security.AccessDeniedException
node
- name
-
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
info.magnolia.cms.security.AccessDeniedException
public javax.jcr.Value getValue(String s)
s
-
public javax.jcr.Value getValue(long l)
l
-
public javax.jcr.Value getValue(String valueStr, int type)
valueStr
- string representation of the valuetype
- type of the value
protected static String replacePByBr(String value, String tagName)
value
- tagName
- public boolean isCreate()
SaveHandler
isCreate
in interface SaveHandler
SaveHandler.isCreate()
public void setCreate(boolean create)
SaveHandler
setCreate
in interface SaveHandler
SaveHandler.setCreate(boolean)
public info.magnolia.cms.core.ItemType getCreationItemType()
SaveHandler
getCreationItemType
in interface SaveHandler
SaveHandler.getCreationItemType()
public void setCreationItemType(info.magnolia.cms.core.ItemType creationItemType)
SaveHandler
setCreationItemType
in interface SaveHandler
SaveHandler.setCreationItemType(info.magnolia.cms.core.ItemType)
protected info.magnolia.cms.beans.runtime.MultipartForm getForm()
protected void setForm(info.magnolia.cms.beans.runtime.MultipartForm form)
form
- containing the sended valuespublic void setRepository(String repository)
setRepository
in interface SaveHandler
repository
- the name of the repositorypublic String getRepository()
getRepository
in interface SaveHandler
protected info.magnolia.cms.core.Content getPageNode(info.magnolia.cms.core.HierarchyManager hm) throws javax.jcr.RepositoryException, info.magnolia.cms.security.AccessDeniedException, javax.jcr.PathNotFoundException
hm
-
javax.jcr.RepositoryException
info.magnolia.cms.security.AccessDeniedException
javax.jcr.PathNotFoundException
protected info.magnolia.cms.core.Content getSaveNode(info.magnolia.cms.core.HierarchyManager hm, info.magnolia.cms.core.Content rootNode) throws info.magnolia.cms.security.AccessDeniedException, javax.jcr.RepositoryException
hm
- rootNode
- the node containing the saving node. If both the nodeCollectionName and the nodeName are empty
this is the returned node.
info.magnolia.cms.security.AccessDeniedException
javax.jcr.RepositoryException
public static void saveDocument(info.magnolia.cms.core.Content node, info.magnolia.cms.beans.runtime.Document doc, String name, String fileName, String template) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException, info.magnolia.cms.security.AccessDeniedException
node
- the node under which the data is storedname
- the name of the nodedata to store the data intofileName
- If empty the original filename is usedtemplate
- can be empty
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
info.magnolia.cms.security.AccessDeniedException
public String getNodeCollectionName()
getNodeCollectionName
in interface SaveHandler
SaveHandler.getNodeCollectionName()
public void setNodeCollectionName(String nodeCollectionName)
setNodeCollectionName
in interface SaveHandler
nodeCollectionName
- The nodeCollectionName to set.SaveHandler.setNodeCollectionName(java.lang.String)
public String getNodeName()
getNodeName
in interface SaveHandler
SaveHandler.getNodeName()
public void setNodeName(String nodeName)
setNodeName
in interface SaveHandler
nodeName
- The nodeName to set.SaveHandler.setNodeName(java.lang.String)
public String getParagraph()
getParagraph
in interface SaveHandler
SaveHandler.getParagraph()
public void setParagraph(String paragraph)
setParagraph
in interface SaveHandler
paragraph
- The paragraph to set.SaveHandler.setParagraph(java.lang.String)
public String getPath()
getPath
in interface SaveHandler
SaveHandler.getPath()
public void setPath(String path)
setPath
in interface SaveHandler
path
- The path to set.SaveHandler.setPath(java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |