protected int exprElementEnd(
MarinerRequestContext context,
PAPIAttributes papiAttributes)
throws PAPIException {
SegmentAttributes attributes
= (SegmentAttributes) papiAttributes;
MarinerPageContext pageContext
= ContextInternals.getMarinerPageContext(context);
String name = attributes.getName();
Segment segment = pageContext.getSegment(name);
if (segment == null) {
logger.error("segment-not-called", new Object[]{name});
throw new PAPIException(
exceptionLocalizer.format("missing-segment", name));
}
SegmentInstance segmentInstance
= (SegmentInstance) pageContext.getFormatInstance(segment,
NDimensionalIndex.ZERO_DIMENSIONS);
// the attribute values should be set on the segment attributes retrieved
// from the segment instance so that they can be used later.
com.volantis.mcs.protocols.SegmentAttributes pattributes
= segmentInstance.getAttributes();
// Copy the core attributes.
pattributes.setId(attributes.getId());
// Copy the other attributes.
pattributes.setName(name);
// get the styles for the current element and set it on the MCSAttributes
pattributes.setStyles(pageContext.getStylingEngine().getStyles());
PolicyReferenceResolver resolver =
pageContext.getPolicyReferenceResolver();
// Resolve the src string to a mariner expression
LinkAssetReference expression = resolver.resolveQuotedLinkExpression(
attributes.getSrc(), PageURLType.SEGMENT);
pattributes.setSrc(expression);
pattributes.setLongDesc(attributes.getLongDesc());
pattributes.setTitle(attributes.getTitle());
return CONTINUE_PROCESSING;
}