protected int elementStartImpl(
MarinerRequestContext context,
PAPIAttributes papiAttributes)
throws PAPIException {
MarinerPageContext pageContext
= ContextInternals.getMarinerPageContext(context);
XFActionAttributes attributes = (XFActionAttributes) papiAttributes;
// Create a new protocol attributes object every time, as this element
// could be reused before the attributes have actually been finished with
// by the protocol.
com.volantis.mcs.protocols.XFActionAttributes pattributes
= new com.volantis.mcs.protocols.XFActionAttributes();
// Validate the type attribute.
String type = attributes.getType();
if (type == null) {
throw new PAPIException(exceptionLocalizer.format("type-required"));
}
if (inline()) {
if (!TYPE_PERFORM.equals(type)) {
throw new PAPIException(
exceptionLocalizer.format("inline-xfaction-type-error",
new Object[]{TYPE_PERFORM,
type}));
}
} else {
if (!TYPE_SUBMIT.equals(type) && !TYPE_RESET.equals(type)) {
// MCSPA0044X="Form xfaction must either be of type '{2}' or '{3}', not '{4}'"
throw new PAPIException(
exceptionLocalizer.format("invalid-xfaction-type",
new Object[]{TYPE_SUBMIT,
TYPE_RESET,
type}));
}
}
// Set the type attribute.
pattributes.setType(type);
// Set the value attribute, for backward compatability if the value is not
// set then it defaults to the caption.
String value = attributes.getValue();
if (value == null) {
// This code should be removed when we stop defaulting to the caption
// value.
PolicyReferenceResolver resolver =
pageContext.getPolicyReferenceResolver();
TextAssetReference object
= resolver.resolveQuotedTextExpression(
attributes.getCaption());
String caption = getPlainText(object);
if (caption != null) {