rave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r1096265 - in /incubator/rave/trunk/rave-portal/src/main: java/org/apache/rave/portal/service/impl/DefaultUserService.java resources/initial_data.sql webapp/WEB-INF/views/home.jsp
Date Sun, 24 Apr 2011 01:50:09 GMT
Author: rgardler
Date: Sun Apr 24 01:50:09 2011
New Revision: 1096265

URL: http://svn.apache.org/viewvc?rev=1096265&view=rev
Log:
Provide pages for three users and select one of them at random on the initial page load. This
is simply to demonstrate the model working correctly for different users.

Modified:
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/service/impl/DefaultUserService.java
    incubator/rave/trunk/rave-portal/src/main/resources/initial_data.sql
    incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/home.jsp

Modified: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/service/impl/DefaultUserService.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/service/impl/DefaultUserService.java?rev=1096265&r1=1096264&r2=1096265&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/service/impl/DefaultUserService.java
(original)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/service/impl/DefaultUserService.java
Sun Apr 24 01:50:09 2011
@@ -19,6 +19,8 @@
 
 package org.apache.rave.portal.service.impl;
 
+import java.util.Random;
+
 import org.apache.rave.portal.model.Person;
 import org.apache.rave.portal.service.UserService;
 import org.springframework.stereotype.Service;
@@ -27,9 +29,22 @@ import org.springframework.stereotype.Se
 public class DefaultUserService implements UserService {
     @Override
     public Person getAuthenticatedUser() {
-        //TODO: Returning mock data until we hook in real authentication
+        //TODO: Returning random mock data until we hook in real authentication
         Person person = new Person();
-        person.setUserId("canonical");
+        String userId;
+        Random random = new Random();
+        switch (random.nextInt(3)) {
+          case 1: 
+            userId = "john.doe";
+            break;
+          case 2: 
+            userId = "jane.doe";
+            break;
+          default:
+            userId = "canonical";
+            break;
+        }
+        person.setUserId(userId);
         return person;
     }
 }
\ No newline at end of file

Modified: incubator/rave/trunk/rave-portal/src/main/resources/initial_data.sql
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/resources/initial_data.sql?rev=1096265&r1=1096264&r2=1096265&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/resources/initial_data.sql (original)
+++ incubator/rave/trunk/rave-portal/src/main/resources/initial_data.sql Sun Apr 24 01:50:09
2011
@@ -40,9 +40,12 @@ values(set(@nyt_widget_id, next value fo
 -- google tabbed news widget
 insert into widget (id, title, url)
 values(set(@tabnews_widget_id, next value for widget_id_seq), 'Google News Gadget', 'http://www.gstatic.com/ig/modules/tabnews/tabnews.xml');
-
 -- end widget data ----
 
+-- hamster widget
+insert into widget (id, title, url)
+values(set(@hamster_widget_id, next value for widget_id_seq), 'Pet Hamster', 'http://hosting.gmodules.com/ig/gadgets/file/112581010116074801021/hamster.xml');
+-- end widget data ----
 
 --- start page layout data ---
 insert into page_layout (id, code,  number_of_regions)
@@ -61,6 +64,8 @@ insert into page_layout (id, code,  numb
 values (next value for page_layout_id_seq, 'columns_3nwn_1_bottom', 4);
 --- end page layout data ----
 
+
+--- Layout for user_id_1 ---
 INSERT INTO page (id, name, owner_id, render_sequence, page_layout_id)
 values (set(@page_1_id, next value for page_id_seq), 'main', @user_id_1, 1, @two_col_id);
 
@@ -78,3 +83,44 @@ INSERT INTO region_widget(id, widget_id,
 values (next value for region_widget_id_seq, @nyt_widget_id, @page_1_region_2, 1, 'N');
 INSERT INTO region_widget(id, widget_id, region_id, render_position, collapsed)
 values (next value for region_widget_id_seq, @tabnews_widget_id, @page_1_region_2, 2, 'N');
+--- End canonical user_id_1 layout ---
+
+--- Layout for user_id_2 ---
+INSERT INTO page (id, name, owner_id, render_sequence, page_layout_id)
+values (set(@page_1_id, next value for page_id_seq), 'main', @user_id_2, 1, @two_col_id);
+
+INSERT INTO region(id, page_id)
+values (set(@page_1_region_1, next value for region_id_seq), @page_1_id);
+INSERT INTO region(id, page_id)
+values (set(@page_1_region_2, next value for region_id_seq), @page_1_id);
+
+INSERT INTO region_widget(id, widget_id, region_id, render_position, collapsed)
+values (next value for region_widget_id_seq, @wikipedia_widget_id, @page_1_region_1, 1, 'N');
+INSERT INTO region_widget(id, widget_id, region_id, render_position, collapsed)
+values (next value for region_widget_id_seq, @hamster_widget_id, @page_1_region_1, 2, 'N');
+
+INSERT INTO region_widget(id, widget_id, region_id, render_position, collapsed)
+values (next value for region_widget_id_seq, @nyt_widget_id, @page_1_region_2, 1, 'N');
+INSERT INTO region_widget(id, widget_id, region_id, render_position, collapsed)
+values (next value for region_widget_id_seq, @tabnews_widget_id, @page_1_region_2, 2, 'N');
+--- End canonical user_id_2 layout ---
+
+--- Layout for user_id_3 ---
+INSERT INTO page (id, name, owner_id, render_sequence, page_layout_id)
+values (set(@page_1_id, next value for page_id_seq), 'main', @user_id_3, 1, @two_col_id);
+
+INSERT INTO region(id, page_id)
+values (set(@page_1_region_1, next value for region_id_seq), @page_1_id);
+INSERT INTO region(id, page_id)
+values (set(@page_1_region_2, next value for region_id_seq), @page_1_id);
+
+INSERT INTO region_widget(id, widget_id, region_id, render_position, collapsed)
+values (next value for region_widget_id_seq, @wikipedia_widget_id, @page_1_region_1, 1, 'N');
+INSERT INTO region_widget(id, widget_id, region_id, render_position, collapsed)
+values (next value for region_widget_id_seq, @translate_widget_id, @page_1_region_1, 2, 'N');
+
+INSERT INTO region_widget(id, widget_id, region_id, render_position, collapsed)
+values (next value for region_widget_id_seq, @hamster_widget_id, @page_1_region_2, 1, 'N');
+INSERT INTO region_widget(id, widget_id, region_id, render_position, collapsed)
+values (next value for region_widget_id_seq, @tabnews_widget_id, @page_1_region_2, 2, 'N');
+--- End canonical user_id_3 layout ---
\ No newline at end of file

Modified: incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/home.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/home.jsp?rev=1096265&r1=1096264&r2=1096265&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/home.jsp (original)
+++ incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/home.jsp Sun Apr 24 01:50:09
2011
@@ -25,7 +25,12 @@
   <title>Rave Home</title>
 </head>
 <body>
-<h1>Hello Rave!</h1>
+<h1>Hello ${pages[0].owner.userId}, welcome to Rave!</h1>
+
+<p>This is very early, alpha quality code. It doesn't do much yet. Note that we don't
have authentication right now so
+we are simply selecting a random user each time this page is loaded - feel free to patch
it so we have a login feature
+(even if it doesn't use authentication).</p>
+
 <table>
   <tr>
     <c:forEach var="region" items="${pages[0].regions}">



Mime
View raw message