Author: xlawrence
Date: Mon Oct 29 17:00:15 2007
New Revision: 18986

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D18986&repname=
=3Djahia
Log:
Correctly set the EntryLoadRequest "withMarkForDeletion" flag in order to s=
ee the marked for deletion content objects in EDIT mode

Modified:
    trunk/core/src/java/org/jahia/data/containers/JahiaContainerSet.java
    trunk/core/src/java/org/jahia/hibernate/manager/JahiaContainerManager.j=
ava
    trunk/core/src/java/org/jahia/params/ProcessingContext.java
    trunk/core/src/java/org/jahia/services/containers/ContainerListFactoryP=
roxy.java

Modified: trunk/core/src/java/org/jahia/data/containers/JahiaContainerSet.j=
ava
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/data/containers/JahiaContainerSet.java&rev=3D18986&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/core/src/java/org/jahia/data/containers/JahiaContainerSet.java (o=
riginal)
+++ trunk/core/src/java/org/jahia/data/containers/JahiaContainerSet.java Mo=
n Oct 29 17:00:15 2007
@@ -1206,13 +1206,16 @@
                         EntryLoadRequest loadRequest =3D (EntryLoadRequest=
)ctnLoadRequest.clone();
                         if (loadRequest.isVersioned()) {
                             if (this.jData.getProcessingContext().showRevi=
sionDiff()) {
-                                // @todo :
-                                // not fully handle so we dont load delete=
d yet
+                                // todo not fully handle so we dont load d=
eleted yet
                                 loadRequest.setWithDeleted(true);
                                 loadRequest.setWithMarkedForDeletion(true);
                             } else {
                                 loadRequest.setWithDeleted(false);
-                                loadRequest.setWithMarkedForDeletion(false=
);
+                                if (jData.getProcessingContext().getOpMode=
().equals(ProcessingContext.EDIT)) {
+                                    loadRequest.setWithMarkedForDeletion(t=
rue);
+                                } else {
+                                    loadRequest.setWithMarkedForDeletion(f=
alse);
+                                }
                             }
                         }
                         try {
@@ -1299,7 +1302,11 @@
                         loadRequest.setWithMarkedForDeletion(true);
                     } else {
                         loadRequest.setWithDeleted(false);
-                        loadRequest.setWithMarkedForDeletion(false);
+                        if (jData.getProcessingContext().getOpMode().equal=
s(ProcessingContext.EDIT)) {
+                            loadRequest.setWithMarkedForDeletion(true);
+                        } else {
+                            loadRequest.setWithMarkedForDeletion(false);
+                        }
                     }
                     ContainerFactory.getInstance()
                             .fullyLoadContainerList(aList, LoadFlags.ALL,
@@ -1415,7 +1422,11 @@
                         loadRequest.setWithMarkedForDeletion(true);
                     } else {
                         loadRequest.setWithDeleted(false);
-                        loadRequest.setWithMarkedForDeletion(false);
+                        if (jData.getProcessingContext().getOpMode().equal=
s(ProcessingContext.EDIT)) {
+                            loadRequest.setWithMarkedForDeletion(true);
+                        } else {
+                            loadRequest.setWithMarkedForDeletion(false);
+                        }
                     }
 =

                     if (theContainerList =3D=3D null) {

Modified: trunk/core/src/java/org/jahia/hibernate/manager/JahiaContainerMan=
ager.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/hibernate/manager/JahiaContainerManager.java&rev=3D18986&repname=
=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/core/src/java/org/jahia/hibernate/manager/JahiaContainerManager.j=
ava (original)
+++ trunk/core/src/java/org/jahia/hibernate/manager/JahiaContainerManager.j=
ava Mon Oct 29 17:00:15 2007
@@ -675,7 +675,7 @@
                     if ( request !=3D null ){
                         staged =3D new EntryLoadRequest(0,diffVersionID,re=
quest.getLocales());
                         staged.setWithDeleted(false);
-                        staged.setWithMarkedForDeletion(false);
+                        //staged.setWithMarkedForDeletion(false);
                     }
                 }
                 JahiaContainer container =3D this.loadContainer(containerI=
d,staged,false);
@@ -693,7 +693,7 @@
                     if ( request !=3D null ){
                         staged =3D new EntryLoadRequest(0,diffVersionID,re=
quest.getLocales());
                         staged.setWithDeleted(false);
-                        staged.setWithMarkedForDeletion(false);
+                       // staged.setWithMarkedForDeletion(false);
                     }
                 }
                 JahiaContainer container =3D this.loadContainer(containerI=
d,staged,false);

