String sessionKey = "C26CF959E1434E31B7F9DA89829369B4";
String projectGuid = "73671509FA5C43ED8FC4171AD0298AD2";
CmsClient client = new CmsClient(logonGuid);
Project project = client.getProject(sessionKey, projectGuid);
String startPageId = "4712";
// create walker
Class.forName("org.hsqldb.jdbcDriver");
Connection connection = DriverManager.getConnection("jdbc:hsqldb:mem:dafpc", "sa", "");
PhysicalPagesWalker walker = new PhysicalPagesWalker(connection, "tableName");
// // init application logger
// Logger logger = Logger.getLogger("BatchProgrammingCollectPhysicalPages");
// PropertyConfigurator.configure("log4j.properties");
//
// // use log4j's debug listener to walker
// class WalkerPageListener implements PageListener {
// private Logger logger;
//
// public WalkerPageListener(Logger logger) {
// super();
// this.logger = logger;
// }
//
// public void update(Page currentPage) throws RQLException {
// logger.debug(" " + currentPage.getHeadlineAndId());
// } // end update method
// } // end listener class
// walker.setListener(new WalkerPageListener(logger));
// use system out listener
class WalkerPageListener2 implements PageListener {
public WalkerPageListener2() {
super();
}
public void update(Page currentPage) throws RQLException {
System.out.println(" " + currentPage.getHeadlineAndId());
} // end update method
} // end listener class
walker.setListener(new WalkerPageListener2());
// prepare page action called on all physical pages
PageAction simulateSmartEditUsage = new SimulateSmartEditUsagePageAction();
// walk through all physical child pages for all given start pages
Page startPg = project.getPageById(startPageId);
walker.walk(startPg, simulateSmartEditUsage);
}