diff --git a/ccm-cms/src/com/arsdigita/cms/RickshawPublishAPIUpgrade.java b/ccm-cms/src/com/arsdigita/cms/RickshawPublishAPIUpgrade.java deleted file mode 100755 index edf0113f8..000000000 --- a/ccm-cms/src/com/arsdigita/cms/RickshawPublishAPIUpgrade.java +++ /dev/null @@ -1,611 +0,0 @@ -/* - * Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -package com.arsdigita.cms; - -import com.arsdigita.cms.ContentBundle; -import com.arsdigita.cms.ContentItem; -import com.arsdigita.cms.Folder; -import com.arsdigita.cms.lifecycle.Lifecycle; -import com.arsdigita.cms.lifecycle.LifecycleDefinition; -import com.arsdigita.cms.lifecycle.Phase; -import com.arsdigita.cms.lifecycle.PhaseCollection; -import com.arsdigita.domain.DomainObjectFactory; -import com.arsdigita.domain.DomainServiceInterfaceExposer; -import com.arsdigita.kernel.ACSObject; -import com.arsdigita.initializer.Configuration; -import com.arsdigita.initializer.InitializationException; -import com.arsdigita.persistence.CompoundFilter; -import com.arsdigita.persistence.DataCollection; -import com.arsdigita.persistence.DataObject; -import com.arsdigita.persistence.OID; -import com.arsdigita.persistence.Session; -import com.arsdigita.persistence.SessionManager; -import com.arsdigita.persistence.TransactionContext; -import com.arsdigita.runtime.Startup; -import com.redhat.persistence.engine.rdbms.RDBMSException; -import org.apache.log4j.Logger; - -import java.math.BigDecimal; - -/** - *
Upgrade initializer for Rickshaw publishing API changes.
- * - *Upgrade process is as follows
- *pending where
- * masterVersion is not null and parent is a Folder or
- * ContentBundle (and is itself _not_ a Folder or
- * ContentBundle):
- * live where
- * masterVersion is not null and parent is a Folder or
- * ContentBundle (and is itself _not_ a Folder or
- * ContentBundle):
- * item in
- * UpgradeItemNoLifecycleSet, call: item.createLiveVersion()item, lifecycle in
- * UpgradeItemLifecycleMap, call:
- *
- * item.publish(lifecycle.getLifecycleDefinition(),
- * lifecycle.getStartDate());
- * // now set stop date and individual phase start/stop dates
- * // based on the LifecycleDefinition
- *
- * pending where
- * masterVersion is not null and parent is a Folder or
- * ContentBundle (and is itself _not_ a Folder or
- * ContentBundle):
- * live where
- * masterVersion is not null and parent is a Folder or
- * ContentBundle (and is itself _not_ a Folder or
- * ContentBundle):
- * item in
- * UpgradeItemNoLifecycleSet, call: item.createLiveVersion()
- */
- private void publishNonLifecycleItems() {
- Session session = SessionManager.getSession();
- DataCollection coll = session.retrieve(UPGRADE_ITEM_NO_LIFECYCLE_SET_TYPE);
- while (coll.next()) {
- DataObject dataObj = (DataObject) coll.get(UPGRADE_ITEM);
- ContentItem item = (ContentItem)DomainObjectFactory
- .newInstance(dataObj);
- ContentItem live = item.createLiveVersion();
- coll.getDataObject().delete();
- s_log.debug("Publishing item with no lifecycle: draft ID=" + item.getID() +
- ", published ID=" + live.getID() + ", name=" + item.getName());
- maybeCommit();
- }
- recordPublishNonLifecycleItemsCompletion();
- }
-
- /**
- * For each draft item item, lifecycle in
- * UpgradeItemLifecycleMap, call:
- *
- * item.publish(lifecycle.getLifecycleDefinition(),
- * lifecycle.getStartDate());
- * // now set stop date and individual phase start/stop dates
- * // based on the LifecycleDefinition
- *
- *
- */
- private void publishLifecycleItems() {
- Session session = SessionManager.getSession();
- DataCollection coll = session.retrieve(UPGRADE_ITEM_LIFECYCLE_MAP_TYPE);
- while (coll.next()) {
- DataObject dataObj = (DataObject) coll.get(UPGRADE_ITEM);
- ContentItem item = (ContentItem)DomainObjectFactory
- .newInstance(dataObj);
- dataObj = (DataObject) coll.get(UPGRADE_LIFECYCLE);
- Lifecycle lifecycle = new Lifecycle(dataObj);
- LifecycleDefinition cycleDef = lifecycle.getLifecycleDefinition();
- ContentItem pending = item.publish(cycleDef,lifecycle.getStartDate());
- Lifecycle newLifecycle = pending.getLifecycle();
- s_log.debug("Publishing item: draft ID=" + item.getID() +
- ", published ID=" + pending.getID() + ", name=" + item.getName()+
- ", lifecycle ID=" + newLifecycle.getID());
- newLifecycle.setEndDate(lifecycle.getEndDate());
- PhaseCollection oldPhases = lifecycle.getPhases();
- PhaseCollection newPhases = newLifecycle.getPhases();
- while (newPhases.next()) {
- if (oldPhases.next()) {
- Phase newPhase = newPhases.getPhase();
- Phase oldPhase = oldPhases.getPhase();
- newPhase.setStartDate(oldPhase.getStartDate());
- newPhase.setEndDate(oldPhase.getEndDate());
- }
- }
- newPhases.close();
- oldPhases.close();
- coll.getDataObject().delete();
- maybeCommit();
- }
- recordPublishLifecycleItemsCompletion();
- }
-
- /**
- * Remove orphaned lifecycles (those with no associated LifecycleService)
- */
- private void removeOrphanedLifecycles() {
- DataCollection coll = SessionManager.getSession().
- retrieve(Lifecycle.BASE_DATA_OBJECT_TYPE);
- coll.addNotInSubqueryFilter
- ("id", "com.arsdigita.cms.getConnectedLifecycles");
- while (coll.next()) {
- DataObject dataObj = coll.getDataObject();
- Lifecycle lifecycle = new Lifecycle(dataObj);
- s_log.debug("Deleting orphaned lifecycle: ID=" + lifecycle.getID());
- lifecycle.delete();
- maybeCommit();
- }
- recordRemoveOrphanedLifecyclesCompletion();
- }
-
- private void maybeCommit() {
- m_txnCounter++;
- if (m_txnCounter == m_itemsPerTransaction) {
- s_log.debug("Publish API upgrade: transaction commit");
- m_txn.commitTxn();
- m_txn.beginTxn();
- m_txnCounter = 0;
- }
- }
-
- private void forceCommit() {
- s_log.debug("Publish API upgrade: transaction commit");
- m_txn.commitTxn();
- m_txn.beginTxn();
- m_txnCounter = 0;
- }
-
-
- private boolean isUnpublishPendingItemsCompleted() {
- return ((Boolean)getUpgradeProgress().get(PENDING_UNPUBLISH_DONE)).booleanValue();
- }
- private boolean isUnpublishLiveItemsCompleted() {
- return ((Boolean)getUpgradeProgress().get(LIVE_UNPUBLISH_DONE)).booleanValue();
- }
- private boolean isCleanupPublishedItemsCompleted() {
- return ((Boolean)getUpgradeProgress().get(CLEANUP_UNPUBLISH_DONE)).booleanValue();
- }
- private boolean isPublishNonLifecycleItemsCompleted() {
- return ((Boolean)getUpgradeProgress().get(NON_LIFECYCLE_PUBLISH_DONE)).booleanValue();
- }
- private boolean isPublishLifecycleItemsCompleted() {
- return ((Boolean)getUpgradeProgress().get(LIFECYCLE_PUBLISH_DONE)).booleanValue();
- }
- private boolean isRemoveOrphanedLifecyclesCompleted() {
- return ((Boolean)getUpgradeProgress().get(REMOVE_ORPHANED_LIFECYCLES_DONE)).booleanValue();
- }
-
- private void recordUnpublishPendingItemsCompletion() {
- getUpgradeProgress().set(PENDING_UNPUBLISH_DONE,Boolean.TRUE);
- forceCommit();
- }
- private void recordUnpublishLiveItemsCompletion() {
- getUpgradeProgress().set(LIVE_UNPUBLISH_DONE,Boolean.TRUE);
- forceCommit();
- }
- private void recordCleanupPublishedItemsCompletion() {
- getUpgradeProgress().set(CLEANUP_UNPUBLISH_DONE,Boolean.TRUE);
- forceCommit();
- }
- private void recordPublishNonLifecycleItemsCompletion() {
- getUpgradeProgress().set(NON_LIFECYCLE_PUBLISH_DONE,Boolean.TRUE);
- forceCommit();
- }
- private void recordPublishLifecycleItemsCompletion() {
- getUpgradeProgress().set(LIFECYCLE_PUBLISH_DONE,Boolean.TRUE);
- forceCommit();
- }
- private void recordRemoveOrphanedLifecyclesCompletion() {
- getUpgradeProgress().set(REMOVE_ORPHANED_LIFECYCLES_DONE,Boolean.TRUE);
- forceCommit();
- }
-
- private DataObject getUpgradeProgress() {
- Session session = SessionManager.getSession();
- DataCollection coll = session.retrieve(UPGRADE_PROGRESS_TYPE);
- DataObject progressObj = null;
- if (coll.next()) {
- progressObj = coll.getDataObject();
- coll.close();
- } else {
- OID oid = null;
- oid = new OID(UPGRADE_PROGRESS_TYPE);
- oid.set(UPGRADE_PROGRESS_ID,UPGRADE_PROGRESS_ID_VALUE);
- progressObj = session.create(oid);
- progressObj.set(PENDING_UNPUBLISH_DONE,Boolean.FALSE);
- progressObj.set(LIVE_UNPUBLISH_DONE,Boolean.FALSE);
- progressObj.set(CLEANUP_UNPUBLISH_DONE,Boolean.FALSE);
- progressObj.set(NON_LIFECYCLE_PUBLISH_DONE,Boolean.FALSE);
- progressObj.set(LIFECYCLE_PUBLISH_DONE,Boolean.FALSE);
- progressObj.set(REMOVE_ORPHANED_LIFECYCLES_DONE,Boolean.FALSE);
- }
- return progressObj;
- }
-}
diff --git a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentItemLoader.java b/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentItemLoader.java.nolongerInUse
similarity index 96%
rename from ccm-cms/src/com/arsdigita/cms/installer/xml/ContentItemLoader.java
rename to ccm-cms/src/com/arsdigita/cms/installer/xml/ContentItemLoader.java.nolongerInUse
index 693fe2048..85de95a31 100755
--- a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentItemLoader.java
+++ b/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentItemLoader.java.nolongerInUse
@@ -38,6 +38,16 @@ import javax.xml.parsers.SAXParserFactory;
import java.io.IOException;
import java.math.BigDecimal;
+
+// //////////////////////////////////////////////////////////////////////////
+//
+// NOT USED anywhere in the code base.
+// Kept here temporarily for easy reference until until refactoring of
+// unit tests is completed.
+//
+// //////////////////////////////////////////////////////////////////////////
+
+
/**
* An initializer to load content items for load testing Will take an
* XML file with one content item definition, and create items whose
@@ -94,8 +104,6 @@ import java.math.BigDecimal;
* @see XMLContentItemHandler
* @see ContentItemHelper
*/
-
-
public class ContentItemLoader extends BaseInitializer {
private Configuration m_conf = new Configuration();
diff --git a/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleService.java b/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleService.java
index e93dd6f61..f10e5d3bd 100755
--- a/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleService.java
+++ b/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleService.java
@@ -18,7 +18,7 @@
*/
package com.arsdigita.cms.lifecycle;
-import com.arsdigita.cms.RickshawPublishAPIUpgrade;
+// import com.arsdigita.cms.RickshawPublishAPIUpgrade;
import com.arsdigita.db.Sequences;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.domain.DomainObject;
@@ -79,6 +79,7 @@ public class LifecycleService extends DomainObject{
super(obj);
}
+ @Override
protected void initialize() {
super.initialize();
@@ -227,6 +228,7 @@ public class LifecycleService extends DomainObject{
}
}
+ @Override
protected void beforeDelete() {
super.beforeDelete();
Lifecycle lifecycle = getLifecycle();
@@ -241,16 +243,19 @@ public class LifecycleService extends DomainObject{
foundReference = true;
}
coll.close();
+
// check temporary lifecycle references for
// unpublish/republish upgrade.
- coll = SessionManager.getSession().
- retrieve(RickshawPublishAPIUpgrade.UPGRADE_ITEM_LIFECYCLE_MAP_TYPE);
- coll.addEqualsFilter(RickshawPublishAPIUpgrade.UPGRADE_LIFECYCLE+"."+ ACSObject.ID,
- lifecycle.getID());
- if (coll.next()) {
- foundReference = true;
- }
- coll.close();
+ // Refers to a very old upgrade routine. Should be removed without
+ // problems for current code.
+// coll = SessionManager.getSession().
+// retrieve(RickshawPublishAPIUpgrade.UPGRADE_ITEM_LIFECYCLE_MAP_TYPE);
+// coll.addEqualsFilter(RickshawPublishAPIUpgrade.UPGRADE_LIFECYCLE+"."+ ACSObject.ID,
+// lifecycle.getID());
+// if (coll.next()) {
+// foundReference = true;
+// }
+// coll.close();
if (!foundReference) {
m_lifecycleToDelete = lifecycle;
@@ -263,6 +268,7 @@ public class LifecycleService extends DomainObject{
* Remove the lifecycle if it doesn't have any remaining
* LifecycleService components
*/
+ @Override
protected void afterDelete() {
if (m_lifecycleToDelete != null) {
m_lifecycleToDelete.delete();
diff --git a/ccm-core/src/com/arsdigita/search/intermedia/Initializer.java b/ccm-core/src/com/arsdigita/search/intermedia/Initializer.java
index f9b8e951a..290052434 100755
--- a/ccm-core/src/com/arsdigita/search/intermedia/Initializer.java
+++ b/ccm-core/src/com/arsdigita/search/intermedia/Initializer.java
@@ -120,6 +120,20 @@ public class Initializer extends com.arsdigita.runtime.GenericInitializer {
new CategoryFilterType()
},
new BaseQueryEngine());
+
+ /* From Old Style Initializer SyncInitializer:
+ * Forces a sync of the database.
+ * Should be run as the last initializer, so that initial
+ * setup data will immediately be available to search.
+ * Presently has no configuration available, either it runs
+ * or it doesn't.
+ *
+ * @author David Eison
+ *
+ * XXX May be have to comment out. Testing required!
+ */
+ BuildIndex.forceSyncNow();
+
} else {
s_log.debug("Intermedia search engine not enabled. Initialization skipped.");
}
diff --git a/ccm-core/src/com/arsdigita/search/intermedia/SyncInitializer.java b/ccm-core/src/com/arsdigita/search/intermedia/SyncInitializer.java.nolongerInUse
similarity index 100%
rename from ccm-core/src/com/arsdigita/search/intermedia/SyncInitializer.java
rename to ccm-core/src/com/arsdigita/search/intermedia/SyncInitializer.java.nolongerInUse