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
index d6f282c..153572e 100644 (file)
@@ -1,4 +1,7 @@
 package net.sourceforge.phpeclipse.wiki.actions.mediawiki.connect;
+
+import java.io.InputStream;
+
 //Parts of this sources are copied and modified from the jEdit Wikipedia plugin:
 //http://www.djini.de/software/wikipedia/index.html
 //
@@ -6,15 +9,102 @@ package net.sourceforge.phpeclipse.wiki.actions.mediawiki.connect;
 //with permission from the original author: Daniel Wunsch
 
 public class Parsed {
-  String timestamp;
+  /**
+   * 6lt;page6gt; XML data from Wikipedia Special:Export pages may be <code>null</code>
+   *  
+   */
+  /* package private */String xmlData = null;
+
+  /**
+   * timeStamp represented in XML format from Wikipedia Special:Export pages
+   */
+  /* package private */String timestamp = null;
+
+  /* package private */String editToken = null;
+
+  /* package private */String title = null;
 
-  String title;
+  /* package private */String body = null;
 
-  String body;
+  /* package private */Parsed() {
+  }
 
-  public Parsed(String timeStamp, String title, String body) {
+  public Parsed(String timeStamp, String title, String body, String editToken) {
+    this.xmlData = "";
     this.timestamp = timeStamp;
     this.title = title;
     this.body = body;
+    this.editToken = editToken;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see java.lang.Object#toString()
+   */
+  public String toString() {
+    StringBuffer buffer = new StringBuffer();
+    buffer.append("==>Title:\n");
+    if (title != null) {
+      buffer.append(title);
+    }
+    buffer.append("==>Timestamp:\n");
+    if (timestamp != null) {
+      buffer.append(timestamp);
+    }
+    buffer.append("==>Body:\n");
+    if (body != null) {
+      buffer.append(body);
+    }
+    return buffer.toString();
+  }
+
+  /**
+   * @return Returns the body.
+   */
+  public String getBody() {
+    return body;
+  }
+
+  /**
+   * @return Returns the timestamp.
+   */
+  public String getTimestamp() {
+    return timestamp;
+  }
+
+  public String getDateTimestamp() {
+    if (timestamp != null) {
+      StringBuffer buffer = new StringBuffer();
+      // 2004-11-22T12:41:10Z
+      buffer.append(timestamp.substring(0, 4)); //year
+      buffer.append(timestamp.substring(5, 7)); //month
+      buffer.append(timestamp.substring(8, 10)); //day
+      buffer.append(timestamp.substring(11, 13));//hour
+      buffer.append(timestamp.substring(14, 16));//minute
+      buffer.append(timestamp.substring(17, 19));//second
+      return buffer.toString();
+    }
+    return "";
+  }
+
+  /**
+   * @return Returns the title.
+   */
+  public String getTitle() {
+    return title;
+  }
+
+  /**
+   * @return Returns the xmlData.
+   */
+  public String getXmlData() {
+    return xmlData;
+  }
+  /**
+   * @return Returns the editToken.
+   */
+  public String getEditToken() {
+    return editToken;
   }
 }
\ No newline at end of file