xlawrence    2005/11/23 16:53:55 CET

  Modified files:
    core/src/java/org/jahia/engines/pages 
                                          PageProperties_Engine.java 
  Log:
  cleanup engine
  
  Revision  Changes    Path
  1.31      +282 -298  
jahia/core/src/java/org/jahia/engines/pages/PageProperties_Engine.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/engines/pages/PageProperties_Engine.java.diff?r1=1.30&r2=1.31&f=h
  
  
  
  Index: PageProperties_Engine.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/engines/pages/PageProperties_Engine.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- PageProperties_Engine.java        24 Oct 2005 12:42:21 -0000      1.30
  +++ PageProperties_Engine.java        23 Nov 2005 15:53:55 -0000      1.31
  @@ -1,4 +1,4 @@
  -// $Id: PageProperties_Engine.java,v 1.30 2005/10/24 12:42:21 knguyen Exp $
  +// $Id: PageProperties_Engine.java,v 1.31 2005/11/23 15:53:55 xlawrence Exp $
   //
   //
   //                                   ____.
  @@ -41,6 +41,7 @@
   import org.jahia.registries.ServicesRegistry;
   import org.jahia.services.audit.LoggingEventListener;
   import org.jahia.services.cache.HtmlCache;
  +import org.jahia.services.cache.CacheService;
   import org.jahia.services.lock.LockKey;
   import org.jahia.services.lock.LockService;
   import org.jahia.services.pages.ContentPage;
  @@ -49,7 +50,6 @@
   import org.jahia.services.pages.PageProperty;
   import org.jahia.services.usermanager.JahiaUser;
   import org.jahia.services.version.EntryLoadRequest;
  -import org.jahia.services.fields.ContentField;
   import org.jahia.views.engines.contentdefinition.ContentDefinitionEngine;
   import 
