1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 package com.sun.star.wizards.web.data;
24 
25 import com.sun.star.util.DateTime;
26 import com.sun.star.wizards.common.*;
27 import org.w3c.dom.Node;
28 
29 public class CGGeneralInfo extends ConfigGroup implements XMLProvider
30 {
31 
32     public String cp_Title;
33     public String cp_Description;
34     public String cp_Author;
35     public int cp_CreationDate;
36     public int cp_UpdateDate;
37     public String cp_Email;
38     public String cp_Copyright;
39 
createDOM(Node parent)40     public Node createDOM(Node parent)
41     {
42         return XMLHelper.addElement(parent, "general-info",
43                 new String[]
44                 {
45                     "title", "author", "description", "creation-date", "update-date", "email", "copyright"
46                 },
47                 new String[]
48                 {
49                     cp_Title, cp_Author, cp_Description, String.valueOf(cp_CreationDate), String.valueOf(cp_UpdateDate), cp_Email, cp_Copyright
50                 });
51     }
52 
getCreationDate()53     public Integer getCreationDate()
54     {
55         if (cp_CreationDate == 0)
56         {
57             cp_CreationDate = currentDate();
58         }
59         return new Integer(cp_CreationDate);
60     }
61 
getUpdateDate()62     public Integer getUpdateDate()
63     {
64         if (cp_UpdateDate == 0)
65         {
66             cp_UpdateDate = currentDate();
67         }
68         return new Integer(cp_UpdateDate);
69     }
70 
setCreationDate(Integer i)71     public void setCreationDate(Integer i)
72     {
73         //System.out.println(i);
74         cp_CreationDate = i.intValue();
75     }
76 
setUpdateDate(Integer i)77     public void setUpdateDate(Integer i)
78     {
79         cp_UpdateDate = i.intValue();
80     }
81 
currentDate()82     private int currentDate()
83     {
84         DateTime dt = JavaTools.getDateTime(System.currentTimeMillis());
85         //System.out.println();
86         return dt.Day + dt.Month * 100 + dt.Year * 10000;
87     }
88 }
89