[Seasar-user:19042] Cooldeploy時のカスタムValidatorの挙動について
萩原 幸央
[E-MAIL ADDRESS DELETED]
2009年 12月 18日 (金) 13:02:58 JST
$B$*@$OC$K$J$j$^$9!"Gk86$H?=$7$^$9!#(B
teeda$B$N(Bversion1.0.13$B$r;HMQ$7!"%7%9%F%`3+H/$r9T$C$F$*$j$^$9!#(B
$B!J(Bs2-framework-2.4.34$B!K(B
$B$=$NCf$G!"%+%9%?%`$N(BValidator$B$r:[E-MAIL ADDRESS DELETED]$7!"2hLL$G$NF~NO%A%'%C%/$KMxMQ$7$F(B
$B$$$k$N$G$9$,!"(BHotdeploy$B;~$G$[E-MAIL ADDRESS DELETED]>o$K=hM}=PMh$k$N$G$9$,!"(BCooldeploy$B;~(B
$B$K>e<j$/F0:n$7$^$;$s!#(B
$B860x$,FCDj=PMh$:$KG:$s$G$*$j$^$9!"2?$+%"%I%P%$%9$rD:$1$^$;$s$G$7$g$&$+!)(B
$B8=>]$O0J2<$NDL$j$G$9!#(B
********************************************************************
$B-!2hLL(BA$B$K$F2hLL9`L\(BA$B$KBP$7$F(BValidator$B!J%"%N%F!<%7%g%s!K$K$h$k%A%'%C%/=hM}$r9T$&!#(B
$B$3$N:]!"%A%'%C%/BP>]$r(BtargetId$[E-MAIL ADDRESS DELETED]$K$F;XDj$7$F$$$k!#(B
$B!J(BValidator$BFb$G;XDj$N(BtargetId$B$r<hF@$7$F$$$^$9!#!K(B
UIComponent targetComponent = component.findComponent(targetId);
$B"M(BtargetId$B$[E-MAIL ADDRESS DELETED]>o$K<hF@=PMh$k$?$a!"=hM}$[E-MAIL ADDRESS DELETED]>o$K=*N;!#(B
$B-"2hLL(BB$B$K$F2hLL9`L\(BB$B$KBP$7$F(BValidator$B!J-!$HF10l!K$K$h$k%A%'%C%/=hM}$r9T$&!#(B
$B"M(BtargetId$B$[E-MAIL ADDRESS DELETED]>o$K<hF@=PMh$k$?$a!"=hM}$[E-MAIL ADDRESS DELETED]>o$K=*N;!#(B
$B-#:FEY!"2hLL(BA$B$K$F2hLL9`L\(BA$B$KBP$7$F(BValidator$B!J-!$HF10l!K$K$h$k%A%'%C%/=hM}$r(B
$B9T$&!#(B
$B"M(BtargetId$B$,2hLL(BB$B$N2hLL9`L\(BB$B$H$J$C$F$*$j!"2hLL(BA$B$K2hLL9`L\(BB$B$OB8:_$7$J$$(B
$B$?$a!"%3%s%]!<%M%s%H$r<hF@$G$-$:%(%i!<$H$J$k!#(B
$B"(%G%P%C%0$7$F$_$?$H$3$m!"(BtargetId$B$KBP$9$k%;%C%?!<$,8F$S=P$5$l$F$$$J$$!#(B
$B-!!"-"$N;~$O%;%C%?!<$,8F$S=P$5$l!"$=$l$>$l%A%'%C%/BP>]$H$J$k9`L\$G(BtargetId$B$,(B
$B>e=q$+$l$k!#(B
Hotdeploy$B$G5/F0$7$?>l9g$O!"-#$N;~$K$b%;%C%?!<$,8F$S=P$5$l!"(BtargetId$B$,>e=q(B
$B$+$l$k!#(B
--- $B0J2<!"%=!<%9(B ------------------------------------------------------
$B!Z(Bvalidator$B![(B
public class DateComparisonValidator implements Validator,
ValidationTargetSelectable {
protected String target = null;
protected String[] targets;
protected String targetId = null;
protected boolean transientValue = false;
protected String messageId = null;
protected String relationMessageId = null;
protected DateComparisonType dateComparisonType;
/*
* ($BHs(B Javadoc)
*
* @see
javax.faces.validator.Validator#validate(javax.faces.context.FacesContext,
* javax.faces.component.UIComponent, java.lang.Object)
*/
public void validate(FacesContext context, UIComponent component,
Object value) throws FacesException {
$B!!!!(BUIComponent targetComponent = getTargetComponent(component);
$B!!!!(B--$B!!CfN,!!(B--
protected UIComponent getTargetComponent(UIComponent component) {
UIComponent targetComponent = component.findComponent(targetId);
if (targetComponent == null) {
$B!!(B throw new EmptyRuntimeException(targetId);
}
return targetComponent;
}
$B!!!!(B--$B!!CfN,!!(B--
public String getTargetId() {
return targetId;
}
public void setTargetId(String targetId) {
this.targetId = targetId;
}
$B!Z%"%N%F!<%7%g%s![(B
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.FIELD, ElementType.METHOD})
@Validator("dateComparisonValidator")
public @interface AaFutureDate {
DateComparisonType dateComparisonType() default
DateComparisonType.FUTURE;
String target() default "doAaa, doBbb, doCcc";
String messageId() default "aaaa";
String relationMessageId() default "bbbb";
String targetId() default "";
}
********************************************************************
$B>e5-$N$h$&$J8=>]$+$i?dB,=PMh$k860x$O$4$6$$$^$9$G$7$g$&$+!)(B
$BI,MW$J>pJs$,$4$6$$$^$7$?$i$4;XE&2<$5$$!#(B
$B0J>e!"59$7$/$*4j$$CW$7$^$9!#(B
Seasar-user メーリングリストの案内