Example usage for org.apache.wicket RestartResponseAtInterceptPageException RestartResponseAtInterceptPageException

List of usage examples for org.apache.wicket RestartResponseAtInterceptPageException RestartResponseAtInterceptPageException

Introduction

In this page you can find the example usage for org.apache.wicket RestartResponseAtInterceptPageException RestartResponseAtInterceptPageException.

Prototype

public RestartResponseAtInterceptPageException(Class<? extends Page> interceptPageClass) 

Source Link

Document

Redirects to the specified intercept page, this will result in a bookmarkable redirect.

Usage

From source file:com.tysanclan.site.projectewok.pages.RealmPage.java

License:Open Source License

public RealmPage(PageParameters params) {
    super("Realm overview");

    RealmPageParams parameters;/* w  w w.j a v  a2s .com*/
    try {
        parameters = requiredLong("id").forParameters(params).toClass(RealmPageParams.class);
    } catch (PageParameterExtractorException e) {
        throw new AbortWithHttpErrorCodeException(HttpServletResponse.SC_NOT_FOUND);
    }

    Realm realm = realmDAO.get(parameters.getId());

    if (realm == null)
        throw new RestartResponseAtInterceptPageException(AccessDeniedPage.class);

    init(realm);
}

From source file:com.userweave.application.UserWeaveAuthorizationStrategy.java

License:Open Source License

public void onUnauthorizedInstantiation(Component component) {
    throw new RestartResponseAtInterceptPageException(LoginPage.class);
}

From source file:cz.zcu.kiv.eegdatabase.wui.ui.account.AccountOverViewPage.java

License:Apache License

public AccountOverViewPage() {

    setPageTitle(ResourceUtils.getModel("pageTitle.accountOverview"));

    add(new ButtonPageMenu("leftMenu", MyAccountPageLeftMenu.values()));

    Person user = personFacade.getPerson(EEGDataBaseSession.get().getLoggedUser().getUsername());

    if (user == null)
        throw new RestartResponseAtInterceptPageException(HomePage.class);

    // user information
    add(new Label("userName", new PropertyModel<String>(user, "email")));
    add(new Label("fullName", user.getGivenname() + " " + user.getSurname()));
    add(new Label("authority", new PropertyModel<String>(user, "authority")));

    add(new Label("phone", user.getPhone()));
    add(new Label("address",
            (user.getAddress() == null ? "" : user.getAddress() + ", ")
                    + (user.getZipCode() == null ? "" : user.getZipCode() + ", ")
                    + (user.getCity() == null ? "" : user.getCity())));
    //add(new Label("address", user.getAddress()));
    add(new Label("country", user.getCountry()));

    List<ResearchGroupAccountInfo> groupDataForAccountOverview = researchGroupFacade
            .getGroupDataForAccountOverview(user);
    boolean emptyGroups = groupDataForAccountOverview.isEmpty();

    WebMarkupContainer noGroups = new WebMarkupContainer("noGroups");
    noGroups.setVisibilityAllowed(emptyGroups);

    // list of user groups
    ListView<ResearchGroupAccountInfo> groups = new ListView<ResearchGroupAccountInfo>("groups",
            groupDataForAccountOverview) {

        private static final long serialVersionUID = 1L;

        @Override/*from w w  w.ja  v  a 2  s.c  o m*/
        protected void populateItem(ListItem<ResearchGroupAccountInfo> item) {
            ResearchGroupAccountInfo modelObject = item.getModelObject();
            item.add(new Label("title", modelObject.getTitle()));
            item.add(new Label("authority", modelObject.getAuthority()));
            item.add(new BookmarkablePageLink<ResearchGroupsDetailPage>("link", ResearchGroupsDetailPage.class,
                    PageParametersUtils.getDefaultPageParameters(modelObject.getGroupId())));
        }
    };
    groups.setVisibilityAllowed(!emptyGroups);

    BookmarkablePageLink<Void> editAccount = new BookmarkablePageLink<Void>("editLink", PersonFormPage.class,
            PageParametersUtils.getDefaultPageParameters(user.getPersonId()));

    add(groups, noGroups, editAccount);
}

From source file:cz.zcu.kiv.eegdatabase.wui.ui.account.BuyMembershipPlanPersonPage.java

License:Apache License

public BuyMembershipPlanPersonPage(PageParameters parameters) {
    final Person person = personFacade.getLoggedPerson();

    setPageTitle(ResourceUtils.getModel("pageTitle.buyPlan"));

    add(new ButtonPageMenu("leftMenu", MyAccountPageLeftMenu.values()));

    Person user = EEGDataBaseSession.get().getLoggedUser();

    if (user == null)
        throw new RestartResponseAtInterceptPageException(HomePage.class);

    DefaultDataTable<MembershipPlan, String> personPlans = new DefaultDataTable<MembershipPlan, String>(
            "personPlans", createMembershipListColumns(),
            new ListMembershipsDataProvider(membershipPlanFacade, MembershipPlanType.PERSON), ITEMS_PER_PAGE);

    add(personPlans);//from   w  ww .j  a  va2s.  c om
}

