public class Wizard extends Object implements SizeMeasurable, Serializable
| Modifier and Type | Class and Description |
|---|---|
(package private) class |
Wizard.OrderByComparator |
| Modifier and Type | Field and Description |
|---|---|
static String |
DTD_EDITWIZARD_1_0 |
static String |
PUBLIC_ID_EDITWIZARD_1_0 |
static String |
PUBLIC_ID_EDITWIZARD_1_0_FAULT |
static String |
RESPONSE_KEY |
| Constructor and Description |
|---|
Wizard(javax.servlet.http.HttpServletRequest request,
URIResolver uri,
Config.WizardConfig wizardConfig,
Cloud cloud)
Constructor.
|
Wizard(javax.servlet.http.HttpServletRequest request,
URIResolver uri,
String wizardname,
String dataid,
Cloud cloud)
Deprecated.
use Wizard(String, URIResolver, Config.WizardConfig, Cloud)
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBinaryData(Node fieldnode)
This method stores binary data in the data, so that the information can be used by the html.
|
protected boolean |
checkNode(String objectNumber,
String operation)
Returns true if the specified operation is valid for the node with the specified objectnumber.
|
boolean |
committed()
Returns whether the wizard has committed the transaction
|
Document |
createPreHtml(Node wizardSchema,
String formid,
Node data,
String instanceName)
This method generated the pre-html.
|
Document |
createPreHtml(String instanceName)
This method generates the pre-html.
|
void |
createPreHtmlForm(Node form,
Node formdef,
Node dataContext)
This method is used by the #createPreHtml method to generate a pre-html form.
|
String |
determineNextForm(String direction)
This method is used to determine what form is the sequential next, previous, first etc.
|
byte[] |
getBinary(String did)
This method allows you to retrieve the data of a temporarily stored binary.
|
String |
getBinaryName(String did)
With this method you can retrieve the binaryname of a placed binary.
|
String |
getBinaryPath(String did)
With this method you can retrieve the binarypath of a placed binary.
|
int |
getByteSize()
Determines the byte-size of this object
|
int |
getByteSize(SizeOf sizeof)
Determines the byte-size of this object using the given SizeOf instance.
|
Node |
getConstraints(String objecttype)
This method gets the MMBase constraints.
|
Node |
getConstraints(String objecttype,
String fieldname)
This method gets the MMBase constraints.
|
Document |
getData() |
String |
getDataId() |
protected List<Element> |
getElementsByNumber(Document d,
String number) |
String |
getObjectNumber() |
Document |
getPreForm() |
Document |
getPreForm(String instanceName) |
Document |
getSchema() |
WizardCommand |
getStartWizardCommand()
Returns the subwizard start command
|
protected void |
loadData()
Load data from mmbase based on the wizard schema
|
protected void |
loadWizard(Config.WizardConfig wizardConfig,
javax.servlet.http.HttpServletRequest request)
Loads the wizard schema, and a work document, and fills it with initial data.
|
boolean |
mayBeClosed()
Returns whether the wizard may be closed
|
protected boolean |
mayDeleteNode(String objectNumber)
Returns true if the node with the specified objectnumber can be deleted
|
protected boolean |
mayEditNode(String objectNumber)
Returns true if the node with the specified objectnumber can be edited
|
void |
mergeConstraints(Node fieldDef,
Node fieldNode)
This method is used to merge MMBase specific constraints with the values placed in the Wizard definition.
|
void |
processCommand(WizardCommand cmd)
This method is usually called by #processCommands and processes one command.
|
void |
processRequest(javax.servlet.http.HttpServletRequest req)
Processes an incoming request (usually passed on by a jsp code).
|
String |
retrieveFieldValue(String did,
String fieldName)
Obtains the value form the right field (given by name) of the right node (given by did).
|
(package private) boolean |
runQuery(Node list,
Node query)
This method tests if a query in a nodelist needs to be run, and runs it if needed, adding the resulting options to the optionlist.
|
void |
setBinary(String did,
byte[] bytes,
String name,
String path)
With this method you can store a binary in the wizard.
|
void |
setBinary(String did,
byte[] bytes,
String name,
String path,
String type)
set binary data for uploaded bytes
|
void |
setReferrer(String s) |
void |
setSessionId(String s) |
void |
setSessionKey(String s) |
void |
setTemplatesDir(String f) |
void |
setTimezone(String s) |
boolean |
startWizard()
Returns whether a sub wizard should be started
|
protected void |
storeConfigurationAttributes(Config.WizardConfig wizardConfig)
Stores configuration variables as attributes in the variables set.
|
void |
storeFieldValue(String did,
String fieldName,
String value)
Puts the given value in the right field (given by name) of the right node (given by did)
Assumes a text field.
|
void |
writeHtmlForm(Writer out,
String instanceName)
Constructs and writes final form-html to the given out writer.
|
void |
writeHtmlForm(Writer out,
String instanceName,
Map<String,Object> externParams)
Constructs and writes final form-html to the given out writer.
|
public static final String PUBLIC_ID_EDITWIZARD_1_0
public static final String PUBLIC_ID_EDITWIZARD_1_0_FAULT
public static final String DTD_EDITWIZARD_1_0
public static final String RESPONSE_KEY
public Wizard(javax.servlet.http.HttpServletRequest request,
URIResolver uri,
String wizardname,
String dataid,
Cloud cloud)
throws WizardException
request - Associated servlet request, sometimes needed for URL generationuri - the URIResolver with which the wizard schema's and the xsl's will be loadedwizardname - name of the wizarddataid - the objectnumbercloud - the Cloud to useWizardException - when wizard creation failedpublic Wizard(javax.servlet.http.HttpServletRequest request,
URIResolver uri,
Config.WizardConfig wizardConfig,
Cloud cloud)
throws WizardException
request - Associated servlet request, sometimes needed for URL generationuri - the URIResolver with which the wizard schema's and the xsl's will be loadedwizardConfig - the class containing the configuration parameters (i.e. wizard name and objectnumber)cloud - the Cloud to useWizardException - when wizard creation failedpublic int getByteSize()
SizeMeasurablegetByteSize in interface SizeMeasurablepublic int getByteSize(SizeOf sizeof)
SizeMeasurablegetByteSize in interface SizeMeasurablepublic void setSessionId(String s)
public void setSessionKey(String s)
public void setReferrer(String s)
public void setTemplatesDir(String f)
public void setTimezone(String s)
public String getObjectNumber()
public String getDataId()
public Document getData()
public Document getSchema()
public Document getPreForm() throws WizardException
WizardExceptionpublic Document getPreForm(String instanceName) throws WizardException
WizardExceptionpublic boolean committed()
true when committedpublic boolean mayBeClosed()
true when allowed to closepublic boolean startWizard()
true when start a sub wizardprotected boolean checkNode(String objectNumber, String operation) throws WizardException
objectNumber - the number of the node to checkoperation - a valid operation, i.e. maywrite or maydeletetrue when valid operationWizardException - if the object cannot be retrievedprotected boolean mayEditNode(String objectNumber) throws WizardException
objectNumber - number of the object to checktrue when allowed to editWizardException - if the object cannot be retrievedprotected boolean mayDeleteNode(String objectNumber) throws WizardException
objectNumber - number of the object to checktrue when allowed to deleteWizardException - if the object cannot be retrievedpublic WizardCommand getStartWizardCommand()
protected void storeConfigurationAttributes(Config.WizardConfig wizardConfig)
wizardConfig - the config with the parametersprotected void loadWizard(Config.WizardConfig wizardConfig, javax.servlet.http.HttpServletRequest request) throws WizardException
wizardConfig - the class containing the configuration parameters (i.e. wizard name and objectnumber)WizardException - when wizard loading failedprotected void loadData()
throws WizardException
WizardException - when data loading failedpublic void processRequest(javax.servlet.http.HttpServletRequest req)
throws WizardException
req - the ServletRequest contains the name-value pairs received through the http connectionWizardException - when request processing failedpublic void writeHtmlForm(Writer out, String instanceName) throws WizardException, TransformerException
out - The writer where the output (html) should be written to.instanceName - name of the current instanceWizardException - when building the current state of the wizard xml failedTransformerException - when transforming the wizard xml failedpublic void writeHtmlForm(Writer out, String instanceName, Map<String,Object> externParams) throws WizardException, TransformerException
out - The writer where the output (html) should be written to.instanceName - name of the current instanceexternParams - sending parameters to the stylesheet which are not
from the editwizards itselfWizardException - when building the current state of the wizard xml failedTransformerException - when transforming the wizard xml failedpublic String determineNextForm(String direction)
direction - indicates what you wanna know. Possibilities:
- first (default)
- last
- previous
- next
public Document createPreHtml(String instanceName) throws WizardException
instanceName - The instancename of this wizardWizardException - thrown when something failed in generating the xmlcreatePreHtml(Node, String, Node, String)public Document createPreHtml(Node wizardSchema, String formid, Node data, String instanceName) throws WizardException
wizardSchema - the main node of the schema to be used. Includes should already be resolved.formid - The id of the current formdata - The main node of the data tree to be usedinstanceName - The instancename of this wizardWizardException - thrown when something failed in generating the xmlboolean runQuery(Node list, Node query)
list - the node of the optionlist in which the query is definedquery - the node of the query definitionpublic void createPreHtmlForm(Node form, Node formdef, Node dataContext) throws WizardException
form - The node of the pre-html form which is to be generatedformdef - the node of the wizardschema form definitiondataContext - Points to the datacontext node which should be used for this form.WizardException - when form generation failedpublic void storeFieldValue(String did, String fieldName, String value) throws WizardException
did - The data id of the nodefieldName - The name of the fieldvalue - The (String) value what should be stored in the data.WizardException - when failed to store field datapublic String retrieveFieldValue(String did, String fieldName) throws WizardException
did - The data id of the nodefieldName - The name of the fieldWizardException - when failed to read fieldpublic void processCommand(WizardCommand cmd) throws WizardException
cmd - The command to be processedWizardException - when failed to process commandpublic void setBinary(String did, byte[] bytes, String name, String path)
did - This is the dataid what points to in what field the binary should be stored, once commited.bytes - This is a bytearray with the data to be stored.name - This is the name which will be used to show what file is uploaded.path - The (local) path of the file placed.public void setBinary(String did, byte[] bytes, String name, String path, String type)
did - This is the dataid what points to in what field the binary should be stored, once commited.bytes - This is a bytearray with the data to be stored.name - This is the name which will be used to show what file is uploaded.path - The (local) path of the file placed.type - Content-type of the byte (or null). If not null, then the fields 'mimetype',
'size' and 'filename' are filled as well.public byte[] getBinary(String did)
did - The dataid of the binary you want.public String getBinaryName(String did)
did - The dataid of the binary you want.public String getBinaryPath(String did)
did - The dataid of the binary you want.public void addBinaryData(Node fieldnode)
fieldnode - the fieldnode where the binary data information should be stored.public void mergeConstraints(Node fieldDef, Node fieldNode)
fieldDef - the fielddefinition as placed in the wizardschema (==definition)fieldNode - The fieldnode points to the datanode. (This is needed to find out what datatype this field is about).public Node getConstraints(String objecttype)
objecttype - The name of the object, eg. images, jumpers, urls, newspublic Node getConstraints(String objecttype, String fieldname)
objecttype - The name of the object, eg. images, jumpers, urls, newsfieldname - The name of the field, eg. title, body, startMMBase 1.9-SNAPSHOT - ${javadoctimestamp}