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
|
* The item's root is the ancestor reachable through repeated
|
||||||
* <code>getParent()</code> calls whose parent is
|
* <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}.
|
* @see com.arsdigita.kernel.ACSObject}.
|
||||||
*
|
*
|
||||||
|
|
@ -1173,7 +1172,7 @@ public class ContentItem extends VersionedACSObject implements CustomCopy {
|
||||||
save();
|
save();
|
||||||
|
|
||||||
PublishedLink.updateLiveLinks(version);
|
PublishedLink.updateLiveLinks(version);
|
||||||
PublishedAssociation.updateLiveAssoications(version);
|
PublishedAssociation.updateLiveAssociations(version);
|
||||||
save();
|
save();
|
||||||
|
|
||||||
// publish item (as template or html pages) to the file
|
// publish item (as template or html pages) to the file
|
||||||
|
|
@ -1884,50 +1883,52 @@ public class ContentItem extends VersionedACSObject implements CustomCopy {
|
||||||
== ItemCopier.VERSION_COPY) {
|
== ItemCopier.VERSION_COPY) {
|
||||||
if (parent instanceof ContentBundle) {
|
if (parent instanceof ContentBundle) {
|
||||||
|
|
||||||
ContentBundle bundle = (ContentBundle) parent;
|
final ContentBundle bundle = (ContentBundle) parent;
|
||||||
ContentBundle liveBundle = (ContentBundle) bundle.
|
final ContentBundle oldLiveBundle = (ContentBundle) bundle.
|
||||||
getPublicVersion();
|
getPublicVersion();
|
||||||
//jensp 2012-03-07 Changes to the ContentBundle were not
|
//jensp 2012-03-07 Changes to the ContentBundle were not
|
||||||
//published because the ContentBundle was not republished.
|
//published because the ContentBundle was not republished.
|
||||||
//Moved the next lines out of the if below to enable
|
//Moved the next lines out of the if below to enable
|
||||||
//republishing of the ContentBundle
|
//republishing of the ContentBundle
|
||||||
liveBundle =
|
final ContentBundle liveBundle =
|
||||||
(ContentBundle) bundle.createPendingVersion(null);
|
(ContentBundle) bundle.
|
||||||
if (liveBundle == null) {
|
createPendingVersion(null);
|
||||||
} else {
|
/*
|
||||||
Set liveCatSet = new HashSet();
|
* if (liveBundle == null) { } else { Set liveCatSet = new
|
||||||
Set draftCatSet = new HashSet();
|
* HashSet(); Set draftCatSet = new HashSet();
|
||||||
|
*
|
||||||
CategoryCollection liveCategories =
|
* CategoryCollection liveCategories =
|
||||||
liveBundle.getCategoryCollection();
|
* liveBundle.getCategoryCollection(); while
|
||||||
while (liveCategories.next()) {
|
* (liveCategories.next()) {
|
||||||
liveCatSet.add(liveCategories.getCategory());
|
* 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);
|
setBundle(liveBundle);
|
||||||
return true;
|
return true;
|
||||||
} else if (parent instanceof Folder) {
|
} else if (parent instanceof Folder) {
|
||||||
|
|
|
||||||
|
|
@ -429,7 +429,8 @@ public class GenericContactPersonAssocUpgrade extends Program {
|
||||||
try {
|
try {
|
||||||
conn.rollback();
|
conn.rollback();
|
||||||
} catch (SQLException ex1) {
|
} 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 {
|
try {
|
||||||
conn.close();
|
conn.close();
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
System.err.println("Failed to close JDBC connectio.");
|
System.err.println("Failed to close JDBC connection.");
|
||||||
printStackTrace(ex);
|
printStackTrace(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ import com.arsdigita.web.ApplicationType;
|
||||||
/**
|
/**
|
||||||
* @author Peter Kopunec
|
* @author Peter Kopunec
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Initializer extends CompoundInitializer {
|
public class Initializer extends CompoundInitializer {
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger(Initializer.class);
|
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);
|
final int database = DbHelper.getDatabaseFromURL(url);
|
||||||
|
|
||||||
add(new PDLInitializer(new ManifestSource("ccm-weblog.pdl.mf",
|
add(new PDLInitializer(new ManifestSource("ccm-weblog.pdl.mf",
|
||||||
new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl"))));
|
new NameFilter(DbHelper.
|
||||||
|
getDatabaseSuffix(database), "pdl"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -46,8 +46,8 @@ public class Initializer extends CompoundInitializer {
|
||||||
s_log.info("WebLog Initializer starting.");
|
s_log.info("WebLog Initializer starting.");
|
||||||
|
|
||||||
boolean isMyTransaction = false;
|
boolean isMyTransaction = false;
|
||||||
TransactionContext txn = SessionManager.getSession()
|
TransactionContext txn = SessionManager.getSession().
|
||||||
.getTransactionContext();
|
getTransactionContext();
|
||||||
if (!txn.inTxn()) {
|
if (!txn.inTxn()) {
|
||||||
txn.beginTxn();
|
txn.beginTxn();
|
||||||
isMyTransaction = true;
|
isMyTransaction = true;
|
||||||
|
|
@ -55,6 +55,7 @@ public class Initializer extends CompoundInitializer {
|
||||||
|
|
||||||
// register application
|
// register application
|
||||||
DomainObjectInstantiator instantiator = new ACSObjectInstantiator() {
|
DomainObjectInstantiator instantiator = new ACSObjectInstantiator() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DomainObject doNewInstance(DataObject dataObject) {
|
protected DomainObject doNewInstance(DataObject dataObject) {
|
||||||
return new WebLogApplication(dataObject);
|
return new WebLogApplication(dataObject);
|
||||||
|
|
@ -66,6 +67,7 @@ public class Initializer extends CompoundInitializer {
|
||||||
|
|
||||||
// Register the portlets
|
// Register the portlets
|
||||||
instantiator = new ACSObjectInstantiator() {
|
instantiator = new ACSObjectInstantiator() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DomainObject doNewInstance(DataObject dataObject) {
|
protected DomainObject doNewInstance(DataObject dataObject) {
|
||||||
return new WebLogPortlet(dataObject);
|
return new WebLogPortlet(dataObject);
|
||||||
|
|
@ -94,7 +96,8 @@ public class Initializer extends CompoundInitializer {
|
||||||
s_log.info("WebLog Initializer - setting up new package");
|
s_log.info("WebLog Initializer - setting up new package");
|
||||||
|
|
||||||
PackageType entityType = PackageType.create("weblog", "WebLog",
|
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 ");
|
s_log.debug("Just added package type WebLog ");
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -102,8 +105,8 @@ public class Initializer extends CompoundInitializer {
|
||||||
|
|
||||||
entityType.save();
|
entityType.save();
|
||||||
|
|
||||||
final ApplicationType entityAppType = ApplicationType
|
final ApplicationType entityAppType = ApplicationType.
|
||||||
.createApplicationType(entityType, "WebLog Application",
|
createApplicationType(entityType, "WebLog Application",
|
||||||
WebLogApplication.BASE_DATA_OBJECT_TYPE);
|
WebLogApplication.BASE_DATA_OBJECT_TYPE);
|
||||||
entityAppType.save();
|
entityAppType.save();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue