本文整理汇总了Java中org.apache.commons.validator.routines.DateValidator类的典型用法代码示例。如果您正苦于以下问题:Java DateValidator类的具体用法?Java DateValidator怎么用?Java DateValidator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DateValidator类属于org.apache.commons.validator.routines包,在下文中一共展示了DateValidator类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: computeMvelExpressionForDateAnswerQuestion
import org.apache.commons.validator.routines.DateValidator; //导入依赖的package包/类
private String computeMvelExpressionForDateAnswerQuestion(QuestionAnswer questionAnswer , LogicalCondition condition, String groupingOperator,String dateFormat){
StringBuilder stringBuilder = new StringBuilder();
if (condition.getDateMin() != null && condition.getDateMax() != null) {
stringBuilder.append("(");
stringBuilder.append("page.questionAnswers[" + (questionAnswer.getOrder() - 1) +"].dateAnswerValue >=" + "org.apache.commons.validator.routines.DateValidator.getInstance().validate('" + DateValidator.getInstance().format(condition.getDateMin(), dateFormat) +"','" + dateFormat + "')");
stringBuilder.append(" && ");
stringBuilder.append("page.questionAnswers[" + (questionAnswer.getOrder() - 1) +"].dateAnswerValue <=" + "org.apache.commons.validator.routines.DateValidator.getInstance().validate('" + DateValidator.getInstance().format(condition.getDateMax(), dateFormat) +"','" + dateFormat + "')");
stringBuilder.append(")");
stringBuilder.append(groupingOperator);
return stringBuilder.toString();
}
if (condition.getDateMin() != null) {
stringBuilder.append("(");
stringBuilder.append("page.questionAnswers[" + (questionAnswer.getOrder() - 1) +"].dateAnswerValue >=" + "org.apache.commons.validator.routines.DateValidator.getInstance().validate('" + DateValidator.getInstance().format(condition.getDateMin(), dateFormat) +"','" + dateFormat + "')");
stringBuilder.append(")");
stringBuilder.append(groupingOperator);
return stringBuilder.toString();
}
if (condition.getDateMax() != null) {
stringBuilder.append("(");
stringBuilder.append("page.questionAnswers[" + (questionAnswer.getOrder() - 1) +"].dateAnswerValue <=" + "org.apache.commons.validator.routines.DateValidator.getInstance().validate('" + DateValidator.getInstance().format(condition.getDateMax(), dateFormat) +"','" + dateFormat + "')");
stringBuilder.append(")");
stringBuilder.append(groupingOperator);
return stringBuilder.toString();
}
return "";
}
开发者ID:JD-Software,项目名称:JDeSurvey,代码行数:31,代码来源:SurveyPage.java
示例2: writeEntry
import org.apache.commons.validator.routines.DateValidator; //导入依赖的package包/类
private void writeEntry(Document document,String label , Date value, String dateFormat) throws Exception{
Paragraph questionParagraph = new Paragraph();
questionParagraph.setLeading(14, 0);
questionParagraph.setIndentationLeft(18);
questionParagraph.add(new Chunk(label.trim() + ": ",boldedFont));
questionParagraph.add(new Chunk(DateValidator.getInstance().format(value ,dateFormat) , normalFont));
document.add(questionParagraph);
}
开发者ID:JD-Software,项目名称:JDeSurvey,代码行数:9,代码来源:StatisticsPdf.java
示例3: isDate
import org.apache.commons.validator.routines.DateValidator; //导入依赖的package包/类
/**
* @param value Cell content
* @return True if input is a date
*/
private boolean isDate(String value) {
DateValidator validator = DateValidator.getInstance();
for (String format : DataType.DATE.getDescription().getExampleFormats()) {
if (validator.isValid(value, format)) {
return true;
}
}
return false;
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:14,代码来源:HIPAAMatcherAttributeValue.java
示例4: DateRule
import org.apache.commons.validator.routines.DateValidator; //导入依赖的package包/类
public DateRule(TextView view, String value, String errorMessage) {
super(view, value, errorMessage);
dateValidator = new DateValidator();
}
开发者ID:Ilhasoft,项目名称:data-binding-validator,代码行数:5,代码来源:DateRule.java
示例5: forgotPasswordPost
import org.apache.commons.validator.routines.DateValidator; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@RequestMapping(method = RequestMethod.POST, value = "/", params = "fpass", produces = "text/html")
public String forgotPasswordPost(@RequestParam(value = "login", required = true) String login,
@RequestParam(value = "dob", required = true) String dob,
@RequestParam(value = "_proceed", required = false) String proceed,
Model uiModel,HttpServletRequest httpServletRequest) {
try {
if(proceed != null){
String resetPasswordLink;
String dateFormat = messageSource.getMessage(DATE_FORMAT, null, LocaleContextHolder.getLocale());
//Validate date and login entries (sanitize)
if (login == null || login.isEmpty() || login.length() > 100 ||
dob == null || dob.isEmpty() ||
!GenericValidator.isDate(dob,dateFormat, true)) {
uiModel.addAttribute("status", "I");
return "public/fpass";
}
//Check if provided DOB and login match
if (!userService.user_validateDateofBirthAndLogin(login,DateValidator.getInstance().validate(dob))) {
uiModel.addAttribute("status", "I");
return "public/fpass";
}
User user = userService.user_findByLogin(login);
if (httpServletRequest.getRequestURI().contains("external")) {
//resetPasswordLink =messageSource.getMessage(EXTERNAL_SITE_BASE_URL, null, LocaleContextHolder.getLocale());
resetPasswordLink = externalBaseUrl;
}
else {
//resetPasswordLink =messageSource.getMessage(INTERNAL_SITE_BASE_URL, null, LocaleContextHolder.getLocale());
resetPasswordLink = internalBaseUrl;
}
if (resetPasswordLink.endsWith("/")) {resetPasswordLink = resetPasswordLink +"public/rpass?key=";} else {resetPasswordLink = resetPasswordLink +"/public/rpass?key=";}
StringWriter sw = new StringWriter();
Map model = new HashMap();
model.put(messageSource.getMessage(RESET_PASSWORD_LINK_PARAMETER_NAME, null, LocaleContextHolder.getLocale()).replace("${", "").replace("}", ""),
"<a href='"+ resetPasswordLink + userService.user_prepareForgotPasswordMessage(user.getId())+ "'>" +
messageSource.getMessage(RESET_PASSWORD_LINK_LABEL, null, LocaleContextHolder.getLocale()) +"</a>");
VelocityContext velocityContext = new VelocityContext(model);
Velocity.evaluate(velocityContext, sw, "velocity-log" ,
surveySettingsService.velocityTemplate_findById(FORGOT_PASSWORD_VELOCITY_EMAIL_TEMPLATE_ID).getDefinition());
mailService.sendEmail(user.getEmail(),
messageSource.getMessage(FORGOT_PASSWORD_EMAIL_TITLE, null, LocaleContextHolder.getLocale()),
sw.toString());
uiModel.addAttribute("status", "S");
return "public/fpass";
}
else { //cancel button
return "public/login";
}
} catch (Exception e) {
log.error(e.getMessage(),e);
throw (new RuntimeException(e));
}
}
开发者ID:JD-Software,项目名称:JDeSurvey,代码行数:62,代码来源:LoginController.java
示例6: getDate
import org.apache.commons.validator.routines.DateValidator; //导入依赖的package包/类
public Date getDate(String date) {
Locale locale = SystemConfiguration.getInstance().getDateLocale();
return DateValidator.getInstance().validate(date, locale);
}
开发者ID:openelisglobal,项目名称:openelisglobal-sandbox,代码行数:5,代码来源:DateValidationProvider.java
示例7: dateIsValid
import org.apache.commons.validator.routines.DateValidator; //导入依赖的package包/类
/**
* Validates whether a date string is valid for the given Locale.
*
* @param date the date string.
* @param locale the Locale
* @return true if the date string is valid, false otherwise.
*/
public static boolean dateIsValid( String date, Locale locale )
{
return DateValidator.getInstance().isValid( date, locale );
}
开发者ID:dhis2,项目名称:dhis2-core,代码行数:12,代码来源:ValidationUtils.java
示例8: isDate
import org.apache.commons.validator.routines.DateValidator; //导入依赖的package包/类
/**
* <p>Checks if the field is a valid date. The <code>Locale</code> is
* used with <code>java.text.DateFormat</code>. The setLenient method
* is set to <code>false</code> for all.</p>
*
* @param value The value validation is being performed on.
* @param locale The locale to use for the date format, defaults to the
* system default if null.
* @return true if the value can be converted to a Date.
*/
@GwtIncompatible("incompatible method")
public static boolean isDate(String value, Locale locale) {
return DateValidator.getInstance().isValid(value, locale);
}
开发者ID:ManfredTremmel,项目名称:gwt-commons-validator,代码行数:15,代码来源:GenericValidator.java
注:本文中的org.apache.commons.validator.routines.DateValidator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论