}
PageEnvelope envelope = null;
PublicationFactory factory = PublicationFactory.getInstance(getLogger());
Publication publication = factory.getPublication(objectModel);
DocumentIdentityMap map = new DocumentIdentityMap(this.manager, getLogger());
Document document = null;
try {
envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(map, 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());
this.rcmlDirectory = rcEnvironment.getRCMLDirectory();
this.rcmlDirectory = publicationPath + File.separator + this.rcmlDirectory;
this.backupDirectory = rcEnvironment.getBackupDirectory();
this.backupDirectory = publicationPath + File.separator + this.backupDirectory;
// Initialize Revision Controller
this.rc = new RevisionController(this.rcmlDirectory, this.backupDirectory, publicationPath);
getLogger().debug("revision controller" + this.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("-bxe");
if (bx > 0) {
String language = document.getLanguage();
int l = documentid.length();
int bxLength = "-bxe".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);
}
}
Document srcDoc = map.get(publication, document.getArea(), documentid, language);
File newFile = srcDoc.getFile();
this.filename = newFile.getCanonicalPath();
} else {
this.filename = document.getFile().getCanonicalPath();