01: package de.webman.content.attributs;
02:
03: import com.teamkonzept.field.db.TKContentAttributeTableData;
04: import com.teamkonzept.lib.TKHashtable;
05:
06: import java.util.Vector;
07: import java.util.Date;
08:
09: /**
10: behandelt 'Gültig von' und 'Gültig bis' Attribute
11:
12: * @author $Author: sebastian $
13: * @version $Revision: 1.2 $
14: */
15:
16: public class ValidAttributes implements AttributeInterface {
17: private Vector attributes;
18:
19: public ValidAttributes() {
20: attributes = new Vector();
21: }
22:
23: public void putAttribute(Attribute attr) {
24: attributes.add(attr);
25: }
26:
27: public boolean isGeneratable(TKHashtable options) {
28: Date aktdate = new Date();
29:
30: for (int i = 0; i < attributes.size(); i++) {
31: Attribute attr = (Attribute) attributes.elementAt(i);
32: Date date = TKContentAttributeTableData.dateScanFormat
33: .parse(attr.value, new java.text.ParsePosition(0));
34:
35: if (attr.name.equalsIgnoreCase("Gültig von")) {
36:
37: if (aktdate.before(date))
38: return false;
39: } else {
40:
41: if (aktdate.after(date))
42: return false;
43: }
44: }
45:
46: return true;
47: }
48:
49: }
|