Seam SVN: r7499 - in trunk/src: main/org/jboss/seam/core and 1 other directory.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2008-03-03 16:58:23 -0500 (Mon, 03 Mar 2008)
New Revision: 7499
Modified:
trunk/src/debug/org/jboss/seam/debug/hot/HotDeployFilter.java
trunk/src/main/org/jboss/seam/core/Expressions.java
trunk/src/main/org/jboss/seam/core/ResourceLoader.java
Log:
allow pages to be reloaded from hot deploy filter
Modified: trunk/src/debug/org/jboss/seam/debug/hot/HotDeployFilter.java
===================================================================
--- …
[View More]trunk/src/debug/org/jboss/seam/debug/hot/HotDeployFilter.java 2008-03-03 16:15:22 UTC (rev 7498)
+++ trunk/src/debug/org/jboss/seam/debug/hot/HotDeployFilter.java 2008-03-03 21:58:23 UTC (rev 7499)
@@ -39,7 +39,6 @@
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException
{
-
Init init = (Init) getServletContext().getAttribute( Seam.getComponentName(Init.class) );
if ( init!=null && init.hasHotDeployableComponents() )
{
@@ -55,7 +54,13 @@
}
//TODO: check the timestamp, for a minor optimization
- getServletContext().removeAttribute( Seam.getComponentName(Pages.class) );
+
+ // instead
+ Pages pages = (Pages) getServletContext().getAttribute(Seam.getComponentName(Pages.class));
+ if (pages!= null) {
+ pages.initialize();
+ }
+
getServletContext().removeAttribute( Seam.getComponentName(Exceptions.class) );
//TODO: is there anything we should remove from the session scope?
Modified: trunk/src/main/org/jboss/seam/core/Expressions.java
===================================================================
--- trunk/src/main/org/jboss/seam/core/Expressions.java 2008-03-03 16:15:22 UTC (rev 7498)
+++ trunk/src/main/org/jboss/seam/core/Expressions.java 2008-03-03 21:58:23 UTC (rev 7499)
@@ -14,6 +14,7 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.el.EL;
import org.jboss.seam.el.SeamExpressionFactory;
@@ -248,8 +249,11 @@
}*/
public static Expressions instance()
- {
- return (Expressions) Component.getInstance(Expressions.class, ScopeType.APPLICATION);
+ {
+ if (!Contexts.isApplicationContextActive()) {
+ return new Expressions();
+ } else {
+ return (Expressions) Component.getInstance(Expressions.class, ScopeType.APPLICATION);
+ }
}
-
}
Modified: trunk/src/main/org/jboss/seam/core/ResourceLoader.java
===================================================================
--- trunk/src/main/org/jboss/seam/core/ResourceLoader.java 2008-03-03 16:15:22 UTC (rev 7498)
+++ trunk/src/main/org/jboss/seam/core/ResourceLoader.java 2008-03-03 21:58:23 UTC (rev 7499)
@@ -12,6 +12,7 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.contexts.ServletLifecycle;
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
@@ -94,7 +95,11 @@
public static ResourceLoader instance()
{
- return (ResourceLoader) Component.getInstance(ResourceLoader.class, ScopeType.STATELESS);
+ if (!Contexts.isApplicationContextActive()) {
+ return new ResourceLoader();
+ } else {
+ return (ResourceLoader) Component.getInstance(ResourceLoader.class, ScopeType.STATELESS);
+ }
}
}
[View Less]
17 years, 1 month
Seam SVN: r7498 - in trunk/examples/wiki: view/themes/default/css and 2 other directories.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2008-03-03 11:15:22 -0500 (Mon, 03 Mar 2008)
New Revision: 7498
Modified:
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/FeedServlet.java
trunk/examples/wiki/view/themes/default/css/template.css
trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css
trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css
Log:
JBSEAM-2699, set <updated> timestamp on feed based on last entry
Modified: trunk/examples/wiki/src/main/org/…
[View More]jboss/seam/wiki/core/ui/FeedServlet.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/FeedServlet.java 2008-03-02 12:56:31 UTC (rev 7497)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/FeedServlet.java 2008-03-03 16:15:22 UTC (rev 7498)
@@ -214,28 +214,29 @@
}
}
- String etag = null;
+ Date lastFeedEntryDate = null;
if (feed.getId() != null) {
- log.debug("calculating etag for local feed");
// Ask the database what the latest feed entry is for that feed, then use its updated timestamp hash
FeedDAO feedDAO = (FeedDAO)Component.getInstance(FeedDAO.class);
List<FeedEntry> result = feedDAO.findLastFeedEntries(feed.getId(), 1);
- if (result.size() > 0)
- etag = calculateEtag(result.get(0).getUpdatedDate());
+ if (result.size() > 0) {
+ lastFeedEntryDate = result.get(0).getUpdatedDate();
+ }
} else {
- log.debug("calculating etag for aggregated feed");
// Get the first (latest) entry of the aggregated feed and use its published timestamp hash (ignoring updates!)
// There is a wrinkle hidden here: What if a feed entry is updated? Then the published timestamp should also
// be different because the "first latest" feed entry in the list is sorted by both published and updated
// timestamps. So even though we only use published timestamp hash as an ETag, this timestamp also changes
// when a feed entry is updated because the collection order changes as well.
- if (feed.getFeedEntries().size() > 0)
- etag = calculateEtag(feed.getFeedEntries().iterator().next().getPublishedDate());
+ if (feed.getFeedEntries().size() > 0) {
+ lastFeedEntryDate = feed.getFeedEntries().iterator().next().getPublishedDate();
+ }
}
- if (etag != null) {
+ if (lastFeedEntryDate != null) {
+ String etag = calculateEtag(lastFeedEntryDate);
log.debug("setting etag header: " + etag);
response.setHeader("ETag", etag);
String previousToken = request.getHeader("If-None-Match");
@@ -261,6 +262,13 @@
aggregateParam
);
+ // If we have an entry on this feed, take the last entry's update timestamp and use it as
+ // the published timestamp of the feed. The Rome library does not have a setUpdatedDate()
+ // method and abuses the published date to write <updated> into the Atom <feed> element.
+ if (lastFeedEntryDate != null) {
+ syndFeed.setPublishedDate(lastFeedEntryDate);
+ }
+
// Write feed to output
response.setContentType(syndFeedType.contentType);
response.setCharacterEncoding("UTF-8");
@@ -319,6 +327,8 @@
syndFeed.setAuthor(feed.getAuthor());
if (feed.getDescription() != null && feed.getDescription().length() >0)
syndFeed.setDescription(feed.getDescription());
+
+ // Setting the date on which the local feed was stored in the database, might be overwritten later
syndFeed.setPublishedDate(feed.getPublishedDate());
// Create feed entries
Modified: trunk/examples/wiki/view/themes/default/css/template.css
===================================================================
--- trunk/examples/wiki/view/themes/default/css/template.css 2008-03-02 12:56:31 UTC (rev 7497)
+++ trunk/examples/wiki/view/themes/default/css/template.css 2008-03-03 16:15:22 UTC (rev 7498)
@@ -1580,6 +1580,10 @@
border: none;
}
+.dr-tree-h-ic-img {
+ height: 18px;
+}
+
.directoryTreeLabel {
padding-top: 2px;
cursor: pointer;
Modified: trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css
===================================================================
--- trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css 2008-03-02 12:56:31 UTC (rev 7497)
+++ trunk/examples/wiki/view/themes/inrelationto/css/inrelationto.css 2008-03-03 16:15:22 UTC (rev 7498)
@@ -1596,6 +1596,10 @@
border: none;
}
+.dr-tree-h-ic-img {
+ height: 18px;
+}
+
.directoryTreeLabel {
padding-top: 2px;
cursor: pointer;
Modified: trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css
===================================================================
--- trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css 2008-03-02 12:56:31 UTC (rev 7497)
+++ trunk/examples/wiki/view/themes/sfwkorg/css/sfwk.css 2008-03-03 16:15:22 UTC (rev 7498)
@@ -998,9 +998,9 @@
text-align: left;
padding-left: 5px;
padding-right: 5px;
- padding-top: 5px;
- padding-bottom: 15px;
- background: white url(../img/th.bg.inverse.gif) 0 0 repeat-x;
+ padding-top: 8px;
+ padding-bottom: 8px;
+ background: #ede8db url(../img/th.bg.gif) 0 0 repeat-x;
border-top: 1px solid #d3d2d1;
border-left: 1px solid #d3d2d1;
border-right: 1px solid #d3d2d1;
@@ -1014,8 +1014,7 @@
}
.boxFooter {
- background: #ede8db url(../img/th.bg.gif) 0 0 repeat-x;
- padding-top: 10px;
+ background: white;
padding-bottom: 5px;
padding-left: 15px;
padding-right: 15px;
@@ -1543,6 +1542,10 @@
border: none;
}
+.dr-tree-h-ic-img {
+ height: 18px;
+}
+
.directoryTreeLabel {
padding-top: 2px;
cursor: pointer;
[View Less]
17 years, 1 month
Seam SVN: r7497 - in trunk/examples/wiki: src/main/org/jboss/seam/wiki/core/search and 3 other directories.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2008-03-02 07:56:31 -0500 (Sun, 02 Mar 2008)
New Revision: 7497
Modified:
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/User.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiNode.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/WikiSearch.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/WikiSearchSupport.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/…
[View More]annotations/Searchable.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/annotations/SearchableType.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/metamodel/SearchRegistry.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/metamodel/SearchableProperty.java
trunk/examples/wiki/view/search_d.xhtml
Log:
Added createdBy/lastModifiedBy to indexed and searchable fields
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/User.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/User.java 2008-02-29 12:50:52 UTC (rev 7496)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/User.java 2008-03-02 12:56:31 UTC (rev 7497)
@@ -18,6 +18,7 @@
@Entity
@Table(name = "USERS")
@org.hibernate.annotations.BatchSize(size = 20)
+(a)org.hibernate.search.annotations.Indexed
public class User implements Serializable {
public static final String GUEST_USERNAME = "guest";
@@ -26,6 +27,7 @@
@Id
@GeneratedValue(generator = "wikiSequenceGenerator")
@Column(name = "USER_ID")
+ @org.hibernate.search.annotations.DocumentId(name = "userId")
private Long id = null;
@Version
@@ -57,6 +59,10 @@
regex="[a-zA-Z]?[a-zA-Z0-9]+",
message="#{messages['lacewiki.entity.UsernameMustStartWithALetterAndOnlyContainLetters']}"
)
+ @org.hibernate.search.annotations.Field(
+ index = org.hibernate.search.annotations.Index.UN_TOKENIZED,
+ store = org.hibernate.search.annotations.Store.YES
+ )
private String username; // Unique and immutable
@Column(name = "PASSWORDHASH", length = 255, nullable = false)
@@ -102,6 +108,10 @@
@org.hibernate.annotations.ForeignKey(name = "FK_USER_USER_PROFILE_ID")
private UserProfile profile = new UserProfile();
+ @OneToMany(fetch = FetchType.LAZY, mappedBy="createdBy")
+ @org.hibernate.search.annotations.ContainedIn
+ private Set<WikiNode> createdNodes; // Just for Lucene index updates of username @Field
+
@Transient
private long ratingPoints = 0;
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiNode.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiNode.java 2008-02-29 12:50:52 UTC (rev 7496)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiNode.java 2008-03-02 12:56:31 UTC (rev 7497)
@@ -70,6 +70,8 @@
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "CREATED_BY_USER_ID", nullable = false)
@org.hibernate.annotations.ForeignKey(name = "FK_WIKI_NODE_CREATED_BY_USER_ID")
+ @org.hibernate.search.annotations.IndexedEmbedded(prefix = "createdBy_")
+ @Searchable(description = "Created By", type = SearchableType.STRING, embeddedProperty = "username")
protected User createdBy;
@Column(name = "LAST_MODIFIED_ON", nullable = true)
@@ -78,12 +80,14 @@
store = org.hibernate.search.annotations.Store.YES
)
@org.hibernate.search.annotations.DateBridge(resolution = org.hibernate.search.annotations.Resolution.DAY)
- @Searchable(description = "Modified", type = SearchableType.PASTDATE)
+ @Searchable(description = "Last Modified", type = SearchableType.PASTDATE)
protected Date lastModifiedOn;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "LAST_MODIFIED_BY_USER_ID", nullable = true)
@org.hibernate.annotations.ForeignKey(name = "FK_WIKI_NODE_LAST_MODIFIED_BY")
+ @org.hibernate.search.annotations.IndexedEmbedded(prefix = "lastModifiedBy_")
+ @Searchable(description = "Last Modified By", type = SearchableType.STRING, embeddedProperty = "username")
protected User lastModifiedBy;
@Column(name = "WRITE_ACCESS_LEVEL", nullable = false)
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/WikiSearch.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/WikiSearch.java 2008-02-29 12:50:52 UTC (rev 7496)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/WikiSearch.java 2008-03-02 12:56:31 UTC (rev 7497)
@@ -109,6 +109,10 @@
propertySearch.getTerms().put(SearchableProperty.TERM_MATCHEXACTPHRASE, getSimpleQueryMatchExactPhrase());
searchEntities.add(entry.getKey());
}
+ // And also simple string queries get the term
+ if (SearchableType.STRING.equals(propertySearch.getProperty().getType())) {
+ propertySearch.getTerms().put(SearchableProperty.TERM_INCLUDE, getSimpleQuery());
+ }
}
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/WikiSearchSupport.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/WikiSearchSupport.java 2008-02-29 12:50:52 UTC (rev 7496)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/WikiSearchSupport.java 2008-03-02 12:56:31 UTC (rev 7497)
@@ -37,7 +37,7 @@
return new SearchHit(
WikiDocument.class.getSimpleName(),
"icon.doc.gif",
- escapeBestFragments(query, new NullFragmenter(), doc.getName(), 0, 0),
+ "(" + doc.getCreatedBy().getFullname() + ") " + escapeBestFragments(query, new NullFragmenter(), doc.getName(), 0, 0),
urlRenderer.renderURL(doc),
escapeBestFragments(query, new SimpleFragmenter(100), doc.getContent(), 5, 350)
);
@@ -52,7 +52,7 @@
return new SearchHit(
WikiComment.class.getSimpleName(),
"icon.user.gif",
- "(" + comment.getFromUserName() + ") "
+ "(" + (comment.getCreatedBy() != null ? comment.getCreatedBy().getFullname() : comment.getFromUserName()) + ") "
+ escapeBestFragments(query, new NullFragmenter(), comment.getSubject(), 0, 0),
urlRenderer.renderURL(comment),
escapeBestFragments(query, new SimpleFragmenter(100), comment.getContent(), 5, 350)
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/annotations/Searchable.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/annotations/Searchable.java 2008-02-29 12:50:52 UTC (rev 7496)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/annotations/Searchable.java 2008-03-02 12:56:31 UTC (rev 7497)
@@ -24,4 +24,5 @@
public @interface Searchable {
String description();
SearchableType type() default SearchableType.PHRASE;
+ String embeddedProperty() default "";
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/annotations/SearchableType.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/annotations/SearchableType.java 2008-02-29 12:50:52 UTC (rev 7496)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/annotations/SearchableType.java 2008-03-02 12:56:31 UTC (rev 7497)
@@ -8,5 +8,5 @@
* @author Christian Bauer
*/
public enum SearchableType {
- PHRASE, PASTDATE, NUMRANGE
+ PHRASE, STRING, PASTDATE, NUMRANGE
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/metamodel/SearchRegistry.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/metamodel/SearchRegistry.java 2008-02-29 12:50:52 UTC (rev 7496)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/metamodel/SearchRegistry.java 2008-03-02 12:56:31 UTC (rev 7497)
@@ -110,6 +110,24 @@
searchableEntity.getProperties().add(property);
}
+ // @Searchable and embedded indexed getters
+ for (Method method : getGetters(entityClass, Searchable.class, org.hibernate.search.annotations.IndexedEmbedded.class)) {
+
+ String prefix = method.getAnnotation(org.hibernate.search.annotations.IndexedEmbedded.class).prefix();
+ propertyName = prefix + method.getAnnotation(Searchable.class).embeddedProperty();
+ if (propertyName.length() == 0)
+ throw new RuntimeException("@IndexedEmbedded requires @Searchable(embeddedProperty) name on entity " + entityClass.getName());
+ propertyDescription = method.getAnnotation(Searchable.class).description();
+ type = method.getAnnotation(Searchable.class).type();
+
+ SearchableProperty property = new SearchablePropertySingle(
+ propertyName,
+ propertyDescription,
+ type
+ );
+ searchableEntity.getProperties().add(property);
+ }
+
// @Searchable fields
for (Field field : getFields(entityClass, Searchable.class, org.hibernate.search.annotations.Field.class)) {
indexFieldName = field.getAnnotation(org.hibernate.search.annotations.Field.class).name();
@@ -126,6 +144,24 @@
}
+ // @Searchable and embedded indexed fields
+ for (Field field : getFields(entityClass, Searchable.class, org.hibernate.search.annotations.IndexedEmbedded.class)) {
+ String prefix = field.getAnnotation(org.hibernate.search.annotations.IndexedEmbedded.class).prefix();
+ propertyName = prefix + field.getAnnotation(Searchable.class).embeddedProperty();
+ if (propertyName.length() == 0)
+ throw new RuntimeException("@IndexedEmbedded requires @Searchable(embeddedProperty) name on entity " + entityClass.getName());
+ propertyDescription = field.getAnnotation(Searchable.class).description();
+ type = field.getAnnotation(Searchable.class).type();
+
+ SearchableProperty property = new SearchablePropertySingle(
+ propertyName,
+ propertyDescription,
+ type
+ );
+ searchableEntity.getProperties().add(property);
+
+ }
+
return searchableEntity;
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/metamodel/SearchableProperty.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/metamodel/SearchableProperty.java 2008-02-29 12:50:52 UTC (rev 7496)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/metamodel/SearchableProperty.java 2008-03-02 12:56:31 UTC (rev 7497)
@@ -102,7 +102,16 @@
query = buildRangeQuery(fieldName, df.format(startDate.getTime()), df.format(today.getTime()));
}
+ } else if (getType().equals(SearchableType.STRING)) {
+
+ String includeString = (String)search.getTerms().get(TERM_INCLUDE);
+ if (includeString != null && includeString.length() >0) {
+ log.debug("building include term query for field: " + fieldName);
+ query = buildTermQuery(fieldName, includeString);
+ }
}
+
+
return query;
}
Modified: trunk/examples/wiki/view/search_d.xhtml
===================================================================
--- trunk/examples/wiki/view/search_d.xhtml 2008-02-29 12:50:52 UTC (rev 7496)
+++ trunk/examples/wiki/view/search_d.xhtml 2008-03-02 12:56:31 UTC (rev 7497)
@@ -125,6 +125,10 @@
</h:selectOneMenu>
</s:div>
+ <h:panelGrid columns="5" rendered="#{search.property.type == 'STRING'}">
+ <h:inputText value="#{search.terms['include']}" size="32" tabindex="1"/>
+ </h:panelGrid>
+
</h:column>
</h:dataTable>
[View Less]
17 years, 1 month