Package org.apache.syncope.console.pages

Examples of org.apache.syncope.console.pages.RoleModalPage


                    @Override
                    public Page createPage() {
                        RoleTO roleTO = new RoleTO();
                        roleTO.setParent(idRole);
                        RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
                        return form;
                    }
                });

                window.show(target);
            }
        };

        MetaDataRoleAuthorizationStrategy.authorize(createRoleLink, ENABLE, xmlRolesReader.getAllAllowedRoles("Roles",
                "create"));

        createRoleLink.setOutputMarkupId(true);
        fragment.add(createRoleLink);

        if (idRole != 0) {
            final AjaxLink updateRoleLink = new ClearIndicatingAjaxLink("updateRoleLink", pageRef) {

                private static final long serialVersionUID = -7978723352517770644L;

                @Override
                protected void onClickInternal(final AjaxRequestTarget target) {
                    window.setPageCreator(new ModalWindow.PageCreator() {

                        private static final long serialVersionUID = -7834632442532690940L;

                        @Override
                        public Page createPage() {
                            RoleTO roleTO = restClient.read(idRole);
                            RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
                            return form;
                        }
                    });

                    window.show(target);
View Full Code Here


                            private static final long serialVersionUID = -7834632442532690940L;

                            @Override
                            public Page createPage() {
                                return new RoleModalPage(
                                        page.getPageReference(), editmodal, (RoleTO) model.getObject());
                            }
                        });

                        editmodal.show(target);
View Full Code Here

                    @Override
                    public Page createPage() {
                        RoleTO roleTO = new RoleTO();
                        roleTO.setParent(idRole);
                        RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
                        return form;
                    }
                });

                window.show(target);
            }
        };

        MetaDataRoleAuthorizationStrategy.authorize(createRoleLink, ENABLE, xmlRolesReader.getAllAllowedRoles("Roles",
                "create"));

        createRoleLink.setOutputMarkupId(true);
        fragment.add(createRoleLink);

        if (idRole != 0) {
            final AjaxLink updateRoleLink = new ClearIndicatingAjaxLink("updateRoleLink", pageRef) {

                private static final long serialVersionUID = -7978723352517770644L;

                @Override
                protected void onClickInternal(final AjaxRequestTarget target) {
                    window.setPageCreator(new ModalWindow.PageCreator() {

                        private static final long serialVersionUID = -7834632442532690940L;

                        @Override
                        public Page createPage() {
                            RoleTO roleTO = restClient.read(idRole);
                            RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
                            return form;
                        }
                    });

                    window.show(target);
View Full Code Here

                    @Override
                    public Page createPage() {
                        RoleTO roleTO = new RoleTO();
                        roleTO.setParent(selectedNode.getId());
                        RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
                        return form;
                    }
                });

                window.show(target);
            }
        }, ActionLink.ActionType.CREATE, xmlRolesReader.getAllAllowedRoles("Roles", "create"));
        links.addWithRoles(new ActionLink() {

            private static final long serialVersionUID = -3722207913631435501L;

            @Override
            public void onClick(final AjaxRequestTarget target) {
                window.setPageCreator(new ModalWindow.PageCreator() {

                    private static final long serialVersionUID = -7834632442532690940L;

                    @Override
                    public Page createPage() {
                        return new StatusModalPage(pageRef, window, roleRestClient.read(selectedNode.getId()));
                    }
                });

                window.show(target);
            }
        }, ActionLink.ActionType.SEARCH, xmlRolesReader.getAllAllowedRoles("Roles", "update"));
        links.addWithRoles(new ActionLink() {

            private static final long serialVersionUID = -3722207913631435501L;

            @Override
            public void onClick(final AjaxRequestTarget target) {
                window.setPageCreator(new ModalWindow.PageCreator() {

                    private static final long serialVersionUID = -7834632442532690940L;

                    @Override
                    public Page createPage() {
                        RoleTO roleTO = roleRestClient.read(selectedNode.getId());
                        RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
                        return form;
                    }
                });

                window.show(target);
            }
        }, ActionLink.ActionType.EDIT, xmlRolesReader.getAllAllowedRoles("Roles", "update"));
        links.addWithRoles(new ActionLink() {

            private static final long serialVersionUID = -3722207913631435501L;

            @Override
            public void onClick(final AjaxRequestTarget target) {
                try {
                    final RoleTO roleTO = roleRestClient.delete(selectedNode.getId());

                    ((Roles) pageRef.getPage()).setModalResult(true);

                    window.setPageCreator(new ModalWindow.PageCreator() {

                        private static final long serialVersionUID = -7834632442532690940L;

                        @Override
                        public Page createPage() {
                            return new ResultStatusModalPage.Builder(window, roleTO).build();
                        }
                    });

                    window.show(target);
                } catch (SyncopeClientCompositeErrorException scce) {
                    error(getString(Constants.OPERATION_ERROR) + ": " + scce.getMessage());
                    target.add(((Roles) pageRef.getPage()).getFeedbackPanel());
                }
            }
        }, ActionLink.ActionType.DELETE, xmlRolesReader.getAllAllowedRoles("Roles", "delete"));

        final Form form = new Form("roleForm");
        form.setModel(new CompoundPropertyModel(selectedNode));
        form.setOutputMarkupId(true);

        final RolePanel rolePanel = new RolePanel.Builder("rolePanel").form(form).roleTO(selectedNode).
                roleModalPageMode(RoleModalPage.Mode.ADMIN).build();
        rolePanel.setEnabled(false);
        form.add(rolePanel);

        final WebMarkupContainer userListContainer = new WebMarkupContainer("userListContainer");

        userListContainer.setOutputMarkupId(true);
        userListContainer.setEnabled(true);
        userListContainer.add(new UserSearchResultPanel("userList", true, null, pageRef, userRestClient));
        userListContainer.add(new ClearIndicatingAjaxButton("search", new ResourceModel("search"), pageRef) {

            private static final long serialVersionUID = -958724007591692537L;

            @Override
            protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
                final MembershipCond membershipCond = new MembershipCond();
                membershipCond.setRoleName(selectedNode.getName());
                NodeCond cond = NodeCond.getLeafCond(membershipCond);

                userListContainer.replace(new UserSearchResultPanel("userList", true, cond, pageRef, userRestClient));

                target.add(userListContainer);
            }
        });

        form.add(userListContainer);
        add(form);
    }
