1 23 package org.mdarad.framework.util.struts.criteria; 24 25 import java.sql.Date ; 26 import java.util.Locale ; 27 28 import org.apache.commons.beanutils.ConvertUtils; 29 import org.dataisland.primitives.format.DataIslandFormat; 30 import org.dataisland.primitives.format.DateDataIslandFormat; 31 32 38 public class DateCriterion extends NumericCriterion { 39 40 51 public DateCriterion(String name, Class associatedEntity, CriterionProperty property, String bundleName, Locale locale) { 52 super(name, associatedEntity, property, bundleName, locale); 53 } 54 55 63 public DateCriterion(DateCriterion criterion) { 64 super(criterion); 65 } 66 67 68 74 public void setPropertyValue(String value) { 75 if (value != null && value.trim().length() > 0) { 76 Date dateValue = (Date ) ConvertUtils.convert(value, Date .class); 77 setValue(dateValue); 78 } 79 } 80 81 86 public String getPropertyValue() { 87 if (getValue() != null) { 88 return DateDataIslandFormat.format(getValue(), Locale.getDefault()); 89 } 90 91 return ""; 92 } 93 94 100 public Class getObjectType() { 101 return Date .class; 102 } 103 } | Popular Tags |