Package org.apache.jetspeed.om.portlet

Examples of org.apache.jetspeed.om.portlet.SecurityRoleRef


            {
                PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
                PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
                PortletDefinition def = app.getPortlet(paNodeBean.getName());

                final SecurityRoleRef secRoleRef = def.getSecurityRoleRef(securityRoleRef.getRoleName());

                List<DescriptionBean> list = new ArrayList<DescriptionBean>();

                for (Description description : secRoleRef.getDescriptions())
                {
                    list.add(new DescriptionBean(description));
                }

                return new ListDataProvider<DescriptionBean>(list);
            }
           
            @Override
            protected Button saveButton(String componentId)
            {
                return new Button(componentId)
                {

                    @Override
                    public void onSubmit()
                    {
                        PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
                        PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
                        PortletDefinition def = app.getPortlet(paNodeBean.getName());
                       
                        if (newLocale != null && newDescription != null)
                        {
                            SecurityRoleRef secRoleRef = def.getSecurityRoleRef(securityRoleRef.getRoleName());
                            Locale locale = new Locale(newLocale);
                            Description targetDescription = null;
                           
                            for (Description description : secRoleRef.getDescriptions())
                            {
                                if (description.getLocale().equals(locale))
                                {
                                    targetDescription = description;
                                    break;
                                }
                            }
                           
                            if (targetDescription == null)
                            {
                                targetDescription = securityRoleRef.addDescription(newLocale);
                            }
                           
                            targetDescription.setDescription(newDescription);
                           
                            newLocale = null;
                            newDescription = null;
                        }

                        FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
                       
                        try
                        {
                            registry.savePortletDefinition(def);
                            StringResourceModel resModel = new StringResourceModel("pam.details.action.status.portlet.saveOK", this, null, new Object [] { paNodeBean.getName() } );
                            feed.info(resModel.getString());
                        }
                        catch (RegistryException e)
                        {
                            logger.error("Failed to save portlet definition.", e);
                            StringResourceModel resModel = new StringResourceModel("pam.details.action.status.portlet.saveFailure", this, null, new Object [] { paNodeBean.getName(), e.getMessage() } );
                            feed.info(resModel.getString());
                        }
                    }
                };
            }

            @Override
            public void delete(IModel<DescriptionBean>[] fields)
            {
                FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
               
                try
                {
                    PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
                    PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
                    PortletDefinition def = app.getPortlet(paNodeBean.getName());
                    SecurityRoleRef secRoleRef = def.getSecurityRoleRef(securityRoleRef.getRoleName());
                   
                    if (secRoleRef != null)
                    {
                        for (Iterator<Description> it = secRoleRef.getDescriptions().iterator(); it.hasNext(); )
                        {
                            Description description = it.next();
                           
                            for (IModel<DescriptionBean> descriptionBeanModel : fields)
                            {
View Full Code Here


        PortletDefinition def = app.getPortlet(paNodeBean.getName());

        Iterator<SecurityRoleRef> it = def.getSecurityRoleRefs().iterator();
        while (it.hasNext())
        {
            SecurityRoleRef securityRoleRef = it.next();
            String roleName = securityRoleRef.getRoleName();
           
            for (IModel<SecurityRoleRef> field : fields)
            {
                if (field.getObject().getRoleName().equals(roleName))
                {
View Full Code Here

                PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
                PortletDefinition def = app.getPortlet(paNodeBean.getName());

                if (newRoleName != null && newRoleLink != null)
                {
                    SecurityRoleRef securityRoleRef = def.addSecurityRoleRef(newRoleName);
                    securityRoleRef.setRoleLink(newRoleLink);

                    if (newLocale != null && newDescription != null)
                    {
                        Description desc = securityRoleRef.addDescription(newLocale);
                        desc.setDescription(newDescription);
                    }
                   
                    newRoleName = null;
                    newRoleLink = null;
View Full Code Here

                InitParam param = def.getInitParam(name);
                description = param.getDescription(locale);
            }
            else if (type == SecurityRoleRef.class)
            {
                SecurityRoleRef securityRoleRef = def.getSecurityRoleRef(name);
                description = securityRoleRef.getDescription(locale);
            }
        }
        else
        {
            UserAttribute attr = app.getUserAttribute(name);
View Full Code Here

    @Override
    protected SecurityRoleRef load()
    {
        PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
        PortletDefinition def = app.getPortlet(paNodeBean.getName());
        SecurityRoleRef securityRoleRef = def.getSecurityRoleRef(roleName);
        return securityRoleRef;
    }
View Full Code Here

            copy.addSupportedPublishingEvent(eventDefRef.getQName());
        }
       
        for (SecurityRoleRef secRoleRef : source.getSecurityRoleRefs())
        {
            SecurityRoleRef copySecRoleRef = copy.addSecurityRoleRef(secRoleRef.getRoleName());
            copySecRoleRef.setRoleLink(secRoleRef.getRoleLink());
           
            for (Description desc : secRoleRef.getDescriptions())
            {
                Description copyDesc = copySecRoleRef.addDescription(desc.getLang());
                copyDesc.setDescription(desc.getDescription());
            }
        }
       
        for (Supports supports : source.getSupports())
View Full Code Here

            {
                PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
                PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
                PortletDefinition def = PortletApplicationUtils.getPortletOrClone(app, paNodeBean.getName());

                final SecurityRoleRef secRoleRef = def.getSecurityRoleRef(securityRoleRef.getRoleName());

                List<DescriptionBean> list = new ArrayList<DescriptionBean>();

                for (Description description : secRoleRef.getDescriptions())
                {
                    list.add(new DescriptionBean(description));
                }

                return new ListDataProvider<DescriptionBean>(list);
            }
           
            @Override
            protected Button saveButton(String componentId)
            {
                return new Button(componentId)
                {

                    @Override
                    public void onSubmit()
                    {
                        PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
                        PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
                        PortletDefinition def = PortletApplicationUtils.getPortletOrClone(app, paNodeBean.getName());
                       
                        if (newLocale != null && newDescription != null)
                        {
                            SecurityRoleRef secRoleRef = def.getSecurityRoleRef(securityRoleRef.getRoleName());
                            Locale locale = new Locale(newLocale);
                            Description targetDescription = null;
                           
                            for (Description description : secRoleRef.getDescriptions())
                            {
                                if (description.getLocale().equals(locale))
                                {
                                    targetDescription = description;
                                    break;
                                }
                            }
                           
                            if (targetDescription == null)
                            {
                                targetDescription = securityRoleRef.addDescription(newLocale);
                            }
                           
                            targetDescription.setDescription(newDescription);
                           
                            newLocale = null;
                            newDescription = null;
                        }

                        FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
                       
                        try
                        {
                            registry.savePortletDefinition(def);
                            StringResourceModel resModel = new StringResourceModel("pam.details.action.status.portlet.saveOK", this, null, new Object [] { paNodeBean.getName() } );
                            feed.info(resModel.getString());
                        }
                        catch (RegistryException e)
                        {
                            logger.error("Failed to save portlet definition.", e);
                            StringResourceModel resModel = new StringResourceModel("pam.details.action.status.portlet.saveFailure", this, null, new Object [] { paNodeBean.getName(), e.getMessage() } );
                            feed.info(resModel.getString());
                        }
                    }
                };
            }

            @Override
            public void delete(IModel<DescriptionBean>[] fields)
            {
                FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
               
                try
                {
                    PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
                    PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
                    PortletDefinition def = PortletApplicationUtils.getPortletOrClone(app, paNodeBean.getName());
                    SecurityRoleRef secRoleRef = def.getSecurityRoleRef(securityRoleRef.getRoleName());
                   
                    if (secRoleRef != null)
                    {
                        for (Iterator<Description> it = secRoleRef.getDescriptions().iterator(); it.hasNext(); )
                        {
                            Description description = it.next();
                           
                            for (IModel<DescriptionBean> descriptionBeanModel : fields)
                            {
View Full Code Here

        PortletDefinition def = PortletApplicationUtils.getPortletOrClone(app, paNodeBean.getName());

        Iterator<SecurityRoleRef> it = def.getSecurityRoleRefs().iterator();
        while (it.hasNext())
        {
            SecurityRoleRef securityRoleRef = it.next();
            String roleName = securityRoleRef.getRoleName();
           
            for (IModel<SecurityRoleRef> field : fields)
            {
                if (field.getObject().getRoleName().equals(roleName))
                {
View Full Code Here

                PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
                PortletDefinition def = PortletApplicationUtils.getPortletOrClone(app, paNodeBean.getName());

                if (newRoleName != null && newRoleLink != null)
                {
                    SecurityRoleRef securityRoleRef = def.addSecurityRoleRef(newRoleName);
                    securityRoleRef.setRoleLink(newRoleLink);

                    if (newLocale != null && newDescription != null)
                    {
                        Description desc = securityRoleRef.addDescription(newLocale);
                        desc.setDescription(newDescription);
                    }
                   
                    newRoleName = null;
                    newRoleLink = null;
View Full Code Here

                InitParam param = def.getInitParam(name);
                description = param.getDescription(locale);
            }
            else if (type == SecurityRoleRef.class)
            {
                SecurityRoleRef securityRoleRef = def.getSecurityRoleRef(name);
                description = securityRoleRef.getDescription(locale);
            }
        }
        else
        {
            UserAttribute attr = app.getUserAttribute(name);
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.portlet.SecurityRoleRef

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.