<gwtVersion>2.4.0</gwtVersion>
<smartgwtGroupId>com.isomorphic.smartgwt</smartgwtGroupId>
<smartgwtVersion>3.1p20140602</smartgwtVersion>
Hi,
I am trying to implement a validator factory and dynamically decide on which class I am going to call the method condition()
my ds.xml
<field name="products" type="text" customSQL="true" >
<validators>
<validator type="serverCustom">
<serverObject lookupStyle="factory" className="com.wirecard.gwt.server.ValidatorFactory"/>
<errorMessage>The product list contains invalid products</errorMessage>
</validator>
</validators>
</field>
The Validator Factory:
public class ValidatorFactory {
private static Log log = LogFactory.getLog(ValidatorFactory.class);
public Object create(RequestContext o1, HttpServletRequest o2, HttpServletResponse o3, ServletContext o4, HttpSession o5) {
return new MyDataSourceValidator();
}
}
The factory is called with the arguments above. My problem is that I wanted to provide a lookup table and depending on wich dataSource and fieldName the factory has been called, return the validator instance. From the parameters in the create() method I am not able to get this information wich is provided for example in the com.isomorphic.datasource.ValidationContext.
I've read this:
http://www.smartclient.com/smartgwte...validation_dmi
and this:
https://www.smartclient.com/smartgwt...iOverview.html
and this:
https://www.smartclient.com/smartgwt...ml#lookupStyle
Unfortunately I cannot provide to the create() method in the factory the input parameters as described in the doc:
HttpServletRequest
HttpServletResponse
ServletContext
HttpSession
RPCManager
DSRequest
RequestContext (from com.isomorphic.servlet)
DataSource (same as DSRequest.getDataSource())
Map (same as DSRequest.getValues())
Bean (auto-populated from DSRequest.getValues())
Could you please provide me with the info how to get the current datasource and field I am going to validate within the factory?
Best
zapryano
<smartgwtGroupId>com.isomorphic.smartgwt</smartgwtGroupId>
<smartgwtVersion>3.1p20140602</smartgwtVersion>
Hi,
I am trying to implement a validator factory and dynamically decide on which class I am going to call the method condition()
my ds.xml
<field name="products" type="text" customSQL="true" >
<validators>
<validator type="serverCustom">
<serverObject lookupStyle="factory" className="com.wirecard.gwt.server.ValidatorFactory"/>
<errorMessage>The product list contains invalid products</errorMessage>
</validator>
</validators>
</field>
The Validator Factory:
public class ValidatorFactory {
private static Log log = LogFactory.getLog(ValidatorFactory.class);
public Object create(RequestContext o1, HttpServletRequest o2, HttpServletResponse o3, ServletContext o4, HttpSession o5) {
return new MyDataSourceValidator();
}
}
The factory is called with the arguments above. My problem is that I wanted to provide a lookup table and depending on wich dataSource and fieldName the factory has been called, return the validator instance. From the parameters in the create() method I am not able to get this information wich is provided for example in the com.isomorphic.datasource.ValidationContext.
I've read this:
http://www.smartclient.com/smartgwte...validation_dmi
and this:
https://www.smartclient.com/smartgwt...iOverview.html
and this:
https://www.smartclient.com/smartgwt...ml#lookupStyle
Unfortunately I cannot provide to the create() method in the factory the input parameters as described in the doc:
HttpServletRequest
HttpServletResponse
ServletContext
HttpSession
RPCManager
DSRequest
RequestContext (from com.isomorphic.servlet)
DataSource (same as DSRequest.getDataSource())
Map (same as DSRequest.getValues())
Bean (auto-populated from DSRequest.getValues())
Could you please provide me with the info how to get the current datasource and field I am going to validate within the factory?
Best
zapryano