|
||||||||||
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 , tags returned by the rich text editors |
protected String |
cleanupLinkPrefix(Content filesNode,
String link,
String prefixRepo)
|
ItemType |
getCollectionNodeCreationItemType()
|
ItemType |
getCreationItemType()
Defines the node type to create if isCreate is true |
protected MultipartForm |
getForm()
|
String |
getNodeCollectionName()
|
String |
getNodeName()
|
protected Content |
getPageNode(HierarchyManager hm)
Returns the page. |
String |
getParagraph()
|
String |
getPath()
|
String |
getRepository()
get the name of thre repository saving to |
protected Content |
getSaveNode(HierarchyManager hm,
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(MultipartForm form)
Initialize the SaveHandlerImpl control. |
boolean |
isCreate()
True if a not existing path should get created during the save process |
protected void |
processBinary(Content node,
String name)
Process binary data. |
protected void |
processCommon(Content node,
String name,
int type,
int valueType,
int encoding,
String[] values)
Process a common value |
protected void |
processDate(Content node,
String name,
int type,
int valueType,
int encoding,
String[] values)
|
protected void |
processMultiple(Content node,
String name,
int type,
String[] values)
Process a multiple value field |
protected void |
processRemoveCommon(Content node,
String name)
Remove the specified property on the node. |
protected void |
processRichEdit(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(Content node,
String saveInfo)
This method cares about one mgnlSaveInfo. |
protected void |
processString(Content node,
String name,
int type,
int encoding,
String[] values,
String valueStr)
Process a string. |
protected void |
processWriteCommon(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(Content node,
Document doc,
String name,
String fileName,
String template)
Saves a uploaded file in the magnolia way. |
void |
setCollectionNodeCreationItemType(ItemType collectionNodeCreationItemType)
|
void |
setCreate(boolean create)
Set true if a not existing node should get created during the save process |
void |
setCreationItemType(ItemType creationItemType)
Defines the node type to create if isCreate is true |
protected void |
setForm(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(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(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(Content node, String saveInfo) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException, AccessDeniedException
node
- node to add datasaveInfo
- name, type, valueType, isRichEditValue, encoding
javax.jcr.PathNotFoundException
- exception
javax.jcr.RepositoryException
- exception
AccessDeniedException
- no accessprotected void processDate(Content node, String name, int type, int valueType, int encoding, String[] values)
protected void processRichEdit(Content node, String name, int type, int isRichEditValue, int encoding, String[] values) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException, AccessDeniedException
node
- name
- type
- isRichEditValue
- encoding
- values
-
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
AccessDeniedException
protected String cleanLineBreaks(String valueStr, int isRichEditValue)
,
tags returned by the rich text editors
valueStr
-
protected String updateLinks(Content node, String name, String valueStr) throws 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
AccessDeniedException
javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
protected String cleanupLinkPrefix(Content filesNode, String link, String prefixRepo)
protected void processCommon(Content node, String name, int type, int valueType, int encoding, String[] values) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException, 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
AccessDeniedException
- exceptionprotected void processString(Content node, String name, int type, int encoding, String[] values, String valueStr) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException, AccessDeniedException
node
- name
- type
- encoding
- values
- valueStr
-
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
AccessDeniedException
protected void processRemoveCommon(Content node, String name) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
protected void processWriteCommon(Content node, String name, String valueStr, int type) throws AccessDeniedException, javax.jcr.RepositoryException
node
- the nodename
- the property name to be writtenvalueStr
- the value of the property
AccessDeniedException
- thrown if the write access is not granted
javax.jcr.RepositoryException
- thrown if other repository exception is thrownprotected void processMultiple(Content node, String name, int type, String[] values) throws javax.jcr.RepositoryException, javax.jcr.PathNotFoundException, AccessDeniedException
node
- name
- type
- values
-
javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
AccessDeniedException
protected void processBinary(Content node, String name) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException, AccessDeniedException
node
- name
-
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
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 ItemType getCreationItemType()
SaveHandler
getCreationItemType
in interface SaveHandler
SaveHandler.getCreationItemType()
public void setCreationItemType(ItemType creationItemType)
SaveHandler
setCreationItemType
in interface SaveHandler
SaveHandler.setCreationItemType(info.magnolia.cms.core.ItemType)
public ItemType getCollectionNodeCreationItemType()
getCollectionNodeCreationItemType
in interface SaveHandler
public void setCollectionNodeCreationItemType(ItemType collectionNodeCreationItemType)
setCollectionNodeCreationItemType
in interface SaveHandler
protected MultipartForm getForm()
protected void setForm(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 Content getPageNode(HierarchyManager hm) throws javax.jcr.RepositoryException, AccessDeniedException, javax.jcr.PathNotFoundException
hm
-
javax.jcr.RepositoryException
AccessDeniedException
javax.jcr.PathNotFoundException
protected Content getSaveNode(HierarchyManager hm, Content rootNode) throws 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.
AccessDeniedException
javax.jcr.RepositoryException
public static void saveDocument(Content node, Document doc, String name, String fileName, String template) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException, AccessDeniedException
node
- the node under which the data is storedname
- the name of the nodedata to store the data intofileName
- If empty the original or default title is usedtemplate
- can be empty
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
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 |