[ 
https://issues.apache.org/jira/browse/CXF-4292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13270404#comment-13270404
 ] 

Sergey Beryozkin commented on CXF-4292:
---------------------------------------

Yes, I recall now that JAXB will generate a dedicated class if a simpleType 
restriction offers an enumeration of values. In fact this issue is a regression 
caused by the code added to reference the generated enum types if any.
So I've updated the code to return 'String' in cases where the class name can 
not be determined - I guess this is the best that the generator can do...
                
> Incorrect code generated with wadl2java tool when use JAXB binding and XML 
> symple type with restriction.
> --------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-4292
>                 URL: https://issues.apache.org/jira/browse/CXF-4292
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>            Reporter: Zebensui Méndez
>             Fix For: 2.6.1, 2.5.4
>
>         Attachments: cxf_2_6_0_wadl.zip
>
>
> If we have an XML schema with a simpleType that has a restriction, the tool 
> is not able to determine the basic type of java.
> Example:
>     <xs:simpleType name="DetailType">
>         <xs:annotation>
>             <xs:documentation>DetailType for WADL is used to indicate the 
> possible values for a WADL Resource parameter. 
>                 This parameter specifies the desired amount of information to 
> be returned. 
>                 For example, it is possible to instruct the web service to 
> return only basic information about the maintainable artefact (i.e.: id, 
> agency id, version and name). 
>                 Most notably, items of item schemes will not be returned (for 
> example, it will not return the codes in a code list query). 
>                 Possible values are: "allstubs" (all artefacts should be 
> returned as stubs ), "referencestubs" (referenced artefacts should be 
> returned as stubs ) 
>                 and full (all available information for all artefacts should 
> be returned ).
>             </xs:documentation>
>         </xs:annotation>
>         <xs:restriction base="xs:string">
>             <xs:pattern value="allstubs"/>
>             <xs:pattern value="referencestubs"/>
>             <xs:pattern value="full"/>
>         </xs:restriction>
>     </xs:simpleType>
> And the generated code is:
> @Path("datastructure/{agencyID}/{resourceID}/{version}")
> public interface Datastructure {
>     @GET
>     @Produces("application/vnd.sdmx.structure+xml;version=2.1")
>     StructureType MaintainableArtefactQuery(@QueryParam("detail") 
> @DefaultValue("full") DetailType detail, @QueryParam("references") 
> @DefaultValue("none") ReferencesType references);
> }
> But DetailType doen't have JAXB binding because is a simpleType (a String). 
> The the correct code would be:
> @Path("datastructure/{agencyID}/{resourceID}/{version}")
> public interface Datastructure {
>     @GET
>     @Produces("application/vnd.sdmx.structure+xml;version=2.1")
>     StructureType MaintainableArtefactQuery(@QueryParam("detail") 
> @DefaultValue("full") String detail, @QueryParam("references") 
> @DefaultValue("none") ReferencesType references);
> }
> Please run the attached code (mvn generate-sources with java parameters 
> -Xms512M -Xmx1024M) to reproduce the issue. Then see for example the class 
> "Datastructure".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to