KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > gui > query > DateSearchQueryParameter


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 1993-2006 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.cms.gui.query;
14
15 import java.text.SimpleDateFormat JavaDoc;
16 import java.util.Date JavaDoc;
17
18 import org.apache.log4j.Logger;
19
20
21 /**
22  * @author Sameer Charles $Id: DateSearchQueryParameter.java 6341 2006-09-12 09:18:27Z philipp $
23  */

24 public class DateSearchQueryParameter extends SearchQueryParameter {
25
26     /**
27      * Logger
28      */

29     private static Logger log = Logger.getLogger(DateSearchQueryParameter.class);
30
31     /**
32      * sql constraint "TODAY"
33      */

34     public static final String JavaDoc TODAY = "today";
35
36     /**
37      * sql constraint "AFTER"
38      */

39     public static final String JavaDoc AFTER = "after";
40
41     /**
42      * sql constraint "BEFORE"
43      */

44     public static final String JavaDoc BEFORE = "before";
45
46     /**
47      * sql constraint "IS"
48      */

49     public static final String JavaDoc IS = "is";
50
51     /**
52      * default date format
53      */

54     private SimpleDateFormat JavaDoc format = new SimpleDateFormat JavaDoc("yyyy-MM-dd");
55
56     /**
57      * @param name of this parameter
58      * @param value
59      * @param constraint check SearchQueryParameter constants
60      */

61     public DateSearchQueryParameter(String JavaDoc name, Date JavaDoc value, String JavaDoc constraint) {
62         super(name, value, constraint);
63     }
64
65     /**
66      * get value
67      * @return Date
68      */

69     public Date JavaDoc getValue() {
70         return (Date JavaDoc) this.value;
71     }
72
73     /**
74      * set value
75      * @param value Date
76      */

77     public void setValue(Date JavaDoc value) {
78         this.value = value;
79     }
80
81     /**
82      * set date format
83      * @param format
84      */

85     public void setDateFormat(SimpleDateFormat JavaDoc format) {
86         this.format = format;
87     }
88
89     /**
90      * get date format
91      * @return date format, either the one which has been set or default "yyyy-MM-dd"
92      */

93     public SimpleDateFormat JavaDoc getDateFormat() {
94         return this.format;
95     }
96 }
97
Popular Tags