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();
filename = newFile.getCanonicalPath();
} else {
filename = document.getFile().getCanonicalPath();
}
filename = filename.substring(publicationPath.length());
log.debug("Filename: " + filename);
username = null;
if (identity != null) {
User user = identity.getUser();
if (user != null) {
username = user.getId();
}
} else {
getLogger().error(".act(): No identity yet");