Author: knguyen
Date: Tue Aug 21 14:20:58 2007
New Revision: 18217
URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D18217&repname=
=3Djahia
Log:
VOD-45: allow publication of content between i.e. 22:00 and 4:00 for Daily =
and X Days in week rules.
Modified:
branches/JAHIA-VODAFONE-5-0-2-SP BRANCH/core/src/java/org/jahia/engines=
/timebasedpublishing/TimeBasedPublishingEngine.java
branches/JAHIA-VODAFONE-5-0-2-SP BRANCH/core/src/java/org/jahia/service=
s/timebasedpublishing/BaseRetentionRule.java
branches/JAHIA-VODAFONE-5-0-2-SP BRANCH/core/src/java/org/jahia/service=
s/timebasedpublishing/DayInWeekBean.java
branches/JAHIA-VODAFONE-5-0-2-SP BRANCH/core/src/java/org/jahia/service=
s/timebasedpublishing/RangeRetentionRule.java
Modified: branches/JAHIA-VODAFONE-5-0-2-SP BRANCH/core/src/java/org/jahia/e=
ngines/timebasedpublishing/TimeBasedPublishingEngine.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-VODAFO=
NE-5-0-2-SP%20BRANCH/core/src/java/org/jahia/engines/timebasedpublishing/Ti=
meBasedPublishingEngine.java&rev=3D18217&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-VODAFONE-5-0-2-SP BRANCH/core/src/java/org/jahia/engines=
/timebasedpublishing/TimeBasedPublishingEngine.java (original)
+++ branches/JAHIA-VODAFONE-5-0-2-SP BRANCH/core/src/java/org/jahia/engines=
/timebasedpublishing/TimeBasedPublishingEngine.java Tue Aug 21 14:20:58 2007
@@ -304,9 +304,15 @@
cal.set(Calendar.HOUR_OF_DAY,rule.getDailyFromHours());
cal.set(Calendar.MINUTE,rule.getDailyFromMinutes());
rule.setValidFromDate(new Long(cal.getTimeInMillis()+timeOffSe=
t));
-
cal.set(Calendar.HOUR_OF_DAY,rule.getDailyToHours());
cal.set(Calendar.MINUTE,rule.getDailyToMinutes());
+ if ( rule.getDailyFromHours() =3D=3D rule.getDailyToHours() ){
+ if ( rule.getDailyToMinutes()<rule.getDailyFromMinutes() ){
+ cal.setTimeInMillis(cal.getTimeInMillis()+86400000);
+ }
+ } else if ( rule.getDailyFromHours() > rule.getDailyToHours() =
){
+ cal.setTimeInMillis(cal.getTimeInMillis()+86400000);
+ }
rule.setValidToDate(new Long(cal.getTimeInMillis()+timeOffSet)=
);
} else if ( RetentionRule.RULE_XDAYINWEEK.equals(rule.getRuleType(=
)) ){
DayInWeekBean.computeRuleNextEventDate(rule,cal.getTimeInMilli=
s(),cal,timeOffSet,false); =
Modified: branches/JAHIA-VODAFONE-5-0-2-SP BRANCH/core/src/java/org/jahia/s=
ervices/timebasedpublishing/BaseRetentionRule.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-VODAFO=
NE-5-0-2-SP%20BRANCH/core/src/java/org/jahia/services/timebasedpublishing/B=
aseRetentionRule.java&rev=3D18217&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-VODAFONE-5-0-2-SP BRANCH/core/src/java/org/jahia/service=
s/timebasedpublishing/BaseRetentionRule.java (original)
+++ branches/JAHIA-VODAFONE-5-0-2-SP BRANCH/core/src/java/org/jahia/service=
s/timebasedpublishing/BaseRetentionRule.java Tue Aug 21 14:20:58 2007
@@ -278,10 +278,9 @@
* @return
*/
public List validate(Object source) {
+ return new ArrayList();
+ /*
List errors =3D new ArrayList();
- if (this.getDailyFromHours()*60+this.getDailyFromMinutes()>this.ge=
tDailyToHours()*60+this.getDailyToMinutes()){
- errors.add(new ValidationError(source,"FromHourMustBeBiggerTha=
nToHour"));
- }
Iterator it =3D this.getDaysInWeek().iterator();
DayInWeekBean dayBean =3D null;
while (it.hasNext()){
@@ -290,7 +289,7 @@
errors.add(new ValidationError(source,"FromHourMustBeBigge=
rThanToHour_"+dayBean.getDay()));
}
}
- return errors;
+ return errors;*/
}
=
protected abstract JahiaRetentionRule getJahiaRetentionRuleFromSubClas=
s() throws JahiaException;
Modified: branches/JAHIA-VODAFONE-5-0-2-SP BRANCH/core/src/java/org/jahia/s=
ervices/timebasedpublishing/DayInWeekBean.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-VODAFO=
NE-5-0-2-SP%20BRANCH/core/src/java/org/jahia/services/timebasedpublishing/D=
ayInWeekBean.java&rev=3D18217&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-VODAFONE-5-0-2-SP BRANCH/core/src/java/org/jahia/service=
s/timebasedpublishing/DayInWeekBean.java (original)
+++ branches/JAHIA-VODAFONE-5-0-2-SP BRANCH/core/src/java/org/jahia/service=
s/timebasedpublishing/DayInWeekBean.java Tue Aug 21 14:20:58 2007
@@ -186,7 +186,6 @@
DayInWeekBean dayBean =3D null;
long nextPublishTime =3D 0;
long nextExpireTime =3D 0;
- int todayDay =3D cal.get(Calendar.DAY_OF_WEEK);
Iterator it =3D newRule.getDaysInWeek().iterator();
List nextPublishDates =3D new ArrayList();
List nextExpireDates =3D new ArrayList();
@@ -260,6 +259,13 @@
}
cal.set(Calendar.HOUR_OF_DAY,dayBean.getToHours());
cal.set(Calendar.MINUTE,dayBean.getToMinutes());
+ if ( dayBean.getFromHours() =3D=3D dayBean.getToHours() ){
+ if ( dayBean.getToMinutes()<dayBean.getFromMinutes() ){
+ cal.setTimeInMillis(cal.getTimeInMillis()+86400000);
+ }
+ } else if ( dayBean.getFromHours() > dayBean.getToHours() ){
+ cal.setTimeInMillis(cal.getTimeInMillis()+86400000);
+ }
cal.setTimeInMillis(cal.getTimeInMillis()+timeOffSet);
nextExpireDates.add(cal.getTime());
}
Modified: branches/JAHIA-VODAFONE-5-0-2-SP BRANCH/core/src/java/org/jahia/s=
ervices/timebasedpublishing/RangeRetentionRule.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-VODAFO=
NE-5-0-2-SP%20BRANCH/core/src/java/org/jahia/services/timebasedpublishing/R=
angeRetentionRule.java&rev=3D18217&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-VODAFONE-5-0-2-SP BRANCH/core/src/java/org/jahia/service=
s/timebasedpublishing/RangeRetentionRule.java (original)
+++ branches/JAHIA-VODAFONE-5-0-2-SP BRANCH/core/src/java/org/jahia/service=
s/timebasedpublishing/RangeRetentionRule.java Tue Aug 21 14:20:58 2007
@@ -266,11 +266,19 @@
cal.set(Calendar.MILLISECOND,0);
cal.set(Calendar.HOUR_OF_DAY,getDailyFromHours());
cal.set(Calendar.MINUTE,getDailyFromMinutes());
- setValidFromDate(new Long(cal.getTimeInMillis()+offSet+1000*60=
*60*24));
-
+ long timeShift =3D 0;
+ boolean fromHourSmallerThanToHour =3D
+ (getDailyFromHours() < getDailyToHours()
+ || (getDailyFromHours() =3D=3D getDailyToHours()
+ && getDailyFromMinutes()<getDailyToMinutes()) ) ;
+ if (fromHourSmallerThanToHour){
+ timeShift =3D 86400000;
+ }
+ setValidFromDate(new Long(cal.getTimeInMillis()+offSet+timeShi=
ft));
cal.set(Calendar.HOUR_OF_DAY,getDailyToHours());
cal.set(Calendar.MINUTE,getDailyToMinutes());
- setValidToDate(new Long(cal.getTimeInMillis()+offSet+1000*60*6=
0*24));
+ timeShift =3D 86400000;
+ setValidToDate(new Long(cal.getTimeInMillis()+offSet+timeShift=
));
} else if ( RetentionRule.RULE_XDAYINWEEK.equals(getRuleType()) ){
DayInWeekBean.computeRuleNextEventDate(this,cal.getTimeInMilli=
s(),cal,offSet,true);
}
_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list