Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

bloomreach clone session

// The correct way of using session is to clone it first.

private Credentials systemCredentials = new SimpleCredentials("system", new char[]{});
//...
Session clonedSession = null;
try {
    clonedSession = session.impersonate(SYSTEM_CREDENTIALS);
    Node subject = clonedSession.getNodeByIdentifier(event.subjectId());
    clonedSession.save();
} catch (UnsupportedRepositoryOperationException e) {
    // we're trying to get something from a deleted node. Ignore
} catch (Exception e) {
    log.error("Unsupported error occurred during document translation event: ", e);
} finally {
    if (clonedSession != null) {
        clonedSession.logout();
    }
}
 
PREVIOUS NEXT
Tagged: #bloomreach #clone #session
ADD COMMENT
Topic
Name
8+1 =