}
public GWTJahiaEditEngineInitBean initializeEditEngine(String nodepath, boolean tryToLockNode)
throws GWTJahiaServiceException {
try {
JCRSessionWrapper sessionWrapper = retrieveCurrentSession();
JCRNodeWrapper nodeWrapper = sessionWrapper.getNode(nodepath);
final GWTJahiaNode node = navigation.getGWTJahiaNode(nodeWrapper);
if (tryToLockNode && !nodeWrapper.isLocked() && nodeWrapper.hasPermission(Privilege.JCR_LOCK_MANAGEMENT)) {
nodeWrapper.checkout();
nodeWrapper.lockAndStoreToken("engine");
}
dumpLocks(nodeWrapper);
// get node type
final List<GWTJahiaNodeType> nodeTypes =
contentDefinition.getNodeTypes(nodeWrapper.getNodeTypes(), getUILocale());
// get properties
final Map<String, GWTJahiaNodeProperty> props =
properties.getProperties(nodepath, retrieveCurrentSession());
final GWTJahiaEditEngineInitBean result = new GWTJahiaEditEngineInitBean(nodeTypes, props);
result.setNode(node);
result.setAvailabledLanguages(languages.getLanguages(getSite(), getRemoteJahiaUser(), getLocale()));
result.setCurrentLocale(languages.getCurrentLang(getLocale()));
String defaultLanguage = nodeWrapper.getResolveSite().getDefaultLanguage();
if (defaultLanguage == null) {
defaultLanguage = sessionWrapper.getRootNode().getResolveSite().getDefaultLanguage();
}
result.setDefaultLanguageCode(defaultLanguage);