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