ITeye博客

ofbiz TemporalExpression 表达式

zc-111 · 2012-04-27 14:26 · Ofbiz · 开源软件 · Markdown

项目中遇到,这个表达式,不知道怎么写,后来Debug进去兜了一圈,转换日期呀序列呀对象啊什么的。今天说下这个表达式一些规则。

<!-- The TemporalExpression field meanings depend upon what type of expression it is. The integer
    values are typically obtained from the java.util.Calendar field constants. For more
    information, see the org.ofbiz.service.calendar.TemporalExpressions.java file.

    tempExprTypeId        integer1       integer2        date1  date2  string1    string2
    ====================  ============== =============== ====== ====== ========== ========
    HOUR_RANGE            start      end
    DATE_RANGE                                           start  end
    TIME_OF_DAY_RANGE interval    count                      start   end 
    DAY_OF_WEEK_RANGE     start       end 
    MINUTE_RANGE          start      end 
    MONTH_RANGE           start       end 
    DAY_OF_MONTH_RANGE    start       end 
    DAY_IN_MONTH          day         occurrence 
    FREQUENCY             freq type   freq count   start

     hh:mm:ss
     Day of week: 1 = Sunday, 7 = Saturday
     Month: January = 0, Undecimber = 12
     Day of month: 1 to 31
     Integer: -5 to +5, zero excluded
     Second = 13, Minute = 12, Hour = 11, Day = 5, Month = 2, Year = 1
     Positive integer, zero excluded
     If null, defaults to system date when the expression was retrieved from storage.
     Second = 13, Minute = 12, Hour = 11 (default)
     Deprecated - do not use
     Integer: 0 to 23, midnight = 0
     Integer: 0 to 59
-->

Integer1对应规则的类型,Integer2对应Integer1(规则类型)的倍数 示例:现在来定义一个14天后的表达式 integer1="5" 可以看出规则类型是Day,integer2="14",所以说是14天。

如果要表达一段时间,比如几点-几点,这样的话,上面的表达式就不能满足。 下面是一个星期一到星期五:

这个东西跟ofbiz Job紧密结合。。。很灵活。。。最近在用这个东西做项目,所以先研究下。后续补上job配置及其东西分享给大家。 关于TemporalExpression的一些例子和介绍 https://cwiki.apache.org/OFBENDUSER/temporal-expressions.html 转载注明出处 Charles,http://juck.iteye.com/

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。