[jboss-svn-commits] JBL Code SVN: r21364 - labs/jbosslabs/trunk/portal-extensions/jbosswiki/wiki-common/src/java-migration/org/jboss/labs/clearspace.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Aug 5 10:44:32 EDT 2008
Author: szimano
Date: 2008-08-05 10:44:32 -0400 (Tue, 05 Aug 2008)
New Revision: 21364
Modified:
labs/jbosslabs/trunk/portal-extensions/jbosswiki/wiki-common/src/java-migration/org/jboss/labs/clearspace/CSMigration.java
Log:
migration fix
Modified: labs/jbosslabs/trunk/portal-extensions/jbosswiki/wiki-common/src/java-migration/org/jboss/labs/clearspace/CSMigration.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jbosswiki/wiki-common/src/java-migration/org/jboss/labs/clearspace/CSMigration.java 2008-08-05 11:14:25 UTC (rev 21363)
+++ labs/jbosslabs/trunk/portal-extensions/jbosswiki/wiki-common/src/java-migration/org/jboss/labs/clearspace/CSMigration.java 2008-08-05 14:44:32 UTC (rev 21364)
@@ -27,6 +27,7 @@
import org.jboss.wiki.WikiEngine;
import org.jboss.wiki.WikiPage;
import org.jboss.wiki.configuration.ConfigurationParser;
+import org.pdfbox.examples.fdf.PrintFields;
import org.w3c.dom.Text;
import com.jivesoftware.base.UnauthorizedException;
@@ -170,14 +171,16 @@
System.out.println("Added page: " + pageName + " as "
+ wsd.getDocumentID());
} catch (DocumentAlreadyExistsException e) {
- log.write("Couldnt add page: " + pageName + " - DocumentAlreadyExistsException\n");
+ log.write("Couldnt add page: " + pageName
+ + " - DocumentAlreadyExistsException\n");
e.printStackTrace();
} catch (SOAPFaultException e) {
e.printStackTrace();
System.out.println("Error while processing page: " + pageName);
} catch (DuplicateIDException e) {
- log.write("Couldnt add page : " + pageName + " - duplicate id\n");
+ log.write("Couldnt add page : " + pageName
+ + " - duplicate id\n");
e.printStackTrace();
} catch (RejectedException e) {
log.write("Couldnt add page: " + pageName + " - Rejected\n");
@@ -225,6 +228,22 @@
original.setMinorEdit(true);
original.save();
+ long creation = wa.getDate().getTime();
+ User user = getUser(wa.getUser());
+
+ String sql = "UPDATE jiveDocVersion j SET modificationDate='"
+ + creation
+ + "', userID='"
+ + user.getID()
+ + "' WHERE j.internalDocID='"
+ + original.getID()
+ + "' and j.versionID='"
+ + (original.getVersionManager()
+ .getDocumentVersionCount()) + "';";
+ // System.out.println("SQL: " + sql);
+
+ sqlScript.write(sql + "\n");
+
System.out.println("Attachment " + att
+ " added for " + page.getName());
} catch (AttachmentException e) {
@@ -271,13 +290,23 @@
WikiPage pageVer = we.getByName(pageName, null, ver,
ConfigurationParser.getDefaultLangugeCode());
+ Date start = new Date();
+
String content = translator.parse(pageName, pageVer
.getContent(), pageDictionary,
pageDictionaryRev, log);
+ double parsingTime = ((double) (new Date().getTime() - start
+ .getTime()) / 1000);
+
+ start = new Date();
+
org.w3c.dom.Document body = WikiContentHelper
.wikiToJiveDocument(content);
+ double innerParsingTime = ((double) (new Date()
+ .getTime() - start.getTime()) / 1000);
+
original.setBody(body);
original.setCreationDate(pageVer.getEditDate());
original.setModificationDate(pageVer.getEditDate());
@@ -296,8 +325,13 @@
// original.addAuthor(user);
original.setMinorEdit(true);
+ start = new Date();
+
original.save();
+ double savingTime = ((double) (new Date().getTime() - start
+ .getTime()) / 1000);
+
long creation = pageVer.getEditDate().getTime();
// update user and last modification date
@@ -309,7 +343,8 @@
+ "' WHERE j.internalDocID='"
+ original.getID()
+ "' and j.versionID='"
- + (ver + 1) + "';";
+ + (original.getVersionManager()
+ .getDocumentVersionCount()) + "';";
// System.out.println("SQL: " + sql);
if (ver == 1) {
@@ -330,11 +365,33 @@
// c.createStatement().execute(sql);
+ start = new Date();
+
original = documentManager.getDocument(original
.getDocumentID());
- System.out.println("Version " + ver + " updated for "
- + pageVer.getName());
+ double gettingTime = ((double) (new Date().getTime() - start
+ .getTime()) / 1000);
+
+ if (innerParsingTime > 20) {
+ // long parsing
+ log
+ .write("Long parsing:=========================================\n"
+ + content
+ + "\n=========================================\n\n");
+ }
+
+ System.out
+ .println("Version "
+ + ver
+ + " updated for "
+ + pageVer.getName()
+ + String
+ .format(
+ " jsp parsing took %.4f seconds; jive parsing took %.4f seconds saving took %.4f seconds getting back took %.4f seconds",
+ parsingTime,
+ innerParsingTime,
+ savingTime, gettingTime));
}
} catch (NullPointerException e) {
// ignore - page coudln't be open
@@ -384,7 +441,7 @@
log = new FileWriter(new File("log-" + sdf.format(start) + ".txt"));
for (String pageName : pages) {
- if (pageName.matches(".*")) {
+ if (pageName.matches("[C].*")) {
toTransform.add(pageName);
}
}
More information about the jboss-svn-commits
mailing list