Search in sources :

Example 1 with DateOnlyFieldMetaData

use of org.jaffa.metadata.DateOnlyFieldMetaData in project jaffa-framework by jaffa-projects.

the class DateOnlyFieldValidator method validate.

/**
 * The RulesEngine will invoke this method to perform the field validation.
 * @throws ValidationException if any validation rule fails.
 * @throws FrameworkException if any framework error occurs.
 */
public void validate() throws ValidationException, FrameworkException {
    Object value = getValue();
    if (value != null) {
        DateOnlyFieldMetaData meta = new DateOnlyFieldMetaData(null, getLabelToken(), null, getLayout(), getMinValue(), getMaxValue());
        if (value instanceof DateOnly)
            FieldValidator.validate((DateOnly) value, meta, false);
        else if (value instanceof Date)
            FieldValidator.validate(new DateOnly((Date) value), meta, false);
        else
            FieldValidator.validateData(value.toString(), meta);
    }
}
Also used : DateOnlyFieldMetaData(org.jaffa.metadata.DateOnlyFieldMetaData) DateOnly(org.jaffa.datatypes.DateOnly) Date(java.util.Date)

Example 2 with DateOnlyFieldMetaData

use of org.jaffa.metadata.DateOnlyFieldMetaData in project jaffa-framework by jaffa-projects.

the class EditBoxForm method getDataTypeDateOnlyWM.

public WidgetModel getDataTypeDateOnlyWM() {
    if (w_dataTypeDateOnly == null) {
        w_dataTypeDateOnly = new EditBoxModel(new DateOnlyFieldMetaData());
        w_dataTypeDateOnly.setValue(getDataTypeDateOnly());
    }
    return w_dataTypeDateOnly;
}
Also used : DateOnlyFieldMetaData(org.jaffa.metadata.DateOnlyFieldMetaData) EditBoxModel(org.jaffa.presentation.portlet.widgets.model.EditBoxModel)

Aggregations

DateOnlyFieldMetaData (org.jaffa.metadata.DateOnlyFieldMetaData)2 Date (java.util.Date)1 DateOnly (org.jaffa.datatypes.DateOnly)1 EditBoxModel (org.jaffa.presentation.portlet.widgets.model.EditBoxModel)1