Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated DocumentViewPage to jump the home fragment when 'id' is null

  • Loading branch information...
commit 12b42a8a723cf5a81ac9a0878d271c1ec6e60eb3 1 parent 0faea5e
@marubinotto authored
Showing with 8 additions and 9 deletions.
  1. +8 −9 src/main/java/marubinotto/piggydb/ui/page/DocumentViewPage.java
View
17 src/main/java/marubinotto/piggydb/ui/page/DocumentViewPage.java
@@ -26,11 +26,8 @@ protected boolean needsAuthentication() {
@Override
protected boolean onPreInit() throws Exception {
- if (this.id == null) {
- getLogger().info("Missing parameter: id");
- return true;
- }
-
+ if (this.id == null) this.id = Fragment.ID_HOME;
+
this.fragment = getDomain().getFragmentRepository().get(this.id.longValue());
if (this.fragment == null) {
getLogger().info("Missing fragment: #" + this.id);
@@ -74,10 +71,12 @@ protected void setModels() throws Exception {
this.publicOnly = !isAuthenticated();
this.additionalCssImports = PageImports.additionalCssImports.toString();
- if (this.publicOnly)
- this.parents = getPublicParents(this.fragment, getDomain().getFragmentRepository());
- else
- this.parents = this.fragment.getParents();
+ if (this.fragment != null) {
+ if (this.publicOnly)
+ this.parents = getPublicParents(this.fragment, getDomain().getFragmentRepository());
+ else
+ this.parents = this.fragment.getParents();
+ }
}
public static List<Fragment> getPublicParents(Fragment fragment, FragmentRepository repository)
Please sign in to comment.
Something went wrong with that request. Please try again.