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

Kishanthan Thangarajah commented on AXIS2-4190:
-----------------------------------------------

Hi Amila,
I had a look at this. The "totalDigits" facet is not included in the 
adb-codegen schema's. Since it is a restriction type, we can include like other 
facets such as maxInclusive, maxLength , etc in restriction type. According to 
the w3c recommendation [1], the totalDigits must take a positive integer as its 
value. And to validate, the input should be less than 10^n where n is the 
defined value in the schema. To check this restriction type, i think we can 
include a converter method in ConverterUtil class and then compare it. WDYT?

Thanks,
Kishanthan.
[1] http://www.w3.org/TR/xmlschema-2/#element-totalDigits
                
> WSDL2JAVA Not generating code for <xsd:totalDigits> when databinding is ADB.
> ----------------------------------------------------------------------------
>
>                 Key: AXIS2-4190
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4190
>             Project: Axis2
>          Issue Type: Bug
>          Components: adb, codegen
>    Affects Versions: 1.3, 1.4, 1.4.1
>         Environment: Any
>            Reporter: Colin Anderson
>            Assignee: Amila Chinthaka Suriarachchi
>
> I have the following definition in an XSD:
> <xsd:simpleType name="tariffID">
>     <xsd:annotation>
>         <xsd:documentation>Standard tariff ID</xsd:documentation>
>     </xsd:annotation>
>     <xsd:restriction base="xsd:int">
>         <xsd:totalDigits value="7"/>
>     </xsd:restriction>
>  </xsd:simpleType>
> When I generate the Java code I get the TariffID type as expected, but in the 
> generated setTariffID(int) method, there is no code generated that captures 
> the <xsd:totalDigits> restriction:
> /**
>  * Auto generated setter method
>  * @param param TariffID
>  */
>   public void setTariffID(int param){
>     this.localTariffID=param;
>   }
> If I then add either <xsd:pattern> or <xsd:minInclusive> and 
> <xsd:maxInclusive> to the XSD then these restrictions are captured in the 
> generated code.  For example, this:
> <xsd:simpleType name="tariffID">
>     <xsd:annotation>
>         <xsd:documentation>Standard tariff ID</xsd:documentation>
>     </xsd:annotation>
>     <xsd:restriction base="xsd:int">
>         <xsd:totalDigits value="7"/>
>         <xsd:minInclusive value="0"/>
>         <xsd:maxInclusive value="9999999"/>
>     </xsd:restriction>
> </xsd:simpleType>
> results in the following Java code being generated:
> /**
>  * Auto generated setter method
>  * @param param TariffID
>  */
> public void setTariffID(int param){
>   if (org.apache.axis2.databinding.utils.ConverterUtil.compare(param, 
> "9999999") <= 0){
>     this.localTariffID=param;
>   }
>   else {
>     throw new java.lang.RuntimeException();
>   }                                       
>   if (org.apache.axis2.databinding.utils.ConverterUtil.compare(param, "0") >= 
> 0){
>     this.localTariffID=param;
>   }
>   else {
>     throw new java.lang.RuntimeException();
>   }
> }
> I and others on the user mailing list believe this is a bug in the ADB 
> databinding code generation. 

--
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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@axis.apache.org
For additional commands, e-mail: java-dev-h...@axis.apache.org

Reply via email to