Bug 779168 (SOA-1563)

Summary: XsltAction - Custom SourceResult is not properly documented
Product: [JBoss] JBoss Enterprise SOA Platform 5 Reporter: Jiri Pechanec <jpechane>
Component: Documentation, JBossESBAssignee: Dana Mison <dmison>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: 5.0.0 ER1   
Target Milestone: ---   
Target Release: 5.0.0 GA   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jira.jboss.org/jira/browse/SOA-1563
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-02-12 10:21:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jiri Pechanec 2009-10-27 13:57:25 UTC
Date of First Response: 2010-01-06 00:30:28
project_key: SOA

Custom SourceResult needs to have resultType set to SOURCERESULT if the original result has to be used. Otherwise resultType must be in conformance with the SourceResult that was created by previous action in pipeline.

Comment 1 Dana Mison 2010-01-06 05:30:28 UTC
Sorry I'm not sure I understand this.

As far as I know, if resultType is set to SOURCERESULT: the direct output of the transform is the result that is returned by the action.  It is not cast into another type.

I'm not sure what you mean by "Otherwise resultType must be in conformance with the SourceResult that was created by previous action in pipeline"

Comment 2 Dana Mison 2010-01-06 06:48:09 UTC
Ah I think I understand.

If your payload is a SourceResult object:

Setting the  resultType to SOURCERESULT will return a result object of the same type as the result attribute of the payloads SourceResult object.

Otherwise the result will be cast to the type specified in resultType and you must ensure that the type-cast is valid.

Comment 3 Jiri Pechanec 2010-01-06 15:10:25 UTC
Check
http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/ResultFactory.java
and method process in http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/transformation/xslt/XsltAction.java

You can send SourceResult object as the payload of the message sent to action.
If resultType is set to SOURCERESULT then the action will write a result directly to the object represented by result attribute of the payload's SourceResult object and the output of the action will be this result object.
Setting the resultType to  something else like String, then the action will expect that result attribute is of type StreamResult, etc. see method extractResult and the output of the action id converted object.

Which is almost the same as you written just instead of type-cast valid is probably better said conversion compatible or similar.


Comment 4 Dana Mison 2010-01-21 05:36:59 UTC
added SOURCERESULT to the list of resultTypes with the description:

SOURCERESULT
When the message payload contains a SourceResult object this produces a result of the same type as the result attribute of the payload's SourceResult object.

and after the list of resultTypes I added this paragraph:

When the message payload is a SourceResult object and resultType is not set to SOURCERESULT, the result is returned as the type specified in resultType. The developer is responsible for ensuring that the types are compatible.

Comment 5 Jiri Pechanec 2010-02-12 10:21:48 UTC
Verified in CR1