Modified: trunk/core/src/java/org/jahia/params/ProcessingContext.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/params/ProcessingContext.java&rev=3D18986&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/core/src/java/org/jahia/params/ProcessingContext.java (original)
+++ trunk/core/src/java/org/jahia/params/ProcessingContext.java Mon Oct 29 =
17:00:15 2007
@@ -784,12 +784,11 @@
                 EntryLoadRequest.ACTIVE_WORKFLOW_STATE, 0, getLocales());
         // compute version info
         if (this.getSiteID() !=3D -1) {
-            if (((EDIT.equals(getOpMode())) || (PREVIEW.equals(getOpMode()=
)) || (COMPARE
-                    .equals(getOpMode())))
-                    && (REGISTRY.getJahiaVersionService().isStagingEnabled=
(this
-                            .getSiteID()))) {
+            if (((EDIT.equals(getOpMode())) || (PREVIEW.equals(getOpMode()=
)) || (COMPARE.equals(getOpMode())))
+                    && (REGISTRY.getJahiaVersionService().isStagingEnabled=
(this.getSiteID()))) {
                 newLoadRequest =3D new EntryLoadRequest(
-                        EntryLoadRequest.STAGING_WORKFLOW_STATE, 0,
+                        EntryLoadRequest.STAGING_WORKFLOW_STATE,
+                        0,
                         getLocales());
                 // this.cacheStatus =3D ProcessingContext.CACHE_OFF; deact=
ivated because
                 // we can't see a reason to have this here.
@@ -1097,12 +1096,10 @@
         // reset the locales
         setLocaleList(null);
         getSessionState().setAttribute(SESSION_LOCALE, locale);
-        setEntryLoadRequest(new EntryLoadRequest(getEntryLoadRequest()
-                .getWorkflowState(), getEntryLoadRequest().getVersionID(),
-                getLocales()));
+        setEntryLoadRequest(new EntryLoadRequest(getEntryLoadRequest().get=
WorkflowState(), getEntryLoadRequest().getVersionID(),
+                getLocales(), getEntryLoadRequest().isWithMarkedForDeletio=
n()));
         resetSubstituteEntryLoadRequest();
-        setParameter(ProcessingContext.LANGUAGE_CODE, this.getCurrentLocal=
e()
-                .toString());
+        setParameter(ProcessingContext.LANGUAGE_CODE, this.getCurrentLocal=
e().toString());
         resolveJahiaPage();
     }
 =

@@ -3136,23 +3133,20 @@
 =

             final int deleteVersionID =3D getContentPage().getDeleteVersio=
nID();
             if (deleteVersionID !=3D -1) {
-
                 // page has been recently deleted, let's check if we can
                 // display it or not.
-
                 if (NORMAL.equals(getOpMode())) {
                     // this is the case of try to access a deleted page in=
 NORMAL
                     // mode which is not allowed.
                     throw new JahiaPageNotFoundException(pageID);
+
                 } else if (CORE_ENGINE_NAME.equals(this.getEngine())
                         && EDIT.equals(getOpMode())
-                        && (!getContentPage().hasStagingEntries() || getCo=
ntentPage()
-                                .isMarkedForDelete())) {
-                    // try to access a deleted page or yet market for dele=
te in EDIT
-                    // mode is not allowed.
+                        && (!getContentPage().hasStagingEntries() /* || ge=
tContentPage().isMarkedForDelete() */ )) {
+                    // try to access a deleted page in EDIT mode is not al=
lowed.
                     throw new JahiaPageNotFoundException(pageID);
-                } else if ((COMPARE.equals(getOpMode()) || (PREVIEW
-                        .equals(getOpMode())))
+
+                } else if ((COMPARE.equals(getOpMode()) || (PREVIEW.equals=
(getOpMode())))
                         && (!getContentPage().checkWriteAccess(getTheUser(=
)))) {
                     // we can view a deleted page in compare and preview m=
ode
                     // only if we can do edition operations on the page.
@@ -3160,12 +3154,15 @@
                 }
             }
 =

-            // if (CORE_ENGINE_NAME.equals(getEngine()) &&
-            // EDIT.equals(getOpMode()) &&
-            // getContentPage().isMarkedForDelete()) {
-            // // try to access a marked for delete in EDIT mode is not al=
lowed.
-            // throw new JahiaPageNotFoundException(pageID);
-            // }
+            if (CORE_ENGINE_NAME.equals(getEngine()) && EDIT.equals(getOpM=
ode()) &&
+                    ! getEntryLoadRequest().isWithMarkedForDeletion()) {
+                // try to access a marked for delete in EDIT mode is not a=
llowed.
+                setEntryLoadRequest(new EntryLoadRequest(
+                        EntryLoadRequest.STAGING_WORKFLOW_STATE, 0,
+                        getLocales(), true));
+                // reset substitute entry load request
+                resetSubstituteEntryLoadRequest();
+            }
 =

             // if the page is not found, throw the associated exception
             if (NORMAL.equals(getOpMode())
@@ -3186,11 +3183,9 @@
 =

         if ((getContentPage() =3D=3D null)
                 || ((getOpMode().equals(NORMAL) || getOpMode().equals(COMP=
ARE))
-                        && getEntryLoadRequest().isCurrent() && !getConten=
tPage()
-                        .hasActiveEntries())
+                        && getEntryLoadRequest().isCurrent() && !getConten=
tPage().hasActiveEntries())
                 || ((getOpMode().equals(NORMAL) || getOpMode().equals(COMP=
ARE))
-                        && getEntryLoadRequest().isCurrent() && getContent=
Page()
-                        .getTitle(getEntryLoadRequest()) =3D=3D null)) {
+                        && getEntryLoadRequest().isCurrent() && getContent=
Page().getTitle(getEntryLoadRequest()) =3D=3D null)) {
             throw new JahiaPageNotFoundException(pageID);
         }
         // Ensure if the requested page is a page of the current site

Modified: trunk/core/src/java/org/jahia/services/containers/ContainerListFa=
ctoryProxy.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/services/containers/ContainerListFactoryProxy.java&rev=3D18986&rep=
name=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/core/src/java/org/jahia/services/containers/ContainerListFactoryP=
roxy.java (original)
+++ trunk/core/src/java/org/jahia/services/containers/ContainerListFactoryP=
roxy.java Mon Oct 29 17:00:15 2007
@@ -103,8 +103,12 @@
                 currentLoadRequest.setWithMarkedForDeletion(true);
             } else {
                 currentLoadRequest.setWithDeleted(false);
-                currentLoadRequest.setWithMarkedForDeletion(false);
-            }            =

+                if (jParams.getOpMode().equals(ProcessingContext.EDIT)) {
+                    currentLoadRequest.setWithMarkedForDeletion(true);
+                } else {
+                    currentLoadRequest.setWithMarkedForDeletion(false);
+                }
+            }
             ContainerFactory.getInstance()
                 .fullyLoadContainerList(containerList,
                 loadFlag, jParams, currentLoadRequest, cachedFieldsFromCon=
tainers,

_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list

Reply via email to