resty-generators 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. data/lib/generators/resty/model/model_generator.rb +1 -1
  2. data/lib/generators/resty/scaffold/scaffold_generator.rb +47 -30
  3. data/lib/generators/resty/setup/setup_generator.rb +11 -0
  4. data/lib/generators/resty/setup/templates/ActivityPlace.java +8 -4
  5. data/lib/generators/resty/setup/templates/ActivityPlaceActivityMapper.java +3 -3
  6. data/lib/generators/resty/setup/templates/BreadCrumbsPanel.java +3 -6
  7. data/lib/generators/resty/setup/templates/EntryPoint.java +22 -17
  8. data/lib/generators/resty/setup/templates/LoginPlace.java +3 -3
  9. data/lib/generators/resty/setup/templates/LoginView.ui.xml +1 -1
  10. data/lib/generators/resty/setup/templates/Mavenfile +1 -1
  11. data/lib/generators/resty/setup/templates/MenuPanel.java +27 -0
  12. data/lib/generators/resty/setup/templates/PlaceHistoryMapper.java +37 -4
  13. data/lib/generators/resty/setup/templates/SessionActivityPlaceActivityMapper.java +10 -10
  14. data/lib/generators/resty/setup/templates/authentication.rb +1 -1
  15. data/lib/generators/resty/templates/Activity.java +63 -17
  16. data/lib/generators/resty/templates/Model.java +2 -2
  17. data/lib/generators/resty/templates/Place.java +7 -2
  18. data/lib/generators/resty/templates/PlaceTokenizer.java +3 -8
  19. data/lib/generators/resty/templates/RestService.java +4 -2
  20. data/lib/generators/resty/templates/View.java +16 -2
  21. data/lib/generators/resty/templates/View.ui.xml +31 -19
  22. data/lib/generators/resty/templates/ViewImpl.java +131 -28
  23. data/lib/resty-generators.rb +1 -1
  24. metadata +9 -12
  25. data/lib/generators/resty/setup/templates/monkey_patch.rb +0 -47
  26. data/lib/generators/resty/templates/ColumnDefinitionsImpl.java +0 -24
  27. data/lib/resty/child_path.rb +0 -31
@@ -15,7 +15,7 @@ module Resty
15
15
  class_option :parent, :type => :string, :desc => "The parent class for the generated model"
16
16
 
17
17
  def create_model_file
18
- template 'Model.java', File.join(java_root, models_base_package.gsub(/\./, "/"), class_path, "#{class_name}.java")
18
+ template 'Model.java', File.join(java_root, models_package.gsub(/\./, "/"), class_path, "#{class_name}.java")
19
19
  end
20
20
 
21
21
  end
@@ -28,9 +28,6 @@ module Resty
28
28
  template 'View.java', File.join(java_root, views_package.gsub(/\./, "/"), class_path, "#{class_name}View.java")
29
29
  template 'View.ui.xml', File.join(java_root, views_package.gsub(/\./, "/"), class_path, "#{class_name}View.ui.xml")
30
30
  template 'ViewImpl.java', File.join(java_root, views_package.gsub(/\./, "/"), class_path, "#{class_name}ViewImpl.java")
31
- unless options[:singleton]
32
- template 'ColumnDefinitionsImpl.java', File.join(java_root, views_package.gsub(/\./, "/"), class_path, "#{class_name.pluralize}ColumnDefinitionsImpl.java")
33
- end
34
31
  end
35
32
 
36
33
  def create_place_files
@@ -44,43 +41,62 @@ module Resty
44
41
 
45
42
  def add_to_activity_factory
46
43
  factory_file = File.join(java_root, managed_package.gsub(/\./, "/"), class_path, "ActivityFactory.java")