org.jahia.views.engines.versioning.pages.actions.PagesVersioningAction;
   
  @@ -62,17 +62,22 @@
    * @version 1.0
    */
   public class PageProperties_Engine implements JahiaEngine {
  -    
  -    /** logging */
  +
  +    /**
  +     * logging
  +     */
       private static final org.apache.log4j.Logger logger =
               org.apache.log4j.Logger.getLogger(PageProperties_Engine.class);
  -    
  +
       private static final String TEMPLATE_JSP = "page_properties";
       private static PageProperties_Engine instance = null;
       public static final String ENGINE_NAME = "pageproperties";
       private EngineToolBox toolBox;
  -    
  -    
  +
  +    private static final ServicesRegistry servicesRegistry = 
ServicesRegistry.getInstance();
  +    private static final LockService lockService = 
servicesRegistry.getLockService();
  +    private static final CacheService cacheService = 
servicesRegistry.getCacheService();
  +
       /**
        * Default constructor, creates a new <code>PageProperties_Engine</code> 
instance.
        */
  @@ -81,8 +86,8 @@
                   "***** Starting " + PageProperties_Engine.class.getName() + 
" engine *****");
           toolBox = EngineToolBox.getInstance();
       }
  -    
  -    
  +
  +
       /**
        * returns a single instance of the object
        */
  @@ -92,90 +97,84 @@
           }
           return instance;
       }
  -    
  +
       /**
        * authoriseRender
        */
  -    public boolean authoriseRender (ProcessingContext jParams) {
  -        return toolBox.authoriseRender (jParams);
  +    public boolean authoriseRender(final ProcessingContext jParams) {
  +        return toolBox.authoriseRender(jParams);
       }
  -    
  +
       /**
        * renderLink
        */
  -    public String renderLink (ProcessingContext jParams, Object theObj)
  +    public String renderLink(final ProcessingContext jParams, final Object 
theObj)
               throws JahiaException {
  -        String params = EMPTY_STRING;
  -//        params += "&mode=display";
  -        params += "?mode=display";
  -        return jParams.composeEngineUrl(ENGINE_NAME, params);
  +        return jParams.composeEngineUrl(ENGINE_NAME, EMPTY_STRING + 
"?mode=display");
       }
  -    
  +
       /**
        * needsJahiaData
        */
  -    public boolean needsJahiaData (ProcessingContext jParams) {
  +    public boolean needsJahiaData(final ProcessingContext jParams) {
           return true;
       }
  -    
  +
       /**
        * handles the engine actions
        *
        * @param jParams a ProcessingContext object
        * @param jData   a JahiaData object (not mandatory)
        */
  -    public EngineValidationHelper handleActions (ProcessingContext jParams, 
JahiaData jData)
  +    public EngineValidationHelper handleActions(final ProcessingContext 
jParams, final JahiaData jData)
               throws JahiaException, JahiaUpdateLockException,
               JahiaForbiddenAccessException {
  -        JahiaUser user = jParams.getUser();
  -        JahiaUser theUser = user;
  +        final JahiaUser user = jParams.getUser();
           EngineValidationHelper evh = null;
  -        
  +
           // initalizes the hashmap
  -        HashMap engineMap = initEngineMap (jParams, jData);
  +        final HashMap engineMap = initEngineMap(jParams, jData);
   
           // checks if the user has the right to display the engine
  -        JahiaPage thePage = (JahiaPage) engineMap.get("thePage");
  +        final JahiaPage thePage = (JahiaPage) engineMap.get("thePage");
           // get the screen
           final String theScreen = (String) engineMap.get("screen");
  -        
  -        if (thePage.checkAdminAccess(theUser)) {
  +
  +        if (thePage.checkAdminAccess(user)) {
               engineMap.put("enableAuthoring", Boolean.TRUE);
               engineMap.put("enableMetadata", Boolean.TRUE);
               engineMap.put("adminAccess", Boolean.TRUE);
               engineMap.put("enableRightView", Boolean.TRUE);
               engineMap.put("enableTimeBasedPublishing", Boolean.TRUE);
               engineMap.put("writeAccess", Boolean.TRUE);
  -            
  -        } else if (thePage.checkWriteAccess(theUser)) {
  +
  +        } else if (thePage.checkWriteAccess(user)) {
               engineMap.put("enableAuthoring", Boolean.TRUE);
               engineMap.put("enableMetadata", Boolean.TRUE);
               engineMap.put("writeAccess", Boolean.TRUE);
           }
  -        
  +
           if (engineMap.get("writeAccess") != null) {
  -            
  +
               // #ifdef LOCK
  -            LockService lockRegistry = ServicesRegistry.getInstance().
  -                    getLockService();
               if (jParams.settings().areLocksActivated()) {
  -                LockKey lockKey = LockKey.composeLockKey(LockKey.
  +                final LockKey lockKey = LockKey.composeLockKey(LockKey.
                           UPDATE_PAGE_TYPE,
                           thePage.getID(), thePage.getID());
  -                if (lockRegistry.acquire(lockKey, user,
  +                if (lockService.acquire(lockKey, user,
                           user.getUserKey(),
                           jParams.getSessionState().
  -                        getMaxInactiveInterval())) {
  +                                getMaxInactiveInterval())) {
   
                       // since we cannot efficiently determine all the 
references
                       // to this page we do an entire cache flush.
  -                    /** @todo is there a better way to do this ? */
  -                    
ServicesRegistry.getInstance().getCacheService().getHtmlCacheInstance().flush();
  +                    /** todo is there a better way to do this ? */
  +                    cacheService.getHtmlCacheInstance().flush();
                       // #endif
                       if (!theScreen.equals("cancel")) {
                           evh = processLastScreen(jParams, engineMap);
                       }
  -                    if ( evh != null && evh.hasErrors() ){
  +                    if (evh != null && evh.hasErrors()) {
                           engineMap.put("screen", evh.getNextScreen());
                           engineMap.put("jspSource", TEMPLATE_JSP);
                       } else {
  @@ -190,17 +189,17 @@
                   }
               }
               // #endif
  -            
  +
           } else {
               throw new JahiaForbiddenAccessException();
           }
  -        
  +
           // displays the screen
  -        toolBox.displayScreen (jData.getProcessingContext (), engineMap);
  +        toolBox.displayScreen(jData.getProcessingContext(), engineMap);
   
           return null;
       }
  -    
  +
       /**
        * Retrieve the engine name.
        *
  @@ -209,36 +208,36 @@
       public final String getName() {
           return ENGINE_NAME;
       }
  -    
  +
       /**
        * processes the last screen sent by the user
        *
        * @param jParams a ProcessingContext object
        */
  -    public EngineValidationHelper processLastScreen(ProcessingContext 
jParams, HashMap engineMap)
  -    throws JahiaException, JahiaForbiddenAccessException {
  -        
  +    public EngineValidationHelper processLastScreen(final ProcessingContext 
jParams, final HashMap engineMap)
  +            throws JahiaException, JahiaForbiddenAccessException {
  +
           // Sets the page
  -        JahiaPage thePage = (JahiaPage) engineMap.get("thePage");
  +        final JahiaPage thePage = (JahiaPage) engineMap.get("thePage");
           // gets the last screen
           // lastscreen   = edit, rights, logs
  -        String lastScreen = jParams.getParameter("lastscreen");         
  -        logger.debug("processLastScreen: "+lastScreen+ " UPDATE_MODE");
  -        
  +        final String lastScreen = jParams.getParameter("lastscreen");
  +        logger.debug("processLastScreen: " + lastScreen + " UPDATE_MODE");
  +
           if (lastScreen == null) {
               return null;
               //lastScreen = "edit";
           }
  -        
  -        EngineLanguageHelper elh = (EngineLanguageHelper)engineMap.
  +
  +        final EngineLanguageHelper elh = (EngineLanguageHelper) engineMap.
                   get(JahiaEngine.ENGINE_LANGUAGE_HELPER);
  -        
  +
           // indicates to sub engines that we are processing last screen
  -        int mode = JahiaEngine.UPDATE_MODE;
  -        
  +        final int mode = JahiaEngine.UPDATE_MODE;
  +
           // dispatches to the appropriate sub engine
           if (lastScreen.equals("edit")) {
  -            String screen = (String) engineMap.get("screen");
  +            final String screen = (String) engineMap.get("screen");
               if (!"cancel".equals(screen)) {
                   if (!updatePageData(jParams, engineMap, 
elh.getPreviousLanguageCode())) {
                       // if there was an error, come back to last screen, 
unless we clicked on cancel
  @@ -253,53 +252,51 @@
                           new Integer(JahiaEngine.RENDERTYPE_FORWARD));
                   // reset engine map to default value
                   engineMap.remove(ENGINE_OUTPUT_FILE_PARAM);
  -                
  +
                   releaseTreeVersioningLocks(jParams);
  -                
  +
                   // now let's reacquire the page lock for this page, as we
                   // have cleared it as part of the page subtree.
  -                LockService lockRegistry = ServicesRegistry.getInstance().
  -                        getLockService();
                   if (jParams.settings().areLocksActivated()) {
  -                    LockKey lockKey = LockKey.composeLockKey(LockKey.
  +                    final LockKey lockKey = LockKey.composeLockKey(LockKey.
                               UPDATE_PAGE_TYPE,
                               thePage.getID(), thePage.getID());
  -                    JahiaUser user = jParams.getUser();
  -                    if (lockRegistry.acquire(lockKey, user,
  -                                             user.getUserKey(),
  -                                             jParams.getSessionState().
  -                                             getMaxInactiveInterval())) {
  +                    final JahiaUser user = jParams.getUser();
  +                    if (lockService.acquire(lockKey, user,
  +                            user.getUserKey(),
  +                            jParams.getSessionState().
  +                                    getMaxInactiveInterval())) {
   
                           // since we cannot efficiently determine all the 
references
                           // to this page we do an entire cache flush.
  -                        /** @todo is there a better way to do this ? */
  -                        
ServicesRegistry.getInstance().getCacheService().getHtmlCacheInstance().flush();
  +                        /** todo is there a better way to do this ? */
  +                        cacheService.getHtmlCacheInstance().flush();
                           // #endif
                           // #ifdef LOCK
                       } else {
                           // Prerequisites are NOT completed ! Damned ! 
Redirect the JSP
                           // output to lock informations.
                           LockEngine.getInstance().redirect(jParams, engineMap,
  -                                                          lockKey);
  +                                lockKey);
                       }
                   }
                   // #endif
  -                
  +
               } else {
                   throw new JahiaForbiddenAccessException();
               }
           } else if (lastScreen.equals("rightsMgmt")) {
               if (engineMap.get("adminAccess") != null) {
                   final EngineValidationHelper evh = 
ManageRights.getInstance().
  -                        handleActions(jParams, mode,  engineMap, 
thePage.getAclID());
  -                
  +                        handleActions(jParams, mode, engineMap, 
thePage.getAclID());
  +
                   if (evh != null && evh.hasErrors()) {
                       // if there was an error, come back to last screen
                       engineMap.put("screen", lastScreen);
                       engineMap.put("jspSource", TEMPLATE_JSP);
  -                    logger.debug("handleActions returned false, setting the 
screen to: "+lastScreen);
  +                    logger.debug("handleActions returned false, setting the 
screen to: " + lastScreen);
                   }
  -                
  +
               } else {
                   throw new JahiaForbiddenAccessException();
               }
  @@ -323,54 +320,52 @@
                   throw new JahiaForbiddenAccessException();
               }
           } else if (lastScreen.equals("metadata")) {
  -            ObjectKey objectKey = 
ContentPage.getPage(thePage.getID()).getObjectKey();
  +            final ObjectKey objectKey = 
ContentPage.getPage(thePage.getID()).getObjectKey();
               Metadata_Engine.getInstance().handleActions(jParams, mode, 
objectKey);
           }
           return null;
       }
  -    
  +
       /**
        * prepares the screen requested by the user
        *
        * @param jParams a ProcessingContext object
        */
  -    public EngineValidationHelper processCurrentScreen(ProcessingContext 
jParams, HashMap engineMap)
  -    throws JahiaException,
  +    public EngineValidationHelper processCurrentScreen(final 
ProcessingContext jParams, final HashMap engineMap)
  +            throws JahiaException,
               JahiaForbiddenAccessException {
   
           // Sets the actual field
  -        JahiaPage thePage = (JahiaPage) engineMap.get("thePage");
  -        
  -        JahiaPageEngineTempBean pageTempBean =
  +        final JahiaPage thePage = (JahiaPage) engineMap.get("thePage");
  +
  +        final JahiaPageEngineTempBean pageTempBean =
                   (JahiaPageEngineTempBean) engineMap.get("pageTempBean");
  -        
  +
   //        EntryLoadRequest entryLoadRequest
   //                = (EntryLoadRequest) engineMap.get ("entryLoadRequest");
  -        
  +
           // gets the current screen
           // screen   = edit, rights, logs
           final String theScreen = (String) engineMap.get("screen");
  -        logger.debug("processCurrentScreen: "+theScreen+ " LOAD_MODE");
  -        
  +        logger.debug("processCurrentScreen: " + theScreen + " LOAD_MODE");
  +
           // indicates to sub enginesthat we are processing last screen
           int mode = JahiaEngine.LOAD_MODE;
  -        
  +
           // #ifdef LOCK
  -        LockKey lockKey = LockKey.composeLockKey(LockKey.UPDATE_PAGE_TYPE,
  +        final LockKey lockKey = 
LockKey.composeLockKey(LockKey.UPDATE_PAGE_TYPE,
                   thePage.getID(), thePage.getID());
  -        LockService lockRegistry = ServicesRegistry.getInstance().
  -                getLockService();
           // #endif
  -        
  -        EngineLanguageHelper elh = 
(EngineLanguageHelper)engineMap.get(JahiaEngine.ENGINE_LANGUAGE_HELPER);
  -        
  +
  +        final EngineLanguageHelper elh = (EngineLanguageHelper) 
engineMap.get(JahiaEngine.ENGINE_LANGUAGE_HELPER);
  +
           // dispatches to the appropriate sub engine
           final JahiaUser user = jParams.getUser();
           if (theScreen.equals("edit")) {
               loadPageData(jParams, engineMap);
           } else if (theScreen.equals("logs")) {
               toolBox.loadLogData(jParams, LoggingEventListener.PAGE_TYPE,
  -                                engineMap);
  +                    engineMap);
           } else if (theScreen.equals("rightsMgmt")) {
               if (engineMap.get("adminAccess") != null) {
                   ManageRights.getInstance().
  @@ -381,7 +376,7 @@
               }
           } else if (theScreen.equals("timeBasedPublishing")) {
               if (engineMap.get("writeAccess") != null
  -                || engineMap.get("adminAccess") != null) {
  +                    || engineMap.get("adminAccess") != null) {
                   TimeBasedPublishingEngine.getInstance().
                           handleActions(jParams, mode, engineMap, 
ContentPage.getPage(thePage.getID()).getObjectKey());
               } else {
  @@ -389,67 +384,66 @@
               }
           } else if (theScreen.equals("versioning")) {
               if (engineMap.get("writeAccess") != null
  -                || engineMap.get("adminAccess") != null) {
  +                    || engineMap.get("adminAccess") != null) {
   
                   // we don't need to free the lock when going to the 
versioning
                   // engine because we can re-acquire a lock we already have.
   
  -                Properties params = new Properties();
  +                final Properties params = new Properties();
                   params.put("method", "showOperationChoices");
                   params.put("pageid", String.valueOf(thePage.getID()));
  -                String versioningURL = jParams.composeStrutsUrl(
  +                final String versioningURL = jParams.composeStrutsUrl(
                           "PagesVersioning", params, null);
   
                   engineMap.put(RENDER_TYPE_PARAM,
  -                              new Integer(JahiaEngine.RENDERTYPE_REDIRECT));
  +                        new Integer(JahiaEngine.RENDERTYPE_REDIRECT));
                   engineMap.put(ENGINE_OUTPUT_FILE_PARAM, versioningURL);
               } else {
                   throw new JahiaForbiddenAccessException();
               }
           } else if (theScreen.equals("categories")) {
               ManageCategories.getInstance().handleActions(jParams, mode,
  -                                                         engineMap, new 
ContentPageKey(thePage.getID()),
  -                                                         
thePage.getPageTemplate(), false);
  +                    engineMap, new ContentPageKey(thePage.getID()),
  +                    thePage.getPageTemplate(), false);
           } else if (theScreen.equals("contentdefinition")) {
               if (engineMap.get("adminAccess") != null) {
                   if (jParams.settings().areLocksActivated()) {
  -                    lockRegistry.release(lockKey, user,user.getUserKey());
  +                    lockService.release(lockKey, user, user.getUserKey());
                   }
  -                JahiaPageDefinition contentDefinition = 
(JahiaPageDefinition)JahiaPageDefinition
  +                final JahiaPageDefinition contentDefinition = 
(JahiaPageDefinition) JahiaPageDefinition
                           
.getChildInstance(String.valueOf(pageTempBean.getPageTemplateID()));
  -                ObjectKey objectKey = contentDefinition.getObjectKey();
   
  -                ContentDefinitionEngine contentDefinitionEngine = new
  -                    ContentDefinitionEngine(contentDefinition,jParams);
  +                final ContentDefinitionEngine contentDefinitionEngine = new
  +                        ContentDefinitionEngine(contentDefinition, jParams);
                   jParams.setAttribute(ContentDefinitionEngine.
  -                    ENGINE_NAME,
  -                                     contentDefinitionEngine);
  +                        ENGINE_NAME,
  +                        contentDefinitionEngine);
                   
jParams.getSessionState().setAttribute(ContentDefinitionEngine.
  -                    ENGINE_NAME,
  -                                                       
contentDefinitionEngine);
  +                        ENGINE_NAME,
  +                        contentDefinitionEngine);
                   
jParams.getSessionState().setAttribute(ContentDefinitionEngine.REINIT_VIEW_PARAM,
  -                                                       Boolean.TRUE);
  +                        Boolean.TRUE);
   
  -                engineMap.put("jspSource","contentdefinition_forward");
  +                engineMap.put("jspSource", "contentdefinition_forward");
               } else {
                   throw new JahiaForbiddenAccessException();
               }
           } else if (theScreen.equals("workflow")) {
               if (engineMap.get("adminAccess") != null) {
                   ManageWorkflow.getInstance().handleActions(jParams, mode,
  -                                                           engineMap, 
jParams.getContentPage());
  +                        engineMap, jParams.getContentPage());
               } else {
                   throw new JahiaForbiddenAccessException();
               }
           } else if (theScreen.equals("metadata")) {
  -            ObjectKey objectKey = 
ContentPage.getPage(thePage.getID()).getObjectKey();
  +            final ObjectKey objectKey = 
ContentPage.getPage(thePage.getID()).getObjectKey();
               Metadata_Engine.getInstance().handleActions(jParams, mode, 
objectKey);
           } else if (theScreen.equals("save") || theScreen.equals("apply")) {
   
               // #ifdef LOCK
               // Did somebody steal the lock ? Panpan cucul !
               if (jParams.settings().areLocksActivated() &&
  -                lockRegistry.isStealedInContext(lockKey, 
user,user.getUserKey())) {
  +                    lockService.isStealedInContext(lockKey, user, 
user.getUserKey())) {
                   engineMap.put("screen", jParams.
                           getParameter("lastscreen"));
                   engineMap.put("jspSource", "apply");
  @@ -462,7 +456,7 @@
                       handleActions(jParams, mode, engineMap, 
thePage.getAclID());
   
               if (evh != null && evh.hasErrors()) {
  -                engineMap.put( JahiaEngine.ENGINE_VALIDATION_HELPER, evh);
  +                engineMap.put(JahiaEngine.ENGINE_VALIDATION_HELPER, evh);
                   engineMap.put("screen", "rightsMgmt");
                   engineMap.put("jspSource", TEMPLATE_JSP);
                   return evh;
  @@ -471,13 +465,12 @@
               mode = JahiaEngine.SAVE_MODE;
   
               // create one entry for each language
  -            ContentPage contentPage = ServicesRegistry.getInstance()
  -            .getJahiaPageService().lookupContentPage(
  +            final ContentPage contentPage = 
servicesRegistry.getJahiaPageService().lookupContentPage(
                       thePage.getID(), false);
   
               // save workflow
               ManageWorkflow.getInstance().handleActions(jParams, mode,
  -                                                       engineMap,  
contentPage);
  +                    engineMap, contentPage);
   
               //Map languageStates = contentPage.getLanguagesStates (false);
   
  @@ -488,8 +481,7 @@
               }
               if (!updatePageData(jParams, engineMap, 
elh.getCurrentLanguageCode())) {
                   // if there was an error, come back to last screen
  -                String lastScreen = jParams.getParameter (
  -                        "lastscreen");
  +                String lastScreen = jParams.getParameter("lastscreen");
                   if (lastScreen == null) {
                       lastScreen = "edit";
                   }
  @@ -498,9 +490,7 @@
                   //engineMap.put( "jspSource", TEMPLATE_JSP );
               }
   
  -            boolean changed = false;
  -
  -            changed |= thePage.setTitles(updatedLanguageEntries, 
pageTempBean.getTitles());
  +            boolean changed = thePage.setTitles(updatedLanguageEntries, 
pageTempBean.getTitles());
   
               //String  pageTitle       = (String)engineMap.get 
("dataPageTitle");
               //Boolean validate = (Boolean) engineMap.get ("validate");
  @@ -508,27 +498,30 @@
               //thePage.setTitle (pageTitle);
               changed |= 
thePage.setPageTemplateID(pageTempBean.getPageTemplateID());
   
  -            String pageURLKey = jParams.getParameter("pageURLKey");
  +            final String pageURLKey = jParams.getParameter("pageURLKey");
  +            logger.debug("processCurrentScreen - pageURLKey: " + pageURLKey);
  +
               if (pageURLKey != null) {
                   if ("".equals(pageURLKey)) {
                       changed |= 
thePage.removeProperty(PageProperty.PAGE_URL_KEY_PROPNAME);
                   } else {
  -                    changed |= 
thePage.setProperty(PageProperty.PAGE_URL_KEY_PROPNAME,
  -                                                   pageURLKey);
  +                    changed |= 
thePage.setProperty(PageProperty.PAGE_URL_KEY_PROPNAME, pageURLKey);
                   }
                   engineMap.put("dataPageURLKey", pageURLKey);
               }
   
  +            logger.debug("changed: " + changed);
  +
               if (changed) {
  -                thePage.commitChanges(true,user);
  +                thePage.commitChanges(true, user);
   
                   // let's flush the sitemap to make sure the changes are 
updated
                   // everywhere.
  -                
ServicesRegistry.getInstance().getJahiaSiteMapService().resetSiteMap();
  +                servicesRegistry.getJahiaSiteMapService().resetSiteMap();
   
  -                JahiaEvent objectCreatedEvent = new JahiaEvent(this, 
jParams, contentPage);
  -                ServicesRegistry.getInstance().getJahiaEventService()
  -                .fireContentObjectUpdated(objectCreatedEvent);
  +                final JahiaEvent objectCreatedEvent = new JahiaEvent(this, 
jParams, contentPage);
  +                servicesRegistry.getJahiaEventService()
  +                        .fireContentObjectUpdated(objectCreatedEvent);
   
                   /* handled by previous event
                   // index page
  @@ -555,44 +548,43 @@
               // save rights
               if (engineMap.get("adminAccess") != null) {
                   engineMap.put("logObjectType",
  -                              
Integer.toString(LoggingEventListener.PAGE_TYPE));
  +                        Integer.toString(LoggingEventListener.PAGE_TYPE));
                   engineMap.put("logObject", thePage);
                   //ViewRights.getInstance().handleActions (jParams, mode, 
engineMap, thePage.getAclID());
                   ManageRights.getInstance().handleActions(jParams, mode,
  -                                                         engineMap, 
thePage.getAclID());
  +                        engineMap, thePage.getAclID());
               }
   
               // save timebasedpublishing engine
               if (engineMap.get("writeAccess") != null
  -                || engineMap.get("adminAccess") != null) {
  +                    || engineMap.get("adminAccess") != null) {
                   TimeBasedPublishingEngine.getInstance().
                           handleActions(jParams, mode, engineMap, 
ContentPage.getPage(thePage.getID()).getObjectKey());
               }
   
               // save categories
               ManageCategories.getInstance().handleActions(jParams, mode,
  -                                                         engineMap,
  -                                                         new 
ContentPageKey(thePage.getID()), thePage.getPageTemplate(), false);
  +                    engineMap,
  +                    new ContentPageKey(thePage.getID()), 
thePage.getPageTemplate(), false);
   
               // save metadata
  -            ObjectKey objectKey = 
ContentPage.getPage(thePage.getID()).getObjectKey();
  -            
Metadata_Engine.getInstance().handleActions(jParams,mode,objectKey);
  +            final ObjectKey objectKey = 
ContentPage.getPage(thePage.getID()).getObjectKey();
  +            Metadata_Engine.getInstance().handleActions(jParams, mode, 
objectKey);
   
   
  -            String lastScreen = jParams.getParameter("lastscreen");
  +            final String lastScreen = jParams.getParameter("lastscreen");
               if (lastScreen != null) {
                   logger.debug("lastScreen=" + lastScreen);
                   if (lastScreen.equals("edit")) {
   
                       // since we cannot efficiently determine all the 
references
                       // to this page we do an entire cache flush.
  -                    /** @todo is there a better way to do this ? */
  -                    
ServicesRegistry.getInstance().getCacheService().getHtmlCacheInstance().flush();
  +                    /** todo is there a better way to do this ? */
  +                    cacheService.getHtmlCacheInstance().flush();
   
                       // fire event
  -                    JahiaEvent theEvent = new JahiaEvent(this, jParams, 
thePage);
  -                    ServicesRegistry.getInstance().getJahiaEventService().
  -                            fireSetPageProperties(theEvent);
  +                    final JahiaEvent theEvent = new JahiaEvent(this, 
jParams, thePage);
  +                    
servicesRegistry.getJahiaEventService().fireSetPageProperties(theEvent);
                   }
               }
               if (theScreen.equals("apply")) {
  @@ -601,7 +593,7 @@
               // #ifdef LOCK
               else {
                   if (jParams.settings().areLocksActivated()) {
  -                    lockRegistry.release(lockKey, user,user.getUserKey());
  +                    lockService.release(lockKey, user, user.getUserKey());
                   }
               }
               // #endif
  @@ -613,48 +605,45 @@
                       handleActions(jParams, mode, engineMap, 
thePage.getAclID());
   
               if (jParams.settings().areLocksActivated()) {
  -                lockRegistry.release(lockKey, user,user.getUserKey());
  +                lockService.release(lockKey, user, user.getUserKey());
                   // since we cannot efficiently determine all the references
                   // to this page we do an entire cache flush.
  -                /** @todo is there a better way to do this ? */
  -                
ServicesRegistry.getInstance().getCacheService().getHtmlCacheInstance().flush();
  +                /** todo is there a better way to do this ? */
  +                cacheService.getHtmlCacheInstance().flush();
               }
               // #endif
           }
           return null;
       }
  -    
  -    
  +
  +
       /**
        * inits the engine map
        *
        * @param jData
  -     *
        * @return a HashMap object containing all the basic values needed by an 
engine
        */
  -    private HashMap initEngineMap(ProcessingContext jParams, JahiaData jData)
  -    throws JahiaException, JahiaSessionExpirationException {
  -        
  +    private HashMap initEngineMap(final ProcessingContext jParams, final 
JahiaData jData)
  +            throws JahiaException, JahiaSessionExpirationException {
  +
           String theScreen = jParams.getParameter("screen");
  -        
  +
           // gets session values
  -        SessionState theSession = jParams.getSessionState ();
  +        final SessionState theSession = jParams.getSessionState();
           if (theSession == null)
               throw new JahiaSessionExpirationException();
  -        
  -        ContentPage contentPage = ServicesRegistry.getInstance()
  -        .getJahiaPageService()
  -        .lookupContentPage(jData.getProcessingContext().getPage().
  -                getID(), false);
  -        
  +
  +        final ContentPage contentPage = 
servicesRegistry.getJahiaPageService().
  +                
lookupContentPage(jData.getProcessingContext().getPage().getID(), false);
  +
           JahiaPageEngineTempBean pageTempBean;
  -        
  +
           HashMap engineMap;
           if (theScreen != null) {
               // if no, load the container value from the session
               engineMap = (HashMap) 
theSession.getAttribute("jahia_session_engineMap");
               //thePage     = (JahiaPage) engineMap.get( "thePage" );
  -            
  +
               
///////////////////////////////////////////////////////////////////////////////////////
               // FIXME -Fulco-
               //
  @@ -665,49 +654,51 @@
               if (engineMap == null) {
                   throw new JahiaSessionExpirationException();
               }
  -            
  +
           } else {
               JahiaPage thePage = jParams.getPage();
               theScreen = "edit";
  -            
  +
               // init engine map
               engineMap = new HashMap();
  -            
  +
               engineMap.put("thePage", thePage);
               pageTempBean = loadPageBeanFromRealPage(thePage);
               engineMap.put("pageTempBean", pageTempBean);
               engineMap.put("dataPageTemplateID",
                       new Integer(thePage.getPageTemplateID()));
  -            PageProperty urlKeyProperty = 
thePage.getPageLocalProperty(PageProperty.PAGE_URL_KEY_PROPNAME);
  +            final PageProperty urlKeyProperty = 
thePage.getPageLocalProperty(PageProperty.PAGE_URL_KEY_PROPNAME);
  +
  +            logger.debug("initEngineMap - urlKeyProperty: " + 
urlKeyProperty);
  +
               if (urlKeyProperty != null) {
                   engineMap.put("dataPageURLKey", urlKeyProperty.getValue());
               } else {
                   engineMap.put("dataPageURLKey", EMPTY_STRING);
               }
  -            engineMap.put("validate", new Boolean(false));
  -            
  +            engineMap.put("validate", Boolean.FALSE);
  +
           }
           engineMap.put(RENDER_TYPE_PARAM, new 
Integer(JahiaEngine.RENDERTYPE_FORWARD));
           engineMap.put(ENGINE_NAME_PARAM, ENGINE_NAME);
           engineMap.put(ENGINE_URL_PARAM, 
jParams.composeEngineUrl(ENGINE_NAME, EMPTY_STRING));
  -        
  +
           // Init Engine Language Helper
  -        EngineLanguageHelper elh = (EngineLanguageHelper)engineMap
  +        EngineLanguageHelper elh = (EngineLanguageHelper) engineMap
                   .get(JahiaEngine.ENGINE_LANGUAGE_HELPER);
  -        if ( elh == null ){
  +        if (elh == null) {
               elh = new EngineLanguageHelper();
  -            engineMap.put(JahiaEngine.ENGINE_LANGUAGE_HELPER,elh);
  +            engineMap.put(JahiaEngine.ENGINE_LANGUAGE_HELPER, elh);
           }
           elh.update(jParams);
   
  -        engineMap.put ("contentPage", contentPage);
  +        engineMap.put("contentPage", contentPage);
   
  -        pageTempBean = (JahiaPageEngineTempBean) engineMap.get 
("pageTempBean");
  +        pageTempBean = (JahiaPageEngineTempBean) 
engineMap.get("pageTempBean");
   
           // load page title for the processing language Code
  -        EntryLoadRequest origEntryLoadRequest = 
jParams.getEntryLoadRequest();
           
jParams.setSubstituteEntryLoadRequest(elh.getCurrentEntryLoadRequest());
  -        String pageTitle = 
contentPage.getTitle(jParams.getEntryLoadRequest());
  +        final String pageTitle = 
contentPage.getTitle(jParams.getEntryLoadRequest());
           if (pageTempBean.getTitle(elh.getCurrentLanguageCode()) == null && 
(pageTitle != null)) {
               pageTempBean.setTitle(elh.getCurrentLanguageCode(), pageTitle);
           }
  @@ -717,7 +708,7 @@
           } else {
               engineMap.put("dataPageTitle", EMPTY_STRING);
           }
  -        
  +
           // remember the requested language codes :
           HashSet updatedLanguageEntries = (HashSet) engineMap.get(
                   "updatedLanguageEntries");
  @@ -728,78 +719,77 @@
               updatedLanguageEntries.add(elh.getCurrentLanguageCode());
           }
           engineMap.put("updatedLanguageEntries", updatedLanguageEntries);
  -        
  +
           theSession.setAttribute("jahia_session_engineMap", engineMap);
  -        
  +
           // sets screen
           engineMap.put("screen", theScreen);
  -        
  +
           if (theScreen.equals("save")) {
               engineMap.put("jspSource", "close");
  -            
  +
           } else if (theScreen.equals("cancel")) {
               engineMap.put("jspSource", "close");
  -            
  +
           } else if (theScreen.equals("apply")) {
               engineMap.put("jspSource", "apply");
  -            
  +
           } else {
               engineMap.put("jspSource", TEMPLATE_JSP);
           }
  -        
  +
           // engineMap.put("enableVersioning", new Boolean(true));
  -        engineMap.put("enableCategories", new Boolean(true));
  +        engineMap.put("enableCategories", Boolean.TRUE);
           engineMap.put("enableTimeBasedPublishing", Boolean.TRUE);
  -        engineMap.put("enableAdvancedWorkflow", new Boolean(true));
  +        engineMap.put("enableAdvancedWorkflow", Boolean.TRUE);
   //        engineMap.put("enableImportExport", Boolean.TRUE);
           // engineMap.put("enableContentDefinition", Boolean.TRUE);
  -        
  +
           // sets engineMap for JSPs
  -        jParams.setAttribute ("engineTitle", "Page properties");
  -        jParams.setAttribute ("org.jahia.engines.EngineHashMap",
  +        jParams.setAttribute("engineTitle", "Page properties");
  +        jParams.setAttribute("org.jahia.engines.EngineHashMap",
                   engineMap);
  -        
  +
           return engineMap;
       }
  -    
  +
       /**
        * loads data for the JSP file
        *
        * @param jParams   a ProcessingContext object (with request and 
response)
        * @param engineMap then engine map, to be forwarded to the JSP file
        */
  -    private void loadPageData (ProcessingContext jParams, HashMap engineMap)
  +    private void loadPageData(final ProcessingContext jParams, final HashMap 
engineMap)
               throws JahiaException {
           // check the arguments are valid
           if (jParams == null)
               throw new JahiaException("Invalid parameter", "jParam argument 
is null!!",
                       JahiaException.ENGINE_ERROR, 
JahiaException.ERROR_SEVERITY);
  -        
  -        JahiaPage thePage = (JahiaPage) engineMap.get("thePage");
  -        JahiaUser theUser = jParams.getUser();
  -        
  +
  +        final JahiaPage thePage = (JahiaPage) engineMap.get("thePage");
  +        final JahiaUser theUser = jParams.getUser();
  +
           // get only visibles templates
  -        Enumeration templateEnum = ServicesRegistry.getInstance ().
  -                getJahiaPageTemplateService ().
  -                getPageTemplates (theUser, thePage.getJahiaID (), true);
  +        final Enumeration templateEnum = servicesRegistry.
  +                getJahiaPageTemplateService().
  +                getPageTemplates(theUser, thePage.getJahiaID(), true);
   
           // get current page's template too even though it is desactivated
  -        ContentPage contentPage = ContentPage.getPage(thePage.getID());
  -        EntryLoadRequest loadRequest =
  +        final ContentPage contentPage = ContentPage.getPage(thePage.getID());
  +        final EntryLoadRequest loadRequest =
                   new EntryLoadRequest(EntryLoadRequest.ACTIVE_WORKFLOW_STATE, 
0,
  -                jParams.getEntryLoadRequest().getLocales());
  +                        jParams.getEntryLoadRequest().getLocales());
           // active page def
  -        JahiaPageDefinition activePageDef = contentPage.getPageTemplate(
  -                loadRequest);
  -        JahiaPageDefinition currentPageDef = thePage.getPageTemplate();
  -        
  +        final JahiaPageDefinition activePageDef = 
contentPage.getPageTemplate(loadRequest);
  +        final JahiaPageDefinition currentPageDef = thePage.getPageTemplate();
  +
           boolean addActivePageDef = true;
           boolean addCurrentPageDef = true;
   
  -        Vector vec = new Vector ();
  -        while (templateEnum.hasMoreElements ()) {
  -            JahiaPageDefinition tmpPageDef = (JahiaPageDefinition) 
templateEnum.
  -                    nextElement ();
  +        final Vector vec = new Vector();
  +        while (templateEnum.hasMoreElements()) {
  +            final JahiaPageDefinition tmpPageDef = (JahiaPageDefinition) 
templateEnum.
  +                    nextElement();
               if (activePageDef != null &&
                       (tmpPageDef.getID() == activePageDef.getID())) {
                   addActivePageDef = false;
  @@ -810,7 +800,7 @@
               }
               vec.add(tmpPageDef);
           }
  -        
  +
           if (addActivePageDef && activePageDef != null) {
               vec.add(activePageDef);
           }
  @@ -820,16 +810,16 @@
                   vec.add(currentPageDef);
               }
           }
  -        
  +
           // sort it
           if (currentPageDef != null) {
               Collections.sort(vec, currentPageDef);
           } else if (activePageDef != null) {
               Collections.sort(vec, activePageDef);
           }
  -        
  +
           engineMap.put("templateList", vec);
  -        
  +
           // existing pages, for move... not used yet
           /*
                    Enumeration pageTree = ServicesRegistry.getInstance().
  @@ -839,81 +829,80 @@
                    engineMap.put ("pageTree", pageTree);
            */
       }
  -    
  +
       /**
        * gets POST form data from the JSP file
        *
        * @param jParams   a ProcessingContext object (with request and 
response)
        * @param engineMap then engine map, to be forwarded to the JSP file
  -     *
        * @return true if everything went okay, false if not
        */
  -    private boolean updatePageData (ProcessingContext jParams, HashMap 
engineMap,
  -                                    String languageCode) {
  -        JahiaPageEngineTempBean pageTempBean = (JahiaPageEngineTempBean)
  -        engineMap.get("pageTempBean");
  -        
  -        EngineMessages engineMessages = new EngineMessages();
  -        
  +    private boolean updatePageData(final ProcessingContext jParams, final 
HashMap engineMap,
  +                                   final String languageCode) {
  +        final JahiaPageEngineTempBean pageTempBean = 
(JahiaPageEngineTempBean)
  +                engineMap.get("pageTempBean");
  +
  +        final EngineMessages engineMessages = new EngineMessages();
  +
           boolean result = false;
  -        Boolean validate = new Boolean ((jParams.getParameter (
  -                "validate") != null));
  +        final Boolean validate = 
Boolean.valueOf((jParams.getParameter("validate") != null));
   
  -        String pageTitle = jParams.getParameter ("pageTitle");
  +        final String pageTitle = jParams.getParameter("pageTitle");
           if (pageTitle != null) {
               pageTempBean.setTitle(languageCode, pageTitle);
               engineMap.put("validate", validate);
               result = true;
           }
  -        String pageURLKey = jParams.getParameter("pageURLKey");
  +        final String pageURLKey = jParams.getParameter("pageURLKey");
  +        logger.debug("updatePageData - pageURLKey: " + pageURLKey);
  +
           if (pageURLKey != null) {
               // we need to validate the pageURLKey.
               // first let's test it against reserved words that are not 
allowed.
               if (ProcessingContext.ENGINE_NAME_PARAMETER.equals(pageURLKey) ||
  -                ProcessingContext.SITE_KEY_PARAMETER.equals(pageURLKey) ||
  -                ProcessingContext.PAGE_ID_PARAMETER.equals(pageURLKey) ||
  -                
ProcessingContext.CONTAINERLIST_ID_PARAMETER.equals(pageURLKey) ||
  -                ProcessingContext.CONTAINER_ID_PARAMETER.equals(pageURLKey) 
||
  -                ProcessingContext.FIELD_ID_PARAMETER.equals(pageURLKey) ||
  -                
ProcessingContext.OPERATION_MODE_PARAMETER.equals(pageURLKey) ||
  -                ProcessingContext.ENTRY_STATE_PARAMETER.equals(pageURLKey) ||
  -                
ProcessingContext.SHOW_REVISION_DIFF_PARAMETER.equals(pageURLKey) ||
  -                ProcessingContext.VALIDATE_PARAMETER.equals(pageURLKey) ||
  -                ProcessingContext.LANGUAGE_CODE.equals(pageURLKey) ||
  -                ProcessingContext.RELEASE_LOCK.equals(pageURLKey) ||
  -                ProcessingContext.STEAL_LOCK.equals(pageURLKey) ||
  -                ProcessingContext.TEMPLATE_PARAMETER.equals(pageURLKey) ||
  -                ProcessingContext.CACHE_MODE_PARAMETER.equals(pageURLKey)) {
  +                    ProcessingContext.SITE_KEY_PARAMETER.equals(pageURLKey) 
||
  +                    ProcessingContext.PAGE_ID_PARAMETER.equals(pageURLKey) ||
  +                    
ProcessingContext.CONTAINERLIST_ID_PARAMETER.equals(pageURLKey) ||
  +                    
ProcessingContext.CONTAINER_ID_PARAMETER.equals(pageURLKey) ||
  +                    ProcessingContext.FIELD_ID_PARAMETER.equals(pageURLKey) 
||
  +                    
ProcessingContext.OPERATION_MODE_PARAMETER.equals(pageURLKey) ||
  +                    
ProcessingContext.ENTRY_STATE_PARAMETER.equals(pageURLKey) ||
  +                    
ProcessingContext.SHOW_REVISION_DIFF_PARAMETER.equals(pageURLKey) ||
  +                    ProcessingContext.VALIDATE_PARAMETER.equals(pageURLKey) 
||
  +                    ProcessingContext.LANGUAGE_CODE.equals(pageURLKey) ||
  +                    ProcessingContext.RELEASE_LOCK.equals(pageURLKey) ||
  +                    ProcessingContext.STEAL_LOCK.equals(pageURLKey) ||
  +                    ProcessingContext.TEMPLATE_PARAMETER.equals(pageURLKey) 
||
  +                    
ProcessingContext.CACHE_MODE_PARAMETER.equals(pageURLKey)) {
   
                   engineMessages.add("pageProperties", new 
EngineMessage("org.jahia.engines.pages.PageProperties_Engine.urlKeyIsReservedWord.label",
 pageURLKey));
  -                result = false;
  +                return false;
               } else if 
(pageURLKey.startsWith(ProcessingContext.CONTAINER_SCROLL_PREFIX_PARAMETER)) {
                   engineMessages.add("pageProperties", new 
EngineMessage("org.jahia.engines.pages.PageProperties_Engine.urlKeyIsReservedWord.label",
 pageURLKey));
  -                result = false;
  +                return false;
               }
               // now we must test whether it has been used already or not.
               try {
  -                List pageProperties = ServicesRegistry.getInstance().
  -                        getJahiaPageService().
  +                final List pageProperties = 
servicesRegistry.getJahiaPageService().
                           getPagePropertiesByValue(pageURLKey);
  -                Iterator propIter = pageProperties.iterator();
  +                final Iterator propIter = pageProperties.iterator();
                   while (propIter.hasNext()) {
  -                    PageProperty curProperty = (PageProperty) 
propIter.next();
  +                    final PageProperty curProperty = (PageProperty) 
propIter.next();
                       if 
((curProperty.getName().equals(PageProperty.PAGE_URL_KEY_PROPNAME)) &&
                               (curProperty.getPageID() != 
pageTempBean.getID())) {
                           engineMessages.add("pageProperties", new 
EngineMessage("org.jahia.engines.pages.PageProperties_Engine.urlKeyIsDuplicate.label",
 pageURLKey));
  -                        result = false;
  +                        return false;
                       }
                   }
               } catch (JahiaException je) {
                   logger.error("Error while verifying existance of page URL 
key duplicate", je);
  -                result = false;
  +                return false;
               }
  -            
  +
               // now we check the page URL key for any invalid characters,
               // although this is probably a temporary check that will no 
longer
               // be necessary once we have a proper URL encoding facility.
  -            if ( (pageURLKey.indexOf('/') != -1) ||
  +            if ((pageURLKey.indexOf('/') != -1) ||
                       (pageURLKey.indexOf(' ') != -1) ||
                       (pageURLKey.indexOf('@') != -1) ||
                       (pageURLKey.indexOf(':') != -1) ||
  @@ -922,11 +911,11 @@
                       (pageURLKey.indexOf('%') != -1) ||
                       (pageURLKey.indexOf('&') != -1) ||
                       (pageURLKey.indexOf('+') != -1) ||
  -                    (pageURLKey.indexOf('#') != -1) ) {
  +                    (pageURLKey.indexOf('#') != -1)) {
                   engineMessages.add("pageProperties", new 
EngineMessage("org.jahia.engines.pages.PageProperties_Engine.urlKeyHasInvalidChars.label",
 pageURLKey));
  -                result = false;
  +                return false;
               }
  -            
  +
               if (!jParams.settings().isUtf8Encoding()) {
                   // let's check that the character is allowed. Since URL 
encoding
                   // can cause problems with non-ASCII characters, we refuse 
any
  @@ -935,48 +924,47 @@
                       int curChar = (int) pageURLKey.charAt(i);
                       if ((curChar < 32) || (curChar > 127)) {
                           engineMessages.add("pageProperties", new 
EngineMessage("org.jahia.engines.pages.PageProperties_Engine.urlKeyHasInvalidChars.label",
 pageURLKey));
  -                        result = false;
  -                        break;
  +                        return false;
                       }
                   }
               }
               engineMap.put("dataPageURLKey", pageURLKey);
           }
  -        String pageDef = jParams.getParameter ("pageTemplate");
  +        final String pageDef = jParams.getParameter("pageTemplate");
           if (pageDef != null) {
  -            int pageTemplateID = Integer.parseInt(pageDef);
  +            final int pageTemplateID = Integer.parseInt(pageDef);
               pageTempBean.setPageTemplateID(pageTemplateID);
               engineMap.put("dataPageTemplateID", new Integer(pageTemplateID));
               engineMap.put("validate", validate);
           }
           if (!engineMessages.isEmpty()) {
  -            engineMessages.saveMessages(((ParamBean)jParams).getRequest());
  +            engineMessages.saveMessages(((ParamBean) jParams).getRequest());
           }
           return result;
       }
  -    
  -    private void DisplayEngineMap(HashMap engineMap) {
  -        StringBuffer output = new StringBuffer("Detail of engineMap :\n");
  -        
  -        Set keys = engineMap.keySet();
  -        Iterator iter = keys.iterator();
  -        
  -        while (iter.hasNext()) {
  -            String name = (String) iter.next();
  -            Object object = engineMap.get(name);
  -            output.append("-" + name + " = [" + object.toString() + "]\n");
  -        }
  -    }
  -    
  +
  +//    private void DisplayEngineMap(HashMap engineMap) {
  +//        StringBuffer output = new StringBuffer("Detail of engineMap :\n");
  +//
  +//        Set keys = engineMap.keySet();
  +//        Iterator iter = keys.iterator();
  +//
  +//        while (iter.hasNext()) {
  +//            String name = (String) iter.next();
  +//            Object object = engineMap.get(name);
  +//            output.append("-").append(name).append(" = 
[").append(object.toString()).append("]\n");
  +//        }
  +//    }
  +
       /**
        * loads the page cache bean with info from an existing JahiaPage
        *
        * @return a PageBean to use as cache for the page info
        */
  -    private JahiaPageEngineTempBean loadPageBeanFromRealPage(JahiaPage 
theRealPage) {
  -        
  +    private JahiaPageEngineTempBean loadPageBeanFromRealPage(final JahiaPage 
theRealPage) {
  +
           logger.debug("Making PageBean from REAL Page...");
  -        StringBuffer pageAttribute = new StringBuffer("        jahiaID       
: [");
  +        final StringBuffer pageAttribute = new StringBuffer("        jahiaID 
      : [");
           pageAttribute.append(theRealPage.getJahiaID());
           pageAttribute.append("]\n");
           pageAttribute.append("        parentID      : [");
  @@ -1000,10 +988,10 @@
           pageAttribute.append("        creator       : [");
           pageAttribute.append(theRealPage.getCreator());
           pageAttribute.append("]\n");
  -        
  +
           logger.debug(pageAttribute.toString());
  -        
  -        JahiaPageEngineTempBean thePage = new JahiaPageEngineTempBean(
  +
  +        return new JahiaPageEngineTempBean(
                   theRealPage.getID(),
                   theRealPage.getJahiaID(),
                   theRealPage.getParentID(),
  @@ -1013,33 +1001,29 @@
                   theRealPage.getPageLinkID(),
                   theRealPage.getCreator(),
                   -1 // linked field not used
  -                );
  -        return thePage;
  +        );
       }
   
  -    private void releaseTreeVersioningLocks (ProcessingContext jParams)
  +    private void releaseTreeVersioningLocks(final ProcessingContext jParams)
               throws JahiaException {
  -        if (jParams.settings ().areLocksActivated ()) {
  -            ArrayList acquiredPageLocks = (ArrayList) 
jParams.getSessionState().getAttribute(PagesVersioningAction.SESSION_VERSIONING_LOCK_LIST);
  +        if (jParams.settings().areLocksActivated()) {
  +            final ArrayList acquiredPageLocks = (ArrayList) 
jParams.getSessionState().getAttribute(PagesVersioningAction.SESSION_VERSIONING_LOCK_LIST);
               if (acquiredPageLocks == null) {
                   return;
               }
  -            HtmlCache htmlCache = 
ServicesRegistry.getInstance().getCacheService().getHtmlCacheInstance();
  -            ContentPage contentPage = ServicesRegistry.getInstance().
  -                    
getJahiaPageService().lookupContentPage(jParams.getPageID(), false);
  -            
  +            final HtmlCache htmlCache = cacheService.getHtmlCacheInstance();
  +
               // Lock all page site if possible.
  -            LockService lockRegistry = 
ServicesRegistry.getInstance().getLockService();
  -            Iterator acquiredPageIter = acquiredPageLocks.iterator();
  +            final Iterator acquiredPageIter = acquiredPageLocks.iterator();
               while (acquiredPageIter.hasNext()) {
                   int curPageID = ((Integer) 
acquiredPageIter.next()).intValue();
  -                LockKey lockKey = 
LockKey.composeLockKey(LockKey.UPDATE_PAGE_TYPE,
  +                final LockKey lockKey = 
LockKey.composeLockKey(LockKey.UPDATE_PAGE_TYPE,
                           curPageID, curPageID);
                   final JahiaUser user = jParams.getUser();
  -                lockRegistry.release(lockKey, user, user.getUserKey());
  +                lockService.release(lockKey, user, user.getUserKey());
                   htmlCache.invalidatePageEntries(Integer.toString(curPageID));
               }
           }
       }
  -    
  +
   }
  

Reply via email to