JBoss Rich Faces SVN: r12428 - in trunk/ui/extendedDataTable/src/main: java/org/richfaces/renderkit and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: pgolawski
Date: 2009-01-26 11:24:43 -0500 (Mon, 26 Jan 2009)
New Revision: 12428
Modified:
trunk/ui/extendedDataTable/src/main/config/component/ExtendedDataTable.xml
trunk/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java
trunk/ui/extendedDataTable/src/main/resources/org/richfaces/renderkit/html/css/extendedDataTable.xcss
trunk/ui/extendedDataTable/src/main/templates/org/richfaces/htmlExtendedDataTable.jspx
Log:
added build-in information row in case there are no data rows to display
Modified: trunk/ui/extendedDataTable/src/main/config/component/ExtendedDataTable.xml
===================================================================
--- trunk/ui/extendedDataTable/src/main/config/component/ExtendedDataTable.xml 2009-01-26 16:23:06 UTC (rev 12427)
+++ trunk/ui/extendedDataTable/src/main/config/component/ExtendedDataTable.xml 2009-01-26 16:24:43 UTC (rev 12428)
@@ -46,6 +46,11 @@
<description>Defines an id of column which the data is grouped by.</description>
</property>
<property>
+ <name>noDataLabel</name>
+ <classname>java.lang.String</classname>
+ <description>Defines label to be displayed in case there are no data rows.</description>
+ </property>
+ <property>
<name>onselectionchange</name>
<classname>java.lang.String</classname>
<description> HTML: script expression to invoke on changing of rows
Modified: trunk/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java
===================================================================
--- trunk/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java 2009-01-26 16:23:06 UTC (rev 12427)
+++ trunk/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java 2009-01-26 16:24:43 UTC (rev 12428)
@@ -50,6 +50,7 @@
import org.richfaces.component.UIDataTable;
import org.richfaces.component.UIExtendedDataTable;
import org.richfaces.component.nsutils.NSUtils;
+import org.richfaces.component.util.ComponentMessageUtil;
import org.richfaces.event.extdt.ChangeColumnVisibilityEvent;
import org.richfaces.event.extdt.ColumnResizeEvent;
import org.richfaces.event.extdt.DragDropEvent;
@@ -106,6 +107,11 @@
private static final String MIN_COLUMN_WIDTH = "20";
//private final Log log = LogFactory.getLog(UIExtendedDataTable.class);
+
+ /*
+ * Message key constants
+ */
+ private static final String MSG_NODATA = "org.richfaces.component.UIExtendedDataTable.NoData";
/**
* Encode all table structure - colgroups definitions, caption, header,
@@ -698,6 +704,30 @@
encodeRowStart(context, getRowSkinClass(), rowClass, table, holder,
writer);
}
+
+ public void encodeNoDataRow(FacesContext context,
+ UIComponent component) throws IOException {
+ UIDataTable table = (UIDataTable) component;
+ ResponseWriter writer = context.getResponseWriter();
+ int numberOfColumns = getColumnsCount(table) + 1;
+ writer.startElement(HTML.TR_ELEMENT, table);
+ writer.writeAttribute(HTML.id_ATTRIBUTE, table.getBaseClientId(context)
+ + ":noDataRow", null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "extdt-noData-row " + getRowSkinClass(), null);
+
+ writer.startElement(HTML.td_ELEM, table);
+ writer.writeAttribute(HTML.class_ATTRIBUTE,
+ "extdt-noData-cell " + getCellSkinClass(), null);
+ writer.writeAttribute("colspan", numberOfColumns, null);
+ String label = (String)table.getAttributes().get("noDataLabel");
+ if ((label == null) || (label.length() == 0)) {
+ label = ComponentMessageUtil.getMessage(context, MSG_NODATA, new Object[] {}).getSummary();
+ }
+ writer.writeText(label, null);
+ writer.endElement(HTML.td_ELEM);
+ writer.endElement(HTML.TR_ELEMENT);
+
+ }
/**
* @return
Modified: trunk/ui/extendedDataTable/src/main/resources/org/richfaces/renderkit/html/css/extendedDataTable.xcss
===================================================================
--- trunk/ui/extendedDataTable/src/main/resources/org/richfaces/renderkit/html/css/extendedDataTable.xcss 2009-01-26 16:23:06 UTC (rev 12427)
+++ trunk/ui/extendedDataTable/src/main/resources/org/richfaces/renderkit/html/css/extendedDataTable.xcss 2009-01-26 16:24:43 UTC (rev 12428)
@@ -36,6 +36,14 @@
display: none;
}
+ .extdt-noData-row {
+ }
+
+ .extdt-noData-cell {
+ text-align: center;
+ font-weight: bold;
+ }
+
.extdt-thead {
}
Modified: trunk/ui/extendedDataTable/src/main/templates/org/richfaces/htmlExtendedDataTable.jspx
===================================================================
--- trunk/ui/extendedDataTable/src/main/templates/org/richfaces/htmlExtendedDataTable.jspx 2009-01-26 16:23:06 UTC (rev 12427)
+++ trunk/ui/extendedDataTable/src/main/templates/org/richfaces/htmlExtendedDataTable.jspx 2009-01-26 16:24:43 UTC (rev 12428)
@@ -43,11 +43,6 @@
variables.setVariable("columnsCount", getColumnsCount(component)+1);
]]>
</jsp:scriptlet>
-
- <!--
- TODO nick - enclose all HTML elements into one container element or add them
- to rendered areas manually in order to be handled correctly by AJAX updates
- -->
<div
id="#{clientId}"
@@ -88,6 +83,26 @@
<tr>
<td colspan="#{columnsCount}" style="padding: 0px;">
<div id="#{clientId}:sd" class="extdt-content" style="height:50px;width:100%;">
+ <jsp:scriptlet>
+ <![CDATA[
+ if (component.getRowCount() <= 0) {
+ ]]>
+ </jsp:scriptlet>
+ <table id="#{clientId}:empty" width="100%"
+ class="extdt-table-layout rich-table #{component.attributes['styleClass']}"
+ >
+ <f:call name="utils.encodePassThruWithExclusions">
+ <f:parameter value="height,value,name,type,id,class,rows,style,width" />
+ </f:call>
+ <tbody>
+ <f:call name="encodeNoDataRow"/>
+ </tbody>
+ </table>
+ <jsp:scriptlet>
+ <![CDATA[
+ }
+ ]]>
+ </jsp:scriptlet>
<table id="#{clientId}:n" width="100%"
class="extdt-table-layout rich-table #{component.attributes['styleClass']}"
>
16 years, 11 months
JBoss Rich Faces SVN: r12427 - in trunk/test-applications/realworld/web/src/main/webapp: stylesheet and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: alevkovsky
Date: 2009-01-26 11:23:06 -0500 (Mon, 26 Jan 2009)
New Revision: 12427
Modified:
trunk/test-applications/realworld/web/src/main/webapp/layout/menu.xhtml
trunk/test-applications/realworld/web/src/main/webapp/layout/template2.xhtml
trunk/test-applications/realworld/web/src/main/webapp/stylesheet/realworld2.css
Log:
Redesign realworld application
Modified: trunk/test-applications/realworld/web/src/main/webapp/layout/menu.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/layout/template2.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/stylesheet/realworld2.css
===================================================================
--- trunk/test-applications/realworld/web/src/main/webapp/stylesheet/realworld2.css 2009-01-26 16:15:02 UTC (rev 12426)
+++ trunk/test-applications/realworld/web/src/main/webapp/stylesheet/realworld2.css 2009-01-26 16:23:06 UTC (rev 12427)
@@ -29,13 +29,13 @@
.top-right-menu-item {
vertical-align: top;
- padding: 0px 8px 0px 15px;
}
-.top-right-menu-item-content {
+.top-right-menu-item a {
font-size: 11px;
color: #ffffff;
text-decoration: none;
+ font-weight: normal;
}
.main-menu {
@@ -83,12 +83,12 @@
color: #FF7D2A
}
-.rich-toolbar {
+.main-menu-toolbar {
background: none;
border: none;
}
-.rich-toolbar-item a {
+.main-menu-toolbar-content a {
color: #FFFFFF;
font-size: 11px;
font-weight: bold;
16 years, 11 months
JBoss Rich Faces SVN: r12426 - trunk/framework/impl/src/main/resources/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: pgolawski
Date: 2009-01-26 11:15:02 -0500 (Mon, 26 Jan 2009)
New Revision: 12426
Modified:
trunk/framework/impl/src/main/resources/org/richfaces/component/messages.properties
trunk/framework/impl/src/main/resources/org/richfaces/component/messages_de.properties
trunk/framework/impl/src/main/resources/org/richfaces/component/messages_en.properties
trunk/framework/impl/src/main/resources/org/richfaces/component/messages_pl.properties
Log:
added "org.richfaces.component.UIExtendedDataTable.NoData" message
Modified: trunk/framework/impl/src/main/resources/org/richfaces/component/messages.properties
===================================================================
--- trunk/framework/impl/src/main/resources/org/richfaces/component/messages.properties 2009-01-26 15:55:56 UTC (rev 12425)
+++ trunk/framework/impl/src/main/resources/org/richfaces/component/messages.properties 2009-01-26 16:15:02 UTC (rev 12426)
@@ -4,6 +4,7 @@
org.richfaces.component.UIExtendedDataTable.Menu.SortDescending=Sort Descending
org.richfaces.component.UIExtendedDataTable.Menu.GroupByColumn=Group by this column
org.richfaces.component.UIExtendedDataTable.Menu.DisableGrouping=Disable Grouping
+org.richfaces.component.UIExtendedDataTable.NoData=No data
# converters
Modified: trunk/framework/impl/src/main/resources/org/richfaces/component/messages_de.properties
===================================================================
--- trunk/framework/impl/src/main/resources/org/richfaces/component/messages_de.properties 2009-01-26 15:55:56 UTC (rev 12425)
+++ trunk/framework/impl/src/main/resources/org/richfaces/component/messages_de.properties 2009-01-26 16:15:02 UTC (rev 12426)
@@ -4,6 +4,7 @@
org.richfaces.component.UIExtendedDataTable.Menu.SortDescending=Aufsteigend sortieren
org.richfaces.component.UIExtendedDataTable.Menu.GroupByColumn=Gruppierung anhand der Spalte
org.richfaces.component.UIExtendedDataTable.Menu.DisableGrouping=Gruppierung aufheben
+org.richfaces.component.UIExtendedDataTable.NoData=Keine Daten
# converters
Modified: trunk/framework/impl/src/main/resources/org/richfaces/component/messages_en.properties
===================================================================
--- trunk/framework/impl/src/main/resources/org/richfaces/component/messages_en.properties 2009-01-26 15:55:56 UTC (rev 12425)
+++ trunk/framework/impl/src/main/resources/org/richfaces/component/messages_en.properties 2009-01-26 16:15:02 UTC (rev 12426)
@@ -4,6 +4,7 @@
org.richfaces.component.UIExtendedDataTable.Menu.SortDescending=Sort Descending
org.richfaces.component.UIExtendedDataTable.Menu.GroupByColumn=Group by this column
org.richfaces.component.UIExtendedDataTable.Menu.DisableGrouping=Disable Grouping
+org.richfaces.component.UIExtendedDataTable.NoData=No data
# converters
Modified: trunk/framework/impl/src/main/resources/org/richfaces/component/messages_pl.properties
===================================================================
--- trunk/framework/impl/src/main/resources/org/richfaces/component/messages_pl.properties 2009-01-26 15:55:56 UTC (rev 12425)
+++ trunk/framework/impl/src/main/resources/org/richfaces/component/messages_pl.properties 2009-01-26 16:15:02 UTC (rev 12426)
@@ -4,6 +4,7 @@
org.richfaces.component.UIExtendedDataTable.Menu.SortDescending=Sortuj malej\u0105co
org.richfaces.component.UIExtendedDataTable.Menu.GroupByColumn=Grupuj po kolumnie
org.richfaces.component.UIExtendedDataTable.Menu.DisableGrouping=Wy\u0142\u0105cz grupowanie
+org.richfaces.component.UIExtendedDataTable.NoData=Brak danych
# converters
16 years, 11 months
JBoss Rich Faces SVN: r12425 - in trunk/test-applications/realworld: web/src/main/java/org/richfaces/realworld/fileupload and 6 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2009-01-26 10:55:56 -0500 (Mon, 26 Jan 2009)
New Revision: 12425
Added:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchParamHolder.java
Removed:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeManager.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/ui/ConversationState.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/ui/RenderLogic.java
Modified:
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/Constants.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ISearchService.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/SearchService.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileManager.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/ImageLoader.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBean.java
trunk/test-applications/realworld/web/src/main/webapp/includes/fileUpload/singleMode.xhtml
trunk/test-applications/realworld/web/src/main/webapp/includes/search/advancedSearch.xhtml
Log:
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/Constants.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/Constants.java 2009-01-26 15:25:08 UTC (rev 12424)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/Constants.java 2009-01-26 15:55:56 UTC (rev 12425)
@@ -83,7 +83,7 @@
public static final String USER_AVAILABLE_USERS_QUERY = "user-availableUsers";
public static final String USER_EXIST_QUERY = "user-exist";
public static final String USER_LOGIN_QUERY = "user-login";
- public static final String USER_ROOT_ALBUMS_QUERY = "user-login";
+ public static final String USER_ROOT_ALBUMS_QUERY = "user-rootAlbums";
public static final String FRIEND_PARAMETER = "friend";
public static final String PERCENT = "%";
public static final String LOGIN_PARAMETER = "login";
@@ -126,6 +126,21 @@
public static final String USER_COUNT_MESSAGES_QUERY = "user-countMessages";
public static final String ALBUM_BY_ALBUM_NAME_AND_LOGIN_QUERY = "album-byAlbumNameAndLogin";
public static final String ALBUM_NAME_PARAMETER = "albumName";
+ public static final String EQUALS = "= ";
+ public static final String LESSTHEN = "< ";
+ public static final String GREATTHEN = "> ";
+ public static final String DATE_ADDON = " and i.created";
+ public static final String UPLOAD_ADDON = " and i.upload";
+ public static final String HEIGHT_ADDON = " and i.height";
+ public static final String SIZE_ADDON = " and i.size";
+ public static final String WIDTH_ADDON = " and i.width";
+ public static final String CAMERA_ADDON = " and i.cameraModel";
+ public static final String VOTES_ADDON = " and i.rank.hits";
+ public static final String SPINNER_ADDON = " and i.rank.total/i.rank.hits";
+ public static final String STRICT = "STRICT";
+ public static final String INCLUDE = "INCLUDE";
+ public static final String END = "END";
+ public static final String START = "START";
private Constants(){
}
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ISearchService.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ISearchService.java 2009-01-26 15:25:08 UTC (rev 12424)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ISearchService.java 2009-01-26 15:55:56 UTC (rev 12425)
@@ -31,9 +31,9 @@
public abstract List<Image> searchImages(String searchPattern, String additionalParams, Map<String, Object> paramMap);
- public List<Image> popularImages(String additionalParams, Map<String, Object> paramMap);
+ public List<Image> popularImages();
- public List<Image> worstImages(String additionalParams, Map<String, Object> paramMap);
+ public List<Image> worstImages();
public abstract List<String> getAllCameras();
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/SearchService.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/SearchService.java 2009-01-26 15:25:08 UTC (rev 12424)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/SearchService.java 2009-01-26 15:55:56 UTC (rev 12425)
@@ -65,49 +65,63 @@
additions.remove(0);
return filter(tempResult, additions, removals);
}
-
- private List<Image> filter(List<Image> tempResult, List<String> additions,
- List<String> removals) {
- List<Image> result = new ArrayList<Image>();
- result.addAll(tempResult);
- for(Image i : tempResult){
- for(String a:additions){
- if(!i.containTag(a)){
- result.remove(i);
- break;
- }
- }
- }
- tempResult.clear();
- tempResult.addAll(result);
- for(Image i : result){
- for(String a:removals){
- if(i.containTag(a)){
- tempResult.remove(i);
- break;
- }
- }
- }
- return tempResult;
- }
@SuppressWarnings("unchecked")
- public List<Image> popularImages(String additionalParams, Map<String, Object> paramMap){
- String fullQuery = Constants.SEARCH_RELEVANT_QUERY_BEGIN + additionalParams + Constants.SEARCH_POPULAR_QUERY_END;
- Query prepared = prepareQuery(fullQuery, null, additionalParams, paramMap);
+ public List<Image> popularImages(){
+ String fullQuery = Constants.SEARCH_RELEVANT_QUERY_BEGIN + Constants.SEARCH_POPULAR_QUERY_END;
+ Query prepared = em.createQuery(fullQuery).setMaxResults(20);
return prepared.getResultList();
}
@SuppressWarnings("unchecked")
- public List<Image> worstImages(String additionalParams, Map<String, Object> paramMap){
- String fullQuery = Constants.SEARCH_RELEVANT_QUERY_BEGIN + additionalParams + Constants.SEARCH_UNPOPULAR_QUERY_END;
- Query prepared = prepareQuery(fullQuery, null, additionalParams, paramMap);
+ public List<Image> worstImages(){
+ String fullQuery = Constants.SEARCH_RELEVANT_QUERY_BEGIN + Constants.SEARCH_UNPOPULAR_QUERY_END;
+ Query prepared = em.createQuery(fullQuery).setMaxResults(20);
return prepared.getResultList();
}
+
+ @SuppressWarnings("unchecked")
+ public List<String> getAllCameras() {
+ Query query = em.createNamedQuery(Constants.IMAGE_CAMERA_QUERY);
+ return (List<String>)query.getResultList();
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<String> getAllMetatags() {
+ Query query = em.createNamedQuery(Constants.IMAGE_TAGS_QUERY);
+ return (List<String>)query.getResultList();
+ }
private Query prepareQuery(String fullQuery ,String searchPattern, String additionalParams,
Map<String, Object> paramMap) {
Query prepared = em.createQuery(fullQuery);
+ setPattern(searchPattern, paramMap, prepared);
+ setParameters(paramMap, prepared);
+ prepared.setMaxResults(20);
+ return prepared;
+ }
+
+ private void setParameters(Map<String, Object> paramMap, Query prepared) {
+ if(paramMap != null){
+ setParameter(paramMap, prepared, Constants.SPINNER_VALUE_NAMED_PARAMETER, Constants.SPINNER_VALUE_PARAMETER);
+ setParameter(paramMap, prepared, Constants.CHOICE_NAMED_PARAMETER, Constants.CHOICE_PARAMETER);
+ setParameter(paramMap, prepared, Constants.DATE_NAMED_PARAMETER, Constants.DATE_PARAMETER);
+ setParameter(paramMap, prepared, Constants.UPLOAD_NAMED_PARAMETER, Constants.UPLOAD_PARAMETER);
+ setParameter(paramMap, prepared, Constants.WIDTH_NAMED_PARAMETER, Constants.WIDTH_PARAMETER);
+ setParameter(paramMap, prepared, Constants.HEIGHT_NAMED_PARAMETER, Constants.HEIGHT_PARAMETER);
+ setParameter(paramMap, prepared, Constants.SIZE_NAMED_PARAMETER, Constants.SIZE_PARAMETER);
+ setParameter(paramMap, prepared, Constants.CAMERA_NAMED_PARAMETER, Constants.CAMERA_PARAMETER);
+ }
+ }
+
+ private void setParameter(Map<String, Object> paramMap, Query prepared, String parameter, String holder){
+ if(paramMap.get(parameter) != null){
+ prepared.setParameter(holder, paramMap.get(parameter));
+ }
+ }
+
+ private void setPattern(String searchPattern, Map<String, Object> paramMap,
+ Query prepared) {
if(searchPattern != null){
if(paramMap != null && paramMap.get(Constants.STRICT_PARAMETER) != null){
String strict = paramMap.get(Constants.STRICT_PARAMETER).toString();
@@ -124,45 +138,32 @@
prepared.setParameter(Constants.METATAG_PARAMETER, searchPattern.toUpperCase()+Constants.PERCENT);
}
}
- if(paramMap != null && paramMap.get(Constants.SPINNER_VALUE_NAMED_PARAMETER) != null){
- prepared.setParameter(Constants.SPINNER_VALUE_PARAMETER, paramMap.get(Constants.SPINNER_VALUE_NAMED_PARAMETER));
+ }
+
+ private List<Image> filter(List<Image> tempResult, List<String> additions,
+ List<String> removals) {
+ List<Image> result = new ArrayList<Image>();
+ result.addAll(tempResult);
+ for(Image i : tempResult){
+ for(String a:additions){
+ if(!i.containTag(a)){
+ result.remove(i);
+ break;
+ }
+ }
}
- if(paramMap != null && paramMap.get(Constants.CHOICE_NAMED_PARAMETER) != null){
- prepared.setParameter(Constants.CHOICE_PARAMETER, paramMap.get(Constants.CHOICE_NAMED_PARAMETER));
+ tempResult.clear();
+ tempResult.addAll(result);
+ for(Image i : result){
+ for(String a:removals){
+ if(i.containTag(a)){
+ tempResult.remove(i);
+ break;
+ }
+ }
}
- if(paramMap != null && paramMap.get(Constants.DATE_NAMED_PARAMETER) != null){
- prepared.setParameter(Constants.DATE_PARAMETER, paramMap.get(Constants.DATE_NAMED_PARAMETER));
- }
- if(paramMap != null && paramMap.get(Constants.UPLOAD_NAMED_PARAMETER) != null){
- prepared.setParameter(Constants.UPLOAD_PARAMETER, paramMap.get(Constants.UPLOAD_NAMED_PARAMETER));
- }
- if(paramMap != null && paramMap.get(Constants.WIDTH_NAMED_PARAMETER) != null){
- prepared.setParameter(Constants.WIDTH_PARAMETER, paramMap.get(Constants.WIDTH_NAMED_PARAMETER));
- }
- if(paramMap != null && paramMap.get(Constants.HEIGHT_NAMED_PARAMETER) != null){
- prepared.setParameter(Constants.HEIGHT_PARAMETER, paramMap.get(Constants.HEIGHT_NAMED_PARAMETER));
- }
- if(paramMap != null && paramMap.get(Constants.SIZE_NAMED_PARAMETER) != null){
- prepared.setParameter(Constants.SIZE_PARAMETER, paramMap.get(Constants.SIZE_NAMED_PARAMETER));
- }
- if(paramMap != null && paramMap.get(Constants.CAMERA_NAMED_PARAMETER) != null){
- prepared.setParameter(Constants.CAMERA_PARAMETER, paramMap.get(Constants.CAMERA_NAMED_PARAMETER));
- }
- prepared.setMaxResults(20);
- return prepared;
+ return tempResult;
}
-
- @SuppressWarnings("unchecked")
- public List<String> getAllCameras() {
- Query query = em.createNamedQuery(Constants.IMAGE_CAMERA_QUERY);
- return (List<String>)query.getResultList();
- }
-
- @SuppressWarnings("unchecked")
- public List<String> getAllMetatags() {
- Query query = em.createNamedQuery(Constants.IMAGE_TAGS_QUERY);
- return (List<String>)query.getResultList();
- }
private boolean parse(String str, List<String> adds, List<String> removes){
str = str.trim();
@@ -200,7 +201,6 @@
Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception(Constants.INVALID_SYNTAX));
return false;
}
-
}else if(c == Constants.MINUS_SIGN){
if(signedPreviousChar == false){
curIndex = i;
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java 2009-01-26 15:25:08 UTC (rev 12424)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java 2009-01-26 15:55:56 UTC (rev 12425)
@@ -67,7 +67,7 @@
@SuppressWarnings("unchecked")
public List<Album> getRootAlbums(User user) {
List<Album> albums = em.createNamedQuery(Constants.USER_ROOT_ALBUMS_QUERY)
- .setParameter("login", user.getLogin())
+ .setParameter(Constants.LOGIN_PARAMETER, user.getLogin())
.getResultList();
return albums;
}
@@ -81,7 +81,7 @@
@SuppressWarnings("unchecked")
public List<Message> getOutgoingMessages(){
List<Message> messages = em.createNamedQuery(Constants.USER_OUTCOMING_MESSAGES)
- .setParameter("login", user.getLogin())
+ .setParameter(Constants.LOGIN_PARAMETER, user.getLogin())
.getResultList();
return messages;
}
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileManager.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileManager.java 2009-01-26 15:25:08 UTC (rev 12424)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileManager.java 2009-01-26 15:55:56 UTC (rev 12425)
@@ -83,18 +83,20 @@
}
}
- public void renameDirectory(String directoryOld, String directoryNew) throws Exception{
+ public boolean renameDirectory(String directoryOld, String directoryNew){
String fullPath = getAbsolutePath(directoryOld);
File fileOld = new File(fullPath);
File fileNew = new File(getUploadRoot() + directoryNew);
createDirectoryIfNotExist(directoryNew);
if(fileNew.exists())
if( fileNew.isDirectory() ){
- throw new Exception(Constants.ALBUM_WITH_THIS_NAME_ALREADY_PRESENT);
+ //throw new Exception(Constants.ALBUM_WITH_THIS_NAME_ALREADY_PRESENT);
+ return false;
}else{
fileNew.delete();
}
fileOld.renameTo(fileNew);
+ return true;
}
public void addDirectory(String directory) {
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java 2009-01-26 15:25:08 UTC (rev 12424)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java 2009-01-26 15:55:56 UTC (rev 12425)
@@ -63,8 +63,6 @@
@Scope(ScopeType.CONVERSATION)
public class FileUploadBean implements Serializable {
-
-
@In
private User user;
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/ImageLoader.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/ImageLoader.java 2009-01-26 15:25:08 UTC (rev 12424)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/ImageLoader.java 2009-01-26 15:55:56 UTC (rev 12425)
@@ -42,8 +42,6 @@
@Scope(ScopeType.CONVERSATION)
public class ImageLoader implements Serializable{
-
-
private static final long serialVersionUID = -1572789608594870285L;
@In(create=true)
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java 2009-01-26 15:25:08 UTC (rev 12424)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java 2009-01-26 15:55:56 UTC (rev 12425)
@@ -60,8 +60,6 @@
@In @Out
private ConversationState conversationState;
- private static final String ADD_ERROR_EVENT = "addErrorEvent";
-
public void addAlbum(){
//Update domain model
albumAction.addAlbum(album);
@@ -95,10 +93,8 @@
String directoryOld = user.getLogin() + fileManager.getFileSeparator() + album.getAlbumPathFromParents(album, new ArrayList<String>(),fileManager.getFileSeparator() )+album.getName();
Album oldAlbum = ((TreeAlbumItem)treeMyAlbumsItem.getNode(album.getName())).getAlbum();
String directoryNew = user.getLogin() + fileManager.getFileSeparator() + oldAlbum.getAlbumPathFromParents(oldAlbum, new ArrayList<String>(),fileManager.getFileSeparator() )+album.getChangedName();
- try {
- fileManager.renameDirectory(directoryOld, directoryNew);
- } catch (Exception e) {
- Events.instance().raiseEvent(ADD_ERROR_EVENT, e);
+ if(!fileManager.renameDirectory(directoryOld, directoryNew)){
+ Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, Constants.ALBUM_WITH_THIS_NAME_ALREADY_PRESENT);
return;
}
String albumOld = user.getLogin() + Constants.SLASH + album.getAlbumPathFromParents(album, new ArrayList<String>(),Constants.SLASH )+album.getName();
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java 2009-01-26 15:25:08 UTC (rev 12424)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java 2009-01-26 15:55:56 UTC (rev 12425)
@@ -83,10 +83,8 @@
}
String directoryOld = user.getLogin() + fileManager.getFileSeparator() + dragValue.getAlbumPathFromParents(dragValue, new ArrayList<String>(), fileManager.getFileSeparator() )+ dragValue.getName();
String directoryNew = user.getLogin() + fileManager.getFileSeparator() + dragValue.getName();
- try{
- fileManager.renameDirectory(directoryOld, directoryNew);
- } catch (Exception e) {
- Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, e);
+ if(!fileManager.renameDirectory(directoryOld, directoryNew)){
+ Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, Constants.ALBUM_WITH_THIS_NAME_ALREADY_PRESENT);
return;
}
String albumOld = user.getLogin() + Constants.SLASH + dragValue.getAlbumPathFromParents(dragValue, new ArrayList<String>(), Constants.SLASH );
@@ -132,10 +130,8 @@
TreeAlbumItem item = (TreeAlbumItem)treeMyAlbumsItem.getNode(dragValue.getName());
itemParent.removeChild(item.getId());
itemParentNew.addAlbum(item);
- try{
- fileManager.renameDirectory(directoryOld, directoryNew);
- } catch (Exception e) {
- Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, e);
+ if(!fileManager.renameDirectory(directoryOld, directoryNew)){
+ Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, Constants.ALBUM_WITH_THIS_NAME_ALREADY_PRESENT);
return;
}
albumAction.renameAllImagesFromAlbumAndChilds(dragValue, albumOld, albumNew);
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBean.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBean.java 2009-01-26 15:25:08 UTC (rev 12424)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBean.java 2009-01-26 15:55:56 UTC (rev 12425)
@@ -27,390 +27,135 @@
import java.util.List;
import java.util.Map;
-import javax.faces.model.SelectItem;
-
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.richfaces.realworld.domain.Image;
+import org.richfaces.realworld.service.Constants;
import org.richfaces.realworld.service.ISearchService;
-import org.richfaces.realworld.service.SearchService;
@Name("searchBean")
@Scope(ScopeType.CONVERSATION)
public class SearchBean implements Serializable {
- @In("#{messages['equals']}") private String EQUALS_CHOICE;
- @In("#{messages['less']}") private String LESS_CHOICE;
- @In("#{messages['more']}") private String MORE_CHOICE;
- @In("#{messages['nomatter']}") private String NO_MATTER_CHOICE;
+ @In(required = false)
+ private SearchBeanHelper helper;
- private static final String EQUALS = "= ";
+ @In(required = false)
+ private SearchParamHolder searchParams;
- private static final String LESSTHEN = "< ";
-
- private static final String GREATTHEN = "> ";
-
- private static final String DATE_ADDON = " and i.created";
-
- private static final String UPLOAD_ADDON = " and i.upload";
-
- private static final String HEIGHT_ADDON = " and i.height";
-
- private static final String SIZE_ADDON = " and i.size";
-
- private static final String WIDTH_ADDON = " and i.width";
-
- private static final String CAMERA_ADDON = " and i.cameraModel";
-
- private static final String VOTES_ADDON = " and i.rank.hits";
-
- private static final String SPINNER_ADDON = " and i.rank.total/i.rank.hits";
-
private static final long serialVersionUID = 5071655218132021316L;
- private boolean caseSensitive;
-
- @In(required=false)
- private SearchBeanHelper helper;
-
@In(create=true)
private ISearchService searchService;
- private String searchPattern;
-
- private Long matcherChoice;
-
- private Long spinnerChoice;
-
- private Long uploadChoice;
-
- private Long sizeChoice;
-
- private Long widthChoice;
-
- private Long heightChoice;
-
- private Long dateChoice;
-
- private Long votesChoice;
-
- private Long numberOfVotes;
-
- private Date date;
-
- private String camera;
-
- private int height;
-
- private double size;
-
- private int width;
-
- private Date uploadDate;
-
private List<Image> findedImages = new ArrayList<Image>();
- public List<SelectItem> getItems() {
- List<SelectItem> list = new ArrayList<SelectItem>(4);
- list.add(new SelectItem(Long.valueOf(0L), NO_MATTER_CHOICE));
- list.add(new SelectItem(Long.valueOf(1L), MORE_CHOICE));
- list.add(new SelectItem(Long.valueOf(2L), LESS_CHOICE));
- list.add(new SelectItem(Long.valueOf(3L), EQUALS_CHOICE));
- return list;
- }
-
- public List<SelectItem> getMatchItems() {
- List<SelectItem> list = new ArrayList<SelectItem>(4);
- list.add(new SelectItem(Long.valueOf(0L), "Strict"));
- list.add(new SelectItem(Long.valueOf(1L), "Start with"));
- list.add(new SelectItem(Long.valueOf(2L), "End with"));
- list.add(new SelectItem(Long.valueOf(3L), "Include"));
- return list;
- }
-
- private String getAstFromIndex(Long item){
- if(item == 1L){
- return GREATTHEN;
- }else if(item == 2L){
- return LESSTHEN;
- }else if(item == 3L){
- return EQUALS;
- }
- return null;
+ public List<String> getAllCameras(){
+ return searchService.getAllCameras();
}
- private String getMatcher(Long item){
- if(item == 1L){
- return "START";
- }else if(item == 2L){
- return "END";
- }else if(item == 3L){
- return "INCLUDE";
- }else if(item == 0L){
- return "STRICT";
- }
- return null;
+ public List<String> getAllMetatags(){
+ return searchService.getAllMetatags();
}
public List<Image> searchImages(){
String additionalParams = populateAdditionalParams();
- Map<String, Object> paramMap = null;
- paramMap = populateMap(additionalParams);
- findedImages = searchService.searchImages(this.searchPattern, additionalParams, paramMap);
+ findedImages = searchService.searchImages(searchParams.getSearchPattern(), additionalParams, populateMap(additionalParams));
return findedImages;
}
public List<Image> popularImages(){
- String additionalParams = populateAdditionalParams();
- Map<String, Object> paramMap = null;
- paramMap = populateMap(additionalParams);
- findedImages = searchService.popularImages(additionalParams, paramMap);
- return findedImages;
+ return searchService.popularImages();
}
+ public List<Image> worstImages(){
+ return searchService.worstImages();
+ }
+
private Map<String, Object> populateMap(String additionalParams) {
Map<String, Object> map = new HashMap<String, Object>();
- if(additionalParams.lastIndexOf(SearchService.SPINNER_VALUE_NAMED_PARAMETER) != -1){
- map.put(SearchService.SPINNER_VALUE_NAMED_PARAMETER, Long.valueOf(helper.getInputSpinner().getValue().toString()));
+ populateParameter(map, additionalParams, Constants.SPINNER_VALUE_NAMED_PARAMETER, Long.valueOf(helper.getInputSpinner().getValue().toString()));
+ populateParameter(map, additionalParams, Constants.CHOICE_NAMED_PARAMETER, searchParams.getNumberOfVotes());
+ populateParameter(map, additionalParams, Constants.DATE_NAMED_PARAMETER, searchParams.getDate());
+ populateParameter(map, additionalParams, Constants.UPLOAD_NAMED_PARAMETER, searchParams.getUploadDate());
+ populateParameter(map, additionalParams, Constants.SIZE_NAMED_PARAMETER, searchParams.getSize());
+ populateParameter(map, additionalParams, Constants.WIDTH_NAMED_PARAMETER, searchParams.getWidth());
+ populateParameter(map, additionalParams, Constants.HEIGHT_NAMED_PARAMETER, searchParams.getHeight());
+ populateParameter(map, additionalParams, Constants.CAMERA_NAMED_PARAMETER, searchParams.getCamera());
+ if(searchParams.getMatcherChoice() != null){
+ map.put(Constants.STRICT_PARAMETER, getMatcher(searchParams.getMatcherChoice()));
}
- if(additionalParams.lastIndexOf(SearchService.CHOICE_NAMED_PARAMETER) != -1){
- map.put(SearchService.CHOICE_NAMED_PARAMETER, numberOfVotes);
- }
- if(additionalParams.lastIndexOf(SearchService.DATE_NAMED_PARAMETER) != -1){
- map.put(SearchService.DATE_NAMED_PARAMETER, date);
- }
- if(additionalParams.lastIndexOf(SearchService.UPLOAD_NAMED_PARAMETER) != -1){
- map.put(SearchService.UPLOAD_NAMED_PARAMETER, uploadDate);
- }
- if(additionalParams.lastIndexOf(SearchService.SIZE_NAMED_PARAMETER) != -1){
- map.put(SearchService.SIZE_NAMED_PARAMETER, size);
- }
- if(additionalParams.lastIndexOf(SearchService.WIDTH_NAMED_PARAMETER) != -1){
- map.put(SearchService.WIDTH_NAMED_PARAMETER, width);
- }
- if(additionalParams.lastIndexOf(SearchService.HEIGHT_NAMED_PARAMETER) != -1){
- map.put(SearchService.HEIGHT_NAMED_PARAMETER, height);
- }
- if(additionalParams.lastIndexOf(SearchService.CAMERA_NAMED_PARAMETER) != -1){
- map.put(SearchService.CAMERA_NAMED_PARAMETER, camera);
- }
- if(matcherChoice != null){
- map.put(SearchService.STRICT_PARAMETER, getMatcher(matcherChoice));
- }
- map.put(SearchService.CASE_SENSITIVE_PARAMETER, caseSensitive);
+ map.put(Constants.CASE_SENSITIVE_PARAMETER, searchParams.isCaseSensitive());
return map;
}
private String populateAdditionalParams() {
StringBuilder additionalParams = new StringBuilder("");
- if(spinnerChoice != null && spinnerChoice > 0L){
- additionalParams.append(SPINNER_ADDON);
- additionalParams.append(getAstFromIndex(spinnerChoice));
- additionalParams.append(SearchService.SPINNER_VALUE_NAMED_PARAMETER);
+ populateChoiceAddon(additionalParams, searchParams.getSpinnerChoice(), Constants.SPINNER_ADDON, Constants.SPINNER_VALUE_NAMED_PARAMETER);
+ populateChoiceAddon(additionalParams, searchParams.getVotesChoice(), Constants.VOTES_ADDON, Constants.CHOICE_NAMED_PARAMETER);
+ populateDateAddon(additionalParams, searchParams.getDateChoice(), Constants.DATE_ADDON, Constants.DATE_NAMED_PARAMETER, searchParams.getDate());
+ populateDateAddon(additionalParams, searchParams.getUploadChoice(), Constants.UPLOAD_ADDON, Constants.UPLOAD_NAMED_PARAMETER, searchParams.getUploadDate());
+ populateChoiceAddon(additionalParams, searchParams.getWidthChoice(), Constants.WIDTH_ADDON, Constants.WIDTH_NAMED_PARAMETER);
+ populateChoiceAddon(additionalParams, searchParams.getHeightChoice(), Constants.HEIGHT_ADDON, Constants.HEIGHT_NAMED_PARAMETER);
+ populateChoiceAddon(additionalParams, searchParams.getSizeChoice(), Constants.SIZE_ADDON, Constants.SIZE_NAMED_PARAMETER);
+ if(searchParams.getCamera()!= null && !searchParams.getCamera().equals("")){
+ additionalParams.append(Constants.CAMERA_ADDON);
+ additionalParams.append(Constants.EQUALS);
+ additionalParams.append(Constants.CAMERA_NAMED_PARAMETER);
}
- if(votesChoice != null && votesChoice > 0L){
- additionalParams.append(VOTES_ADDON);
- additionalParams.append(getAstFromIndex(votesChoice));
- additionalParams.append(SearchService.CHOICE_NAMED_PARAMETER);
- }
- if(dateChoice != null && dateChoice > 0L && date != null){
- additionalParams.append(DATE_ADDON);
- additionalParams.append(getAstFromIndex(dateChoice));
- additionalParams.append(SearchService.DATE_NAMED_PARAMETER);
- }
- if(uploadChoice != null && uploadChoice > 0L && uploadDate != null){
- additionalParams.append(UPLOAD_ADDON);
- additionalParams.append(getAstFromIndex(uploadChoice));
- additionalParams.append(SearchService.UPLOAD_NAMED_PARAMETER);
- }
- if(widthChoice != null && widthChoice > 0L){
- additionalParams.append(WIDTH_ADDON);
- additionalParams.append(getAstFromIndex(widthChoice));
- additionalParams.append(SearchService.WIDTH_NAMED_PARAMETER);
- }
- if(heightChoice != null && heightChoice > 0L){
- additionalParams.append(HEIGHT_ADDON);
- additionalParams.append(getAstFromIndex(heightChoice));
- additionalParams.append(SearchService.HEIGHT_NAMED_PARAMETER);
- }
- if(sizeChoice != null && sizeChoice > 0L){
- additionalParams.append(SIZE_ADDON);
- additionalParams.append(getAstFromIndex(sizeChoice));
- additionalParams.append(SearchService.SIZE_NAMED_PARAMETER);
- }
- if(camera!= null && !camera.equals("")){
- additionalParams.append(CAMERA_ADDON);
- additionalParams.append(EQUALS);
- additionalParams.append(SearchService.CAMERA_NAMED_PARAMETER);
- }
return additionalParams.toString();
}
- public List<Image> worstImages(){
- String additionalParams = populateAdditionalParams();
- Map<String, Object> paramMap = null;
- if(!additionalParams.equals("")){
- paramMap = populateMap(additionalParams);
+ private String getAstFromIndex(Long item){
+ if(item == 1L){
+ return Constants.GREATTHEN;
+ }else if(item == 2L){
+ return Constants.LESSTHEN;
+ }else if(item == 3L){
+ return Constants.EQUALS;
}
- findedImages = searchService.worstImages(additionalParams, paramMap);
- return findedImages;
+ return null;
}
-
- public List<String> getAllCameras(){
- List<String> cameras = new ArrayList<String>();
- cameras = searchService.getAllCameras();
- return cameras;
+
+ private String getMatcher(Long item){
+ if(item == 1L){
+ return Constants.START;
+ }else if(item == 2L){
+ return Constants.END;
+ }else if(item == 3L){
+ return Constants.INCLUDE;
+ }else if(item == 0L){
+ return Constants.STRICT;
+ }
+ return null;
}
- public List<String> getAllMetatags(){
- List<String> metatags = new ArrayList<String>();
- metatags = searchService.getAllMetatags();
- return metatags;
+ private void populateParameter(Map<String, Object> map, String additionalParams, String parameter, Object value){
+ if(additionalParams.lastIndexOf(parameter) != -1){
+ map.put(parameter, value);
+ }
}
- public String getSearchPattern() {
- return searchPattern;
+ private void populateChoiceAddon(StringBuilder additionalParams, Long choice, String addon, String namedParameter){
+ if(choice != null && choice > 0L){
+ additionalParams.append(addon);
+ additionalParams.append(getAstFromIndex(choice));
+ additionalParams.append(namedParameter);
+ }
}
-
- public void setSearchPattern(String searchPattern) {
- this.searchPattern = searchPattern;
+
+ private void populateDateAddon(StringBuilder additionalParams, Long choice, String addon, String namedParameter, Date date){
+ if(choice != null && choice > 0L && date != null ){
+ additionalParams.append(addon);
+ additionalParams.append(getAstFromIndex(choice));
+ additionalParams.append(namedParameter);
+ }
}
- public Long getSpinnerChoice() {
- return spinnerChoice;
- }
-
- public void setSpinnerChoice(Long spinnerChoice) {
- this.spinnerChoice = spinnerChoice;
- }
-
- public Long getDateChoice() {
- return dateChoice;
- }
-
- public void setDateChoice(Long dateChoice) {
- this.dateChoice = dateChoice;
- }
-
- public Long getVotesChoice() {
- return votesChoice;
- }
-
- public void setVotesChoice(Long votesChoice) {
- this.votesChoice = votesChoice;
- }
-
- public Long getNumberOfVotes() {
- return numberOfVotes;
- }
-
- public void setNumberOfVotes(Long numberOfVotes) {
- this.numberOfVotes = numberOfVotes;
- }
-
- public Date getDate() {
- return date;
- }
-
- public void setDate(Date date) {
- this.date = date;
- }
-
public List<Image> getFindedImages() {
return findedImages;
}
-
- public void setFindedImages(List<Image> findedImages) {
- this.findedImages = findedImages;
- }
-
- public String getCamera() {
- return camera;
- }
-
- public void setCamera(String camera) {
- this.camera = camera;
- }
-
- public int getHeight() {
- return height;
- }
-
- public void setHeight(int height) {
- this.height = height;
- }
-
- public double getSize() {
- return size;
- }
-
- public void setSize(double size) {
- this.size = size;
- }
-
- public int getWidth() {
- return width;
- }
-
- public void setWidth(int width) {
- this.width = width;
- }
-
- public Date getUploadDate() {
- return uploadDate;
- }
-
- public void setUploadDate(Date uploadDate) {
- this.uploadDate = uploadDate;
- }
-
- public Long getUploadChoice() {
- return uploadChoice;
- }
-
- public void setUploadChoice(Long uploadChoice) {
- this.uploadChoice = uploadChoice;
- }
-
- public Long getSizeChoice() {
- return sizeChoice;
- }
-
- public void setSizeChoice(Long sizeChoice) {
- this.sizeChoice = sizeChoice;
- }
-
- public Long getWidthChoice() {
- return widthChoice;
- }
-
- public void setWidthChoice(Long widthChoice) {
- this.widthChoice = widthChoice;
- }
-
- public Long getHeightChoice() {
- return heightChoice;
- }
-
- public void setHeightChoice(Long heightChoice) {
- this.heightChoice = heightChoice;
- }
-
- public boolean isCaseSensitive() {
- return caseSensitive;
- }
-
- public void setCaseSensitive(boolean caseSensitive) {
- this.caseSensitive = caseSensitive;
- }
-
- public Long getMatcherChoice() {
- return matcherChoice;
- }
-
- public void setMatcherChoice(Long matcherChoice) {
- this.matcherChoice = matcherChoice;
- }
-}
+
+}
\ No newline at end of file
Added: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchParamHolder.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchParamHolder.java (rev 0)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchParamHolder.java 2009-01-26 15:55:56 UTC (rev 12425)
@@ -0,0 +1,218 @@
+package org.richfaces.realworld.search;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.faces.model.SelectItem;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+
+@Name("searchParams")
+(a)Scope(ScopeType.CONVERSATION)
+public class SearchParamHolder {
+
+ private static final String INCLUDE = "Include";
+ private static final String END_WITH = "End with";
+ private static final String START_WITH = "Start with";
+ private static final String STRICT = "Strict";
+ @In("#{messages['equals']}")
+ private String EQUALS_CHOICE;
+ @In("#{messages['less']}")
+ private String LESS_CHOICE;
+ @In("#{messages['more']}")
+ private String MORE_CHOICE;
+ @In("#{messages['nomatter']}")
+ private String NO_MATTER_CHOICE;
+
+ private boolean caseSensitive;
+
+ private String searchPattern;
+
+ private Long matcherChoice;
+
+ private Long spinnerChoice;
+
+ private Long uploadChoice;
+
+ private Long sizeChoice;
+
+ private Long widthChoice;
+
+ private Long heightChoice;
+
+ private Long dateChoice;
+
+ private Long votesChoice;
+
+ private Long numberOfVotes;
+
+ private Date date;
+
+ private String camera;
+
+ private int height;
+
+ private double size;
+
+ private int width;
+
+ private Date uploadDate;
+
+ public List<SelectItem> getItems() {
+ List<SelectItem> list = new ArrayList<SelectItem>(4);
+ list.add(new SelectItem(Long.valueOf(0L), NO_MATTER_CHOICE));
+ list.add(new SelectItem(Long.valueOf(1L), MORE_CHOICE));
+ list.add(new SelectItem(Long.valueOf(2L), LESS_CHOICE));
+ list.add(new SelectItem(Long.valueOf(3L), EQUALS_CHOICE));
+ return list;
+ }
+
+ public List<SelectItem> getMatchItems() {
+ List<SelectItem> list = new ArrayList<SelectItem>(4);
+ list.add(new SelectItem(Long.valueOf(0L), STRICT));
+ list.add(new SelectItem(Long.valueOf(1L), START_WITH));
+ list.add(new SelectItem(Long.valueOf(2L), END_WITH));
+ list.add(new SelectItem(Long.valueOf(3L), INCLUDE));
+ return list;
+ }
+
+ public String getSearchPattern() {
+ return searchPattern;
+ }
+
+ public void setSearchPattern(String searchPattern) {
+ this.searchPattern = searchPattern;
+ }
+
+ public Long getSpinnerChoice() {
+ return spinnerChoice;
+ }
+
+ public void setSpinnerChoice(Long spinnerChoice) {
+ this.spinnerChoice = spinnerChoice;
+ }
+
+ public Long getDateChoice() {
+ return dateChoice;
+ }
+
+ public void setDateChoice(Long dateChoice) {
+ this.dateChoice = dateChoice;
+ }
+
+ public Long getVotesChoice() {
+ return votesChoice;
+ }
+
+ public void setVotesChoice(Long votesChoice) {
+ this.votesChoice = votesChoice;
+ }
+
+ public Long getNumberOfVotes() {
+ return numberOfVotes;
+ }
+
+ public void setNumberOfVotes(Long numberOfVotes) {
+ this.numberOfVotes = numberOfVotes;
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ public String getCamera() {
+ return camera;
+ }
+
+ public void setCamera(String camera) {
+ this.camera = camera;
+ }
+
+ public int getHeight() {
+ return height;
+ }
+
+ public void setHeight(int height) {
+ this.height = height;
+ }
+
+ public double getSize() {
+ return size;
+ }
+
+ public void setSize(double size) {
+ this.size = size;
+ }
+
+ public int getWidth() {
+ return width;
+ }
+
+ public void setWidth(int width) {
+ this.width = width;
+ }
+
+ public Date getUploadDate() {
+ return uploadDate;
+ }
+
+ public void setUploadDate(Date uploadDate) {
+ this.uploadDate = uploadDate;
+ }
+
+ public Long getUploadChoice() {
+ return uploadChoice;
+ }
+
+ public void setUploadChoice(Long uploadChoice) {
+ this.uploadChoice = uploadChoice;
+ }
+
+ public Long getSizeChoice() {
+ return sizeChoice;
+ }
+
+ public void setSizeChoice(Long sizeChoice) {
+ this.sizeChoice = sizeChoice;
+ }
+
+ public Long getWidthChoice() {
+ return widthChoice;
+ }
+
+ public void setWidthChoice(Long widthChoice) {
+ this.widthChoice = widthChoice;
+ }
+
+ public Long getHeightChoice() {
+ return heightChoice;
+ }
+
+ public void setHeightChoice(Long heightChoice) {
+ this.heightChoice = heightChoice;
+ }
+
+ public boolean isCaseSensitive() {
+ return caseSensitive;
+ }
+
+ public void setCaseSensitive(boolean caseSensitive) {
+ this.caseSensitive = caseSensitive;
+ }
+
+ public Long getMatcherChoice() {
+ return matcherChoice;
+ }
+
+ public void setMatcherChoice(Long matcherChoice) {
+ this.matcherChoice = matcherChoice;
+ }
+}
Property changes on: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchParamHolder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Deleted: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeManager.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeManager.java 2009-01-26 15:25:08 UTC (rev 12424)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeManager.java 2009-01-26 15:55:56 UTC (rev 12425)
@@ -1,246 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-package org.richfaces.realworld.tree;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.model.SelectItem;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Observer;
-import org.jboss.seam.annotations.Out;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Synchronized;
-import org.jboss.seam.core.Events;
-import org.richfaces.component.UIDatascroller;
-import org.richfaces.component.UITree;
-import org.richfaces.component.html.HtmlTree;
-import org.richfaces.event.DataScrollerEvent;
-import org.richfaces.event.NodeSelectedEvent;
-import org.richfaces.model.TreeNode;
-import org.richfaces.model.TreeRowKey;
-import org.richfaces.realworld.domain.Album;
-import org.richfaces.realworld.domain.Image;
-import org.richfaces.realworld.domain.User;
-import org.richfaces.realworld.fileupload.FileManager;
-import org.richfaces.realworld.manager.ImageManager;
-import org.richfaces.realworld.navigation.NavigationEnum;
-import org.richfaces.realworld.ui.ConversationState;
-
-@Name("treeManager")
-(a)Scope(ScopeType.CONVERSATION)
-@Synchronized(timeout=200000)
-public class TreeManager implements Serializable{
-
- private static final String DATASCROLLER_ID = "mainform:imageScroller";
-
- private static final String IMAGE_DATATABLE_ID = "mainform:mainImage";
-
- private static final String FIRST = "first";
-
- private static final String NEXT = "next";
-
- private static final String LAST = "last";
-
- private static final String UPDATE_MAIN_AREA_EVENT = "updateMainArea";
-
- private static final String PREVIOUS = "previous";
-
- private static final long serialVersionUID = -6072049677194472463L;
-
- private NavigationEnum mainArea;
-
- @In(required=false) @Out(required=false)
- private ConversationState conversationState;
-
- @In(create=true)
- FileManager fileManager;
-
- @In User user;
-
- @In(required=false)
- ImageManager imageManager;
-
- public void showFileUpload(TreeAlbumItem item, boolean singleMode){
- String i;
- if(singleMode){
- i="single";
- }else{
- i="multy";
- }
- Events.instance().raiseEvent("changeMode", i);
- Events.instance().raiseEvent("fileUploadClear");
- conversationState.setSelectedAlbum(item.getAlbum());
- this.setMainArea(NavigationEnum.FILE_UPLOAD);
- }
-
- public void showFileUpload(Album item, boolean singleMode){
- String i;
- if(singleMode){
- i="single";
- }else{
- i="multy";
- }
- Events.instance().raiseEvent("changeMode", i);
- Events.instance().raiseEvent("fileUploadClear");
- conversationState.setSelectedAlbum(item);
- this.setMainArea(NavigationEnum.FILE_UPLOAD);
- }
-
- public void scrollerListener(DataScrollerEvent event) {
- List<Image> images = conversationState.getSelectedAlbum().getImages();
- if (event.getNewScrolVal().equals(PREVIOUS)) {
- for(int index = 0 ; index < images.size(); index++){
- if(images.get(index) == conversationState.getSelectedImage()){
- conversationState.setSelectedImage(images.get(index - 1));
- conversationState.setSelectedImageIndex(index);
- }
- }
- } else if (event.getNewScrolVal().equals(LAST)) {
- conversationState.setSelectedImage(images.get(images.size() - 1));
- conversationState.setSelectedImageIndex(images.size());
- } else if (event.getNewScrolVal().equals(NEXT)) {
- for(int index = 0 ; index < images.size(); index++){
- if(images.get(index) == conversationState.getSelectedImage()){
- conversationState.setSelectedImage(images.get(index + 1));
- conversationState.setSelectedImageIndex(index + 2);
- return;
- }
- }
- } else if (event.getNewScrolVal().equals(FIRST)) {
- conversationState.setSelectedImage(images.get(0));
- conversationState.setSelectedImageIndex(1);
- }
-
- }
-
- public Boolean adviseNodeSelected(UITree tree) {
- TreeRowKey treeRowKey = (TreeRowKey) tree.getRowKey();
- TreeNode treeNode = (TreeNode) tree.getRowData(treeRowKey);
- if (treeNode instanceof TreeAlbumItem) {
- TreeAlbumItem currentNode = (TreeAlbumItem) treeNode;
- boolean selected = currentNode.getAlbum() == conversationState.getSelectedAlbum() || currentNode.containAlbum(conversationState.getSelectedAlbum());
- return selected;
- }
- return null;
- }
-
- public Boolean adviseNodeOpened(UITree tree) {
- TreeRowKey treeRowKey = (TreeRowKey) tree.getRowKey();
- TreeNode treeNode = (TreeNode) tree.getRowData(treeRowKey);
- if (treeNode instanceof TreeAlbumItem) {
- TreeAlbumItem currentNode = (TreeAlbumItem) treeNode;
- boolean selected = currentNode.getAlbum() == conversationState.getSelectedAlbum() || currentNode.containAlbum(conversationState.getSelectedAlbum());
- return selected;
- }
- return null;
- }
-
- public void processSelection(NodeSelectedEvent event) {
- Events.instance().raiseEvent(UPDATE_MAIN_AREA_EVENT, NavigationEnum.IMAGE_PREVIEW);
- HtmlTree tree = (HtmlTree) event.getComponent();
- TreeNode<String> currentNode = tree.getModelTreeNode(tree.getRowKey());
- if(currentNode instanceof TreeAlbumItem){
- TreeAlbumItem node = (TreeAlbumItem)currentNode;
- Album album = node.getAlbum();
- conversationState.setSelectedAlbum(album);
- }else if(currentNode instanceof TreeMyAlbumsItem){
- conversationState.setSelectedAlbum(null);
- }
- conversationState.setSelectedUser(user);
- conversationState.setSelectedImage(null);
- }
-
- public void processSelectionFriends(NodeSelectedEvent event) {
- Events.instance().raiseEvent(UPDATE_MAIN_AREA_EVENT, NavigationEnum.IMAGE_PREVIEW);
- HtmlTree tree = (HtmlTree) event.getComponent();
- TreeNode<String> currentNode = tree.getModelTreeNode(tree.getRowKey());
- if(currentNode instanceof TreeAlbumItem){
- TreeAlbumItem node = (TreeAlbumItem)currentNode;
- conversationState.setSelectedUser(((TreeAlbumItem)currentNode).getAlbum().getOwner());
- Album album = node.getAlbum();
- conversationState.setSelectedAlbum(album);
- }else if(currentNode instanceof TreeFriendsItem){
- conversationState.setSelectedUser(null);
- conversationState.setSelectedAlbum(null);
- }else if(currentNode instanceof TreeFriendItem){
- conversationState.setSelectedUser(((TreeFriendItem)currentNode).getFriend());
- conversationState.setSelectedAlbum(null);
- }
- conversationState.setSelectedImage(null);
- }
-
- private void setDataScrollerIndex(int index) {
- UIComponent component = FacesContext.getCurrentInstance().getViewRoot();
- UIDatascroller scroller = (UIDatascroller)component.findComponent(DATASCROLLER_ID);
- Map<String, Object> attributes = scroller.getDataTable().getAttributes();
- attributes.put(UIDatascroller.SCROLLER_STATE_ATTRIBUTE, index+1);
- conversationState.setSelectedImageIndex(index+1);
- }
-
-
- public void incrementSlideshowIndex() {
- int index = conversationState.getSelectedAlbum().getIndex(conversationState.getSelectedImage());
- if(conversationState.getSelectedAlbum().getImages().size() == index +1){
- index = -1;
- }
- conversationState.setSelectedImage(conversationState.getSelectedAlbum().getImages().get(index +1));
- UIComponent component = FacesContext.getCurrentInstance().getViewRoot();
- UIDatascroller scroller = (UIDatascroller)component.findComponent(DATASCROLLER_ID);
- Map<String, Object> attributes = scroller.getDataTable().getAttributes();
- attributes.put(UIDatascroller.SCROLLER_STATE_ATTRIBUTE, index+2);
- conversationState.setSelectedImageIndex(index+2);
- }
-
- public NavigationEnum getMainArea() {
- return mainArea;
- }
-
- @Observer("updateMainArea")
- public void setMainArea(NavigationEnum mainArea) {
- this.mainArea = mainArea;
- if(mainArea.equals(NavigationEnum.FILE_UPLOAD)){
- Events.instance().raiseEvent("showFileUpload", true);
- }
- }
-
- public SelectItem[] getAvailableIndexOfImages(){
- SelectItem[] group = new SelectItem[conversationState.getSelectedAlbum().getImages().size()];
- for(int i = 0; i < conversationState.getSelectedAlbum().getImages().size(); i++){
- group[i] = new SelectItem(i+1);
- }
- return group;
- }
-
- public void updateSelectedItems(Image image){
- conversationState.setSelectedImage(image);
- Integer index = conversationState.getSelectedAlbum().getIndex(conversationState.getSelectedImage());
- setDataScrollerIndex(index);
- }
-}
Deleted: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/ui/ConversationState.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/ui/ConversationState.java 2009-01-26 15:25:08 UTC (rev 12424)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/ui/ConversationState.java 2009-01-26 15:55:56 UTC (rev 12425)
@@ -1,106 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-package org.richfaces.realworld.ui;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.richfaces.realworld.domain.Album;
-import org.richfaces.realworld.domain.Image;
-import org.richfaces.realworld.domain.User;
-import org.richfaces.realworld.tree.TreeMyAlbumsItem;
-
-@Name("conversationState")
-(a)Scope(ScopeType.CONVERSATION)
-public class ConversationState implements Serializable{
-
- private static final long serialVersionUID = 5656562187249324512L;
-
- private Integer selectedImageIndex = 1;
-
- private Image selectedImage;
-
- private Album selectedAlbum;
-
- private User selectedUser;
-
- private User secondSelectedUser;
-
- @In(required=false) private TreeMyAlbumsItem treeMyAlbumsItem;
-
- public Integer getSelectedImageIndex() {
- return selectedImageIndex;
- }
-
- public void setSelectedImageIndex(Integer selectedImageIndex) {
- this.selectedImageIndex = selectedImageIndex;
- }
-
- public Image getSelectedImage() {
- return selectedImage;
- }
-
- public void setSelectedImage(Image selectedImage) {
- this.selectedImage = selectedImage;
- }
-
- public Album getSelectedAlbum() {
- return selectedAlbum;
- }
-
- public void setSelectedAlbum(Album selectedAlbum) {
- this.selectedAlbum = selectedAlbum;
- }
-
- public String getSelectedAlbumName() {
- if(null == selectedAlbum){
- return "";
- }
- return selectedAlbum.getAlbumPathFromParents(selectedAlbum, new ArrayList<String>(), "/");
- }
-
- public void setSelectedAlbumName(String selectedAlbumName) {
- selectedAlbumName = selectedAlbumName.substring(0, selectedAlbumName.length() -1);
- int lastIndexOf = selectedAlbumName.lastIndexOf("/");
- String prevPathEnd = selectedAlbumName.substring(lastIndexOf+1);
- this.selectedAlbum = treeMyAlbumsItem.getAlbumByName(prevPathEnd).getAlbum();
- }
-
- public User getSelectedUser() {
- return selectedUser;
- }
-
- public void setSelectedUser(User selectedUser) {
- this.selectedUser = selectedUser;
- }
-
- public User getSecondSelectedUser() {
- return secondSelectedUser;
- }
-
- public void setSecondSelectedUser(User secondSelectedUser) {
- this.secondSelectedUser = secondSelectedUser;
- }
-}
Deleted: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/ui/RenderLogic.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/ui/RenderLogic.java 2009-01-26 15:25:08 UTC (rev 12424)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/ui/RenderLogic.java 2009-01-26 15:55:56 UTC (rev 12425)
@@ -1,107 +0,0 @@
-package org.richfaces.realworld.ui;
-
-import java.io.Serializable;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.security.Identity;
-import org.richfaces.realworld.domain.Album;
-import org.richfaces.realworld.domain.Image;
-import org.richfaces.realworld.domain.User;
-
-@Name("renderLogic")
-(a)Scope(ScopeType.CONVERSATION)
-public class RenderLogic implements Serializable{
-
- @In User user;
- @In Identity identity;
- @In ConversationState conversationState;
-
- private static final long serialVersionUID = 5656562187249324512L;
-
- public boolean shouldRenderFriendFolders(){
- return conversationState.getSelectedUser() == null;
- }
-
- public boolean shouldRenderFolders(){
- return conversationState.getSelectedUser()!=null && conversationState.getSelectedImage() == null;
- }
-
- public boolean shouldRenderImage(){
- return conversationState.getSelectedUser()!=null && conversationState.getSelectedAlbum()!=null && conversationState.getSelectedImage() != null;
- }
-
- public boolean shouldRenderImageList(){
- return conversationState.getSelectedUser()!=null && conversationState.getSelectedAlbum()!=null;
- }
-
- public boolean isCurrentUserProfileSelected(){
- return user.equals(conversationState.getSelectedUser());
- }
-
- public boolean isSecondUserProfileSelected(){
- return conversationState.getSecondSelectedUser() != null;
- }
-
- public boolean isUserAlbumSelected(){
- return conversationState.getSelectedAlbum() != null && conversationState.getSelectedAlbum().getOwner().equals(user);
- }
-
- public boolean isUserGuest(){
- return identity.hasRole("guest");
- }
-
- public boolean shouldRenderFileUpload(){
- return conversationState.getSelectedAlbum()!=null && conversationState.getSelectedAlbum().getOwner().equals(user);
- }
-
- public boolean isUserSelected(){
- return user.equals(conversationState.getSelectedUser());
- }
-
- public boolean isFriendSelected(){
- return conversationState.getSelectedUser() == null || isUserFriend();
- }
-
- public boolean isNotFriendSelected(){
- return !isUserSelected() && !isUserFriend();
- }
-
- public boolean isUserFriend(){
- return user.getFriends() != null && user.getFriends().contains(conversationState.getSelectedUser());
- }
-
- public boolean isUserFriend(User u){
- return user.getFriends() != null && user.getFriends().contains(u);
- }
-
- public boolean isAlbumSelected(){
- return conversationState.getSelectedAlbum() != null;
- }
-
- public boolean isImageSelected(){
- return conversationState.getSelectedImage() != null;
- }
-
- public boolean isAccessToAlbumGranted(Album album){
- return album.getOwner().equals(user) || album.isShared() || isUserFriend(album.getOwner());
- }
-
- public boolean isUserAlbum(Album album){
- if(album == null){
- return false;
- }
- return album.getOwner().equals(user);
- }
-
- public boolean isFavoriteAlbum(Album album){
- return user.getFavoriteAlbums().contains(album);
- }
-
- public boolean isFavoriteImage(Image image){
- return user.getFavoriteImages().contains(image);
- }
-
-}
Modified: trunk/test-applications/realworld/web/src/main/webapp/includes/fileUpload/singleMode.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/includes/search/advancedSearch.xhtml
===================================================================
(Binary files differ)
16 years, 11 months
JBoss Rich Faces SVN: r12424 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2009-01-26 10:25:08 -0500 (Mon, 26 Jan 2009)
New Revision: 12424
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenuItem/panelMenuItemAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuItemTest.java
Log:
RF-5804, RF-5806, RF-5809, RF-5813
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenuItem/panelMenuItemAutoTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuItemTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuItemTest.java 2009-01-26 14:20:39 UTC (rev 12423)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuItemTest.java 2009-01-26 15:25:08 UTC (rev 12424)
@@ -84,6 +84,30 @@
}
@Test
+ public void testAjaxSingle(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, null);
+ writeStatus("Test ajaxSingle attribute in case of external validation failure");
+ autoTester.testAjaxSingle();
+ }
+
+ @Test
+ public void testAjaxSingleWithExternalAndProcessedComponentsValidationFailures(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, null);
+ writeStatus("Test ajaxSingle attribute in case of validation failures of both external and processed components");
+ autoTester.testAjaxSingleWithProcesExternalValidation(true);
+ }
+
+ @Test
+ public void testWithExternalValidationFailure(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, null);
+ writeStatus("Check component in case of external validation failure: listeners are not invoked, model is not updated");
+ autoTester.testExtrenalValidationFailure();
+ }
+
+ @Test
public void testStandardHTMLAttributesAreOutputToClient(Template template) {
renderPage(LOOK_AND_FEEL_TEST_URL, template, null);
16 years, 11 months
JBoss Rich Faces SVN: r12423 - trunk/framework/impl/src/main/java/org/ajax4jsf/javascript.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-01-26 09:20:39 -0500 (Mon, 26 Jan 2009)
New Revision: 12423
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/javascript/JSMin.java
Log:
https://jira.jboss.org/jira/browse/RF-5935
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/javascript/JSMin.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/javascript/JSMin.java 2009-01-26 14:16:53 UTC (rev 12422)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/javascript/JSMin.java 2009-01-26 14:20:39 UTC (rev 12423)
@@ -199,7 +199,7 @@
case 3:
theB = next();
- if (theB == '/' && (theA == '(' || theA == ',' || theA == '='|| theA == ':' || theA == '[')) {
+ if (theB == '/' && (theA == '(' || theA == '!' || theA == '&' || theA == '|' || theA == ',' || theA == '='|| theA == ':' || theA == '[')) {
out.write(theA);
out.write(theB);
for (;;) {
16 years, 11 months
JBoss Rich Faces SVN: r12422 - trunk/ui/extendedDataTable/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: pgolawski
Date: 2009-01-26 09:16:53 -0500 (Mon, 26 Jan 2009)
New Revision: 12422
Modified:
trunk/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java
Log:
bugfix for IE: set focus to filter input on filter event
Modified: trunk/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java
===================================================================
--- trunk/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java 2009-01-26 13:24:23 UTC (rev 12421)
+++ trunk/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java 2009-01-26 14:16:53 UTC (rev 12422)
@@ -332,10 +332,15 @@
}
private JSFunctionDefinition buildSetFocusFunctionDef(String elementId){
- JSFunctionDefinition function = new JSFunctionDefinition("event");
- function.addToBody("" + "var element = document.getElementById('"
- + elementId + "');" + "if (element) {" + " element.focus();"
- + "}");
+ JSFunctionDefinition function = new JSFunctionDefinition("request","event","data");
+ function.addToBody(
+ "var element = request.form.elements['" + elementId + "'];" +
+ "if (!element) {element = document.getElementById('" + elementId + "')}" +
+ "if (element) {" +
+ "element.focus();" +
+ //"if (element.createTextRange) { var r = (element.createTextRange()); r.collapse(false); r.select();}" +
+ "element.value = element.value;" +
+ "}");
return function;
}
16 years, 11 months
JBoss Rich Faces SVN: r12421 - management/design/message/funcspec.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2009-01-26 08:24:23 -0500 (Mon, 26 Jan 2009)
New Revision: 12421
Modified:
management/design/message/funcspec/FuncSpec - RF Message Component.doc
management/design/message/funcspec/FuncSpec - RF Messages Component.doc
Log:
passed state removed
Modified: management/design/message/funcspec/FuncSpec - RF Message Component.doc
===================================================================
(Binary files differ)
Modified: management/design/message/funcspec/FuncSpec - RF Messages Component.doc
===================================================================
(Binary files differ)
16 years, 11 months
JBoss Rich Faces SVN: r12420 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2009-01-26 08:08:44 -0500 (Mon, 26 Jan 2009)
New Revision: 12420
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenuItem/panelMenuItemAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuItemTest.java
Log:
https://jira.jboss.org/jira/browse/RF-5810
https://jira.jboss.org/jira/browse/RF-5812
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenuItem/panelMenuItemAutoTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuItemTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuItemTest.java 2009-01-26 12:46:10 UTC (rev 12419)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuItemTest.java 2009-01-26 13:08:44 UTC (rev 12420)
@@ -68,6 +68,22 @@
}
@Test
+ public void testImmediate(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test immediate attribute");
+ tester.testImmediate();
+ }
+
+ @Test
+ public void testImmediateWithExternalValidationFailed(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test immediate attribute with external validation failed");
+ tester.testImmediateWithExternalValidationFailed();
+ }
+
+ @Test
public void testStandardHTMLAttributesAreOutputToClient(Template template) {
renderPage(LOOK_AND_FEEL_TEST_URL, template, null);
16 years, 11 months
JBoss Rich Faces SVN: r12419 - in trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld: service and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2009-01-26 07:46:10 -0500 (Mon, 26 Jan 2009)
New Revision: 12419
Added:
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/Constants.java
Modified:
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Album.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/FriendshipRequest.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Image.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Message.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Rank.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IMessageAction.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ISearchService.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/MessageAction.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/MessageComparator.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/SearchService.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java
Log:
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Album.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Album.java 2009-01-26 12:44:43 UTC (rev 12418)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Album.java 2009-01-26 12:46:10 UTC (rev 12419)
@@ -1,7 +1,22 @@
-/*
- * Album.java
- * Last modified by: $Author$
- * $Revision$ $Date$
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.richfaces.realworld.domain;
@@ -34,214 +49,220 @@
import org.jboss.seam.annotations.Role;
/**
- * Class for representing Album Entity
- * EJB3 Entity Bean
+ * Class for representing Album Entity EJB3 Entity Bean
*
* @author Andrey Markhel
*/
-@NamedQueries({
- @NamedQuery(
- name = "album-byAlbumNameAndLogin",
- query = "from Album a where a.name=:albumName and a.owner.login=:login"
- )
-})
-
+@NamedQueries( { @NamedQuery(name = "album-byAlbumNameAndLogin", query = "from Album a where a.name=:albumName and a.owner.login=:login") })
@Entity
@Name("album")
@Table(name = "albums")
-@Role(name="selectedAlbum", scope = ScopeType.CONVERSATION)
+@Role(name = "selectedAlbum", scope = ScopeType.CONVERSATION)
public class Album implements Serializable {
- private static final long serialVersionUID = -7042878411608396483L;
+ private static final long serialVersionUID = -7042878411608396483L;
- @Id
- @GeneratedValue
- @Column(name = "ALBUM_ID")
- private Long id = null;
+ @Id
+ @GeneratedValue
+ @Column(name = "ALBUM_ID")
+ private Long id = null;
- @Column(length = 255, nullable = false)
- @NotNull
+ @Column(length = 255, nullable = false)
+ @NotNull
@NotEmpty
- @Length(min=3)
- private String name;
+ @Length(min = 3)
+ private String name;
- @Column(length = 1024)
- @NotNull
+ @Column(length = 1024)
+ @NotNull
@NotEmpty
- @Length(min=3)
- private String description;
-
- @ManyToOne
- @JoinColumn(name="ALBUM_USER_ID",
- referencedColumnName="USER_ID")
- private User owner;
+ @Length(min = 3)
+ private String description;
- @NotNull
- private boolean shared;
-
- @Transient
- private String changedName;
-
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "album")
- @org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.SUBSELECT)
- private List<Image> images = new ArrayList<Image>();
-
- @ManyToMany
- @JoinTable(
- name = "SHARED_ALBUMS",
- joinColumns = @JoinColumn(name = "ALBUM_ID"),
- inverseJoinColumns = @JoinColumn(name = "USER_ID")
- )
- private List<User> sharedOwners = new ArrayList<User>();
-
- @OneToMany(mappedBy = "parent", cascade = {CascadeType.ALL})
- @org.hibernate.annotations.OrderBy(clause = "NAME asc")
- private List<Album> childAlbums = new ArrayList<Album>();
+ @ManyToOne
+ @JoinColumn(name = "ALBUM_USER_ID", referencedColumnName = "USER_ID")
+ private User owner;
- @ManyToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "PARENT_ALBUM_ID", nullable = true)
- @org.hibernate.annotations.ForeignKey(name = "FK_ALBUM_PARENT_ID")
- private Album parent;
+ @NotNull
+ private boolean shared;
+
+ @Transient
+ private String changedName;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "album")
+ @org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.SUBSELECT)
+ private List<Image> images = new ArrayList<Image>();
+
+ @ManyToMany
+ @JoinTable(name = "SHARED_ALBUMS", joinColumns = @JoinColumn(name = "ALBUM_ID"), inverseJoinColumns = @JoinColumn(name = "USER_ID"))
+ private List<User> sharedOwners = new ArrayList<User>();
+
+ @OneToMany(mappedBy = "parent", cascade = { CascadeType.ALL })
+ @org.hibernate.annotations.OrderBy(clause = "NAME asc")
+ private List<Album> childAlbums = new ArrayList<Album>();
+
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "PARENT_ALBUM_ID", nullable = true)
+ @org.hibernate.annotations.ForeignKey(name = "FK_ALBUM_PARENT_ID")
+ private Album parent;
+
/**
* No-arg constructor for JavaBean tools
*/
- public Album() {
- }
+ public Album() {
+ }
// ********************** Accessor Methods ********************** //
- public List<Album> getChildAlbums() { return childAlbums; }
-
- public void addChildAlbum(Album album) {
- if (album == null) throw new IllegalArgumentException("Null child category!");
- if (album.getParent() != null)
- album.getParent().getChildAlbums().remove(album);
- album.setParent(this);
- childAlbums.add(album);
- }
- public void removeChildAlbum(Album album) {
- if (album == null) throw new IllegalArgumentException("Null child category!");
- album.setParent(null);
- childAlbums.remove(album);
- }
+ public List<Album> getChildAlbums() {
+ return childAlbums;
+ }
- public Album getParent() { return parent; }
- public void setParent(Album parent) { this.parent = parent; }
+ public void addChildAlbum(Album album) {
+ if (album == null)
+ throw new IllegalArgumentException("Null child category!");
+ if (album.getParent() != null)
+ album.getParent().getChildAlbums().remove(album);
+ album.setParent(this);
+ childAlbums.add(album);
+ }
- public String getAlbumPathFromParents(Album album, List<String> list, String delimiter) {
- if(album.getParent() == null){
+ public void removeChildAlbum(Album album) {
+ if (album == null)
+ throw new IllegalArgumentException("Null child category!");
+ album.setParent(null);
+ childAlbums.remove(album);
+ }
+
+ public Album getParent() {
+ return parent;
+ }
+
+ public void setParent(Album parent) {
+ this.parent = parent;
+ }
+
+ public String getAlbumPathFromParents(Album album, List<String> list,
+ String delimiter) {
+ if (album.getParent() == null) {
list.add(album.getName() + delimiter);
return "";
- }else{
- album.getParent().getAlbumPathFromParents(album.getParent(), list, delimiter);
+ } else {
+ album.getParent().getAlbumPathFromParents(album.getParent(), list,
+ delimiter);
}
- list.add(this.getName()+delimiter);
- String path = "";
- for(int i =0; i < list.size(); i++){
- path += list.get(i);
+ list.add(this.getName() + delimiter);
+ String path = "";
+ for (int i = 0; i < list.size(); i++) {
+ path += list.get(i);
+ }
+ return path;
}
- return path;
-}
- public List<Album> getArrayOfParents(){
+
+ public List<Album> getArrayOfParents() {
return getArrayOfParents(new ArrayList<Album>());
}
-
- public List<Album> getArrayOfParents(List<Album> albums){
- if(this.getParent() == null){
+
+ public List<Album> getArrayOfParents(List<Album> albums) {
+ if (this.getParent() == null) {
Collections.reverse(albums);
return albums;
- }else{
+ } else {
albums.add(this.getParent());
this.getParent().getArrayOfParents(albums);
}
return albums;
}
-
- /**
+
+ /**
* Getter for property id
*
* @return id of album
*/
- public Long getId() {
- return id;
- }
+ public Long getId() {
+ return id;
+ }
- /**
+ /**
* Getter for property name
*
* @return name of album
*/
- public String getName() {
- return name;
- }
+ public String getName() {
+ return name;
+ }
/**
* Setter for property name
*
- * @param name - name of album
+ * @param name -
+ * name of album
*/
- public void setName(String name) {
- this.name = name;
- }
+ public void setName(String name) {
+ this.name = name;
+ }
/**
* Getter for property description
*
* @return description of album
*/
- public String getDescription() {
- return description;
- }
+ public String getDescription() {
+ return description;
+ }
/**
* Setter for property description
*
- * @param description - description of album
+ * @param description -
+ * description of album
*/
- public void setDescription(String description) {
- this.description = description;
- }
-
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
// ********************** Business Methods ********************** //
/**
* This method add image to collection of images of current album
*
- * @param image - image to add
+ * @param image -
+ * image to add
*/
- public void addImage(Image image) {
- if (image == null) {
- throw new IllegalArgumentException("Null image!");
- }
- if (image.getAlbum() != null && !this.equals(image.getAlbum())) {
- image.getAlbum().getImages().remove(image);
- }
- image.setAlbum(this);
- images.add(image);
- }
+ public void addImage(Image image) {
+ if (image == null) {
+ throw new IllegalArgumentException("Null image!");
+ }
+ if (image.getAlbum() != null && !this.equals(image.getAlbum())) {
+ image.getAlbum().getImages().remove(image);
+ }
+ image.setAlbum(this);
+ images.add(image);
+ }
/**
* This method remove image from collection of images of album
*
- * @param image - image to remove
+ * @param image -
+ * image to remove
*/
- public void removeImage(Image image) {
- if (image == null) {
- throw new IllegalArgumentException("Null image");
- }
- image.setAlbum(null);
- images.remove(image);
- }
+ public void removeImage(Image image) {
+ if (image == null) {
+ throw new IllegalArgumentException("Null image");
+ }
+ image.setAlbum(null);
+ images.remove(image);
+ }
/**
* This method return count of images of current album
*
* @return count of images of this album
*/
- public int getCountImages() {
- return this.getImages()!= null ? this.getImages().size() : 0;
+ public int getCountImages() {
+ return this.getImages() != null ? this.getImages().size() : 0;
- }
+ }
public boolean isShared() {
return shared;
@@ -264,7 +285,7 @@
}
public String getChangedName() {
- if(changedName != null){
+ if (changedName != null) {
return changedName;
}
return this.getName();
@@ -283,8 +304,8 @@
}
public int getIndex(Image image) {
- for(int i =0; i < this.images.size(); i++){
- if(this.images.get(i).equals(image)){
+ for (int i = 0; i < this.images.size(); i++) {
+ if (this.images.get(i).equals(image)) {
return i;
}
}
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java 2009-01-26 12:44:43 UTC (rev 12418)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java 2009-01-26 12:46:10 UTC (rev 12419)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.domain;
import java.io.Serializable;
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/FriendshipRequest.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/FriendshipRequest.java 2009-01-26 12:44:43 UTC (rev 12418)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/FriendshipRequest.java 2009-01-26 12:46:10 UTC (rev 12419)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.domain;
import java.io.Serializable;
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Image.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Image.java 2009-01-26 12:44:43 UTC (rev 12418)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Image.java 2009-01-26 12:46:10 UTC (rev 12419)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
/*
* Image.java
* Last modified by: $Author$
@@ -20,6 +40,8 @@
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@@ -34,6 +56,17 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Role;
+@NamedQueries({
+ @NamedQuery(
+ name = "image-tags",
+ query = "select distinct t.tag from Image i join i.tags t"
+ ),
+ @NamedQuery(
+ name = "image-camera",
+ query = "select distinct i.cameraModel from Image i"
+ )
+ }
+)
/**
* Class for representing Image Entity
* EJB3 Entity Bean
@@ -355,13 +388,4 @@
}
return false;
}
-
- public boolean validateTags() {
- for(MetaTag t : this.getTags()){
- if(t.getTag().length()<3){
- return false;
- }
- }
- return true;
- }
}
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Message.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Message.java 2009-01-26 12:44:43 UTC (rev 12418)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Message.java 2009-01-26 12:46:10 UTC (rev 12419)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.domain;
import java.io.Serializable;
@@ -18,9 +38,7 @@
import org.hibernate.validator.Length;
import org.hibernate.validator.NotEmpty;
import org.hibernate.validator.NotNull;
-import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Role;
@Entity
@Name("message")
@Table(name = "messages")
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java 2009-01-26 12:44:43 UTC (rev 12418)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java 2009-01-26 12:46:10 UTC (rev 12419)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.domain;
import java.io.Serializable;
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Rank.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Rank.java 2009-01-26 12:44:43 UTC (rev 12418)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Rank.java 2009-01-26 12:46:10 UTC (rev 12419)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.domain;
import java.io.Serializable;
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2009-01-26 12:44:43 UTC (rev 12418)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2009-01-26 12:46:10 UTC (rev 12419)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.domain;
import java.io.Serializable;
@@ -60,6 +80,16 @@
name = "user-outcomeMessages",
query = "from Message m WHERE m.author.login=:login"
)
+ ,
+ @NamedQuery(
+ name = "user-historyMessages",
+ query = "from Message m where m.author =:author and m.owner=:owner"
+ )
+ ,
+ @NamedQuery(
+ name = "user-user",
+ query = "from User u where u.login = :login"
+ )
})
@Entity
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java 2009-01-26 12:44:43 UTC (rev 12418)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java 2009-01-26 12:46:10 UTC (rev 12419)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.service;
import javax.ejb.Stateless;
@@ -17,8 +37,6 @@
@In(value="entityManager")
EntityManager em;
- private static final String SLASH = "/";
-
@In @Out
private User user;
@@ -55,8 +73,8 @@
}
for (Album a : album.getChildAlbums()) {
- String replace2 = replace + SLASH + a.getName();
- String forReplace2 = forReplace + SLASH + a.getName();
+ String replace2 = replace + Constants.SLASH + a.getName();
+ String forReplace2 = forReplace + Constants.SLASH + a.getName();
renameAllImagesFromAlbumAndChilds(a, replace2, forReplace2);
}
em.flush();
Added: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/Constants.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/Constants.java (rev 0)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/Constants.java 2009-01-26 12:46:10 UTC (rev 12419)
@@ -0,0 +1,133 @@
+package org.richfaces.realworld.service;
+
+import org.jboss.seam.annotations.In;
+import org.richfaces.realworld.service.IUserAction;
+
+public class Constants {
+
+ public static final String ERROR_ID = "mainform:error";
+ public static final String CLEAR_ERROR_EVENT = "clearErrorEvent";
+ public static final String ADD_ERROR_EVENT = "addErrorEvent";
+ public static final String ALBUM_WITH_THIS_NAME_ALREADY_PRESENT = "Album with this name already present!";
+ public static final String UPLOAD_ROOT = "uploadRoot";
+ public static final String FILE_SEPARATOR = "file.separator";
+ public static final String SLASH = "/";
+ public static final String DOT = ".";
+ public static final String JPG = "JPG";
+ public static final int MULTY_MODE_FILE_QUANTITY = 100;
+ public static final int SINGLE_MODE_FILE_QUANTITY = 1;
+ public static final String MULTY = "multy";
+ public static final String SINGLE = "single";
+ public static final String FILE_PROCESSING_ERROR = "Error processing occured during upload";
+ public static final String ADD_IMAGE_EVENT = "addImage";
+ public static final String FILE_SAVE_ERROR = "Error occured during saving image to disk";
+ public static final int KB = 1024;
+ public static final String FILE_UPLOAD_CLEAR_EVENT = "fileUploadClear";
+ public static final String SHOW_FILE_UPLOAD_EVENT = "showFileUpload";
+ public static final String CHANGE_MODE_FILE_UPLOAD_EVENT = "changeMode";
+ public static final String JPEG = "jpeg";
+ public static final String INVALID_LOGIN_OR_PASSWORD = "Invalid login or password";
+ public static final String MAIN_OUTCOME = "main";
+ public static final String LOGIN_SUCCESS = "You are successfully registered.";
+ public static final String REGISTER_LOGIN_NAME_ID = "register:loginName";
+ public static final String REGISTER_CONFIRM_PASSWORD_ID = "register:confirmPassword";
+ public static final String INDEX_OUTCOME = "index";
+ public static final String ADMIN_ROLE = "admin";
+ public static final String GUEST_ROLE = "guest";
+ public static final String UPDATE_MAIN_AREA_EVENT = "updateMainArea";
+ public static final String WRONG_DND = "That album isn't yours, so you can't change it's location";
+ public static final String TREE_ID = "tree";
+ public static final String CLEAR_EDITOR_EVENT = "clearEditor";
+ public static final String RE = "Re:";
+ public static final String FRIEND_ERROR_MESSAGE = "This user won't be your friend!";
+ public static final String SEND_MESSAGE_EVENT = "sendMessage";
+ public static final String HTTPS = "https://";
+ public static final String HTTP = "http://";
+ public static final String HTTP_1_0 = "HTTP/1.0";
+ public static final String HTTP_1_1 = "HTTP/1.1";
+ public static final String PICTURE_FOLDER_PATH = "/picture/";
+ public static final String MINI_FORMAT = "_mini";
+ public static final String MEDIUM_FORMAT = "_medium";
+ public static String URL = "URL";
+ public static String HTML = "HTML";
+ public static String FORUM = "Forum";
+ public static String HTML_PATTERN = "<a href='%s'><img src='%s' border='0'></a>";
+ public static String FORUM_PATTERN = "[URL=%s][IMG]%s[/IMG][/URL]";
+ public static final String ERROR_PAGE = "/error.seam";
+ public static final String IMAGE_JPG = "image/jpg";
+ public static final String PATH_PARAMETER = "path";
+ public static final String FILE_MANAGER = "fileManager";
+ public static final String ENTITY_MANAGER = "entityManager";
+ public static final String USER_ID = "userId";
+ public static final int INITIAL_DELAY = 10000;
+ public static final int DELAY = 1000;
+ public static final String ALBUM_NODE_TYPE = "album";
+ public static final String USER_MANAGER = "userManager";
+ public static final String TREE_FRIEND_ALBUM_TYPE = "treeFriendAlbum";
+ public static final String TREE_FRIEND_ROOT_NODE_TYPE = "treeRootFriend";
+ public static final String USER = "user";
+ public static final String TREE_FRIEND_TYPE = "treeFriendsAlbums";
+ public static final String TREE_MY_ALBUMS_TYPE = "treeMyAlbums";
+ public static final String TREE_MY_ALBUMS_ITEM = "treeMyAlbumsItem";
+ public static final String TREE_ROOT_NODE_TYPE = "treeRoot";
+ public static final String DATASCROLLER_ID = "mainform:imageScroller";
+ public static final String HAVENT_ACCESS = "You have no rights to view this album";
+ public static final String FIRST = "first";
+ public static final String NEXT = "next";
+ public static final String LAST = "last";
+ public static final String PREVIOUS = "previous";
+ public static final String OWNER_PARAM = "owner";
+ public static final String AUTHOR_PARAM = "author";
+ public static final String USER_HISTORY_MESSAGES_QUERY = "user-historyMessages";
+ public static final String USER_FRIEND_EXIST_QUERY = "user-friendExist";
+ public static final String USER_AVAILABLE_USERS_QUERY = "user-availableUsers";
+ public static final String USER_EXIST_QUERY = "user-exist";
+ public static final String USER_LOGIN_QUERY = "user-login";
+ public static final String USER_ROOT_ALBUMS_QUERY = "user-login";
+ public static final String FRIEND_PARAMETER = "friend";
+ public static final String PERCENT = "%";
+ public static final String LOGIN_PARAMETER = "login";
+ public static final String PASSWORD_PARAMETER = "password";
+ public static final String USERNAME_PARAMETER = "username";
+ public static final String USER_OUTCOMING_MESSAGES = "user-outcomeMessages";
+ public static final String MINUS = "-";
+ public static final String PLUS = "+";
+ public static final String INVALID_SYNTAX = "Invalid syntax";
+ public static final char MINUS_SIGN = '-';
+ public static final char PLUS_SIGN = '+';
+ public static final String DATE_NAMED_PARAMETER = ":date";
+ public static final String UPLOAD_NAMED_PARAMETER = ":upload";
+ public static final String WIDTH_NAMED_PARAMETER = ":width";
+ public static final String HEIGHT_NAMED_PARAMETER = ":height";
+ public static final String SIZE_NAMED_PARAMETER = ":size";
+ public static final String CAMERA_NAMED_PARAMETER = ":camera";
+ public static final String CHOICE_NAMED_PARAMETER = ":choice";
+ public static final String SPINNER_VALUE_NAMED_PARAMETER = ":spinnerValue";
+ public static final String DATE_PARAMETER = "date";
+ public static final String UPLOAD_PARAMETER = "upload";
+ public static final String WIDTH_PARAMETER = "width";
+ public static final String HEIGHT_PARAMETER = "height";
+ public static final String SIZE_PARAMETER = "size";
+ public static final String CAMERA_PARAMETER = "camera";
+ public static final String CHOICE_PARAMETER = "choice";
+ public static final String SPINNER_VALUE_PARAMETER = "spinnerValue";
+ public static final String METATAG_PARAMETER = "metatag";
+ public static final String SEARCH_UNPOPULAR_QUERY_END = " order by r.total/r.hits asc";
+ public static final String SEARCH_POPULAR_QUERY_END = " order by r.total/r.hits desc";
+ public static final String SEARCH_RELEVANT_QUERY_BEGIN = "select i from Image i join i.rank r where i.album.shared=true";
+ public static final String SEARCH_QUERY_END = " order by i.rank.total/i.rank.hits desc";
+ public static final String SEARCH_QUERY_BEGIN = "select i from MetaTag t join t.parent i where upper(t.tag) like:metatag and i.album.shared=true";
+ public static final String SEARCH_SENSITIVE_QUERY_BEGIN = "select i from MetaTag t join t.parent i where t.tag like:metatag and i.album.shared=true";
+ public static final String STRICT_PARAMETER = "STRICT";
+ public static final String CASE_SENSITIVE_PARAMETER = "CASE_SENSITIVE";
+ public static final String IMAGE_TAGS_QUERY = "image-tags";
+ public static final String IMAGE_CAMERA_QUERY = "image-camera";
+ public static final String USER_USER_QUERY = "user-user";
+ public static final String USER_COUNT_MESSAGES_QUERY = "user-countMessages";
+ public static final String ALBUM_BY_ALBUM_NAME_AND_LOGIN_QUERY = "album-byAlbumNameAndLogin";
+ public static final String ALBUM_NAME_PARAMETER = "albumName";
+ private Constants(){
+
+ }
+
+}
Property changes on: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/Constants.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java 2009-01-26 12:44:43 UTC (rev 12418)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java 2009-01-26 12:46:10 UTC (rev 12419)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.service;
import javax.ejb.Local;
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java 2009-01-26 12:44:43 UTC (rev 12418)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java 2009-01-26 12:46:10 UTC (rev 12419)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.service;
import javax.ejb.Local;
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IMessageAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IMessageAction.java 2009-01-26 12:44:43 UTC (rev 12418)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IMessageAction.java 2009-01-26 12:46:10 UTC (rev 12419)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.service;
import javax.ejb.Local;
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ISearchService.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ISearchService.java 2009-01-26 12:44:43 UTC (rev 12418)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ISearchService.java 2009-01-26 12:46:10 UTC (rev 12419)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.service;
import java.util.List;
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java 2009-01-26 12:44:43 UTC (rev 12418)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java 2009-01-26 12:46:10 UTC (rev 12419)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.service;
import java.util.List;
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java 2009-01-26 12:44:43 UTC (rev 12418)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java 2009-01-26 12:46:10 UTC (rev 12419)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.service;
import javax.ejb.Stateless;
@@ -12,10 +32,7 @@
@Name("imageAction")
@Stateless
public class ImageAction implements IImageAction {
-
- private static final String ALBUM_BY_ALBUM_NAME_AND_LOGIN_QUERY = "album-byAlbumNameAndLogin";
- private static final String LOGIN_PARAMETER = "login";
- private static final String ALBUM_NAME_PARAMETER = "albumName";
+
@In(value="entityManager")
EntityManager em;
@@ -30,7 +47,7 @@
String login = albumPrevious.getOwner().getLogin();
String albumName = image.getAlbumName();
albumPrevious.removeImage(image);
- Album album = (Album)em.createNamedQuery(ALBUM_BY_ALBUM_NAME_AND_LOGIN_QUERY).setParameter(ALBUM_NAME_PARAMETER, albumName).setParameter(LOGIN_PARAMETER, login).getSingleResult();
+ Album album = (Album)em.createNamedQuery(Constants.ALBUM_BY_ALBUM_NAME_AND_LOGIN_QUERY).setParameter(Constants.ALBUM_NAME_PARAMETER, albumName).setParameter(Constants.LOGIN_PARAMETER, login).getSingleResult();
album.addImage(image);
}
image.getTags().clear();
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/MessageAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/MessageAction.java 2009-01-26 12:44:43 UTC (rev 12418)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/MessageAction.java 2009-01-26 12:46:10 UTC (rev 12419)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.service;
import javax.ejb.Stateless;
@@ -13,18 +33,14 @@
@Stateless
public class MessageAction implements IMessageAction {
- private static final String LOGIN_PARAMETER = "login";
-
- private static final String USER_COUNT_MESSAGES_QUERY = "user-countMessages";
-
@In(value="entityManager")
EntityManager em;
- @Observer("sendMessage")
+ @Observer(Constants.SEND_MESSAGE_EVENT)
public void sendMessage(Message message){
if(message.getOwnerLogin() != null){
- User user = (User)em.createQuery("from User u where u.login = :login")
- .setParameter(LOGIN_PARAMETER, message.getOwnerLogin())
+ User user = (User)em.createNamedQuery(Constants.USER_USER_QUERY)
+ .setParameter(Constants.LOGIN_PARAMETER, message.getOwnerLogin())
.getSingleResult();
message.setOwner(user);
message.setOwnerLogin(null);
@@ -37,8 +53,8 @@
}
public long countNotReadedMessages(User user){
- Long result = (Long)em.createNamedQuery(USER_COUNT_MESSAGES_QUERY)
- .setParameter(LOGIN_PARAMETER, user.getLogin())
+ Long result = (Long)em.createNamedQuery(Constants.USER_COUNT_MESSAGES_QUERY)
+ .setParameter(Constants.LOGIN_PARAMETER, user.getLogin())
.getSingleResult();
return result;
}
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/MessageComparator.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/MessageComparator.java 2009-01-26 12:44:43 UTC (rev 12418)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/MessageComparator.java 2009-01-26 12:46:10 UTC (rev 12419)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.service;
import java.util.Comparator;
@@ -4,11 +24,9 @@
import org.richfaces.realworld.domain.Message;
-public class MessageComparator implements Comparator {
+public class MessageComparator implements Comparator<Message> {
- public int compare(Object obj1, Object obj2) {
- Message mes1 = (Message) obj1;
- Message mes2 = (Message) obj2;
+ public int compare(Message mes1, Message mes2) {
return mes1.getDate().after(mes2.getDate())?-1:1;
}
}
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/SearchService.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/SearchService.java 2009-01-26 12:44:43 UTC (rev 12418)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/SearchService.java 2009-01-26 12:46:10 UTC (rev 12419)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.service;
import java.io.Serializable;
@@ -13,43 +33,18 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.core.Events;
import org.richfaces.realworld.domain.Image;
-import org.richfaces.realworld.domain.MetaTag;
@Name("searchService")
@Stateless
public class SearchService implements ISearchService, Serializable
- {
+ {
- private static final String PERCENT = "%";
- public static final String DATE_NAMED_PARAMETER = ":date";
- public static final String UPLOAD_NAMED_PARAMETER = ":upload";
- public static final String WIDTH_NAMED_PARAMETER = ":width";
- public static final String HEIGHT_NAMED_PARAMETER = ":height";
- public static final String SIZE_NAMED_PARAMETER = ":size";
- public static final String CAMERA_NAMED_PARAMETER = ":camera";
- public static final String CHOICE_NAMED_PARAMETER = ":choice";
- public static final String SPINNER_VALUE_NAMED_PARAMETER = ":spinnerValue";
- private static final String DATE_PARAMETER = "date";
- private static final String UPLOAD_PARAMETER = "upload";
- private static final String WIDTH_PARAMETER = "width";
- private static final String HEIGHT_PARAMETER = "height";
- private static final String SIZE_PARAMETER = "size";
- private static final String CAMERA_PARAMETER = "camera";
- private static final String CHOICE_PARAMETER = "choice";
- private static final String SPINNER_VALUE_PARAMETER = "spinnerValue";
- private static final String METATAG_PARAMETER = "metatag";
- private static final String SEARCH_UNPOPULAR_QUERY_END = " order by r.total/r.hits asc";
- private static final String SEARCH_POPULAR_QUERY_END = " order by r.total/r.hits desc";
- private static final String SEARCH_RELEVANT_QUERY_BEGIN = "select i from Image i join i.rank r where i.album.shared=true";
- private static final String SEARCH_QUERY_END = " order by i.rank.total/i.rank.hits desc";
- private static final String SEARCH_QUERY_BEGIN = "select i from MetaTag t join t.parent i where upper(t.tag) like:metatag and i.album.shared=true";
- private static final String SEARCH_SENSITIVE_QUERY_BEGIN = "select i from MetaTag t join t.parent i where t.tag like:metatag and i.album.shared=true";
private static final long serialVersionUID = -2750591521413940277L;
- public static final String STRICT_PARAMETER = "STRICT";
- public static final String CASE_SENSITIVE_PARAMETER = "CASE_SENSITIVE";
+
@In(value="entityManager")
EntityManager em;
+ @SuppressWarnings("unchecked")
public List<Image> searchImages(String searchPattern, String additionalParams, Map<String, Object> paramMap){
List<String> additions = new ArrayList<String>();
List<String> removals = new ArrayList<String>();
@@ -57,12 +52,12 @@
return null;
}
String fullQuery = null;
- if(paramMap != null && paramMap.get(CASE_SENSITIVE_PARAMETER) != null){
- boolean sensitive = (Boolean)paramMap.get(CASE_SENSITIVE_PARAMETER);
+ if(paramMap != null && paramMap.get(Constants.CASE_SENSITIVE_PARAMETER) != null){
+ boolean sensitive = (Boolean)paramMap.get(Constants.CASE_SENSITIVE_PARAMETER);
if(sensitive){
- fullQuery = SEARCH_SENSITIVE_QUERY_BEGIN + additionalParams + SEARCH_QUERY_END;
+ fullQuery = Constants.SEARCH_SENSITIVE_QUERY_BEGIN + additionalParams + Constants.SEARCH_QUERY_END;
}else{
- fullQuery = SEARCH_QUERY_BEGIN + additionalParams + SEARCH_QUERY_END;
+ fullQuery = Constants.SEARCH_QUERY_BEGIN + additionalParams + Constants.SEARCH_QUERY_END;
}
}
Query prepared = prepareQuery(fullQuery, additions.get(0), additionalParams, paramMap);
@@ -96,14 +91,16 @@
return tempResult;
}
+ @SuppressWarnings("unchecked")
public List<Image> popularImages(String additionalParams, Map<String, Object> paramMap){
- String fullQuery = SEARCH_RELEVANT_QUERY_BEGIN + additionalParams + SEARCH_POPULAR_QUERY_END;
+ String fullQuery = Constants.SEARCH_RELEVANT_QUERY_BEGIN + additionalParams + Constants.SEARCH_POPULAR_QUERY_END;
Query prepared = prepareQuery(fullQuery, null, additionalParams, paramMap);
return prepared.getResultList();
}
+ @SuppressWarnings("unchecked")
public List<Image> worstImages(String additionalParams, Map<String, Object> paramMap){
- String fullQuery = SEARCH_RELEVANT_QUERY_BEGIN + additionalParams + SEARCH_UNPOPULAR_QUERY_END;
+ String fullQuery = Constants.SEARCH_RELEVANT_QUERY_BEGIN + additionalParams + Constants.SEARCH_UNPOPULAR_QUERY_END;
Query prepared = prepareQuery(fullQuery, null, additionalParams, paramMap);
return prepared.getResultList();
}
@@ -112,66 +109,68 @@
Map<String, Object> paramMap) {
Query prepared = em.createQuery(fullQuery);
if(searchPattern != null){
- if(paramMap != null && paramMap.get(STRICT_PARAMETER) != null){
- String strict = paramMap.get(STRICT_PARAMETER).toString();
+ if(paramMap != null && paramMap.get(Constants.STRICT_PARAMETER) != null){
+ String strict = paramMap.get(Constants.STRICT_PARAMETER).toString();
if(strict.equals("STRICT")){
- prepared.setParameter(METATAG_PARAMETER, searchPattern.toUpperCase());
+ prepared.setParameter(Constants.METATAG_PARAMETER, searchPattern.toUpperCase());
}else if(strict.equals("START")){
- prepared.setParameter(METATAG_PARAMETER, searchPattern.toUpperCase()+PERCENT);
+ prepared.setParameter(Constants.METATAG_PARAMETER, searchPattern.toUpperCase()+Constants.PERCENT);
}else if(strict.equals("END")){
- prepared.setParameter(METATAG_PARAMETER, PERCENT + searchPattern.toUpperCase());
+ prepared.setParameter(Constants.METATAG_PARAMETER, Constants.PERCENT + searchPattern.toUpperCase());
}else if(strict.equals("INCLUDE")){
- prepared.setParameter(METATAG_PARAMETER, PERCENT + searchPattern.toUpperCase()+PERCENT);
+ prepared.setParameter(Constants.METATAG_PARAMETER, Constants.PERCENT + searchPattern.toUpperCase()+Constants.PERCENT);
}
}else{
- prepared.setParameter(METATAG_PARAMETER, searchPattern.toUpperCase()+PERCENT);
+ prepared.setParameter(Constants.METATAG_PARAMETER, searchPattern.toUpperCase()+Constants.PERCENT);
}
}
- if(paramMap != null && paramMap.get(SPINNER_VALUE_NAMED_PARAMETER) != null){
- prepared.setParameter(SPINNER_VALUE_PARAMETER, paramMap.get(SPINNER_VALUE_NAMED_PARAMETER));
+ if(paramMap != null && paramMap.get(Constants.SPINNER_VALUE_NAMED_PARAMETER) != null){
+ prepared.setParameter(Constants.SPINNER_VALUE_PARAMETER, paramMap.get(Constants.SPINNER_VALUE_NAMED_PARAMETER));
}
- if(paramMap != null && paramMap.get(CHOICE_NAMED_PARAMETER) != null){
- prepared.setParameter(CHOICE_PARAMETER, paramMap.get(CHOICE_NAMED_PARAMETER));
+ if(paramMap != null && paramMap.get(Constants.CHOICE_NAMED_PARAMETER) != null){
+ prepared.setParameter(Constants.CHOICE_PARAMETER, paramMap.get(Constants.CHOICE_NAMED_PARAMETER));
}
- if(paramMap != null && paramMap.get(DATE_NAMED_PARAMETER) != null){
- prepared.setParameter(DATE_PARAMETER, paramMap.get(DATE_NAMED_PARAMETER));
+ if(paramMap != null && paramMap.get(Constants.DATE_NAMED_PARAMETER) != null){
+ prepared.setParameter(Constants.DATE_PARAMETER, paramMap.get(Constants.DATE_NAMED_PARAMETER));
}
- if(paramMap != null && paramMap.get(UPLOAD_NAMED_PARAMETER) != null){
- prepared.setParameter(UPLOAD_PARAMETER, paramMap.get(UPLOAD_NAMED_PARAMETER));
+ if(paramMap != null && paramMap.get(Constants.UPLOAD_NAMED_PARAMETER) != null){
+ prepared.setParameter(Constants.UPLOAD_PARAMETER, paramMap.get(Constants.UPLOAD_NAMED_PARAMETER));
}
- if(paramMap != null && paramMap.get(WIDTH_NAMED_PARAMETER) != null){
- prepared.setParameter(WIDTH_PARAMETER, paramMap.get(WIDTH_NAMED_PARAMETER));
+ if(paramMap != null && paramMap.get(Constants.WIDTH_NAMED_PARAMETER) != null){
+ prepared.setParameter(Constants.WIDTH_PARAMETER, paramMap.get(Constants.WIDTH_NAMED_PARAMETER));
}
- if(paramMap != null && paramMap.get(HEIGHT_NAMED_PARAMETER) != null){
- prepared.setParameter(HEIGHT_PARAMETER, paramMap.get(HEIGHT_NAMED_PARAMETER));
+ if(paramMap != null && paramMap.get(Constants.HEIGHT_NAMED_PARAMETER) != null){
+ prepared.setParameter(Constants.HEIGHT_PARAMETER, paramMap.get(Constants.HEIGHT_NAMED_PARAMETER));
}
- if(paramMap != null && paramMap.get(SIZE_NAMED_PARAMETER) != null){
- prepared.setParameter(SIZE_PARAMETER, paramMap.get(SIZE_NAMED_PARAMETER));
+ if(paramMap != null && paramMap.get(Constants.SIZE_NAMED_PARAMETER) != null){
+ prepared.setParameter(Constants.SIZE_PARAMETER, paramMap.get(Constants.SIZE_NAMED_PARAMETER));
}
- if(paramMap != null && paramMap.get(CAMERA_NAMED_PARAMETER) != null){
- prepared.setParameter(CAMERA_PARAMETER, paramMap.get(CAMERA_NAMED_PARAMETER));
+ if(paramMap != null && paramMap.get(Constants.CAMERA_NAMED_PARAMETER) != null){
+ prepared.setParameter(Constants.CAMERA_PARAMETER, paramMap.get(Constants.CAMERA_NAMED_PARAMETER));
}
prepared.setMaxResults(20);
return prepared;
}
+ @SuppressWarnings("unchecked")
public List<String> getAllCameras() {
- Query query = em.createQuery("select distinct i.cameraModel from Image i");
+ Query query = em.createNamedQuery(Constants.IMAGE_CAMERA_QUERY);
return (List<String>)query.getResultList();
}
+ @SuppressWarnings("unchecked")
public List<String> getAllMetatags() {
- Query query = em.createQuery("select distinct t.tag from Image i join i.tags t");
+ Query query = em.createNamedQuery(Constants.IMAGE_TAGS_QUERY);
return (List<String>)query.getResultList();
}
private boolean parse(String str, List<String> adds, List<String> removes){
str = str.trim();
- if(str.startsWith("+") || str.startsWith("-") || str.endsWith("+") || str.endsWith("-") || str.length() == 0){
- Events.instance().raiseEvent("addErrorEvent", new Exception("Invalid syntax"));
+ if(str.startsWith(Constants.PLUS) || str.startsWith(Constants.MINUS) || str.endsWith(Constants.PLUS) || str.endsWith(Constants.MINUS) || str.length() == 0){
+ Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception(Constants.INVALID_SYNTAX));
return false;
}
- if(str.lastIndexOf('+')==-1 && str.lastIndexOf('-')==-1){
+ if(str.lastIndexOf(Constants.PLUS_SIGN)==-1 && str.lastIndexOf(Constants.MINUS_SIGN)==-1){
adds.add(str);
return true;
}
@@ -181,7 +180,7 @@
boolean signedPreviousChar = false;
for(int i =0; i< str.length(); i++){
char c = str.charAt(i);
- if(c == '+' ){
+ if(c == Constants.PLUS_SIGN ){
if(signedPreviousChar == false){
curIndex = i;
@@ -198,11 +197,11 @@
signedPreviousChar=true;
prevIndex =i;
}else {
- Events.instance().raiseEvent("addErrorEvent", new Exception("Invalid syntax"));
+ Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception(Constants.INVALID_SYNTAX));
return false;
}
- }else if(c == '-'){
+ }else if(c == Constants.MINUS_SIGN){
if(signedPreviousChar == false){
curIndex = i;
signedPreviousChar=true;
@@ -219,7 +218,7 @@
prevIndex =i;
}else {
- Events.instance().raiseEvent("addErrorEvent", new Exception("Invalid syntax"));
+ Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception(Constants.INVALID_SYNTAX));
return false;
}
}else{
@@ -227,9 +226,9 @@
}
}
char c2 = str.charAt(prevIndex);
- if(c2 == '+'){
+ if(c2 == Constants.PLUS_SIGN){
adds.add(str.substring(prevIndex+1));
- }else if(c2 == '-'){
+ }else if(c2 == Constants.MINUS_SIGN){
removes.add(str.substring(prevIndex+1));
}
return true;
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java 2009-01-26 12:44:43 UTC (rev 12418)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java 2009-01-26 12:46:10 UTC (rev 12419)
@@ -40,27 +40,7 @@
@Stateless
@AutoCreate
public class UserAction implements IUserAction {
-
- private static final String USER_FRIEND_EXIST_QUERY = "user-friendExist";
- private static final String USER_AVAILABLE_USERS_QUERY = "user-availableUsers";
-
- private static final String USER_EXIST_QUERY = "user-exist";
-
- private static final String USER_LOGIN_QUERY = "user-login";
-
- private static final String FRIEND_PARAMETER = "friend";
-
- private static final String PERCENT = "%";
-
- private static final String LOGIN_PARAMETER = "login";
-
- private static final String PASSWORD_PARAMETER = "password";
-
- private static final String USERNAME_PARAMETER = "username";
-
- private static final String USER_OUTCOMING_MESSAGES = "user-outcomeMessages";
-
@In(value="entityManager")
EntityManager em;
@@ -68,9 +48,9 @@
private User user;
public User login(String username, String password) {
- return user = (User)em.createNamedQuery(USER_LOGIN_QUERY)
- .setParameter(USERNAME_PARAMETER, username)
- .setParameter(PASSWORD_PARAMETER, password)
+ return user = (User)em.createNamedQuery(Constants.USER_LOGIN_QUERY)
+ .setParameter(Constants.USERNAME_PARAMETER, username)
+ .setParameter(Constants.PASSWORD_PARAMETER, password)
.getSingleResult();
}
@@ -84,8 +64,9 @@
this.user = user;
}
+ @SuppressWarnings("unchecked")
public List<Album> getRootAlbums(User user) {
- List<Album> albums = em.createNamedQuery("user-rootAlbums")
+ List<Album> albums = em.createNamedQuery(Constants.USER_ROOT_ALBUMS_QUERY)
.setParameter("login", user.getLogin())
.getResultList();
return albums;
@@ -97,29 +78,29 @@
this.user = user;
}
+ @SuppressWarnings("unchecked")
public List<Message> getOutgoingMessages(){
- List<Message> messages = em.createNamedQuery(USER_OUTCOMING_MESSAGES)
+ List<Message> messages = em.createNamedQuery(Constants.USER_OUTCOMING_MESSAGES)
.setParameter("login", user.getLogin())
.getResultList();
return messages;
}
public boolean isUserExist(String login) {
- return em.createNamedQuery(USER_EXIST_QUERY)
- .setParameter(LOGIN_PARAMETER, login)
+ return em.createNamedQuery(Constants.USER_EXIST_QUERY)
+ .setParameter(Constants.LOGIN_PARAMETER, login)
.getResultList().size() != 0;
}
+ @SuppressWarnings("unchecked")
public List<String> getUsers(String suggest) {
- List<String> users = em.createNamedQuery(USER_AVAILABLE_USERS_QUERY)
- .setParameter(LOGIN_PARAMETER, suggest + PERCENT)
+ List<String> users = em.createNamedQuery(Constants.USER_AVAILABLE_USERS_QUERY)
+ .setParameter(Constants.LOGIN_PARAMETER, suggest + Constants.PERCENT)
.setMaxResults(10)
.getResultList();
return users;
}
-
-
public void removeFromFriends(User owner, User removed) {
owner.removeFriend(removed);
removed.removeFriend(owner);
@@ -127,9 +108,9 @@
}
public boolean friendExist(User user, User friend) {
- Long result = (Long)em.createNamedQuery(USER_FRIEND_EXIST_QUERY)
- .setParameter(LOGIN_PARAMETER, user.getLogin())
- .setParameter(FRIEND_PARAMETER, friend.getLogin())
+ Long result = (Long)em.createNamedQuery(Constants.USER_FRIEND_EXIST_QUERY)
+ .setParameter(Constants.LOGIN_PARAMETER, user.getLogin())
+ .setParameter(Constants.FRIEND_PARAMETER, friend.getLogin())
.getSingleResult();
return result > 0;
}
@@ -165,12 +146,14 @@
return userMessages;
}
+ @SuppressWarnings("unchecked")
private List<Message> getUserSecondMessages(User historyUser) {
- return em.createQuery("from Message m where m.author =:author and m.owner=:owner").setParameter("author", historyUser).setParameter("owner", user).getResultList();
+ return em.createNamedQuery(Constants.USER_HISTORY_MESSAGES_QUERY).setParameter(Constants.AUTHOR_PARAM, historyUser).setParameter(Constants.OWNER_PARAM, user).getResultList();
}
+ @SuppressWarnings("unchecked")
private List<Message> getUserMessages(User historyUser) {
- return em.createQuery("from Message m where m.author =:author and m.owner=:owner").setParameter("author", user).setParameter("owner", historyUser).getResultList();
+ return em.createNamedQuery(Constants.USER_HISTORY_MESSAGES_QUERY).setParameter(Constants.AUTHOR_PARAM, user).setParameter(Constants.OWNER_PARAM, historyUser).getResultList();
}
public void addFavoriteImage(Image image) {
16 years, 11 months