From source file:cz.zcu.kiv.eegdatabase.wui.ui.account.ChangePasswordPage.java

License:Apache License

public ChangePasswordPage(PageParameters parameters) {

    StringValue value = parameters.get(PARAM_ID);
    if (!value.isNull() && !value.isEmpty() && value.toString().equals(PARAM_ID)) {
        add(new Label("headTitle", ResourceUtils.getModel("pageTitle.changesWereMade")));
        setupComponents(false);/*ww  w  . j  a v a  2  s . c o  m*/
    } else
        throw new RestartResponseAtInterceptPageException(AccountOverViewPage.class);

}

From source file:cz.zcu.kiv.eegdatabase.wui.ui.account.ListOfMembershipPlansPersonPage.java

License:Apache License

private StringValue parseParameters(PageParameters parameters) {

    StringValue value = parameters.get(BasePage.DEFAULT_PARAM_ID);
    if (value.isNull() || value.isEmpty())
        throw new RestartResponseAtInterceptPageException(EEGDataBaseApplication.get().getHomePage());
    return value;
}

From source file:cz.zcu.kiv.eegdatabase.wui.ui.account.SocialNetworksPage.java

License:Apache License

public SocialNetworksPage() {
    setPageTitle(ResourceUtils.getModel("pageTitle.socialOverview"));

    throw new RestartResponseAtInterceptPageException(UnderConstructPage.class);
}

From source file:cz.zcu.kiv.eegdatabase.wui.ui.administration.forms.LicenseManageFormPage.java

License:Open Source License

public LicenseManageFormPage(PageParameters parameters) {
    StringValue licenseId = parameters.get(DEFAULT_PARAM_ID);
    if (licenseId.isNull() || licenseId.isEmpty())
        throw new RestartResponseAtInterceptPageException(AdminManageLicensesPage.class);

    License license = licenseFacade.read(licenseId.toInteger());

    add(new Label("headTitle", ResourceUtils.getModel("pageTitle.editLicenseTemplate")));
    add(new ButtonPageMenu("leftMenu", AdministrationPageLeftMenu.values()));
    add(new LicenseForm("form", new Model<License>(license), licenseFacade, getFeedback()));

}

From source file:cz.zcu.kiv.eegdatabase.wui.ui.articles.ArticleCommentFormPage.java

License:Apache License

public ArticleCommentFormPage(PageParameters parameters) {

    setPageTitle(ResourceUtils.getModel("label.addComment"));
    add(new ButtonPageMenu("leftMenu", ArticlesPageLeftMenu.values()));

    StringValue articleParam = parameters.get(PageParametersUtils.ARTICLE);
    StringValue commentParam = parameters.get(PageParametersUtils.COMMENT);

    if (articleParam.isNull() || articleParam.isEmpty() || commentParam.isEmpty() || commentParam.isNull()) {
        throw new RestartResponseAtInterceptPageException(ArticlesPage.class);
    }/*  w w  w  .ja va 2  s  . c o  m*/

    int articleId = articleParam.toInt();
    int commentId = commentParam.toInt();

    Article article = facade.read(articleId);

    boolean isPublicArticle = article.getResearchGroup() == null;
    testUserCanAddArticleComment(isPublicArticle);

    ArticleComment parentComment = facade.readComment(commentId);
    Person person = EEGDataBaseSession.get().getLoggedUser();

    ArticleComment newComment = new ArticleComment();
    newComment.setArticle(article);
    newComment.setPerson(person);
    newComment.setParent(parentComment);

    add(new ArticleCommentFormPanel("addCommentFormPanel", new Model<ArticleComment>(newComment),
            getFeedback()));

}

From source file:cz.zcu.kiv.eegdatabase.wui.ui.articles.ArticleCommentFormPage.java

License:Apache License

private void testUserCanAddArticleComment(boolean isPublicArticle) {

    boolean isUserAdmin = EEGDataBaseSession.get().hasRole(UserRole.ROLE_ADMIN.name());
    boolean userCanAddArticle = securityFacade.userIsGroupAdmin() || securityFacade.userIsExperimenter()
            || isPublicArticle || isUserAdmin;
    if (!userCanAddArticle) {
        throw new RestartResponseAtInterceptPageException(ArticlesPage.class);
    }/*from  w w  w  . ja v  a  2s . c om*/
}