knguyen 2004/09/28 11:28:20 CEST
Modified files: (Branch: JAHIA-4-0-BRANCH)
src/java/org/jahia/content AbstractContentTreeVisitor.java
ContentTree.java
ContentTreeVisitorInterface.java
src/java/org/jahia/services/fields ContentPageField.java
JahiaFieldBaseService.java
src/java/org/jahia/services/pages JahiaPageBaseService.java
JahiaPageService.java
src/java/org/jahia/services/version
ContentTreeRevisionsVisitor.java
PageRevisionsCompositor.java
UndoStagingContentTreeVisitor.java
src/java/org/jahia/views/engines/versioning/pages/actions
PagesVersioningAction.java
Log:
- cleaning ContentTree
- fix page move activation
Revision Changes Path
1.4.4.1 +19 -9
jahia/src/java/org/jahia/content/AbstractContentTreeVisitor.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/content/AbstractContentTreeVisitor.java.diff?r1=1.4&r2=1.4.4.1&f=h
1.6.4.3 +31 -45 jahia/src/java/org/jahia/content/ContentTree.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/content/ContentTree.java.diff?r1=1.6.4.2&r2=1.6.4.3&f=h
1.3.4.1 +18 -10
jahia/src/java/org/jahia/content/ContentTreeVisitorInterface.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/content/ContentTreeVisitorInterface.java.diff?r1=1.3&r2=1.3.4.1&f=h
1.74.4.4 +59 -36 jahia/src/java/org/jahia/services/fields/ContentPageField.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/services/fields/ContentPageField.java.diff?r1=1.74.4.3&r2=1.74.4.4&f=h
1.104.2.5 +2 -0
jahia/src/java/org/jahia/services/fields/JahiaFieldBaseService.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/services/fields/JahiaFieldBaseService.java.diff?r1=1.104.2.4&r2=1.104.2.5&f=h
1.67.2.5 +36 -1
jahia/src/java/org/jahia/services/pages/JahiaPageBaseService.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/services/pages/JahiaPageBaseService.java.diff?r1=1.67.2.4&r2=1.67.2.5&f=h
1.28.2.4 +37 -0 jahia/src/java/org/jahia/services/pages/JahiaPageService.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/services/pages/JahiaPageService.java.diff?r1=1.28.2.3&r2=1.28.2.4&f=h
1.5.4.1 +2 -3
jahia/src/java/org/jahia/services/version/ContentTreeRevisionsVisitor.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/services/version/ContentTreeRevisionsVisitor.java.diff?r1=1.5&r2=1.5.4.1&f=h
1.2.4.2 +6 -3
jahia/src/java/org/jahia/services/version/PageRevisionsCompositor.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/services/version/PageRevisionsCompositor.java.diff?r1=1.2.4.1&r2=1.2.4.2&f=h
1.5.2.4 +17 -8
jahia/src/java/org/jahia/services/version/UndoStagingContentTreeVisitor.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/services/version/UndoStagingContentTreeVisitor.java.diff?r1=1.5.2.3&r2=1.5.2.4&f=h
1.19.2.3 +0 -88
jahia/src/java/org/jahia/views/engines/versioning/pages/actions/PagesVersioningAction.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/views/engines/versioning/pages/actions/PagesVersioningAction.java.diff?r1=1.19.2.2&r2=1.19.2.3&f=h
Index: AbstractContentTreeVisitor.java
===================================================================
RCS file:
/home/cvs/repository/jahia/src/java/org/jahia/content/Attic/AbstractContentTreeVisitor.java,v
retrieving revision 1.4
retrieving revision 1.4.4.1
diff -u -r1.4 -r1.4.4.1
--- AbstractContentTreeVisitor.java 30 Jun 2003 22:29:07 -0000 1.4
+++ AbstractContentTreeVisitor.java 28 Sep 2004 09:28:18 -0000 1.4.4.1
@@ -154,8 +154,7 @@
* @throws JahiaException
*/
public void processContentObjectBeforeChilds(
- ContentObject contentObject,
- ContentTreeStatusInterface contentStatusInterface, int currentPageLevel)
+ ContentObject contentObject, int currentPageLevel)
throws JahiaException{
// do nothing by default
}
@@ -164,31 +163,42 @@
* Called after processing the current object's childs when traversing the tree
*
* @param contentObject
- * @param contentTreeStatus
* @param currentPageLevel
* @throws JahiaException
*/
public void processContentObjectAfterChilds(
- ContentObject contentObject,
- ContentTreeStatusInterface contentTreeStatus, int currentPageLevel)
+ ContentObject contentObject, int currentPageLevel)
throws JahiaException{
// do nothing by default
}
/**
+ * Called after the childs has been processed and the ContentTreeStatus has been
+ * set with continueAfterChilds = false. usually, we should simply do nothing
with
+ * the contentObject, as requested by one of this child.
+ *
+ * @param contentObject
+ * @param currentPageLevel
+ * @throws JahiaException
+ */
+ public void stopProcessContentObjectAfterChilds(
+ ContentObject contentObject, int currentPageLevel)
+ throws JahiaException {
+ // do nothing by default
+ }
+
+ /**
* Process the Last Content page Field on which, we reached the page level
limit when
* descending in subtree.
*
* @param contentObject the last content page field on which we reach the page
level limit.
- * @param contentStatusInterface
* @param currentPageLevel
* @throws JahiaException
*/
public void processLastContentPageField(
- ContentObject contentObject,
- ContentTreeStatusInterface contentStatusInterface, int currentPageLevel)
+ ContentObject contentObject, int currentPageLevel)
throws JahiaException{
// do nothing by default
}
-}
\ No newline at end of file
+}
Index: ContentTree.java
===================================================================
RCS file:
/home/cvs/repository/jahia/src/java/org/jahia/content/Attic/ContentTree.java,v
retrieving revision 1.6.4.2
retrieving revision 1.6.4.3
diff -u -r1.6.4.2 -r1.6.4.3
--- ContentTree.java 24 Sep 2004 13:56:34 -0000 1.6.4.2
+++ ContentTree.java 28 Sep 2004 09:28:18 -0000 1.6.4.3
@@ -96,10 +96,9 @@
* @param contentObject
* @param visitor
* @param currentPageLevel
- * @return the last ContentTreeStatus on the stack
* @throws JahiaException
*/
- private ContentTreeStatusInterface iterate(ContentObject contentObject,
+ private void iterate(ContentObject contentObject,
ContentTreeVisitorInterface visitor,
int currentPageLevel)
throws JahiaException {
@@ -115,54 +114,41 @@
&& currentPageLevel>descendingPageLevel ){
// process last ContentPageField for which we don't want to go further
- visitor.processLastContentPageField(contentObject,
- contentTreeStatus, currentPageLevel);
-
+ visitor.processLastContentPageField(contentObject, currentPageLevel);
// stop iterate further
- this.contentTreeStatusStack.pop();
- return contentTreeStatus;
- }
-
- // processing root object
- visitor.processContentObjectBeforeChilds(contentObject,
- contentTreeStatus, currentPageLevel);
-
- ContentTreeStatusInterface childCTS = null;
-
- // processing childs object
- if ( visitor.withChildsContent()
- && contentTreeStatus.continueWithChilds() ){
- ArrayList childs = visitor.getChilds(contentObject,
- currentPageLevel);
- Iterator childsIterator = childs.iterator();
- ContentObject childContentObject;
- while( childsIterator.hasNext() ){
- childContentObject = (ContentObject)childsIterator.next();
- if ( childContentObject instanceof ContentPageField ){
- childCTS =
iterate(childContentObject,visitor,currentPageLevel+1);
- } else {
- childCTS = iterate(childContentObject,visitor,currentPageLevel);
- }
- if ( !childCTS.continueAfterChilds() ){
- contentTreeStatus.setContinueAfterChilds(false);
- //return contentTreeStatus;
- }
- if ( !childCTS.continueWithNextContentObject() ){
- break;
- //contentTreeStatus.setContinueWithNextContentObject(false);
- //return contentTreeStatus;
+ } else {
+ // processing root object
+ visitor.processContentObjectBeforeChilds(contentObject,
+ currentPageLevel);
+
+ // processing childs object
+ if (visitor.withChildsContent()
+ && contentTreeStatus.continueWithChilds()) {
+ ArrayList childs = visitor.getChilds(contentObject,
+ currentPageLevel);
+ Iterator childsIterator = childs.iterator();
+ ContentObject childContentObject;
+ while (childsIterator.hasNext()
+ && contentTreeStatus.continueWithChilds()) {
+ childContentObject = (ContentObject) childsIterator.next();
+ if (childContentObject instanceof ContentPageField) {
+ iterate(childContentObject, visitor,
+ currentPageLevel + 1);
+ }
+ else {
+ iterate(childContentObject, visitor, currentPageLevel);
+ }
}
}
+ if (contentTreeStatus.continueAfterChilds()) {
+ visitor.processContentObjectAfterChilds(contentObject,
+ currentPageLevel);
+ } else {
+ visitor.stopProcessContentObjectAfterChilds(contentObject,
+ currentPageLevel);
+ }
}
- if ( contentTreeStatus.continueAfterChilds() ){
- visitor.processContentObjectAfterChilds(contentObject,
- contentTreeStatus, currentPageLevel);
- }
-
- contentTreeStatus.setContinueAfterChilds(true);
-
// remove the status
this.contentTreeStatusStack.pop();
- return contentTreeStatus;
}
}
Index: ContentTreeVisitorInterface.java
===================================================================
RCS file:
/home/cvs/repository/jahia/src/java/org/jahia/content/Attic/ContentTreeVisitorInterface.java,v
retrieving revision 1.3
retrieving revision 1.3.4.1
diff -u -r1.3 -r1.3.4.1
--- ContentTreeVisitorInterface.java 30 Jun 2003 22:29:07 -0000 1.3
+++ ContentTreeVisitorInterface.java 28 Sep 2004 09:28:18 -0000 1.3.4.1
@@ -105,40 +105,48 @@
* Called before processing the current content object's childs
*
* @param contentObject
- * @param contentStatusInterface
* @param currentPageLevel
* @throws JahiaException
*/
public abstract void processContentObjectBeforeChilds(
- ContentObject contentObject,
- ContentTreeStatusInterface contentStatusInterface, int currentPageLevel)
+ ContentObject contentObject, int currentPageLevel)
throws JahiaException;
/**
* Called after processing the current object's childs when traversing the tree
*
* @param contentObject
- * @param contentTreeStatus
* @param currentPageLevel
* @throws JahiaException
*/
public abstract void processContentObjectAfterChilds(
- ContentObject contentObject,
- ContentTreeStatusInterface contentTreeStatus, int currentPageLevel)
+ ContentObject contentObject, int currentPageLevel)
throws JahiaException;
/**
+ * Called after the childs has been processed and the ContentTreeStatus has been
+ * set with continueAfterChilds = false. usually, we should simply do nothing
with
+ * the contentObject, as requested by one of this child.
+ *
+ * @param contentObject
+ * @param currentPageLevel
+ * @throws JahiaException
+ */
+ public abstract void stopProcessContentObjectAfterChilds(
+ ContentObject contentObject, int currentPageLevel)
+ throws JahiaException;
+
+
+ /**
* Process the Last Content page Field on which, we reached the page level
limit when
* descending in subtree.
*
* @param contentObject the last content page field on which we reach the page
level limit.
- * @param contentStatusInterface
* @param currentPageLevel
* @throws JahiaException
*/
public abstract void processLastContentPageField(
- ContentObject contentObject,
- ContentTreeStatusInterface contentStatusInterface, int currentPageLevel)
+ ContentObject contentObject, int currentPageLevel)
throws JahiaException;
-}
\ No newline at end of file
+}
Index: ContentPageField.java
===================================================================
RCS file:
/home/cvs/repository/jahia/src/java/org/jahia/services/fields/Attic/ContentPageField.java,v
retrieving revision 1.74.4.3
retrieving revision 1.74.4.4
diff -u -r1.74.4.3 -r1.74.4.4
--- ContentPageField.java 24 Sep 2004 16:29:23 -0000 1.74.4.3
+++ ContentPageField.java 28 Sep 2004 09:28:18 -0000 1.74.4.4
@@ -240,47 +240,69 @@
ActivationTestResults activationTestResults = new ActivationTestResults ();
ContentPage contentPage = null;
- try {
- // It exists the possibility that the field value for a page is
- // a text default value such "<jahia_linkonly>" instead a
- // reference to an existing Jahia page. In this case, the
- // link is broken meanning that the page actually does not exists.
- contentPage = getContentPage (jParams);
- } catch (NumberFormatException nfe) {
- logger.debug ("Page link seems to have an invalid value.");
- // this is not considered an error because we must be able to
- // validate containers that have "unfilled" values.
- /*
-
activationTestResults.setStatus(ActivationTestResults.PARTIAL_OPERATION_STATUS);
+
+ //1 ) Try with staged value
+ ContentObjectEntryState entryState = null;
+ ContentObjectEntryState activeEntryState = null;
+ ContentObjectEntryState stagedEntryState = null;
+
+ Set entrySets = this.getActiveAndStagingEntryStates();
+ Iterator iterator = entrySets.iterator();
+ while ( iterator.hasNext() ){
+ entryState = (ContentObjectEntryState)iterator.next();
+ if (
entryState.getWorkflowState()>ContentObjectEntryState.WORKFLOW_STATE_ACTIVE ){
+ stagedEntryState = entryState;
+ } else {
+ activeEntryState = entryState;
+ }
+ }
+
+ boolean movedPage = false;
+ if ( stagedEntryState != null ){
try {
- IsValidForActivationResults activationResults = new
- IsValidForActivationResults (
- ContentFieldKey.FIELD_TYPE, getID (),
- jParams.getLocale ().toString (),
- "A page field is declared in template but does not
exist.");
- activationTestResults.appendWarning (activationResults);
- return activationTestResults;
- } catch (ClassNotFoundException cnfe) {
- // normally this shouldn't happen !
- logger.debug ("ObjectKey is of invalid type, this should never
happen !", cnfe);
- return null;
- }*/
+ String value = this.getValue(stagedEntryState);
+ if ( value != null && Integer.parseInt(value)>0 ){
+ contentPage = ContentPage.getPage(Integer.parseInt(value));
+ if ( contentPage != null ){
+ // check if page not currently moved
+ if ( ServicesRegistry.getInstance().getJahiaPageService()
+
.getStagingAndActivePageFieldIDs(contentPage.getID()).size()>1 ){
+ // two different page fields are pointing the same page
+ // It's a moved page !
+ movedPage = true;
+ }
+ }
+ }
+ } catch (NumberFormatException nfe) {
+ logger.debug ("Page link seems to have an invalid value.");
+ // this is not considered an error because we must be able to
+ // validate containers that have "unfilled" values.
+ }
}
- if ( contentPage == null ){
+
+ if ( !movedPage && activeEntryState != null ){
try {
- // We need to check if this page field is not referring to a page
actually moved
- ContentObjectEntryState entryState =
- new ContentObjectEntryState(ContentObjectEntryState
- .WORKFLOW_STATE_START_STAGING, -1,
- ContentObject.SHARED_LANGUAGE);
- String val = this.getValue(entryState);
- contentPage = ContentPage.getPage(Integer.parseInt(val));
- } catch ( Throwable t ){
- logger.debug(t);
+ String value = this.getValue(activeEntryState);
+ if ( value != null && Integer.parseInt(value)>0 ){
+ contentPage = ContentPage.getPage(Integer.parseInt(value));
+ if ( contentPage != null ){
+ // check if page not currently moved
+ if ( ServicesRegistry.getInstance().getJahiaPageService()
+
.getStagingAndActivePageFieldIDs(contentPage.getID()).size()>1 ){
+ // two different page fields are pointing the same page
+ // It's a moved page !
+ movedPage = true;
+ }
+ }
+ }
+ } catch (NumberFormatException nfe) {
+ logger.debug ("Page link seems to have an invalid value.");
+ // this is not considered an error because we must be able to
+ // validate containers that have "unfilled" values.
}
}
- if ( contentPage != null &&
- (contentPage.hasSameParentID() != ContentPage.SAME_PARENT) ){
+
+ if ( movedPage ){
// the page is currently in a move state, but not activated
if (
!stateModifContext.getStartObject().equals(contentPage.getObjectKey()) ){
activationTestResults.setStatus(ActivationTestResults.
@@ -299,6 +321,7 @@
return activationTestResults;
}
}
+
if (contentPage == null) {
// this could happen if the database had a jahia_link_only value
activationTestResults.setStatus
(ActivationTestResults.PARTIAL_OPERATION_STATUS);
Index: JahiaFieldBaseService.java
===================================================================
RCS file:
/home/cvs/repository/jahia/src/java/org/jahia/services/fields/Attic/JahiaFieldBaseService.java,v
retrieving revision 1.104.2.4
retrieving revision 1.104.2.5
diff -u -r1.104.2.4 -r1.104.2.5
--- JahiaFieldBaseService.java 29 Jul 2004 15:39:53 -0000 1.104.2.4
+++ JahiaFieldBaseService.java 28 Sep 2004 09:28:18 -0000 1.104.2.5
@@ -1266,6 +1266,8 @@
ActivationTestResults activationResults = new ActivationTestResults ();
+ /** FIXME : this test has no meaning, because,
areFieldsValidForActivation(...)
+ * always move Error status to Warning status !!!!! */
activationResults.merge (
areFieldsValidForActivation (languageCodes, pageID, user,
saveVersion, jParams,
stateModifContext));
Index: JahiaPageBaseService.java
===================================================================
RCS file:
/home/cvs/repository/jahia/src/java/org/jahia/services/pages/Attic/JahiaPageBaseService.java,v
retrieving revision 1.67.2.4
retrieving revision 1.67.2.5
diff -u -r1.67.2.4 -r1.67.2.5
--- JahiaPageBaseService.java 23 Sep 2004 16:31:24 -0000 1.67.2.4
+++ JahiaPageBaseService.java 28 Sep 2004 09:28:19 -0000 1.67.2.5
@@ -914,6 +914,9 @@
* if pageInfosFlag is ContentPage.ARCHIVED_PAGE_INFOS,
* returns child pages ( returns pages that are active or deleted too )
*
+ * if pageInfosFlag is ContentPage.ACTIVE_PAGE_INFOS &
ContentPage.STAGING_PAGE_INFOS,
+ * returns child pages ( returns pages that are active or deleted or only
staged )
+ *
* Return an enumeration holding all the child PAGE(!) of the specified page.
* This method checks the rights for a user and loads only the pages a user
* is allowed to see.
@@ -942,7 +945,39 @@
Integer intPageID = new Integer(pageID);
Vector childIDs = new Vector();
- if ( (pageInfosFlag & ContentPage.STAGING_PAGE_INFOS) != 0) {
+ if ( ((pageInfosFlag & ContentPage.STAGING_PAGE_INFOS) != 0)
+ && ((pageInfosFlag & ContentPage.ACTIVE_PAGE_INFOS) != 0) ) {
+ childIDs = mUtilsDB.getStagingPageChildIDs(pageID);
+ Vector activeChildIDs = mUtilsDB.getActivePageChildIDs(pageID);
+ // add the deleted childs too
+ int size = activeChildIDs.size();
+ Integer I = null;
+ for ( int i=0; i<size; i++ ){
+ I = (Integer)activeChildIDs.get(i);
+ if ( !childIDs.contains(I) ){
+ int size2 = childIDs.size();
+ Integer J = null;
+ int pos = -1;
+ boolean bigger = false;
+ for ( int j=0; j<size2; j++ ){
+ J = (Integer)childIDs.get(j);
+ bigger = false;
+ if ( I.intValue() > J.intValue() ){
+ pos = j;
+ bigger = true;
+ }
+ if ( pos != -1 && !bigger ){
+ break;
+ }
+ }
+ if ( pos != -1 ){
+ childIDs.add(pos+1,I);
+ } else {
+ childIDs.add(0,I);
+ }
+ }
+ }
+ } else if ( (pageInfosFlag & ContentPage.STAGING_PAGE_INFOS) != 0) {
childIDs = mUtilsDB.getStagingPageChildIDs(pageID);
} else if ( (pageInfosFlag & ContentPage.ACTIVE_PAGE_INFOS) != 0) {
childIDs = mUtilsDB.getActivePageChildIDs(pageID);
Index: JahiaPageService.java
===================================================================
RCS file:
/home/cvs/repository/jahia/src/java/org/jahia/services/pages/Attic/JahiaPageService.java,v
retrieving revision 1.28.2.3
retrieving revision 1.28.2.4
diff -u -r1.28.2.3 -r1.28.2.4
--- JahiaPageService.java 23 Sep 2004 16:31:25 -0000 1.28.2.3
+++ JahiaPageService.java 28 Sep 2004 09:28:19 -0000 1.28.2.4
@@ -331,6 +331,43 @@
throws JahiaException;
/**
+ * An implementation that support versioning !
+ *
+ * if pageInfosFlag is ContentPage.ACTIVE_PAGE_INFOS,
+ * returns active child pages only
+ *
+ * if pageInfosFlag is ContentPage.STAGING_PAGE_INFOS,
+ * returns staging and child pages ( returns pages that are marked for delete
too )
+ *
+ * if pageInfosFlag is ContentPage.ARCHIVED_PAGE_INFOS,
+ * returns child pages ( returns pages that are active or deleted too )
+ *
+ * if pageInfosFlag is ContentPage.ACTIVE_PAGE_INFOS &
ContentPage.STAGING_PAGE_INFOS,
+ * returns child pages ( returns pages that are active or deleted or only
staged )
+ *
+ * Return an enumeration holding all the child PAGE(!) of the specified page.
+ * This method checks the rights for a user and loads only the pages a user
+ * is allowed to see.
+ *
+ * @param pageID the source page ID
+ * @param user a <code>JahiaUser</code> reference for which to check
+ * the rights on the
+ * pages
+ * @param pageInfosFlag if Archived, return all
+ * @param languageCode if <code>null</code>, return all language
+ * @param versionId used only if pageInfosFlag =
ContentPage.ARCHIVED_PAGE_INFOS
+ * @param directPageOnly sould we return only direct page or not
+ * @return a Vector of JahiaPage objects that are the childs of this page
+ * @throws JahiaException thrown in the case we have problems while loading
data from the persistent storage
+ */
+ public abstract Vector getContentPageChilds (int pageID,
+ JahiaUser user,
+ int pageInfosFlag,
+ String languageCode,
+ int versionId,
+ boolean directPageOnly) throws
JahiaException;
+
+ /**
* Should be used in place of getPagePath , use ContentPage instead of JahiaPage
*
* @param pageID
Index: ContentTreeRevisionsVisitor.java
===================================================================
RCS file:
/home/cvs/repository/jahia/src/java/org/jahia/services/version/Attic/ContentTreeRevisionsVisitor.java,v
retrieving revision 1.5
retrieving revision 1.5.4.1
diff -u -r1.5 -r1.5.4.1
--- ContentTreeRevisionsVisitor.java 12 Aug 2003 18:00:33 -0000 1.5
+++ ContentTreeRevisionsVisitor.java 28 Sep 2004 09:28:19 -0000 1.5.4.1
@@ -136,12 +136,11 @@
* process the current content object when traversing the tree
*
* @param contentObject
- * @param contentTreeStatus
* @param currentPageLevel
* @throws JahiaException
*/
public abstract void processContentObjectBeforeChilds(ContentObject
contentObject,
- ContentTreeStatusInterface contentTreeStatus, int currentPageLevel)
+ int currentPageLevel)
throws JahiaException;
/**
@@ -397,4 +396,4 @@
Arrays.sort(array,comparator);
this.revisionsList = new ArrayList(Arrays.asList(array));
}
-}
\ No newline at end of file
+}
Index: PageRevisionsCompositor.java
===================================================================
RCS file:
/home/cvs/repository/jahia/src/java/org/jahia/services/version/Attic/PageRevisionsCompositor.java,v
retrieving revision 1.2.4.1
retrieving revision 1.2.4.2
diff -u -r1.2.4.1 -r1.2.4.2
--- PageRevisionsCompositor.java 17 Aug 2004 13:55:19 -0000 1.2.4.1
+++ PageRevisionsCompositor.java 28 Sep 2004 09:28:19 -0000 1.2.4.2
@@ -54,19 +54,21 @@
* process the current content object when traversing the tree
*
* @param contentObject
- * @param contentTreeStatus
* @param currentPageLevel
* @throws JahiaException
*/
- public void processContentObjectBeforeChilds(ContentObject contentObject,
- ContentTreeStatusInterface contentTreeStatus, int currentPageLevel)
+ public void processContentObjectBeforeChilds(ContentObject contentObject, int
currentPageLevel)
throws JahiaException{
+ ContentTreeStatusInterface contentTreeStatus = (ContentTreeStatusInterface)
+ this.getContentTree().getContentTreeStatusStack().peek();
+
//check permission
if ( !contentObject.checkAdminAccess(this.getUser())
&& !contentObject.checkWriteAccess(this.getUser()) ){
// stop processing childs too.
contentTreeStatus.setContinueWithChilds(false);
+ contentTreeStatus.setContinueAfterChilds(false);
return;
}
@@ -76,6 +78,7 @@
if ( !this.isWithDeletedContent() && !hasActiveEntries ){
// stop processing childs too.
contentTreeStatus.setContinueWithChilds(false);
+ contentTreeStatus.setContinueAfterChilds(false);
return;
}
Index: UndoStagingContentTreeVisitor.java
===================================================================
RCS file:
/home/cvs/repository/jahia/src/java/org/jahia/services/version/Attic/UndoStagingContentTreeVisitor.java,v
retrieving revision 1.5.2.3
retrieving revision 1.5.2.4
diff -u -r1.5.2.3 -r1.5.2.4
--- UndoStagingContentTreeVisitor.java 24 Sep 2004 16:29:23 -0000 1.5.2.3
+++ UndoStagingContentTreeVisitor.java 28 Sep 2004 09:28:19 -0000 1.5.2.4
@@ -128,12 +128,11 @@
* process the current content object when traversing the tree
*
* @param contentObject
- * @param contentTreeStatus
* @param currentPageLevel
* @throws JahiaException
*/
public void processContentObjectBeforeChilds(ContentObject contentObject,
- ContentTreeStatusInterface contentTreeStatus, int currentPageLevel)
+ int currentPageLevel)
throws JahiaException{
}
@@ -141,13 +140,11 @@
* Called after processing the current object's childs when traversing the tree
*
* @param contentObject
- * @param contentTreeStatus
* @param currentPageLevel
* @throws JahiaException
*/
public void processContentObjectAfterChilds(
- ContentObject contentObject,
- ContentTreeStatusInterface contentTreeStatus, int currentPageLevel)
+ ContentObject contentObject, int currentPageLevel)
throws JahiaException{
if ( contentObject instanceof ContentPage ){
@@ -189,13 +186,11 @@
* descending in subtree.
*
* @param contentObject the last content page field on which we reach the page
level limit.
- * @param contentStatusInterface
* @param currentPageLevel
* @throws JahiaException
*/
public void processLastContentPageField(
ContentObject contentObject,
- ContentTreeStatusInterface contentStatusInterface,
int currentPageLevel)
throws JahiaException{
@@ -235,11 +230,18 @@
ContentPageField contentPageField = (ContentPageField)
contentObject;
if (contentPageField.getContainerID() > 0) {
- // we avoid undo staging on parent container too
+ // we don't allow the parent container to undo staging
+ ContentTreeStatusInterface contentTreeStatus =
+ (ContentTreeStatusInterface)
+ this.contentTree.getContentTreeStatusStack().pop();
+
ContentTreeStatusInterface parentStatus =
(ContentTreeStatusInterface)
this.contentTree.getContentTreeStatusStack().peek();
parentStatus.setContinueAfterChilds(false);
+
+ this.contentTree.getContentTreeStatusStack()
+ .push(contentTreeStatus);
}
} else {
// There is an issue with container containing more than one
direct page
@@ -279,10 +281,17 @@
}
// in all other case, we don't allow the parent container to
undo staging
+ ContentTreeStatusInterface contentTreeStatus =
+ (ContentTreeStatusInterface)
+ this.contentTree.getContentTreeStatusStack().pop();
+
ContentTreeStatusInterface parentStatus =
(ContentTreeStatusInterface)
this.contentTree.getContentTreeStatusStack().peek();
parentStatus.setContinueAfterChilds(false);
+
+ this.contentTree.getContentTreeStatusStack()
+ .push(contentTreeStatus);
}
}
} else {
Index: PagesVersioningAction.java
===================================================================
RCS file:
/home/cvs/repository/jahia/src/java/org/jahia/views/engines/versioning/pages/actions/Attic/PagesVersioningAction.java,v
retrieving revision 1.19.2.2
retrieving revision 1.19.2.3
diff -u -r1.19.2.2 -r1.19.2.3
--- PagesVersioningAction.java 23 Sep 2004 16:31:26 -0000 1.19.2.2
+++ PagesVersioningAction.java 28 Sep 2004 09:28:19 -0000 1.19.2.3
@@ -1301,92 +1301,4 @@
}
}
}
-
- /**
- * Return additional pages to restore.
- *
- * @param pagesToRestore
- * @param jParams
- * @param restoreDate
- */
- private void checkPagesToRestore(HashMap pagesToRestore,
- ParamBean jParams,
- long restoreDate)
- throws JahiaException {
- HashMap additionalPages = getInvolvedPagesToRestore(pagesToRestore,
- jParams,restoreDate);
- while ( additionalPages.size()>0 ){
- Iterator iterator = additionalPages.keySet().iterator();
- while ( iterator.hasNext() ){
- Integer pageID = (Integer)iterator.next();
- pagesToRestore.put(pageID,additionalPages.get(pageID));
- }
- additionalPages = getInvolvedPagesToRestore(pagesToRestore,
- jParams,restoreDate);
- }
- }
-
- /**
- * Return additional pages to restore.
- *
- * @param pagesToRestore
- * @param jParams
- * @param restoreDate
- */
- private HashMap getInvolvedPagesToRestore(HashMap pagesToRestore,
- ParamBean jParams,
- long restoreDate)
- throws JahiaException {
-
-
- HashMap additionalPages = new HashMap();
- Iterator iterator = pagesToRestore.keySet().iterator();
- while ( iterator.hasNext() ){
- Integer pageID = (Integer)iterator.next();
- ContentPage contentPage = ContentPage.getPage(pageID.intValue());
- ArrayList langsToRestore = (ArrayList)pagesToRestore.get(pageID);
- String lang = (String)langsToRestore.get(0);
- ContentObjectEntryState entryState =
- new
ContentObjectEntryState(EntryLoadRequest.VERSIONED_WORKFLOW_STATE,
- (int)(restoreDate/1000),lang);
- EntryLoadRequest entryLoadRequest = new EntryLoadRequest(entryState);
- entryLoadRequest.setWithDeleted(true);
- entryLoadRequest.setWithMarkedForDeletion(true);
-
- try {
- int parentId = contentPage.getParentID(entryLoadRequest);
- if ( !pagesToRestore.containsKey(new Integer(parentId))
- && !additionalPages.containsKey(new Integer(parentId)) ){
- ContentPage parentPage = contentPage.getPage(parentId, false);
- JahiaPage page = parentPage.getPage(jParams);
- if (contentPage.getID() == page.getParentID()) {
- ArrayList langsAr = new ArrayList();
- langsAr.add(lang);
- additionalPages.put(new
Integer(parentPage.getID()),langsAr);
- }
- }
- } catch ( Throwable t ){
- logger.debug(t);
- }
-
- try {
- JahiaPage page = contentPage.getPage(jParams);
- int parentId = page.getParentID();
- if ( !pagesToRestore.containsKey(new Integer(parentId))
- && !additionalPages.containsKey(new Integer(parentId)) ){
- ContentPage parentPage = ContentPage.getPage(parentId, false);
- if (parentPage.getParentID(entryLoadRequest)
- == contentPage.getID()) {
- ArrayList langsAr = new ArrayList();
- langsAr.add(lang);
- additionalPages.put(new
Integer(parentPage.getID()),langsAr);
- }
- }
- } catch ( Throwable t ){
- logger.debug(t);
- }
- }
- return additionalPages;
- }
-
}