[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model ...
Christian Bauer
christian at hibernate.org
Sat Dec 29 21:33:22 EST 2007
User: cbauer
Date: 07/12/29 21:33:22
Modified: examples/wiki/src/main/org/jboss/seam/wiki/core/model
WikiDirectory.java WikiNode.java
DatabaseObjects.hbm.xml LinkProtocol.java
UserProfile.java WikiDocumentFeedEntry.java
WikiDocument.java User.java Role.java
WikiComment.java FeedEntry.java
Removed: examples/wiki/src/main/org/jboss/seam/wiki/core/model
WikiMacro.java
Log:
Complete overhaul of the preferences system
Revision Changes Path
1.3 +2 -2 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDirectory.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: WikiDirectory.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDirectory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- WikiDirectory.java 20 Dec 2007 12:23:04 -0000 1.2
+++ WikiDirectory.java 30 Dec 2007 02:33:21 -0000 1.3
@@ -26,8 +26,8 @@
@org.hibernate.annotations.LazyToOne(org.hibernate.annotations.LazyToOneOption.NO_PROXY)
private WikiFile defaultFile;
- @OneToOne(fetch = FetchType.LAZY, mappedBy = "directory", cascade = CascadeType.PERSIST)
- @org.hibernate.annotations.LazyToOne(org.hibernate.annotations.LazyToOneOption.NO_PROXY)
+ @OneToOne(fetch = FetchType.EAGER, mappedBy = "directory", cascade = CascadeType.PERSIST)
+ @org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.JOIN)
private Feed feed;
@Embedded
1.3 +1 -4 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiNode.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: WikiNode.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- WikiNode.java 20 Dec 2007 12:23:04 -0000 1.2
+++ WikiNode.java 30 Dec 2007 02:33:22 -0000 1.3
@@ -33,7 +33,7 @@
@Version
@Column(name = "OBJ_VERSION", nullable = false)
- protected int version;
+ protected int version = 0;
@Column(name = "AREA_NR", nullable = false)
protected Long areaNumber;
@@ -100,9 +100,6 @@
@org.hibernate.annotations.OnDelete(action = org.hibernate.annotations.OnDeleteAction.CASCADE)
@org.hibernate.annotations.ForeignKey(name = "FK_WIKI_NODE_PARENT_NODE_ID")
@org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.JOIN)
- /*
- @org.hibernate.annotations.LazyToOne(org.hibernate.annotations.LazyToOneOption.NO_PROXY)
- */
protected WikiNode parent;
protected WikiNode() {}
1.9 +98 -8 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/DatabaseObjects.hbm.xml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: DatabaseObjects.hbm.xml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/DatabaseObjects.hbm.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- DatabaseObjects.hbm.xml 19 Dec 2007 04:29:20 -0000 1.8
+++ DatabaseObjects.hbm.xml 30 Dec 2007 02:33:22 -0000 1.9
@@ -111,20 +111,20 @@
<database-object>
<create>
- create index IDX_COMPONENT_NAME on PREFERENCE (COMPONENT_NAME);
+ create index IDX_PREFERENCE_ENTITY_NAME on PREFERENCE (ENTITY_NAME);
</create>
<drop>
- drop index IDX_COMPONENT_NAME
+ drop index IDX_PREFERENCE_ENTITY_NAME
</drop>
<dialect-scope name="org.hibernate.dialect.HSQLDialect"/>
</database-object>
<database-object>
<create>
- create index IDX_COMPONENT_PROPERTY_NAME on PREFERENCE (PROPERTY_NAME, COMPONENT_NAME);
+ create index IDX_PREFERENCE_ENTITY_PROPERTY_NAME on PREFERENCE (PROPERTY_NAME, ENTITY_NAME);
</create>
<drop>
- drop index IDX_COMPONENT_PROPERTY_NAME
+ drop index IDX_PREFERENCE_ENTITY_PROPERTY_NAME
</drop>
<dialect-scope name="org.hibernate.dialect.HSQLDialect"/>
</database-object>
@@ -281,20 +281,110 @@
<database-object>
<create>
- create index IDX_COMPONENT_NAME on PREFERENCE (COMPONENT_NAME);
+ create index IDX_PREFERENCE_ENTITY_NAME on PREFERENCE (ENTITY_NAME)
</create>
<drop>
- drop index IDX_COMPONENT_NAME
+ drop index IDX_PREFERENCE_ENTITY_NAME
</drop>
<dialect-scope name="org.hibernate.dialect.MySQL5InnoDBDialect"/>
</database-object>
<database-object>
<create>
- create index IDX_COMPONENT_PROPERTY_NAME on PREFERENCE (PROPERTY_NAME, COMPONENT_NAME);
+ create index IDX_PREFERENCE_ENTITY_PROPERTY_NAME on PREFERENCE (PROPERTY_NAME, ENTITY_NAME)
</create>
<drop>
- drop index IDX_COMPONENT_PROPERTY_NAME
+ drop index IDX_PREFERENCE_ENTITY_PROPERTY_NAME
+ </drop>
+ <dialect-scope name="org.hibernate.dialect.MySQL5InnoDBDialect"/>
+ </database-object>
+
+ <database-object>
+ <create>
+ create index IDX_WIKI_NODE_READ_ACCESS_LEVEL on WIKI_NODE (READ_ACCESS_LEVEL)
+ </create>
+ <drop>
+ drop index IDX_WIKI_NODE_READ_ACCESS_LEVEL
+ </drop>
+ <dialect-scope name="org.hibernate.dialect.MySQL5InnoDBDialect"/>
+ </database-object>
+
+ <database-object>
+ <create>
+ create index IDX_WIKI_NODE_CREATED_ON on WIKI_NODE (CREATED_ON)
+ </create>
+ <drop>
+ drop index IDX_WIKI_NODE_CREATED_ON
+ </drop>
+ <dialect-scope name="org.hibernate.dialect.MySQL5InnoDBDialect"/>
+ </database-object>
+
+ <database-object>
+ <create>
+ create index IDX_WIKI_DIRECTORY_NS_LEFT on WIKI_DIRECTORY (NS_LEFT)
+ </create>
+ <drop>
+ drop index IDX_WIKI_DIRECTORY_NS_LEFT
+ </drop>
+ <dialect-scope name="org.hibernate.dialect.MySQL5InnoDBDialect"/>
+ </database-object>
+
+ <database-object>
+ <create>
+ create index IDX_WIKI_DIRECTORY_NS_RIGHT on WIKI_DIRECTORY (NS_RIGHT)
+ </create>
+ <drop>
+ drop index IDX_WIKI_DIRECTORY_NS_RIGHT
+ </drop>
+ <dialect-scope name="org.hibernate.dialect.MySQL5InnoDBDialect"/>
+ </database-object>
+
+ <database-object>
+ <create>
+ create index IDX_WIKI_DIRECTORY_NS_THREAD on WIKI_DIRECTORY (NS_THREAD)
+ </create>
+ <drop>
+ drop index IDX_WIKI_DIRECTORY_NS_THREAD
+ </drop>
+ <dialect-scope name="org.hibernate.dialect.MySQL5InnoDBDialect"/>
+ </database-object>
+
+ <database-object>
+ <create>
+ create index IDX_WIKI_COMMENT_NS_LEFT on WIKI_COMMENT (NS_LEFT)
+ </create>
+ <drop>
+ drop index IDX_WIKI_COMMENT_NS_LEFT
+ </drop>
+ <dialect-scope name="org.hibernate.dialect.MySQL5InnoDBDialect"/>
+ </database-object>
+
+ <database-object>
+ <create>
+ create index IDX_WIKI_COMMENT_NS_RIGHT on WIKI_COMMENT (NS_RIGHT)
+ </create>
+ <drop>
+ drop index IDX_WIKI_COMMENT_NS_RIGHT
+ </drop>
+ <dialect-scope name="org.hibernate.dialect.MySQL5InnoDBDialect"/>
+ </database-object>
+
+ <database-object>
+ <create>
+ create index IDX_WIKI_COMMENT_NS_THREAD on WIKI_COMMENT (NS_THREAD)
+ </create>
+ <drop>
+ drop index IDX_WIKI_COMMENT_NS_THREAD
+ </drop>
+ <dialect-scope name="org.hibernate.dialect.MySQL5InnoDBDialect"/>
+ </database-object>
+
+ <database-object>
+ <create>
+ create index IDX_WIKI_DOCUMENT_HEADER_MACROS on WIKI_DOCUMENT (HEADER_MACROS)
+ </create>
+ <drop>
+ drop index IDX_WIKI_DOCUMENT_HEADER_MACROS
</drop>
<dialect-scope name="org.hibernate.dialect.MySQL5InnoDBDialect"/>
</database-object>
1.6 +1 -1 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/LinkProtocol.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: LinkProtocol.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/LinkProtocol.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- LinkProtocol.java 19 Dec 2007 04:29:20 -0000 1.5
+++ LinkProtocol.java 30 Dec 2007 02:33:22 -0000 1.6
@@ -23,7 +23,7 @@
@Version
@Column(name = "OBJ_VERSION", nullable = false)
- protected int version;
+ protected int version = 0;
@Column(name = "PREFIX", nullable = false)
@Length(min = 2, max = 10)
1.4 +1 -1 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/UserProfile.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UserProfile.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/UserProfile.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- UserProfile.java 19 Dec 2007 04:29:20 -0000 1.3
+++ UserProfile.java 30 Dec 2007 02:33:22 -0000 1.4
@@ -23,7 +23,7 @@
@Version
@Column(name = "OBJ_VERSION", nullable = false)
- protected int version;
+ private int version = 0;
@Column(name = "CREATED_ON", nullable = false, updatable = false)
private Date createdOn = new Date();
1.2 +4 -0 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocumentFeedEntry.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: WikiDocumentFeedEntry.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocumentFeedEntry.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- WikiDocumentFeedEntry.java 19 Dec 2007 04:29:20 -0000 1.1
+++ WikiDocumentFeedEntry.java 30 Dec 2007 02:33:22 -0000 1.2
@@ -24,4 +24,8 @@
return getDocument().getReadAccessLevel();
}
+ public boolean isTagged(String tag) {
+ return getDocument().isTagged(tag);
+ }
+
}
1.3 +11 -4 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocument.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: WikiDocument.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocument.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- WikiDocument.java 20 Dec 2007 12:23:04 -0000 1.2
+++ WikiDocument.java 30 Dec 2007 02:33:22 -0000 1.3
@@ -2,6 +2,7 @@
import org.hibernate.validator.Length;
import org.jboss.seam.wiki.core.search.annotations.Searchable;
+import org.jboss.seam.wiki.core.engine.WikiMacro;
import javax.persistence.*;
import java.io.Serializable;
@@ -142,10 +143,16 @@
}
public boolean macroPresent(String macroName) {
- WikiMacro wikiMacro = new WikiMacro(macroName);
- return getHeaderMacros().contains(wikiMacro) ||
- getContentMacros().contains(wikiMacro) ||
- getFooterMacros().contains(wikiMacro);
+ for (WikiMacro headerMacro : headerMacros) {
+ if (headerMacro.getName().equals(macroName)) return true;
+ }
+ for (WikiMacro contentMacro : contentMacros) {
+ if (contentMacro.getName().equals(macroName)) return true;
+ }
+ for (WikiMacro footerMacro : footerMacros) {
+ if (footerMacro.getName().equals(macroName)) return true;
+ }
+ return false;
}
public String getFeedDescription() {
1.15 +1 -1 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/User.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: User.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/User.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- User.java 19 Dec 2007 04:29:20 -0000 1.14
+++ User.java 30 Dec 2007 02:33:22 -0000 1.15
@@ -30,7 +30,7 @@
@Version
@Column(name = "OBJ_VERSION", nullable = false)
- private int version;
+ private int version = 0;
@Column(name = "FIRSTNAME", length = 63, nullable = false)
@NotNull
1.9 +1 -1 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Role.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Role.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Role.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- Role.java 19 Dec 2007 04:29:20 -0000 1.8
+++ Role.java 30 Dec 2007 02:33:22 -0000 1.9
@@ -26,7 +26,7 @@
@Version
@Column(name = "OBJ_VERSION", nullable = false)
- private int version;
+ private int version = 0;
@Column(name = "NAME", length = 255, nullable = false, unique = true)
private String name;
1.3 +4 -4 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiComment.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: WikiComment.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiComment.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- WikiComment.java 20 Dec 2007 12:23:04 -0000 1.2
+++ WikiComment.java 30 Dec 2007 02:33:22 -0000 1.3
@@ -136,14 +136,14 @@
return "/" + getArea().getWikiname() + "/" + getParentDocument().getWikiname() + "#comment" + getId();
}
- // TODO: Everything can have comments
- public WikiDocument getParentDocument() {
+ // TODO: Everything can have comments, this has the wrong name and it's crude
+ public WikiNode getParentDocument() {
WikiNode current = this.getParent();
- if (WikiDocument.class.isAssignableFrom(current.getClass())) return (WikiDocument)current;
+ if (WikiDocument.class.isAssignableFrom(current.getClass())) return current;
while (current.getParent() != null && WikiComment.class.isAssignableFrom(current.getParent().getClass())) {
current = current.getParent();
}
- return (WikiDocument)current.getParent(); // Let's just assume that the parent of a comment is at some point a document
+ return current.getParent(); // Let's just assume that the parent of a comment is at some point a document
}
1.15 +5 -1 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/FeedEntry.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: FeedEntry.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/FeedEntry.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- FeedEntry.java 19 Dec 2007 04:29:20 -0000 1.14
+++ FeedEntry.java 30 Dec 2007 02:33:22 -0000 1.15
@@ -29,7 +29,7 @@
@Version
@Column(name = "OBJ_VERSION", nullable = false)
- protected int version;
+ protected int version = 0;
@Column(name = "LINK", nullable = false)
@Length(min = 3, max = 1024)
@@ -139,6 +139,10 @@
return 0; // No restrictions
}
+ public boolean isTagged(String tag) {
+ return false; // Can't be tagged
+ }
+
// Sort by date
public int compareTo(Object o) {
FeedEntry other = (FeedEntry)o;
More information about the jboss-cvs-commits
mailing list