Handle the new "wpEditToken" input parameter for upload
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.wiki / src / net / sourceforge / phpeclipse / wiki / actions / mediawiki / connect / Parsed.java
1 package net.sourceforge.phpeclipse.wiki.actions.mediawiki.connect;
2
3 import java.io.InputStream;
4
5 //Parts of this sources are copied and modified from the jEdit Wikipedia plugin:
6 //http://www.djini.de/software/wikipedia/index.html
7 //
8 //The modified sources are available under the "Common Public License"
9 //with permission from the original author: Daniel Wunsch
10
11 public class Parsed {
12   /**
13    * 6lt;page6gt; XML data from Wikipedia Special:Export pages may be <code>null</code>
14    *  
15    */
16   /* package private */String xmlData = null;
17
18   /**
19    * timeStamp represented in XML format from Wikipedia Special:Export pages
20    */
21   /* package private */String timestamp = null;
22
23   /* package private */String editToken = null;
24
25   /* package private */String title = null;
26
27   /* package private */String body = null;
28
29   /* package private */Parsed() {
30   }
31
32   public Parsed(String timeStamp, String title, String body, String editToken) {
33     this.xmlData = "";
34     this.timestamp = timeStamp;
35     this.title = title;
36     this.body = body;
37     this.editToken = editToken;
38   }
39
40   /*
41    * (non-Javadoc)
42    * 
43    * @see java.lang.Object#toString()
44    */
45   public String toString() {
46     StringBuffer buffer = new StringBuffer();
47     buffer.append("==>Title:\n");
48     if (title != null) {
49       buffer.append(title);
50     }
51     buffer.append("==>Timestamp:\n");
52     if (timestamp != null) {
53       buffer.append(timestamp);
54     }
55     buffer.append("==>Body:\n");
56     if (body != null) {
57       buffer.append(body);
58     }
59     return buffer.toString();
60   }
61
62   /**
63    * @return Returns the body.
64    */
65   public String getBody() {
66     return body;
67   }
68
69   /**
70    * @return Returns the timestamp.
71    */
72   public String getTimestamp() {
73     return timestamp;
74   }
75
76   public String getDateTimestamp() {
77     if (timestamp != null) {
78       StringBuffer buffer = new StringBuffer();
79       // 2004-11-22T12:41:10Z
80       buffer.append(timestamp.substring(0, 4)); //year
81       buffer.append(timestamp.substring(5, 7)); //month
82       buffer.append(timestamp.substring(8, 10)); //day
83       buffer.append(timestamp.substring(11, 13));//hour
84       buffer.append(timestamp.substring(14, 16));//minute
85       buffer.append(timestamp.substring(17, 19));//second
86       return buffer.toString();
87     }
88     return "";
89   }
90
91   /**
92    * @return Returns the title.
93    */
94   public String getTitle() {
95     return title;
96   }
97
98   /**
99    * @return Returns the xmlData.
100    */
101   public String getXmlData() {
102     return xmlData;
103   }
104   /**
105    * @return Returns the editToken.
106    */
107   public String getEditToken() {
108     return editToken;
109   }
110 }