View Full Code Here

                            private static final long serialVersionUID = -7834632442532690940L;

                            @Override
                            public Page createPage() {
                                return new RoleModalPage(
                                        page.getPageReference(), editmodal, (RoleTO) model.getObject());
                            }
                        });

                        editmodal.show(target);
View Full Code Here

                    @Override
                    public Page createPage() {
                        RoleTO roleTO = new RoleTO();
                        roleTO.setParent(idRole);
                        RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
                        return form;
                    }
                });

                window.show(target);
            }
        };

        MetaDataRoleAuthorizationStrategy.authorize(createRoleLink, ENABLE, xmlRolesReader.getAllAllowedRoles("Roles",
                "create"));

        createRoleLink.setOutputMarkupId(true);
        fragment.add(createRoleLink);

        if (idRole != 0) {
            final AjaxLink updateRoleLink = new ClearIndicatingAjaxLink("updateRoleLink", pageRef) {

                private static final long serialVersionUID = -7978723352517770644L;

                @Override
                protected void onClickInternal(final AjaxRequestTarget target) {
                    window.setPageCreator(new ModalWindow.PageCreator() {

                        private static final long serialVersionUID = -7834632442532690940L;

                        @Override
                        public Page createPage() {
                            RoleTO roleTO = restClient.read(idRole);
                            RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
                            return form;
                        }
                    });

                    window.show(target);
View Full Code Here

                            private static final long serialVersionUID = -7834632442532690940L;

                            @Override
                            public Page createPage() {
                                RoleTO roleTO = new RoleTO();
                                RoleModalPage form = new RoleModalPage(builder.callerPageRef, builder.window, roleTO);
                                return form;
                            }
                        });

                        builder.window.show(target);
View Full Code Here

                    @Override
                    public Page createPage() {
                        RoleTO roleTO = new RoleTO();
                        roleTO.setParent(idRole);
                        RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
                        return form;
                    }
                });

                window.show(target);
            }
        };

        MetaDataRoleAuthorizationStrategy.authorize(createRoleLink, ENABLE, xmlRolesReader.getAllAllowedRoles("Roles",
                "create"));

        fragment.add(createRoleLink);

        if (idRole != 0) {
            AjaxLink updateRoleLink = new ClearIndicatingAjaxLink("updateRoleLink", pageRef) {

                @Override
                protected void onClickInternal(final AjaxRequestTarget target) {
                    window.setPageCreator(new ModalWindow.PageCreator() {

                        private static final long serialVersionUID = -7834632442532690940L;

                        @Override
                        public Page createPage() {
                            RoleTO roleTO = restClient.readRole(idRole);
                            RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
                            return form;
                        }
                    });

                    window.show(target);
View Full Code Here

                    @Override
                    public Page createPage() {
                        RoleTO roleTO = new RoleTO();
                        roleTO.setParent(selectedNode.getId());
                        RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
                        return form;
                    }
                });

                window.show(target);
            }
        }, ActionLink.ActionType.CREATE, xmlRolesReader.getAllAllowedRoles("Roles", "create"));
        links.addWithRoles(new ActionLink() {

            private static final long serialVersionUID = -3722207913631435501L;

            @Override
            public void onClick(final AjaxRequestTarget target) {
                window.setPageCreator(new ModalWindow.PageCreator() {

                    private static final long serialVersionUID = -7834632442532690940L;

                    @Override
                    public Page createPage() {
                        return new StatusModalPage<RoleTO>(pageRef, window, roleRestClient.read(selectedNode.getId()));
                    }
                });

                window.show(target);
            }
        }, ActionLink.ActionType.MANAGE_RESOURCES, xmlRolesReader.getAllAllowedRoles("Roles", "update"));
        links.addWithRoles(new ActionLink() {

            private static final long serialVersionUID = -3722207913631435501L;

            @Override
            public void onClick(final AjaxRequestTarget target) {
                window.setPageCreator(new ModalWindow.PageCreator() {

                    private static final long serialVersionUID = -7834632442532690940L;

                    @Override
                    public Page createPage() {
                        RoleTO roleTO = roleRestClient.read(selectedNode.getId());
                        RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
                        return form;
                    }
                });

                window.show(target);
            }
        }, ActionLink.ActionType.EDIT, xmlRolesReader.getAllAllowedRoles("Roles", "update"));
        links.addWithRoles(new ActionLink() {

            private static final long serialVersionUID = -3722207913631435501L;

            @Override
            public void onClick(final AjaxRequestTarget target) {
                try {
                    final RoleTO roleTO = roleRestClient.delete(selectedNode.getETagValue(), selectedNode.getId());

                    ((Roles) pageRef.getPage()).setModalResult(true);

                    window.setPageCreator(new ModalWindow.PageCreator() {

                        private static final long serialVersionUID = -7834632442532690940L;

                        @Override
                        public Page createPage() {
                            return new ResultStatusModalPage.Builder(window, roleTO).build();
                        }
                    });

                    window.show(target);
                } catch (SyncopeClientException e) {
                    error(getString(Constants.OPERATION_ERROR) + ": " + e.getMessage());
                    ((Roles) pageRef.getPage()).getFeedbackPanel().refresh(target);
                }
            }
        }, ActionLink.ActionType.DELETE, xmlRolesReader.getAllAllowedRoles("Roles", "delete"));

        final Form form = new Form("roleForm");
        form.setModel(new CompoundPropertyModel(selectedNode));
        form.setOutputMarkupId(true);

        final RolePanel rolePanel = new RolePanel.Builder("rolePanel").form(form).roleTO(selectedNode).
                roleModalPageMode(RoleModalPage.Mode.ADMIN).build();
        rolePanel.setEnabled(false);
        form.add(rolePanel);

        final WebMarkupContainer userListContainer = new WebMarkupContainer("userListContainer");

        userListContainer.setOutputMarkupId(true);
        userListContainer.setEnabled(true);
        userListContainer.add(new UserSearchResultPanel("userList", true, null, pageRef, userRestClient));
        userListContainer.add(new ClearIndicatingAjaxButton("search", new ResourceModel("search"), pageRef) {

            private static final long serialVersionUID = -958724007591692537L;

            @Override
            protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
                userListContainer.replace(new UserSearchResultPanel("userList",
                        true,
                        SyncopeClient.getUserSearchConditionBuilder().hasRoles(selectedNode.getId()).query(),
                        pageRef,
                        userRestClient));

                target.add(userListContainer);
            }
        });

        form.add(userListContainer);
        add(form);
    }
View Full Code Here

                            private static final long serialVersionUID = -7834632442532690940L;

                            @Override
                            public Page createPage() {
                                return new RoleModalPage(
                                        page.getPageReference(), editmodal, (RoleTO) model.getObject());
                            }
                        });

                        editmodal.show(target);
View Full Code Here

TOP

Related Classes of org.apache.syncope.console.pages.RoleModalPage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.