Fix für Bug beim Publizieren von Bundle-Instanzen. Achtung: Nicht abschließend getestet.
git-svn-id: https://svn.libreccm.org/ccm/trunk@1544 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
451b67580d
commit
c757188e00
|
|
@ -617,8 +617,7 @@ public class ContentItem extends VersionedACSObject implements CustomCopy {
|
|||
*
|
||||
* The item's root is the ancestor reachable through repeated
|
||||
* <code>getParent()</code> calls whose parent is
|
||||
* <code>null</code>. This is usually a folder, but may be any
|
||||
* {
|
||||
* <code>null</code>. This is usually a folder, but may be any {
|
||||
*
|
||||
* @see com.arsdigita.kernel.ACSObject}.
|
||||
*
|
||||
|
|
@ -1173,7 +1172,7 @@ public class ContentItem extends VersionedACSObject implements CustomCopy {
|
|||
save();
|
||||
|
||||
PublishedLink.updateLiveLinks(version);
|
||||
PublishedAssociation.updateLiveAssoications(version);
|
||||
PublishedAssociation.updateLiveAssociations(version);
|
||||
save();
|
||||
|
||||
// publish item (as template or html pages) to the file
|
||||
|
|
@ -1884,50 +1883,52 @@ public class ContentItem extends VersionedACSObject implements CustomCopy {
|
|||
== ItemCopier.VERSION_COPY) {
|
||||
if (parent instanceof ContentBundle) {
|
||||
|
||||
ContentBundle bundle = (ContentBundle) parent;
|
||||
ContentBundle liveBundle = (ContentBundle) bundle.
|
||||
final ContentBundle bundle = (ContentBundle) parent;
|
||||
final ContentBundle oldLiveBundle = (ContentBundle) bundle.
|
||||
getPublicVersion();
|
||||
//jensp 2012-03-07 Changes to the ContentBundle were not
|
||||
//published because the ContentBundle was not republished.
|
||||
//Moved the next lines out of the if below to enable
|
||||
//republishing of the ContentBundle
|
||||
liveBundle =
|
||||
(ContentBundle) bundle.createPendingVersion(null);
|
||||
if (liveBundle == null) {
|
||||
} else {
|
||||
Set liveCatSet = new HashSet();
|
||||
Set draftCatSet = new HashSet();
|
||||
|
||||
CategoryCollection liveCategories =
|
||||
liveBundle.getCategoryCollection();
|
||||
while (liveCategories.next()) {
|
||||
liveCatSet.add(liveCategories.getCategory());
|
||||
final ContentBundle liveBundle =
|
||||
(ContentBundle) bundle.
|
||||
createPendingVersion(null);
|
||||
/*
|
||||
* if (liveBundle == null) { } else { Set liveCatSet = new
|
||||
* HashSet(); Set draftCatSet = new HashSet();
|
||||
*
|
||||
* CategoryCollection liveCategories =
|
||||
* liveBundle.getCategoryCollection(); while
|
||||
* (liveCategories.next()) {
|
||||
* liveCatSet.add(liveCategories.getCategory()); }
|
||||
* liveCategories.close();
|
||||
*
|
||||
* CategoryCollection draftCategories =
|
||||
* bundle.getCategoryCollection(); while
|
||||
* (draftCategories.next()) {
|
||||
* draftCatSet.add(draftCategories.getCategory()); }
|
||||
* draftCategories.close();
|
||||
*
|
||||
* Set catsToRemove = new HashSet(liveCatSet);
|
||||
* catsToRemove.removeAll(draftCatSet); Set catsToAdd = new
|
||||
* HashSet(draftCatSet); catsToAdd.removeAll(liveCatSet);
|
||||
*
|
||||
* Iterator removeIter = catsToRemove.iterator(); while
|
||||
* (removeIter.hasNext()) { liveBundle.removeCategory(
|
||||
* (Category) removeIter.next()); } Iterator addIter =
|
||||
* catsToAdd.iterator(); while (addIter.hasNext()) {
|
||||
* liveBundle.addCategory((Category) addIter.next()); }
|
||||
*
|
||||
* }
|
||||
*/
|
||||
if (oldLiveBundle != null) {
|
||||
final ItemCollection instances = oldLiveBundle.
|
||||
getInstances();
|
||||
while (instances.next()) {
|
||||
liveBundle.addInstance(instances.getContentItem());
|
||||
}
|
||||
liveCategories.close();
|
||||
|
||||
CategoryCollection draftCategories =
|
||||
bundle.getCategoryCollection();
|
||||
while (draftCategories.next()) {
|
||||
draftCatSet.add(draftCategories.getCategory());
|
||||
}
|
||||
draftCategories.close();
|
||||
|
||||
Set catsToRemove = new HashSet(liveCatSet);
|
||||
catsToRemove.removeAll(draftCatSet);
|
||||
Set catsToAdd = new HashSet(draftCatSet);
|
||||
catsToAdd.removeAll(liveCatSet);
|
||||
|
||||
Iterator removeIter = catsToRemove.iterator();
|
||||
while (removeIter.hasNext()) {
|
||||
liveBundle.removeCategory(
|
||||
(Category) removeIter.next());
|
||||
}
|
||||
Iterator addIter = catsToAdd.iterator();
|
||||
while (addIter.hasNext()) {
|
||||
liveBundle.addCategory((Category) addIter.next());
|
||||
}
|
||||
|
||||
}
|
||||
setBundle(liveBundle);
|
||||
return true;
|
||||
} else if (parent instanceof Folder) {
|
||||
|
|
|
|||
|
|
@ -429,7 +429,8 @@ public class GenericContactPersonAssocUpgrade extends Program {
|
|||
try {
|
||||
conn.rollback();
|
||||
} catch (SQLException ex1) {
|
||||
System.out.println("Rollback failed.");
|
||||
System.err.println("Rollback failed.");
|
||||
ex1.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -437,7 +438,7 @@ public class GenericContactPersonAssocUpgrade extends Program {
|
|||
try {
|
||||
conn.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println("Failed to close JDBC connectio.");
|
||||
System.err.println("Failed to close JDBC connection.");
|
||||
printStackTrace(ex);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import com.arsdigita.web.ApplicationType;
|
|||
/**
|
||||
* @author Peter Kopunec
|
||||
*/
|
||||
|
||||
public class Initializer extends CompoundInitializer {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(Initializer.class);
|
||||
|
|
@ -38,7 +37,8 @@ public class Initializer extends CompoundInitializer {
|
|||
final int database = DbHelper.getDatabaseFromURL(url);
|
||||
|
||||
add(new PDLInitializer(new ManifestSource("ccm-weblog.pdl.mf",
|
||||
new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl"))));
|
||||
new NameFilter(DbHelper.
|
||||
getDatabaseSuffix(database), "pdl"))));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -46,8 +46,8 @@ public class Initializer extends CompoundInitializer {
|
|||
s_log.info("WebLog Initializer starting.");
|
||||
|
||||
boolean isMyTransaction = false;
|
||||
TransactionContext txn = SessionManager.getSession()
|
||||
.getTransactionContext();
|
||||
TransactionContext txn = SessionManager.getSession().
|
||||
getTransactionContext();
|
||||
if (!txn.inTxn()) {
|
||||
txn.beginTxn();
|
||||
isMyTransaction = true;
|
||||
|
|
@ -55,6 +55,7 @@ public class Initializer extends CompoundInitializer {
|
|||
|
||||
// register application
|
||||
DomainObjectInstantiator instantiator = new ACSObjectInstantiator() {
|
||||
|
||||
@Override
|
||||
protected DomainObject doNewInstance(DataObject dataObject) {
|
||||
return new WebLogApplication(dataObject);
|
||||
|
|
@ -66,6 +67,7 @@ public class Initializer extends CompoundInitializer {
|
|||
|
||||
// Register the portlets
|
||||
instantiator = new ACSObjectInstantiator() {
|
||||
|
||||
@Override
|
||||
protected DomainObject doNewInstance(DataObject dataObject) {
|
||||
return new WebLogPortlet(dataObject);
|
||||
|
|
@ -94,7 +96,8 @@ public class Initializer extends CompoundInitializer {
|
|||
s_log.info("WebLog Initializer - setting up new package");
|
||||
|
||||
PackageType entityType = PackageType.create("weblog", "WebLog",
|
||||
"WebLogs", "http://www.undp.org/weblog");
|
||||
"WebLogs",
|
||||
"http://www.undp.org/weblog");
|
||||
s_log.debug("Just added package type WebLog ");
|
||||
|
||||
|
||||
|
|
@ -102,8 +105,8 @@ public class Initializer extends CompoundInitializer {
|
|||
|
||||
entityType.save();
|
||||
|
||||
final ApplicationType entityAppType = ApplicationType
|
||||
.createApplicationType(entityType, "WebLog Application",
|
||||
final ApplicationType entityAppType = ApplicationType.
|
||||
createApplicationType(entityType, "WebLog Application",
|
||||
WebLogApplication.BASE_DATA_OBJECT_TYPE);
|
||||
entityAppType.save();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue