KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > storage > search > FieldValueDateConstraint


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.storage.search;
11
12 import java.util.Calendar JavaDoc;
13
14 /**
15  * @javadoc
16  * @author Michiel Meeuwissen
17  * @version $Id: FieldValueDateConstraint.java,v 1.5 2005/08/16 14:05:38 pierre Exp $
18  * @since MMBase-1.8
19  */

20 public interface FieldValueDateConstraint extends FieldValueConstraint {
21
22     // Try to match the part constants available in most datetime constraints to the Calendar constants.
23
// This does not work everywhere, as some values are not supported by Calendar, and vice versa.
24

25     /** Date part: 'century' */
26     static final int CENTURY = 0; // note: does not exist in Calendar
27
// (0 is Calendar.ERA)
28
/** Date part: 'year' */
29     static final int YEAR = Calendar.YEAR; // 1
30
/** Date part: 'month' */
31     static final int MONTH = Calendar.MONTH; // 2
32
/** Date part: 'week' */
33     static final int WEEK = Calendar.WEEK_OF_YEAR; // 3
34
/** Date part: 'quarter' */
35     static final int QUARTER = 4; // note: does not exist in Calendar
36
// (4 is Calendar.WEEK_OF_MONTH)
37
/** Date part: 'day of month' */
38     static final int DAY_OF_MONTH = Calendar.DAY_OF_MONTH; // 5
39
/** Date part: 'day of year' */
40     static final int DAY_OF_YEAR = Calendar.DAY_OF_YEAR; // 6
41
/** Date part: 'day of week' */
42     static final int DAY_OF_WEEK = Calendar.DAY_OF_WEEK; // 7
43

44     // 8 (Calendar.DAY_OF_WEEK_IN_MONTH) and 9 (Calendar.AM_PM) are not used
45

46     /** Time part: 'hour' */
47     static final int HOUR = Calendar.HOUR; // 10
48

49     // 11 (Calendar.HOUR_OF_DAY) is not used
50

51     /** Time part: 'minute' */
52     static final int MINUTE = Calendar.MINUTE; // 12
53
/** Time part: 'second' */
54     static final int SECOND = Calendar.SECOND; // 13
55
/** Time part: 'millisecond' */
56     static final int MILLISECOND = Calendar.MILLISECOND; // 14
57

58     /**
59      * Part descriptions corresponding to the date and time part values:
60      * {@link #CENTURY}, {@link #YEAR}, {@link #MONTH}, {@link #QUARTER},
61      * {@link #WEEK}, {@link #DAY_OF_YEAR}, {@link #DAY_OF_MONTH}, {@link #DAY_OF_WEEK},
62      * {@link #HOUR}, {@link #MINUTE}, {@link #SECOND} and {@link #MILLISECOND}
63      */

64     public final static String JavaDoc[] PART_DESCRIPTIONS = new String JavaDoc[] {
65          "century", "year", "month", "week",
66          "quarter",
67          "day of month", "day of year", "day of week",
68          "","",
69          "hour",
70          "",
71          "minute", "second", "millisecond"
72     };
73
74     /**
75      * Returns the part of the date-field wich is to be compared.
76      */

77     int getPart();
78
79 }
80
Popular Tags