Hi Jorge, I just did a blog post on this here [1], please have a look.
[1] http://lafernando.com/2011/06/14/writing-a-custom-validator-for-wso2-dss/ Cheers, Anjana. On Mon, Jun 13, 2011 at 8:26 AM, Jorge Infante Osorio <[email protected]>wrote: > Hi Anjana. > > -----Mensaje original----- > De: Anjana Fernando [mailto:[email protected]] > Enviado el: jueves, 07 de abril de 2011 11:18 > Para: [email protected] > CC: Jorge Infante Osorio > Asunto: Re: [Carbon-dev] data service defaultValue config > > Hi Jorge, > > On Thu, Apr 7, 2011 at 7:46 PM, Jorge Infante Osorio <[email protected]> > wrote: > > Hi all. > > > > In a data service query I need to specified 3 input parameters, > > numero3 is mandatory, and numero1 and numero2 are optional, numero1 or > > numero2, but I need to pass [numero1 and numero3] or [numero 2 and > > numero3] not numero3 alone. How can I do that? > > You can either do that in the client application itself, or if you really > need to enforce it in DSS, you can write a custom validator [1]. There you > can get something called the "validation context", which gives you access > to > other parameter names and its values, so you can enforce your logic there. > > [1] > > http://wso2.org/project/solutions/data-services/java/2.5.1/docs/validation.h > tml > > Can you provide me with an example of this custom validator? I check in the > DSS 2.5.1 documentation and I don´t see any code example. > I see that I need to implement this interface: > > public interface Validator { > > public void validate(ValidationContext context, String name, > ParamValue value) throws ValidationException; > > } > But I have doubts about what I need to pass in the ValidationContext > object. > > Another question: in which jar do you have this interface? > > Regards, > Jorge. > > Cheers, > Anjana. > > > > > > > > > <param name="numero1" paramType="SCALAR" sqlType="STRING" type="IN" > > ordinal="1" defaultValue="#{NULL}" /> > > > > <param name="numero2" paramType="SCALAR" sqlType="STRING" type="IN" > > ordinal="2" defaultValue="#{NULL}" /> > > > > <param name="numero3" paramType="SCALAR" sqlType="STRING" type="IN" > > ordinal="3" /> > > > > > > > > > > > > Thanks, > > > > Ing. Jorge Infante Osorio. > > > > J´Dpto Soluciones SOA. > > > > CDAE. > > > > UCI > > > > > > > > _______________________________________________ > > Carbon-dev mailing list > > [email protected] > > http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev > > > > > > > > -- > Anjana Fernando > Software Engineer > WSO2, Inc.; http://wso2.com > lean.enterprise.middleware > > -- *Anjana Fernando* Senior Software Engineer WSO2 Inc. | http://wso2.com lean . enterprise . middleware
_______________________________________________ Carbon-dev mailing list [email protected] http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
