return null;
}
PageEnvelope envelope = null;
Publication publication = null;
Document document = null;
try {
envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(objectModel);
publication = envelope.getPublication();
document = envelope.getDocument();
} catch (Exception e) {
getLogger().error("Resolving page envelope failed: ", e);
throw e;
}
//get Parameters for RC
String publicationPath = publication.getDirectory().getCanonicalPath();
RCEnvironment rcEnvironment =
RCEnvironment.getInstance(publication.getServletContext().getCanonicalPath());
rcmlDirectory = rcEnvironment.getRCMLDirectory();
rcmlDirectory = publicationPath + File.separator + rcmlDirectory;
backupDirectory = rcEnvironment.getBackupDirectory();
backupDirectory = publicationPath + File.separator + backupDirectory;
// Initialize Revision Controller
rc = new RevisionController(rcmlDirectory, backupDirectory, publicationPath);
getLogger().debug("revision controller" + rc);
// /Initialize Revision Controller
// Get session
Session session = request.getSession(false);
if (session == null) {
getLogger().error(".act(): No session object");
return null;
}
Identity identity = (Identity) session.getAttribute(Identity.class.getName());
getLogger().debug(".act(): Identity: " + identity);
//FIXME: hack because of the uri for the editor bitflux. The filename cannot be get from the page-envelope
String documentid = document.getId();
int bx = documentid.lastIndexOf("-bxeng");
if (bx > 0) {
String language = document.getLanguage();
int l = documentid.length();
int bxLength = "-bxeng".length();
int lang = documentid.lastIndexOf("_", bx);
int langLength = bx - lang;
if (bx > 0 && bx + bxLength <= l) {
documentid = documentid.substring(0, bx) + documentid.substring(bx + bxLength, l);
if (lang > 0 && langLength + lang < l) {
language = documentid.substring(lang + 1, lang + langLength);
documentid =
documentid.substring(0, lang)
+ documentid.substring(lang + langLength, l - bxLength);
}
}
DocumentBuilder builder = publication.getDocumentBuilder();
String srcUrl =
builder.buildCanonicalUrl(publication, document.getArea(), documentid, language);
Document srcDoc = builder.buildDocument(publication, srcUrl);
File newFile = srcDoc.getFile();