KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > content > attributs > ValidAttributes


1 package de.webman.content.attributs;
2
3
4 import com.teamkonzept.field.db.TKContentAttributeTableData;
5 import com.teamkonzept.lib.TKHashtable;
6
7 import java.util.Vector JavaDoc;
8 import java.util.Date JavaDoc;
9
10
11 /**
12     behandelt 'Gültig von' und 'Gültig bis' Attribute
13     
14  * @author $Author: sebastian $
15  * @version $Revision: 1.2 $
16 */

17
18 public class ValidAttributes implements AttributeInterface
19 {
20     private Vector JavaDoc attributes;
21     
22     public ValidAttributes()
23     {
24         attributes = new Vector JavaDoc();
25     }
26     
27     public void putAttribute(Attribute attr)
28     {
29         attributes.add(attr);
30     }
31         
32     public boolean isGeneratable(TKHashtable options)
33     {
34         Date JavaDoc aktdate = new Date JavaDoc();
35         
36         for (int i = 0; i < attributes.size();i++)
37         {
38             Attribute attr = (Attribute) attributes.elementAt(i);
39             Date JavaDoc date = TKContentAttributeTableData.dateScanFormat.parse(attr.value, new java.text.ParsePosition JavaDoc(0));
40             
41             if (attr.name.equalsIgnoreCase("Gültig von"))
42             {
43                 
44                 if (aktdate.before(date))
45                     return false;
46             }
47             else
48             {
49                 
50                 if (aktdate.after(date))
51                     return false;
52             }
53         }
54         
55         return true;
56     }
57
58 }
Popular Tags