Author: bpapez
Date: Wed Jan 2 19:03:12 2008
New Revision: 19448
URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D19448&repname=
=3Djahia
Log:
JAHIA-2638: add a TBP expiration date for a 10000 pages subsection
Refactorings due to performance improvements:
* Entries in jahia_retrule and jahia_retrule_range are not created, if the =
rule is just being inherited from the parent (patch scripts have been added=
to remove these unnecessary entries from existing installations)
* The TimeBasedPublishing operations have been changed to not use the compl=
etely loaded ContentObjects, but work only with the ContentObjectKey object=
s. This way we removed many unnecessary selects to load the objects, as onl=
y the key is needed. Moved the getChildsForTimeBasedPublishing and getParen=
tForTimeBasedPublishing methods out of ContentObject into the TimeBasedPubl=
ishingService.
* Refactored the TimeBasedPublishingImplService.handleTimeBasedPublishingEv=
ent (creation of a new rule if null not necessary; copyParentStateToCurrent=
ObjectAndChilds removed as it is anyway done through calling the handleTime=
BasedPublishingEvent on the children) =
* Removed propagateRuleChangeToCHilds and its calling from TimeBasedPublish=
ingJob as the same functionality is done in handling the fireTimeBasedPubli=
shingStateChange event, which is called afterwards
* Add a load-flag in the ContentObject.getChilds() to specify, whether list=
s OR fields OR both should be loaded
Modified:
trunk/core/src/java/org/jahia/services/containers/ContentContainer.java
trunk/core/src/java/org/jahia/services/containers/ContentContainerList.=
java
trunk/core/src/java/org/jahia/services/pages/ContentPage.java
Modified: trunk/core/src/java/org/jahia/services/containers/ContentContaine=
r.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/services/containers/ContentContainer.java&rev=3D19448&repname=3Dja=
hia
=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/ContentContainer.java=
(original)
+++ trunk/core/src/java/org/jahia/services/containers/ContentContainer.java=
Wed Jan 2 19:03:12 2008
@@ -26,6 +26,7 @@
import org.jahia.data.containers.JahiaContainer;
import org.jahia.data.containers.JahiaContainerDefinition;
import org.jahia.data.containers.JahiaContainerList;
+import org.jahia.data.containers.JahiaContainerStructure;
import org.jahia.data.fields.LoadFlags;
import org.jahia.data.fields.JahiaPageField;
import org.jahia.exceptions.JahiaException;
@@ -40,12 +41,9 @@
import org.jahia.services.fields.ContentFieldTools;
import org.jahia.services.fields.ContentPageField;
import org.jahia.services.pages.ContentPage;
-import org.jahia.services.pages.JahiaPage;
import org.jahia.services.usermanager.JahiaUser;
import org.jahia.services.usermanager.JahiaAdminUser;
import org.jahia.services.version.*;
-import org.jahia.services.metadata.CoreMetadataConstant;
-import org.jahia.services.timebasedpublishing.RetentionRule;
import org.jahia.services.search.indexingscheduler.RuleEvaluationContext;
import org.jahia.utils.LanguageCodeConverters;
import org.springframework.context.ApplicationContext;
@@ -206,45 +204,59 @@
return entries;
}
=
+ public ArrayList getChilds(JahiaUser user, EntryLoadRequest loadReques=
t)
+ throws JahiaException {
+
+ return getChilds(user, loadRequest,
+ JahiaContainerStructure.ALL_TYPES);
+ }
+ =
public ArrayList getChilds(JahiaUser user,
- EntryLoadRequest loadRequest
- )
+ EntryLoadRequest loadRequest, int loadFlag)=
=
throws JahiaException {
ArrayList resultList =3D new FastArrayList ();
+ =
+ if ((loadFlag & JahiaContainerStructure.JAHIA_FIELD) !=3D 0) {
+ Vector fieldIDs =3D ContentContainerTools.getInstance()
+ .getFieldIDsByContainer(getID(), loadRequest);
+
+ Enumeration fieldIDEnum =3D fieldIDs.elements();
+
+ if (fieldIDEnum.hasMoreElements()) {
+ int fieldID =3D ((Integer) fieldIDEnum.nextElement()).intV=
alue();
+ ContentField currentField =3D ContentFieldTools.getInstanc=
e()
+ .getFieldFromCacheOnly(fieldID);
+ if (currentField =3D=3D null) {
+ ContentField
+ .preloadActiveOrStagedFieldsByContainerID(getI=
D());
+ currentField =3D ContentField.getField(fieldID);
+ }
+ resultList.add(currentField);
=
- Vector fieldIDs =3D ContentContainerTools.getInstance()
- .getFieldIDsByContainer(getID (), loadRequest);
-
- Enumeration fieldIDEnum =3D fieldIDs.elements ();
+ while (fieldIDEnum.hasMoreElements()) {
+ fieldID =3D ((Integer) fieldIDEnum.nextElement()).intV=
alue();
=
- if (fieldIDEnum.hasMoreElements()) {
- int fieldID =3D ((Integer) fieldIDEnum.nextElement ()).intValu=
e ();
- ContentField currentField =3D ContentFieldTools.getInstance().=
getFieldFromCacheOnly(fieldID);
- if (currentField =3D=3D null) {
- ContentField.preloadActiveOrStagedFieldsByContainerID(getI=
D());
- currentField =3D ContentField.getField (fieldID);
- }
- resultList.add (currentField);
-
- while (fieldIDEnum.hasMoreElements ()) {
- fieldID =3D ((Integer) fieldIDEnum.nextElement ()).intValu=
e ();
-
- currentField =3D ContentField.getField (fieldID);
- if (currentField !=3D null) {
- resultList.add (currentField);
+ currentField =3D ContentField.getField(fieldID);
+ if (currentField !=3D null) {
+ resultList.add(currentField);
+ }
}
}
}
+ if ((loadFlag & JahiaContainerStructure.JAHIA_CONTAINER) !=3D 0) {
=
- // now let's check that the case of subcontainer lists. If they ca=
nnot
- // be marked for deletion, neither can this container.
- Iterator subContainerListIDEnum =3D containerListManager.getSubCon=
tainerListIDs (getID (), loadRequest).iterator();
- while (subContainerListIDEnum.hasNext ()) {
- Integer curContainerListID =3D (Integer) subContainerListIDEnu=
m.next ();
- ContentContainerList curContainerList =3D ContentContainerList=
.getContainerList (
- curContainerListID.intValue ());
- if (curContainerList !=3D null) {
- resultList.add (curContainerList);
+ // now let's check that the case of subcontainer lists. If the=
y cannot
+ // be marked for deletion, neither can this container.
+ Iterator subContainerListIDEnum =3D containerListManager
+ .getSubContainerListIDs(getID(), loadRequest).iterator=
();
+ while (subContainerListIDEnum.hasNext()) {
+ Integer curContainerListID =3D (Integer) subContainerListI=
DEnum
+ .next();
+ ContentContainerList curContainerList =3D ContentContainer=
List
+ .getContainerList(curContainerListID.intValue());
+ if (curContainerList !=3D null) {
+ resultList.add(curContainerList);
+ }
}
}
return (ArrayList) resultList;
@@ -1181,74 +1193,6 @@
}
=
/**
- * Returns childs that implement TimeBasedPublishingJahiaObject interf=
ace
- *
- * @param user
- * @param loadRequest
- * @param operationMode
- * @return
- */
- public List getChildsForTimeBasedPublishing(JahiaUser user,
- EntryLoadRequest loadRequest,
- String operationMode) throws JahiaExceptio=
n {
-
- ArrayList childs =3D this.getChilds(user,loadRequest);
- ArrayList filteredChilds =3D new ArrayList();
- ContentObject child =3D null;
- for ( int i=3D0; i<childs.size(); i++ ){
- child =3D (ContentObject)childs.get(i);
- if ( child instanceof ContentContainerList ){
- filteredChilds.add(child);
- } else if ( child instanceof ContentPageField ) {
- // field child
- ContentPageField field =3D (ContentPageField)child;
- ContentPage page =3D field.getContentPage(loadRequest);
- if ( page !=3D null ){
- filteredChilds.add(page);
- }
- }
- }
- return filteredChilds;
- }
-
- /**
- * Returns the parent of the current object for timebased publishing
- *
- * @return
- */
- public TimeBasedPublishingJahiaObject getParentForTimeBasedPublishing(=
JahiaUser user,
- EntryLoadRequest loadRequest,
- String operationMode) throws JahiaExceptio=
n{
- return getParentForTimeBasedPublishing(user,loadRequest,operationM=
ode,false);
- }
-
- /**
- * Returns the parent of the current object for timebased publishing
- */
- public TimeBasedPublishingJahiaObject getParentForTimeBasedPublishing(=
JahiaUser user,
- =
EntryLoadRequest loadRequest,
- =
String operationMode,
- =
boolean withoutInheritedRule)
- throws JahiaException {
- ContentObject contentObject =3D this.getPage();
- if (!withoutInheritedRule){
- return (TimeBasedPublishingJahiaObject)contentObject;
- }
- if ( contentObject !=3D null ){
- final RetentionRule retRule =3D ServicesRegistry.getInstance()=
.getTimeBasedPublishingService()
- .getRetentionRule(contentObject.getObjectKey());
- if ( retRule !=3D null && !retRule.getInherited().booleanValue=
() ){
- return (TimeBasedPublishingJahiaObject)contentObject;
- }
- return ((TimeBasedPublishingJahiaObject)contentObject)
- .getParentForTimeBasedPublishing(user,loadRequest,oper=
ationMode,
- withoutInheritedRule);
- }
- return null;
- }
-
-
- /**
* This method is called to notify that time based publishing state ha=
s changed
*/
public void notifyStateChanged(){
Modified: trunk/core/src/java/org/jahia/services/containers/ContentContaine=
rList.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/services/containers/ContentContainerList.java&rev=3D19448&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/services/containers/ContentContainerList.=
java (original)
+++ trunk/core/src/java/org/jahia/services/containers/ContentContainerList.=
java Wed Jan 2 19:03:12 2008
@@ -37,7 +37,6 @@
import org.jahia.services.version.*;
import org.jahia.services.acl.JahiaBaseACL;
import org.jahia.services.acl.ACLNotFoundException;
-import org.jahia.services.timebasedpublishing.RetentionRule;
import org.jahia.utils.LanguageCodeConverters;
import org.springframework.context.ApplicationContext;
=
@@ -205,6 +204,11 @@
return entries;
}
=
+ public ArrayList getChilds(JahiaUser user, EntryLoadRequest loadReques=
t,
+ int loadFlag) throws JahiaException {
+ return getChilds(user, loadRequest);
+ }
+ =
public ArrayList getChilds(JahiaUser user,
EntryLoadRequest loadRequest
)
@@ -619,57 +623,6 @@
}
=
/**
- * Returns the parent of the current object for timebased publishing
- *
- * @return
- */
- public TimeBasedPublishingJahiaObject getParentForTimeBasedPublishing(=
JahiaUser user,
- EntryLoadRequest loadRequest,
- String operationMode) throws JahiaExceptio=
n{
- return getParentForTimeBasedPublishing(user,loadRequest,operationM=
ode,false);
- }
-
- /**
- * Returns the parent of the current object for timebased publishing
- */
- public TimeBasedPublishingJahiaObject getParentForTimeBasedPublishing(=
JahiaUser user,
- =
EntryLoadRequest loadRequest,
- =
String operationMode,
- =
boolean withoutInheritedRule)
- throws JahiaException {
- ContentObject contentObject =3D getParent(user,loadRequest,operati=
onMode);
- if (!withoutInheritedRule){
- return (TimeBasedPublishingJahiaObject)contentObject;
- }
- if ( contentObject !=3D null ){
- final RetentionRule retRule =3D ServicesRegistry.getInstance()=
.getTimeBasedPublishingService()
- .getRetentionRule(contentObject.getObjectKey());
- if ( retRule !=3D null && !retRule.getInherited().booleanValue=
() ){
- return (TimeBasedPublishingJahiaObject)contentObject;
- }
- return ((TimeBasedPublishingJahiaObject)contentObject)
- .getParentForTimeBasedPublishing(user,loadRequest,oper=
ationMode,
- withoutInheritedRule);
- }
- return null;
- }
-
- /**
- * Returns childs that implement TimeBasedPublishingJahiaObject interf=
ace
- *
- * @param user
- * @param loadRequest
- * @param operationMode
- * @return
- */
- public List getChildsForTimeBasedPublishing(JahiaUser user,
- EntryLoadRequest loadRequest,
- String operationMode) throws JahiaExceptio=
n {
-
- return this.getChilds(user,loadRequest);
- }
-
- /**
* This method is called to notify that time based publishing state ha=
s changed
*/
public void notifyStateChanged(){
Modified: trunk/core/src/java/org/jahia/services/pages/ContentPage.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/services/pages/ContentPage.java&rev=3D19448&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/services/pages/ContentPage.java (original)
+++ trunk/core/src/java/org/jahia/services/pages/ContentPage.java Wed Jan =
2 19:03:12 2008
@@ -23,6 +23,7 @@
import org.jahia.content.*;
import org.jahia.content.events.ContentUndoStagingEvent;
import org.jahia.data.containers.JahiaContainer;
+import org.jahia.data.containers.JahiaContainerStructure;
import org.jahia.data.events.JahiaEvent;
import org.jahia.data.fields.LoadFlags;
import org.jahia.engines.EngineMessage;
@@ -50,7 +51,6 @@
import org.jahia.services.version.*;
import org.jahia.services.workflow.WorkflowEvent;
import org.jahia.services.workflow.WorkflowService;
-import org.jahia.services.timebasedpublishing.RetentionRule;
import org.jahia.services.search.indexingscheduler.RuleEvaluationContext;
import org.jahia.utils.JahiaTools;
import org.jahia.utils.LanguageCodeConverters;
@@ -1789,36 +1789,51 @@
return null;
} // end getChilds
=
- public ArrayList getChilds(JahiaUser user, EntryLoadRequest loadReques=
t) throws JahiaException {
+ public ArrayList getChilds(JahiaUser user, EntryLoadRequest loadReques=
t)
+ throws JahiaException {
+ return getChilds(user, loadRequest, JahiaContainerStructure.ALL_TY=
PES);
+ }
+
+ public ArrayList getChilds(JahiaUser user, EntryLoadRequest loadReques=
t,
+ int loadFlag) throws JahiaException {
ArrayList resultList =3D new ArrayList();
switch (getPageType(loadRequest)) {
case JahiaPage.TYPE_DIRECT:
- // first let's add all the fields that are directly attach=
ed to the
- // page.
- List nonContainerFieldIDs =3D ServicesRegistry.getInstance=
()
- .getJahiaFieldService()
- .getNonContainerFieldIDsInPageByWorkflowState(getI=
D(), loadRequest);
- Iterator nonContainerFieldIDEnum =3D nonContainerFieldIDs.=
iterator();
- while (nonContainerFieldIDEnum.hasNext()) {
- Integer curFieldID =3D (Integer) nonContainerFieldIDEn=
um.next();
- ContentField curField =3D ContentField.getField(curFie=
ldID.intValue());
- if (curField !=3D null && !curField.isMetadata()) {
- resultList.add(curField);
+ if ((loadFlag & JahiaContainerStructure.JAHIA_FIELD) !=3D =
0) {
+ // first let's add all the fields that are directly at=
tached to the
+ // page.
+ List nonContainerFieldIDs =3D ServicesRegistry.getInst=
ance()
+ .getJahiaFieldService()
+ .getNonContainerFieldIDsInPageByWorkflowState(
+ getID(), loadRequest);
+ Iterator nonContainerFieldIDEnum =3D nonContainerField=
IDs
+ .iterator();
+ while (nonContainerFieldIDEnum.hasNext()) {
+ Integer curFieldID =3D (Integer) nonContainerField=
IDEnum
+ .next();
+ ContentField curField =3D ContentField
+ .getField(curFieldID.intValue());
+ if (curField !=3D null && !curField.isMetadata()) {
+ resultList.add(curField);
+ }
}
}
-
- // now let's add all the container lists that are the dire=
ct children
- // of this page (subcontainers lists are NOT included here=
!)
- SortedSet containerListIDs =3D ServicesRegistry.getInstanc=
e()
- .getJahiaContainersService()
- .getAllPageTopLevelContainerListIDs(getID(), loadR=
equest);
- Iterator containerListIDIter =3D containerListIDs.iterator=
();
- while (containerListIDIter.hasNext()) {
- Integer curContainerListID =3D (Integer) containerList=
IDIter.next();
- ContentContainerList curContainerList =3D ContentConta=
inerList.getContainerList(
- curContainerListID.intValue());
- if (curContainerList !=3D null) {
- resultList.add(curContainerList);
+ if ((loadFlag & JahiaContainerStructure.JAHIA_CONTAINER) !=
=3D 0) {
+ // now let's add all the container lists that are the =
direct children
+ // of this page (subcontainers lists are NOT included =
here !)
+ SortedSet containerListIDs =3D ServicesRegistry.getIns=
tance()
+ .getJahiaContainersService()
+ .getAllPageTopLevelContainerListIDs(getID(),
+ loadRequest);
+ Iterator containerListIDIter =3D containerListIDs.iter=
ator();
+ while (containerListIDIter.hasNext()) {
+ Integer curContainerListID =3D (Integer) container=
ListIDIter
+ .next();
+ ContentContainerList curContainerList =3D ContentC=
ontainerList
+ .getContainerList(curContainerListID.intVa=
lue());
+ if (curContainerList !=3D null) {
+ resultList.add(curContainerList);
+ }
}
}
break;
@@ -5017,65 +5032,6 @@
}
=
/**
- * Returns the parent of the current object for timebased publishing
- */
- public TimeBasedPublishingJahiaObject getParentForTimeBasedPublishing(=
JahiaUser user,
- =
EntryLoadRequest loadRequest,
- =
String operationMode) throws JahiaException {
- return getParentForTimeBasedPublishing(user,loadRequest,operationM=
ode,false);
- }
-
- /**
- * Returns the parent of the current object for timebased publishing
- */
- public TimeBasedPublishingJahiaObject getParentForTimeBasedPublishing(=
JahiaUser user,
- =
EntryLoadRequest loadRequest,
- =
String operationMode,
- =
boolean withoutInheritedRule)
- throws JahiaException {
- ContentPageField pageField =3D (ContentPageField) this.getParent(u=
ser, loadRequest, operationMode);
- if (pageField !=3D null) {
- ContentContainer contentContainer =3D ContentContainer.getCont=
ainer(pageField.getContainerID());
- if ( !withoutInheritedRule ){
- return contentContainer;
- }
- if ( contentContainer !=3D null ){
- final RetentionRule retRule =3D ServicesRegistry.getInstan=
ce().getTimeBasedPublishingService()
- .getRetentionRule(contentContainer.getObjectKey());
- if ( retRule !=3D null && !retRule.getInherited().booleanV=
alue() ){
- return contentContainer;
- }
- return contentContainer.getParentForTimeBasedPublishing(us=
er,loadRequest,operationMode,
- withoutInheritedRule);
- }
- }
- return null;
- }
-
- /**
- * Returns childs that implement TimeBasedPublishingJahiaObject interf=
ace
- *
- * @param user
- * @param loadRequest
- * @param operationMode
- */
- public List getChildsForTimeBasedPublishing(JahiaUser user,
- EntryLoadRequest loadReque=
st,
- String operationMode) thro=
ws JahiaException {
-
- ArrayList childs =3D this.getChilds(user, loadRequest);
- ArrayList filteredChilds =3D new ArrayList();
- ContentObject child;
- for (int i =3D 0, childSize =3D childs.size(); i < childSize; i++)=
{
- child =3D (ContentObject) childs.get(i);
- if (child instanceof ContentContainerList) {
- filteredChilds.addAll(((ContentContainerList) child).getCh=
ildsForTimeBasedPublishing(user, loadRequest, operationMode));
- }
- }
- return filteredChilds;
- }
-
- /**
* This method is called to notify that time based publishing state ha=
s changed
*/
public void notifyStateChanged() {
_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list