47
- factory = File.read(factory_file)
48
- if factory =~ /@Named\(.#{table_name}.\)/
49
- log 'keep', factory_file
50
- else
51
- factory.sub! /interface\s+ActivityFactory\s+{/, "interface ActivityFactory {\n @Named(\"#{table_name}\") Activity create(#{places_package}.#{class_name}Place place);"
52
- File.open(factory_file, 'w') { |f| f.print factory }
53
- log "added to", factory_file
44
+ if File.exists?(factory_file)
45
+ factory = File.read(factory_file)
46
+ if factory =~ /@Named\(.#{table_name}.\)/
47
+ log 'keep', factory_file
48
+ else
49
+ factory.sub! /interface\s+ActivityFactory\s+\{/, "interface ActivityFactory {\n @Named(\"#{table_name}\") Activity create(#{places_package}.#{class_name}Place place);"
50
+ File.open(factory_file, 'w') { |f| f.print factory }
51
+ log "added to", factory_file
52
+ end
54
53
  end
55
54
  end
56
55
 
57
56
  def add_to_place_histroy_mapper
58
57
  file = File.join(java_root, managed_package.gsub(/\./, "/"), class_path, "#{application_name}PlaceHistoryMapper.java")
59
- content = File.read(file)
60
- if content =~ /#{class_name}PlaceTokenizer.class/
61
- log 'keep', file
62
- elsif content =~ /@WithTokenizers\({}\)/
63
- content.sub! /@WithTokenizers\({}\)/, "@WithTokenizers({#{places_package}.#{class_name}PlaceTokenizer.class})"
64
- File.open(file, 'w') { |f| f.print content }
65
- log "added to", file
66
- else
67
- content.sub! /@WithTokenizers\({/, "@WithTokenizers({#{places_package}.#{class_name}PlaceTokenizer.class,\n "
68
- File.open(file, 'w') { |f| f.print content }
69
- log "added to", file
58
+ if File.exists?(file)
59
+ content = File.read(file)
60
+ if content =~ /#{class_name}PlaceTokenizer/
61
+ log 'keep', file
62
+ else
63
+ content.sub! /public\s+#{application_name}PlaceHistoryMapper.(.*).\s*\{/ do |m|
64
+ "public #{application_name}PlaceHistoryMapper(#{$1}){\n register(\"#{table_name}\", new #{places_package}.#{class_name}PlaceTokenizer());"
65
+ end
66
+ File.open(file, 'w') { |f| f.print content }
67
+ log "added to", file
68
+ end
69
+ end
70
+ end
71
+
72
+ def add_to_menu_panel
73
+ file = File.join(java_root, managed_package.gsub(/\./, "/"), class_path, "#{application_name}MenuPanel.java")
74
+ if File.exists?(file)
75
+ content = File.read(file)
76
+ if content =~ /#{class_name}Place\(RestfulActionEnum/
77
+ log 'keep', file
78
+ else
79
+ # TODO non session case !!!
80
+ t_name = options[:singleton] ? singular_table_name : table_name
81
+ content.sub! /super\(\s*sessionManager\s*\)\s*;/, "super(sessionManager);\n addButton(\"#{t_name.underscore.humanize}\").addClickHandler(new ClickHandler() {\n public void onClick(ClickEvent event) {\n placeController.goTo(new #{places_package}.#{class_name}Place(RestfulActionEnum.#{options[:singleton] ? 'SHOW' : 'INDEX'}));\n }\n });"
82
+ File.open(file, 'w') { |f| f.print content }
83
+ log "added to", file
84
+ end
70
85
  end
71
86
  end
72
87
 
73
88
  def add_to_module
74
89
  file = File.join(java_root, managed_package.gsub(/\./, "/"), class_path, "#{application_name}Module.java")
75
- content = File.read(file)
76
- if content =~ /#{class_name.pluralize}RestService.class/
77
- log 'keep', file
78
- else content =~ /super.configure\(\);/
79
- content.sub! /super.configure\(\);/, "super.configure();\n bind(#{restservices_package}.#{class_name.pluralize}RestService.class).toProvider(#{class_name.pluralize}RestServiceProvider.class);"
90
+ if File.exists?(file)
91
+ content = File.read(file)
92
+ if content =~ /#{class_name.pluralize}RestService.class/
93
+ log 'keep', file
94
+ else content =~ /super.configure\(\);/
95
+ content.sub! /super.configure\(\);/, "super.configure();\n bind(#{restservices_package}.#{class_name.pluralize}RestService.class).toProvider(#{class_name.pluralize}RestServiceProvider.class);"
80
96
 
81
- content.sub! /new GinFactoryModuleBuilder\(\)/, "new GinFactoryModuleBuilder()\n .implement(Activity.class, Names.named(\"#{table_name}\"), #{activities_package}.#{class_name}Activity.class)"
97
+ content.sub! /new GinFactoryModuleBuilder\(\)/, "new GinFactoryModuleBuilder()\n .implement(Activity.class, Names.named(\"#{table_name}\"), #{activities_package}.#{class_name}Activity.class)"
82
98
 
83
- content.sub! /^}/, <<-EOF
99
+ content.sub! /^}/, <<-EOF
84
100
 
85
101
  @Singleton
86
102
  public static class #{class_name.pluralize}RestServiceProvider implements Provider<#{restservices_package}.#{class_name.pluralize}RestService> {
@@ -91,8 +107,9 @@ module Resty
91
107
  }
92
108
  }
93
109
  EOF
94
- File.open(file, 'w') { |f| f.print content }
95
- log "added to", file
110
+ File.open(file, 'w') { |f| f.print content }
111
+ log "added to", file
112
+ end
96
113
  end
97
114
  end
98
115
 
@@ -11,6 +11,8 @@ module Resty
11
11
 
12
12
  class_option :session, :type => :boolean, :default => false
13
13
 
14
+ class_option :menu, :type => :boolean, :default => false
15
+
14
16
  def name
15
17
  gwt_module_name
16
18
  end
@@ -44,6 +46,11 @@ module Resty
44
46
  template 'ActivityFactory.java',
45
47
  File.join(java_root, path,
46
48
  "ActivityFactory.java")
49
+ if options[:menu]
50
+ template 'MenuPanel.java',
51
+ File.join(java_root, path,
52
+ "#{application_name}MenuPanel.java")
53
+ end
47
54
  end
48
55
 
49
56
  def create_scaffolded_files
@@ -97,6 +104,10 @@ module Resty
97
104
  template 'gitignore', File.join('public', 'WEB-INF', '.gitignore')
98
105
  end
99
106
 
107
+ def add_gems
108
+ gem 'ixtlan-core'
109
+ end
110
+
100
111
  def create_rails_session_files
101
112
  if options[:session]
102
113
  template 'sessions_controller.rb', File.join('app', 'controllers', "sessions_controller.rb")
@@ -4,15 +4,19 @@ import <%= managed_package %>.ActivityFactory;
4
4
 
5
5
  import com.google.gwt.activity.shared.Activity;
6
6
 
7
- import <%= gwt_rails_package %>.RestfulAction;
8
- import <%= gwt_rails_package %>.RestfulPlace;
7
+ import <%= gwt_rails_package %>.places.RestfulAction;
8
+ import <%= gwt_rails_package %>.places.RestfulPlace;
9
9
 
10
- public abstract class ActivityPlace extends RestfulPlace {
10
+ public abstract class ActivityPlace<T> extends RestfulPlace<T> {
11
11
 
12
12
  protected ActivityPlace(RestfulAction restfulAction, String name) {
13
13
  super(restfulAction, name);
14
14
  }
15
15
 
16
+ protected ActivityPlace(T model, RestfulAction restfulAction, String name) {
17
+ super(model, restfulAction, name);
18
+ }
19
+
16
20
  protected ActivityPlace(int id, RestfulAction restfulAction, String name) {
17
21
  super(id, restfulAction, name);
18
22
  }
@@ -22,4 +26,4 @@ public abstract class ActivityPlace extends RestfulPlace {
22
26
  }
23
27
 
24
28
  public abstract Activity create(ActivityFactory factory);
25
- }
29
+ }
@@ -21,10 +21,10 @@ public class ActivityPlaceActivityMapper implements ActivityMapper {
21
21
 
22
22
 
23
23
  public Activity getActivity(Place place) {
24
- if (place instanceof ActivityPlace) {
25
- return ((ActivityPlace) place).create(factory);
24
+ if (place instanceof ActivityPlace<?>) {
25
+ return ((ActivityPlace<?>) place).create(factory);
26
26
  }
27
27
  notice.setText("nothing to see");
28
28
  return null;
29
29
  }
30
- }
30
+ }
@@ -11,7 +11,6 @@ import org.fusesource.restygwt.client.MethodCallback;
11
11
 
12
12
  import com.google.gwt.event.dom.client.ClickEvent;
13
13
  import com.google.gwt.event.dom.client.ClickHandler;
14
- import com.google.gwt.user.client.History;
15
14
  import com.google.gwt.user.client.ui.Button;
16
15
  import com.google.gwt.user.client.ui.FlowPanel;
17
16
  import com.google.gwt.user.client.ui.Label;
@@ -28,13 +27,13 @@ public class BreadCrumbsPanel extends FlowPanel {
28
27
  @Inject
29
28
  public BreadCrumbsPanel(final SessionManager<User> sessionManager, final SessionRestService service,
30
29
  final Notice notice){
30
+ setStyleName("rails-breadcrumbs");
31
31
  setVisible(false);
32
32
  sessionManager.addSessionHandler(new SessionHandler<User>() {
33
33
 
34
34
  public void timeout() {
35
35
  notice.setText("timeout");
36
- setName(null);
37
- History.fireCurrentHistoryState();
36
+ logout();
38
37
  }
39
38
 
40
39
  public void logout() {
@@ -45,12 +44,10 @@ public class BreadCrumbsPanel extends FlowPanel {
45
44
  }
46
45
  });
47
46
  setName(null);
48
- History.fireCurrentHistoryState();
49
47
  }
50
48
 
51
49
  public void login(User user) {
52
50
  setName(user.name);
53
- History.fireCurrentHistoryState();
54
51
  }
55
52
 
56
53
  public void accessDenied() {
@@ -77,4 +74,4 @@ public class BreadCrumbsPanel extends FlowPanel {
77
74
  setVisible(false);
78
75
  }
79
76
  }
80
- }
77
+ }
@@ -1,16 +1,15 @@
1
1
  package <%= base_package %>;
2
2
 
3
- import <%= managed_package %>.<%= application_name %>PlaceHistoryMapper;
3
+ <% if options[:menu] -%>
4
+ import <%= managed_package %>.<%= application_name %>MenuPanel;
5
+ <% end -%>
4
6
  import <%= managed_package %>.<%= application_name %>Module;
5
7
 
6
8
  import com.google.gwt.activity.shared.ActivityManager;
7
9
  import com.google.gwt.core.client.EntryPoint;
8
10
  import com.google.gwt.core.client.GWT;
9
- import com.google.gwt.event.shared.EventBus;
10
11
  import com.google.gwt.inject.client.GinModules;
11
12
  import com.google.gwt.inject.client.Ginjector;
12
- import com.google.gwt.place.shared.Place;
13
- import com.google.gwt.place.shared.PlaceController;
14
13
  import com.google.gwt.place.shared.PlaceHistoryHandler;
15
14
  import com.google.gwt.user.client.ui.Panel;
16
15
  import com.google.gwt.user.client.ui.RootPanel;
@@ -18,7 +17,7 @@ import com.google.inject.Inject;
18
17
 
19
18
  import <%= gwt_rails_package %>.Application;
20
19
  import <%= gwt_rails_package %>.Notice;
21
- import <%= gwt_rails_package %>.DefaultDispatcherSingleton;
20
+ import <%= gwt_rails_package %>.dispatchers.DefaultDispatcherSingleton;
22
21
 
23
22
  import org.fusesource.restygwt.client.Defaults;
24
23
 
@@ -29,8 +28,7 @@ public class <%= application_name %>EntryPoint implements EntryPoint {
29
28
 
30
29
  @GinModules(<%= application_name %>Module.class)
31
30
  static public interface <%= application_name %>Ginjector extends Ginjector {
32
- PlaceController getPlaceController();
33
- EventBus getEventBus();
31
+ PlaceHistoryHandler getPlaceHistoryHandler();
34
32
  Application getApplication();
35
33
  }
36
34
 
@@ -38,6 +36,9 @@ public class <%= application_name %>EntryPoint implements EntryPoint {
38
36
  private final Notice notice;
39
37
  <% if options[:session] -%>
40
38
  private final BreadCrumbsPanel breadCrumbs;
39
+ <% end -%>
40
+ <% if options[:menu] -%>
41
+ private final <%= application_name %>MenuPanel menu;
41
42
  <% end -%>
42
43
  private RootPanel root;
43
44
 
@@ -45,6 +46,9 @@ public class <%= application_name %>EntryPoint implements EntryPoint {
45
46
  <%= application_name %>Application(final Notice notice,
46
47
  <% if options[:session] -%>
47
48
  final BreadCrumbsPanel breadCrumbs,
49
+ <% end -%>
50
+ <% if options[:menu] -%>
51
+ final <%= application_name %>MenuPanel menu,
48
52
  <% end -%>
49
53
  final ActivityManager activityManager){
50
54
  super(activityManager);
@@ -52,7 +56,10 @@ public class <%= application_name %>EntryPoint implements EntryPoint {
52
56
  <% if options[:session] -%>
53
57
  this.breadCrumbs = breadCrumbs;
54
58
  <% end -%>
55
- }
59
+ <% if options[:menu] -%>
60
+ this.menu = menu;
61
+ <% end -%>
62
+ }
56
63
 
57
64
  protected Panel getApplicationPanel(){
58
65
  if (this.root == null) {
@@ -60,6 +67,9 @@ public class <%= application_name %>EntryPoint implements EntryPoint {
60
67
  this.root.add(notice);
61
68
  <% if options[:session] -%>
62
69
  this.root.add(breadCrumbs);
70
+ <% end -%>
71
+ <% if options[:menu] -%>
72
+ this.root.add(menu);
63
73
  <% end -%>
64
74
  }
65
75
  return this.root;
@@ -76,15 +86,10 @@ public class <%= application_name %>EntryPoint implements EntryPoint {
76
86
 
77
87
  final <%= application_name %>Ginjector injector = GWT.create(<%= application_name %>Ginjector.class);
78
88
 
89
+ // setup display
79
90
  injector.getApplication().run();
80
-
81
- // Start PlaceHistoryHandler with our PlaceHistoryMapper
82
- <%= application_name %>PlaceHistoryMapper historyMapper = GWT.create(<%= application_name %>PlaceHistoryMapper.class);
83
-
84
- PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
85
- historyHandler.register(injector.getPlaceController(), injector.getEventBus(), Place.NOWHERE);
86
-
91
+
87
92
  // Goes to the place represented on URL else default place
88
- historyHandler.handleCurrentHistory();
93
+ injector.getPlaceHistoryHandler().handleCurrentHistory();
89
94
  }
90
- }
95
+ }
@@ -5,16 +5,16 @@ import <%= managed_package %>.ActivityFactory;
5
5
 
6
6
  import com.google.gwt.activity.shared.Activity;
7
7
 
8
- public class LoginPlace extends ActivityPlace {
8
+ public class LoginPlace extends ActivityPlace<Void> {
9
9
 
10
10
  public static final LoginPlace LOGIN = new LoginPlace();
11
11
 
12
12
  private LoginPlace() {
13
- super(null);
13
+ super(null, null);
14
14
  }
15
15
 
16
16
  @Override
17
17
  public Activity create(ActivityFactory factory) {
18
18
  return factory.create(this);
19
19
  }
20
- }
20
+ }
@@ -6,7 +6,7 @@
6
6
  <ui:style>
7
7
  </ui:style>
8
8
 
9
- <g:FlowPanel>
9
+ <g:FlowPanel styleName="display">
10
10
  <g:HTML><label name="login">Username or Email</label></g:HTML>
11
11
  <g:TextBox ui:field="login" name="login"/>
12
12
  <g:HTML><label name="password">Password</label></g:HTML>
@@ -1,5 +1,5 @@
1
1
  #-*- mode: ruby -*-
2
- GWT_VERSION = '2.2.0'
2
+ GWT_VERSION = '2.3.0'
3
3
  jar('org.fusesource.restygwt:restygwt', '1.2-SNAPSHOT').scope :provided
4
4
  jar('javax.ws.rs:jsr311-api', '1.1').scope :provided
5
5
  jar('com.google.gwt:gwt-user', GWT_VERSION).scope :provided
@@ -0,0 +1,27 @@
1
+ package <%= managed_package %>;
2
+
3
+ import javax.inject.Inject;
4
+ import javax.inject.Singleton;
5
+ <% if options[:session] -%>
6
+
7
+ import <%= models_package %>.User;
8
+ <% end -%>
9
+
10
+ import com.google.gwt.event.dom.client.ClickEvent;
11
+ import com.google.gwt.event.dom.client.ClickHandler;
12
+ import com.google.gwt.place.shared.PlaceController;
13
+
14
+ import <%= gwt_rails_package %>.places.RestfulActionEnum;
15
+ <% if options[:session] -%>
16
+ import <%= gwt_rails_package %>.session.SessionManager;
17
+ <% end -%>
18
+ import <%= gwt_rails_package %>.views.MenuPanel;
19
+
20
+ @Singleton
21
+ public class <%= application_name %>MenuPanel extends MenuPanel<User> {
22
+
23
+ @Inject
24
+ <%= application_name %>MenuPanel(final PlaceController placeController<% if options[:session] -%>, SessionManager<User> sessionManager<% end %>){
25
+ super(<% if options[:session] -%>sessionManager<% end -%>);
26
+ }
27
+ }
@@ -1,8 +1,41 @@
1
1
  package <%= managed_package %>;
2
2
 
3
- import com.google.gwt.place.shared.PlaceHistoryMapper;
4
- import com.google.gwt.place.shared.WithTokenizers;
3
+ import javax.inject.Inject;
4
+ import javax.inject.Singleton;
5
5
 
6
- @WithTokenizers({})
7
- public interface <%= application_name %>PlaceHistoryMapper extends PlaceHistoryMapper {
6
+ <% if options[:session] -%>
7
+ import <%= models_package %>.User;
8
+
9
+ import com.google.gwt.place.shared.Place;
10
+
11
+ import <%= gwt_rails_package %>.places.RestfulPlace;
12
+ <% end -%>
13
+ import <%= gwt_rails_package %>.places.RestfulPlaceHistoryMapper;
14
+ <% if options[:session] -%>
15
+ import <%= gwt_rails_package %>.session.SessionManager;
16
+ <% end -%>
17
+
18
+ @Singleton
19
+ public class <%= application_name %>PlaceHistoryMapper extends RestfulPlaceHistoryMapper {
20
+ <% if options[:session] -%>
21
+
22
+ private final SessionManager<User> manager;
23
+ <% end -%>
24
+
25
+ @Inject
26
+ public <%= application_name %>PlaceHistoryMapper(<% if options[:session] -%>SessionManager<User> manager<% end -%>){
27
+ <% if options[:session] -%>
28
+ this.manager = manager;
29
+ <% end -%>
30
+ }
31
+ <% if options[:session] -%>
32
+
33
+ @Override
34
+ public Place getPlace(String token) {
35
+ RestfulPlace<?> place = (RestfulPlace<?>) super.getPlace(token);
36
+ // place needs to be different on the level of equals in order to trigger an activity
37
+ place.hasSession = manager.hasSession();
38
+ return place;
39
+ }
40
+ <% end -%>
8
41
  }
@@ -9,11 +9,11 @@ import <%= places_package %>.LoginPlace;
9
9
  import com.google.gwt.activity.shared.Activity;
10
10
  import com.google.gwt.place.shared.Place;
11
11
 
12
- import de.mkristian.gwt.rails.Notice;
13
- import de.mkristian.gwt.rails.RestfulPlace;
14
- import de.mkristian.gwt.rails.session.NeedsAuthorization;
15
- import de.mkristian.gwt.rails.session.NoAuthorization;
16
- import de.mkristian.gwt.rails.session.SessionManager;
12
+ import <%= gwt_rails_package %>.Notice;
13
+ import <%= gwt_rails_package %>.places.RestfulPlace;
14
+ import <%= gwt_rails_package %>.session.NeedsAuthorization;
15
+ import <%= gwt_rails_package %>.session.NoAuthorization;
16
+ import <%= gwt_rails_package %>.session.SessionManager;
17
17
 
18
18
  public class SessionActivityPlaceActivityMapper extends ActivityPlaceActivityMapper {
19
19
 
@@ -35,8 +35,8 @@ public class SessionActivityPlaceActivityMapper extends ActivityPlaceActivityMap
35
35
  */
36
36
  protected Activity pessimisticGetActivity(Place place) {
37
37
  if (!(place instanceof NoAuthorization)) {
38
- if(manager.isActive()){
39
- if(!manager.isAllowed((RestfulPlace)place)){
38
+ if(manager.hasSession()){
39
+ if(!manager.isAllowed((RestfulPlace<?>)place)){
40
40
  notice.setText("nothing to see");
41
41
  return null;
42
42
  }
@@ -56,8 +56,8 @@ public class SessionActivityPlaceActivityMapper extends ActivityPlaceActivityMap
56
56
  */
57
57
  protected Activity optimisticGetActivity(Place place) {
58
58
  if (place instanceof NeedsAuthorization) {
59
- if(manager.isActive()){
60
- if(!manager.isAllowed((RestfulPlace)place)){
59
+ if(manager.hasSession()){
60
+ if(!manager.isAllowed((RestfulPlace<?>)place)){
61
61
  notice.setText("nothing to see");
62
62
  return null;
63
63
  }
@@ -68,4 +68,4 @@ public class SessionActivityPlaceActivityMapper extends ActivityPlaceActivityMap
68
68
  }
69
69
  return super.getActivity(place);
70
70
  }
71
- }
71
+ }
@@ -1,3 +1,3 @@
1
1
  class Authentication < ActiveResource::Base
2
- self.site = Rails.application.config.remote_sso_url
2
+ self.site = Rails.application.config.remote_sso_url if Rails.application.config.respond_to? :remote_sso_url
3
3
  end