Author: gmazza
Date: Thu Sep 18 01:05:57 2014
New Revision: 1625869
URL: http://svn.apache.org/r1625869
Log:
ROL-1387 count tags only from published blog entries towards tag aggregate
counts (to keep tag clouds accurate with viewable blog entries)
Modified:
roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/WeblogEntryManager.java
roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/runnable/ScheduledEntriesTask.java
roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/themes/ThemeManager.java
roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/WeblogEntry.java
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/filters/DeviceResolverRequestFilter.java
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/ThemeResourceLoader.java
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java
roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/Utilities.java
roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogEntry.orm.xml
roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogEntryTag.orm.xml
roller/trunk/app/src/main/resources/sql/createdb.vm
roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/WeblogEntryTest.java
Modified:
roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/WeblogEntryManager.java
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/WeblogEntryManager.java?rev=1625869&r1=1625868&r2=1625869&view=diff
==============================================================================
---
roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/WeblogEntryManager.java
(original)
+++
roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/WeblogEntryManager.java
Thu Sep 18 01:05:57 2014
@@ -141,13 +141,6 @@ public interface WeblogEntryManager {
throws WebloggerException;
/**
- * Remove tag with given name from given WeblogEntryData
- * @param name Name of tag to be removed
- */
- void removeWeblogEntryTag(String name,WeblogEntry entry)
- throws WebloggerException;
-
- /**
* Save weblog category.
*/
void saveWeblogCategory(WeblogCategory cat) throws WebloggerException;
@@ -294,21 +287,6 @@ public interface WeblogEntryManager {
throws WebloggerException;
/**
- * This method maintains the tag aggregate table up-to-date with total
counts. More
- * specifically every time this method is called it will act upon exactly
two rows
- * in the database (tag,website,count), one with website matching the
argument passed
- * and one where website is null. If the count ever reaches zero, the row
must be deleted.
- *
- * @param name The tag name
- * @param website The website to used when updating the stats.
- * @param amount The amount to increment the tag count (it can be
positive or negative).
- * @throws WebloggerException
- */
- void updateTagCount(String name, Weblog website, int amount)
- throws WebloggerException;
-
-
- /**
* Get a HitCountData by id.
*
* @param id The HitCountData id.
Modified:
roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java?rev=1625869&r1=1625868&r2=1625869&view=diff
==============================================================================
---
roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
(original)
+++
roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
Thu Sep 18 01:05:57 2014
@@ -194,12 +194,31 @@ public class JPAWeblogEntryManagerImpl i
entry.setAnchor(this.createAnchor(entry));
}
- for (Object name : entry.getAddedTags()) {
- updateTagCount((String) name, entry.getWebsite(), 1);
+ if (entry.isPublished()) {
+ // tag aggregates are updated only when entry published in order
for
+ // tag cloud counts to match published articles
+ if (entry.getRefreshAggregates()) {
+ // blog entry wasn't published before, so all tags need to be
incremented
+ for (WeblogEntryTag tag : entry.getTags()) {
+ updateTagCount(tag.getName(), entry.getWebsite(), 1);
+ }
+ } else {
+ // only new tags need to be incremented
+ for (WeblogEntryTag tag : entry.getAddedTags()) {
+ updateTagCount(tag.getName(), entry.getWebsite(), 1);
+ }
+ }
+ } else {
+ if (entry.getRefreshAggregates()) {
+ // blog entry no longer published so need to reduce aggregate
count
+ for (WeblogEntryTag tag : entry.getTags()) {
+ updateTagCount(tag.getName(), entry.getWebsite(), -1);
+ }
+ }
}
- for (Object name : entry.getRemovedTags()) {
- updateTagCount((String) name, entry.getWebsite(), -1);
+ for (WeblogEntryTag tag : entry.getRemovedTags()) {
+ removeWeblogEntryTag(tag);
}
// if the entry was published to future, set status as SCHEDULED
@@ -241,13 +260,10 @@ public class JPAWeblogEntryManagerImpl i
this.strategy.remove(comment);
}
- // remove tags aggregates
+ // remove tag & tag aggregates
if (entry.getTags() != null) {
- for (Iterator it = entry.getTags().iterator(); it.hasNext(); ) {
- WeblogEntryTag tag = (WeblogEntryTag) it.next();
- updateTagCount(tag.getName(), entry.getWebsite(), -1);
- it.remove();
- this.strategy.remove(tag);
+ for (WeblogEntryTag tag : entry.getTags()) {
+ removeWeblogEntryTag(tag);
}
}
@@ -489,28 +505,13 @@ public class JPAWeblogEntryManagerImpl i
}
}
- public void removeWeblogEntryTag(String name, WeblogEntry entry)
- throws WebloggerException {
-
- // seems silly, why is this not done in WeblogEntry?
-
- for (Iterator it = entry.getTags().iterator(); it.hasNext();) {
- WeblogEntryTag tag = (WeblogEntryTag) it.next();
- if (tag.getName().equals(name)) {
-
- //Call back the entity to adjust its internal state
- entry.onRemoveTag(name);
-
- //Remove it from the collection
- it.remove();
-
- //Remove it from database
- this.strategy.remove(tag);
- this.strategy.flush();
- }
+ private void removeWeblogEntryTag(WeblogEntryTag tag) throws
WebloggerException {
+ if (tag.getWeblogEntry().isPublished()) {
+ updateTagCount(tag.getName(), tag.getWeblogEntry().getWebsite(),
-1);
}
+ this.strategy.remove(tag);
}
-
+
/**
* @inheritDoc
*/
@@ -1103,17 +1104,25 @@ public class JPAWeblogEntryManagerImpl i
//instead of objects as done currently
return (results != null && results.size() == tags.size());
}
-
+
/**
- * @inheritDoc
+ * This method maintains the tag aggregate table up-to-date with total
counts. More
+ * specifically every time this method is called it will act upon exactly
two rows
+ * in the database (tag,website,count), one with website matching the
argument passed
+ * and one where website is null. If the count ever reaches zero, the row
must be deleted.
+ *
+ * @param name The tag name
+ * @param website The website to used when updating the stats.
+ * @param amount The amount to increment the tag count (it can be
positive or negative).
+ * @throws WebloggerException
*/
- public void updateTagCount(String name, Weblog website, int amount)
+ private void updateTagCount(String name, Weblog website, int amount)
throws WebloggerException {
- if(amount == 0) {
+ if (amount == 0) {
throw new WebloggerException("Tag increment amount cannot be
zero.");
}
- if(website == null) {
+ if (website == null) {
throw new WebloggerException("Website cannot be NULL.");
}
Modified:
roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/runnable/ScheduledEntriesTask.java
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/runnable/ScheduledEntriesTask.java?rev=1625869&r1=1625868&r2=1625869&view=diff
==============================================================================
---
roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/runnable/ScheduledEntriesTask.java
(original)
+++
roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/runnable/ScheduledEntriesTask.java
Thu Sep 18 01:05:57 2014
@@ -147,6 +147,7 @@ public class ScheduledEntriesTask extend
for (WeblogEntry entry : scheduledEntries) {
entry.setStatus(PubStatus.PUBLISHED);
+ entry.setRefreshAggregates(true);
wMgr.saveWeblogEntry(entry);
}
Modified:
roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/themes/ThemeManager.java
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/themes/ThemeManager.java?rev=1625869&r1=1625868&r2=1625869&view=diff
==============================================================================
---
roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/themes/ThemeManager.java
(original)
+++
roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/themes/ThemeManager.java
Thu Sep 18 01:05:57 2014
@@ -22,7 +22,6 @@ import java.util.List;
import org.apache.roller.weblogger.WebloggerException;
import org.apache.roller.weblogger.business.InitializationException;
-import org.apache.roller.weblogger.pojos.Theme;
import org.apache.roller.weblogger.pojos.WeblogTheme;
import org.apache.roller.weblogger.pojos.Weblog;
Modified:
roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/WeblogEntry.java
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/WeblogEntry.java?rev=1625869&r1=1625868&r2=1625869&view=diff
==============================================================================
---
roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/WeblogEntry.java
(original)
+++
roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/WeblogEntry.java
Thu Sep 18 01:05:57 2014
@@ -29,6 +29,7 @@ import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -89,7 +90,12 @@ public class WeblogEntry implements Seri
private PubStatus status = PubStatus.DRAFT;
private String locale = null;
private String creatorUserName = null;
- private String searchDescription = null;
+ private String searchDescription = null;
+
+ // set to true when switching between pending/draft/scheduled and published
+ // either the aggregate table needs the entry's tags added (for published)
+ // or subtracted (anything else)
+ private Boolean refreshAggregates = Boolean.FALSE;
// Associated objects
private Weblog website = null;
@@ -99,8 +105,8 @@ public class WeblogEntry implements Seri
private Set<WeblogEntryAttribute> attSet = new
TreeSet<WeblogEntryAttribute>();
private Set<WeblogEntryTag> tagSet = new HashSet<WeblogEntryTag>();
- private Set<String> removedTags = new HashSet<String>();
- private Set<String> addedTags = new HashSet<String>();
+ private Set<WeblogEntryTag> removedTags = new HashSet<WeblogEntryTag>();
+ private Set<WeblogEntryTag> addedTags = new HashSet<WeblogEntryTag>();
//----------------------------------------------------------- Construction
@@ -520,18 +526,16 @@ public class WeblogEntry implements Seri
this.locale = locale;
}
- public Set<WeblogEntryTag> getTags()
- {
+ public Set<WeblogEntryTag> getTags() {
return tagSet;
- }
-
- @SuppressWarnings("unused")
- private void setTags(Set<WeblogEntryTag> tagSet) throws WebloggerException
- {
+ }
+
+ @SuppressWarnings("unused")
+ private void setTags(Set<WeblogEntryTag> tagSet) throws WebloggerException
{
this.tagSet = tagSet;
- this.removedTags = new HashSet();
- this.addedTags = new HashSet();
- }
+ this.removedTags = new HashSet<WeblogEntryTag>();
+ this.addedTags = new HashSet<WeblogEntryTag>();
+ }
/**
* Roller lowercases all tags based on locale because there's not a 1:1
mapping
@@ -560,55 +564,17 @@ public class WeblogEntry implements Seri
tag.setTime(getUpdateTime());
tagSet.add(tag);
- addedTags.add(name);
- }
-
- public void onRemoveTag(String name) throws WebloggerException {
- removedTags.add(name);
+ addedTags.add(tag);
}
- public Set getAddedTags() {
+ public Set<WeblogEntryTag> getAddedTags() {
return addedTags;
}
- public Set getRemovedTags() {
+ public Set<WeblogEntryTag> getRemovedTags() {
return removedTags;
}
- public void updateTags(List<String> updatedTags) throws WebloggerException
{
-
- if(updatedTags == null) {
- return;
- }
-
- Set<String> newTags = new HashSet<String>(updatedTags.size());
- Locale localeObject = getWebsite() != null ?
getWebsite().getLocaleInstance() : Locale.getDefault();
-
- for (String name : updatedTags) {
- newTags.add(Utilities.normalizeTag(name, localeObject));
- }
-
- Set<String> removeTags = new HashSet<String>();
-
- // remove old ones no longer passed.
- for (WeblogEntryTag tag : getTags()) {
- if (!newTags.contains(tag.getName())) {
- removeTags.add(tag.getName());
- } else {
- newTags.remove(tag.getName());
- }
- }
-
- WeblogEntryManager weblogEntryManager =
WebloggerFactory.getWeblogger().getWeblogEntryManager();
- for (String removeTag : removeTags) {
- weblogEntryManager.removeWeblogEntryTag(removeTag, this);
- }
-
- for (String newTag : newTags) {
- addTag(newTag);
- }
- }
-
public String getTagsAsString() {
StringBuilder sb = new StringBuilder();
// Sort by name
@@ -626,12 +592,36 @@ public class WeblogEntry implements Seri
public void setTagsAsString(String tags) throws WebloggerException {
if (StringUtils.isEmpty(tags)) {
+ removedTags.addAll(tagSet);
tagSet.clear();
return;
}
- updateTags(Utilities.splitStringAsTags(tags));
- }
+ List<String> updatedTags = Utilities.splitStringAsTags(tags);
+ Set<String> newTags = new HashSet<String>(updatedTags.size());
+ Locale localeObject = getWebsite() != null ?
getWebsite().getLocaleInstance() : Locale.getDefault();
+
+ for (String name : updatedTags) {
+ newTags.add(Utilities.normalizeTag(name, localeObject));
+ }
+
+ // remove old ones no longer passed.
+ for (Iterator it = tagSet.iterator(); it.hasNext();) {
+ WeblogEntryTag tag = (WeblogEntryTag) it.next();
+ if (!newTags.contains(tag.getName())) {
+ // tag no longer listed in UI, needs removal from DB
+ removedTags.add(tag);
+ it.remove();
+ } else {
+ // already in persisted set, therefore isn't new
+ newTags.remove(tag.getName());
+ }
+ }
+
+ for (String newTag : newTags) {
+ addTag(newTag);
+ }
+ }
// ------------------------------------------------------------------------
@@ -1035,4 +1025,12 @@ public class WeblogEntry implements Seri
return displayContent(null);
}
+ public Boolean getRefreshAggregates() {
+ return refreshAggregates;
+ }
+
+ public void setRefreshAggregates(Boolean refreshAggregates) {
+ this.refreshAggregates = refreshAggregates;
+ }
+
}
Modified:
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/filters/DeviceResolverRequestFilter.java
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/filters/DeviceResolverRequestFilter.java?rev=1625869&r1=1625868&r2=1625869&view=diff
==============================================================================
---
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/filters/DeviceResolverRequestFilter.java
(original)
+++
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/filters/DeviceResolverRequestFilter.java
Thu Sep 18 01:05:57 2014
@@ -23,7 +23,6 @@ package org.apache.roller.weblogger.ui.r
import java.io.IOException;
-import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
Modified:
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/ThemeResourceLoader.java
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/ThemeResourceLoader.java?rev=1625869&r1=1625868&r2=1625869&view=diff
==============================================================================
---
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/ThemeResourceLoader.java
(original)
+++
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/ThemeResourceLoader.java
Thu Sep 18 01:05:57 2014
@@ -29,7 +29,6 @@ import java.io.UnsupportedEncodingExcept
import org.apache.commons.collections.ExtendedProperties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.roller.weblogger.pojos.TemplateRendition;
import org.apache.roller.weblogger.pojos.TemplateRendition.RenditionType;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.runtime.resource.Resource;
Modified:
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java?rev=1625869&r1=1625868&r2=1625869&view=diff
==============================================================================
---
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java
(original)
+++
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java
Thu Sep 18 01:05:57 2014
@@ -143,6 +143,11 @@ public final class EntryEdit extends UIA
*/
public String saveDraft() {
getBean().setStatus(PubStatus.DRAFT.name());
+ if (entry.isPublished()) {
+ // entry reverted from published to non-viewable draft
+ // so need to reduce tag aggregates
+ entry.setRefreshAggregates(true);
+ }
return save();
}
@@ -159,8 +164,16 @@ public final class EntryEdit extends UIA
if (pubTime != null && pubTime.after(
new Date(System.currentTimeMillis() +
RollerConstants.MIN_IN_MS))) {
getBean().setStatus(PubStatus.SCHEDULED.name());
+ if (entry.isPublished()) {
+ // entry went from published to scheduled, need to reduce
tag aggregates
+ entry.setRefreshAggregates(true);
+ }
} else {
getBean().setStatus(PubStatus.PUBLISHED.name());
+ if (getBean().getId() != null && !entry.isPublished()) {
+ // if not a new add, need to add tags to aggregates
+ entry.setRefreshAggregates(true);
+ }
}
} else {
getBean().setStatus(PubStatus.PENDING.name());
@@ -176,7 +189,7 @@ public final class EntryEdit extends UIA
private String save() {
if (!hasActionErrors()) {
try {
- WeblogEntryManager weblogMgr = WebloggerFactory.getWeblogger()
+ WeblogEntryManager weblogEntryManager =
WebloggerFactory.getWeblogger()
.getWeblogEntryManager();
IndexManager indexMgr = WebloggerFactory.getWeblogger()
@@ -228,11 +241,11 @@ public final class EntryEdit extends UIA
try {
// if MediaCast string is empty, clean out MediaCast
// attributes
- weblogMgr.removeWeblogEntryAttribute(
+ weblogEntryManager.removeWeblogEntryAttribute(
"att_mediacast_url", weblogEntry);
- weblogMgr.removeWeblogEntryAttribute(
+ weblogEntryManager.removeWeblogEntryAttribute(
"att_mediacast_type", weblogEntry);
- weblogMgr.removeWeblogEntryAttribute(
+ weblogEntryManager.removeWeblogEntryAttribute(
"att_mediacast_length", weblogEntry);
} catch (WebloggerException e) {
@@ -248,7 +261,7 @@ public final class EntryEdit extends UIA
}
log.debug("Saving entry");
- weblogMgr.saveWeblogEntry(weblogEntry);
+ weblogEntryManager.saveWeblogEntry(weblogEntry);
WebloggerFactory.getWeblogger().flush();
// notify search of the new entry
Modified:
roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/Utilities.java
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/Utilities.java?rev=1625869&r1=1625868&r2=1625869&view=diff
==============================================================================
---
roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/Utilities.java
(original)
+++
roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/Utilities.java
Thu Sep 18 01:05:57 2014
@@ -977,10 +977,10 @@ public class Utilities {
}
/**
- * @param tags
- * @return
+ * @param tags String holding space separated list of tags
+ * @return List of strings, one string for each tag
*/
- public static List splitStringAsTags(String tags) {
+ public static List<String> splitStringAsTags(String tags) {
String[] tagsarr = StringUtils.split(tags, TAG_SPLIT_CHARS);
if (tagsarr == null) {
return Collections.emptyList();
Modified:
roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogEntry.orm.xml
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogEntry.orm.xml?rev=1625869&r1=1625868&r2=1625869&view=diff
==============================================================================
---
roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogEntry.orm.xml
(original)
+++
roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogEntry.orm.xml
Thu Sep 18 01:05:57 2014
@@ -130,6 +130,7 @@
<transient name="pluginsList"/>
<transient name="addedTags"/>
<transient name="removedTags"/>
+ <transient name="refreshAggregates"/>
</attributes>
</entity>
</entity-mappings>
Modified:
roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogEntryTag.orm.xml
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogEntryTag.orm.xml?rev=1625869&r1=1625868&r2=1625869&view=diff
==============================================================================
---
roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogEntryTag.orm.xml
(original)
+++
roller/trunk/app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogEntryTag.orm.xml
Thu Sep 18 01:05:57 2014
@@ -7,7 +7,7 @@
class="org.apache.roller.weblogger.pojos.WeblogEntryTag"
access="PROPERTY">
<table name="roller_weblogentrytag"/>
<named-query name="WeblogEntryTag.getByWeblog">
- <query>SELECT w FROM WeblogEntryTag w WHERE w.weblog= ?1</query>
+ <query>SELECT w FROM WeblogEntryTag w WHERE w.weblog = ?1</query>
</named-query>
<attributes>
<id name="id">
Modified: roller/trunk/app/src/main/resources/sql/createdb.vm
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/sql/createdb.vm?rev=1625869&r1=1625868&r2=1625869&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/sql/createdb.vm (original)
+++ roller/trunk/app/src/main/resources/sql/createdb.vm Thu Sep 18 01:05:57 2014
@@ -458,9 +458,12 @@ alter table custom_template_rendition ad
alter table weblogentry add constraint we_weblogid_fk
foreign key ( websiteid ) references weblog( id ) $!db.ADDL_FK_PARAMS ;
-alter table weblogentry add constraint wc_categoryid_fk
+alter table weblogentry add constraint we_categoryid_fk
foreign key ( categoryid ) references weblogcategory( id )
$!db.ADDL_FK_PARAMS ;
+alter table roller_weblogentrytag add constraint rwtg_entryid_fk
+ foreign key ( entryid ) references weblogentry( id ) $!db.ADDL_FK_PARAMS ;
+
alter table weblogcategory add constraint wc_weblogid_fk
foreign key ( websiteid ) references weblog( id ) $!db.ADDL_FK_PARAMS ;
Modified:
roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/WeblogEntryTest.java
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/WeblogEntryTest.java?rev=1625869&r1=1625868&r2=1625869&view=diff
==============================================================================
---
roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/WeblogEntryTest.java
(original)
+++
roller/trunk/app/src/test/java/org/apache/roller/weblogger/business/WeblogEntryTest.java
Thu Sep 18 01:05:57 2014
@@ -477,8 +477,7 @@ public class WeblogEntryTest extends Tes
TestUtils.endSession(true);
entry = mgr.getWeblogEntry(id);
- mgr.removeWeblogEntryTag("testtag", entry);
- mgr.removeWeblogEntryTag("testtag2", entry);
+ entry.setTagsAsString("");
mgr.saveWeblogEntry(entry);
TestUtils.endSession(true);
@@ -636,11 +635,7 @@ public class WeblogEntryTest extends Tes
entry = mgr.getWeblogEntry(id);
assertEquals(2, entry.getTags().size());
- List<String> updateTags = new ArrayList<String>();
- updateTags.add("testwillstaytag");
- updateTags.add("testnewtag");
- updateTags.add("testnewtag3");
- entry.updateTags(updateTags);
+ entry.setTagsAsString("testwillstaytag testnewtag testnewtag3");
mgr.saveWeblogEntry(entry);
TestUtils.endSession(true);
@@ -691,11 +686,7 @@ public class WeblogEntryTest extends Tes
original = tagData.getTime();
}
- List<String> updateTags = new ArrayList<String>();
- updateTags.add("testwillstaytag");
- updateTags.add("testnewtag");
- updateTags.add("testnewtag3");
- entry.updateTags(updateTags);
+ entry.setTagsAsString("testwillstaytag testnewtag testnewtag3");
mgr.saveWeblogEntry(entry);
TestUtils.endSession(true);
@@ -806,11 +797,7 @@ public class WeblogEntryTest extends Tes
testWeblog = TestUtils.getManagedWebsite(testWeblog);
entry = mgr.getWeblogEntryByAnchor(testWeblog, "entry2");
- List<String> updateTags = new ArrayList<String>();
- updateTags.add("one");
- updateTags.add("three");
- updateTags.add("five");
- entry.updateTags(updateTags);
+ entry.setTagsAsString("one three five");
mgr.saveWeblogEntry(entry);
TestUtils.endSession(true);