|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jbpm.formbuilder.client.XmlParseHelper
public class XmlParseHelper
This class is to help FormBuilderModel to parse response messages
and transform request bodies.
| Constructor Summary | |
|---|---|
XmlParseHelper()
|
|
| Method Summary | |
|---|---|
String |
asXml(FormRepresentation form,
Map<String,Object> inputs)
Method to output xml from a form preview and its group of test input variables with the following format:
<formPreview> |
String |
asXml(String groupName,
FBMenuItem item)
Method to output xml from a menu item and its group's name with the following format:
<menuItem> |
String |
asXml(String formItemName,
FormItemRepresentation formItem)
Method to output xml from a form item and is name with the following format:
<formItem name="${formItemName}"> |
String |
getFileName(String responseText)
Parses and returns a file name from an XML response of the following format: <fileName>${response}</fileName> |
String |
getFormId(String responseText)
Parses and returns a formItemId from an XML response of the following format: <formItemId>${response}</formItemId> |
String |
getFormItemId(String responseText)
Parses and returns a formId from an XML response of the following format: <formId>${response}</formId> |
List<String> |
readFiles(String responseText)
Ment to parse an XML response with the following format:
<files> |
List<FormRepresentation> |
readForms(String responseText)
Ment to parse an XML response with the following format:
<listForms> |
Map<String,List<FBMenuItem>> |
readMenuMap(String responseText)
Ment to parse an XML response with the following format:
<menuGroups> |
List<MainMenuOption> |
readMenuOptions(String responseText)
Ment to parse an XML response with the following format:
<menuOptions> |
Map<String,String> |
readPropertyMap(String responseText)
Parses and returns a map of strings with string keys from an XML response of the following format:
<properties> |
List<String> |
readRoles(String response)
|
List<TaskRef> |
readTasks(String responseText)
Ment to parse an XML response with the following format:
<tasks> |
List<FBValidationItem> |
readValidations(String responseText)
Parses and returns a validation dto list from an XML response of the following format:
<validations> |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XmlParseHelper()
| Method Detail |
|---|
public String asXml(String formItemName,
FormItemRepresentation formItem)
throws FormEncodingException
<formItem name="${formItemName}">
<content>${formItem.asJson()}</content>
</formItem>
formItemName - name of the form itemformItem - the form item to format
FormEncodingException
public String asXml(String groupName,
FBMenuItem item)
<menuItem>
<groupName>${groupName}</groupName>
<name>${item.description.text}</name>
<clone><![CDATA[${item.asJson()}]]></clone>
<effect>${item.formEffects[0].class.name}</effect>
<effect>${item.formEffects[1].class.name}</effect>
...
<effect>${item.formEffects[n].class.name}</effect>
</menuItem>
groupName - the menu item group's nameitem - the menu item
public List<TaskRef> readTasks(String responseText)
<tasks>
<task processId="${task.processId}" taskName="${task.taskId}">
<input name="${task.inputs[0].name}" source="${task.inputs[0].sourceExpression}"/>
<input name="${task.inputs[1].name}" source="${task.inputs[1].sourceExpression}"/>
...
<input name="${task.inputs[n].name}" source="${task.inputs[n].sourceExpression}"/>
<output name="${task.outputs[0].name}" source="${task.outputs[0].sourceExpression}"/>
<output name="${task.outputs[1].name}" source="${task.outputs[1].sourceExpression}"/>
...
<output name="${task.outputs[n].name}" source="${task.outputs[n].sourceExpression}"/>
<metaData key="${task.metaData.entrySet[0].key}" value="${task.metaData.entrySet[0].value}"/>
<metaData key="${task.metaData.entrySet[1].key}" value="${task.metaData.entrySet[1].value}"/>
...
<metaData key="${task.metaData.entrySet[n].key}" value="${task.metaData.entrySet[n].value}"/>
</task>
...
</tasks>
responseText - The XML response.
public List<MainMenuOption> readMenuOptions(String responseText)
<menuOptions>
<menuOption name="${option[0].html}" (commandClass="${option[0].command.class.name}")>
<menuOption name="${option[0].subMenu[0].html}" commandClass="${option[0].subMenu[0].command.class.name}"/>
...
<menuOption name="${option[0].subMenu[n].html}" (commandClass="${option[0].subMenu[n].command.class.name}")>
<menuOption name="${option[0].subMenu[n].subMenu[0].html}" commandClass="${option[0].subMenu[n].subMenu[0].command.class.name}"/>
</menuOption>
</menuOption>
...
<menuOption name="${option[m].html}" commandClass="${option[m].command.class.name}"/>
</menuOptions>
responseText - The XML response.
public List<FormRepresentation> readForms(String responseText)
<listForms>
<form><json>${jsonFromFormRepresentation}</json></form>
</listForms>
responseText - the XML response.
public Map<String,List<FBMenuItem>> readMenuMap(String responseText)
<menuGroups>
<menuGroup name="???">
<menuItem className="???" optionName="???">
<itemJson>???</itemJson>
<effect className="???"/>
</menuItem>
...
<menuItem ...>
...
</menuItem>
</menuGroup>
...
<menuGroup name="???">
...
</menuGroup>
</menuGroups>
responseText - the XML response.
public String getFormItemId(String responseText)
<formId>${response}</formId>
responseText - XML response to parse
public String getFormId(String responseText)
<formItemId>${response}</formItemId>
responseText - XML response to parse
public String getFileName(String responseText)
<fileName>${response}</fileName>
responseText - XML response to parse
public Map<String,String> readPropertyMap(String responseText)
<properties>
<property key="${key[0]}" value="${value[0]}"/>
<property key="${key[1]}" value="${value[1]}"/>
...
<property key="${key[n]}" value="${value[n]}"/>
</properties>
responseText - XML response to parse
public String asXml(FormRepresentation form,
Map<String,Object> inputs)
throws FormEncodingException
<formPreview>
<representation>${form.toJson()}</representation>
<input key="${inputs[0].key}" value="${inputs[0].value}"/>
<input key="${inputs[1].key}" value="${inputs[1].value}"/>
...
<input key="${inputs[n].key}" value="${inputs[n].value}"/>
</formPreview>
form - the form representation to transform on server side to a given languageinputs - the data inputs of the form representation to test it
FormEncodingException - in case of error parsing the form representation
public List<FBValidationItem> readValidations(String responseText)
throws Exception
<validations>
<validation className="${fbValidationItem[0].class.name}">
<property key="${key[0]}" value="${value[0]}"/>
<property key="${key[1]}" value="${value[1]}"/>
...
<property key="${key[n]}" value="${value[n]}"/>
</validation>
...
<validation className="${fbValidationItem[m].class.name}">
<property key="${key[0]}" value="${value[0]}"/>
<property key="${key[1]}" value="${value[1]}"/>
...
<property key="${key[p]}" value="${value[p]}"/>
</validation>
</validations>
responseText - XML response to parse
Exceptionpublic List<String> readRoles(String response)
public List<String> readFiles(String responseText)
<files>
<file>${url}</file>
</files>
responseText - the XML response.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||