Package org.apache.jetspeed.om.page

Examples of org.apache.jetspeed.om.page.PageSecurity


            if (links != null)
            {
                all.addAll(links);
            }
            query = QueryFactory.newQuery(PageSecurityImpl.class, filter);
            PageSecurity document = (PageSecurity)getPersistenceBrokerTemplate().getObjectByQuery(query);
            if (document != null)
            {
                all.add(document);
            }
View Full Code Here


        catch (FolderNotFoundException e)
        {
        }
        try
        {
            PageSecurity check = pageManager.getPageSecurity();
            assertTrue("PageSecurity FOUND", false);
        }
        catch (DocumentNotFoundException e)
        {
        }
View Full Code Here

                }
            }

            // update page security
            query = QueryFactory.newQuery(PageSecurityImpl.class, filter);
            PageSecurity document = (PageSecurity)getPersistenceBrokerTemplate().getObjectByQuery(query);
            if (document != null)
            {
                updatePageSecurity(document);
            }
View Full Code Here

                }
            }

            // remove page security
            query = QueryFactory.newQuery(PageSecurityImpl.class, filter);
            PageSecurity document = (PageSecurity)getPersistenceBrokerTemplate().getObjectByQuery(query);
            if (document != null)
            {
                removePageSecurity(document);
            }
        }
View Full Code Here

        if (name == null)
            throw new AJAXException("Missing 'name' parameter");
       
        try
        {
            PageSecurity pageSecurity = pageManager.getPageSecurity();       
            SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(name);
            if (def == null)
            {
                return 0;
            }
            List defs = pageSecurity.getSecurityConstraintsDefs();
            defs.remove(def);
            pageSecurity.setSecurityConstraintsDefs(defs);
            pageManager.updatePageSecurity(pageSecurity);
        }
        catch (Exception e)
        {
            throw new AJAXException(e);
View Full Code Here

            SAXBuilder saxBuilder = new SAXBuilder();
            StringReader reader = new StringReader(xml);
            Document document = saxBuilder.build(reader);
            Element root = document.getRootElement();
            String name = root.getAttribute("name").getValue();
            PageSecurity pageSecurity = pageManager.getPageSecurity();
            SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(name);
            int defsSize = 0;
            if (def == null)
            {
                def = pageManager.newSecurityConstraintsDef();
                def.setName(name);
                added = true;
            }
            int xmlSize = root.getChildren("security-constraint").size();
            if (added == false)
            {
                defsSize = def.getSecurityConstraints().size();
            }
            int min = (xmlSize < defsSize) ? xmlSize : defsSize;
            List xmlConstraints = root.getChildren("security-constraint");
            List constraints = def.getSecurityConstraints();
            Element owner = root.getChild("owner");
            if (owner != null)
            {
            }
            for (int ix = 0; ix < min; ix++)
            {
                Element xmlConstraint = (Element)xmlConstraints.get(ix);
                SecurityConstraint constraint =  (SecurityConstraint)constraints.get(ix);               
                updateConstraintValues(xmlConstraint, constraint);
                count++;               
            }
            if (xmlSize < defsSize)
            {
                // remove constraints
                List deletes = new ArrayList(defsSize - xmlSize);
                for (int ix = min; ix < defsSize; ix++)
                {
                    deletes.add(constraints.get(ix));
                }
                for (int ix = 0; ix < deletes.size(); ix++)
                {
                    constraints.remove(deletes.get(ix));
                    count++;                   
                }               
            }
            else if (xmlSize > defsSize)
            {
                // add new constraints
                for (int ix = min; ix < xmlSize; ix++)
                {
                    Element xmlConstraint = (Element)xmlConstraints.get(ix);
                    SecurityConstraint constraint =  pageManager.newPageSecuritySecurityConstraint();                   
                    updateConstraintValues(xmlConstraint, constraint);
                    constraints.add(constraint);                   
                    count++;
                }               
            }
            if (added)
            {               
                pageSecurity.getSecurityConstraintsDefs().add(def);
                pageSecurity.setSecurityConstraintsDefs(pageSecurity.getSecurityConstraintsDefs());
            }
            pageManager.updatePageSecurity(pageSecurity);
        }
        catch (Exception e)
        {
View Full Code Here

        if (name == null)
            throw new AJAXException("Missing 'name' parameter");
       
        try
        {
            PageSecurity pageSecurity = pageManager.getPageSecurity();       
            List globals = pageSecurity.getGlobalSecurityConstraintsRefs();
            if (!globals.contains(name))
            {
                return 0;
            }
            globals.remove(name);
            pageSecurity.setGlobalSecurityConstraintsRefs(globals);
            pageManager.updatePageSecurity(pageSecurity);
            count++;
        }
        catch (Exception e)
        {
View Full Code Here

        if (name == null)
            throw new AJAXException("Missing 'name' parameter");
       
        try
        {
            PageSecurity pageSecurity = pageManager.getPageSecurity();       
            List globals = pageSecurity.getGlobalSecurityConstraintsRefs();
            if (pageSecurity.getSecurityConstraintsDef(name) == null)
            {
                throw new AJAXException("global name doesnt exist in definitions");
            }
            if (globals.contains(name))
            {
                // already exist;
                return count;
            }
            globals.add(name);
            pageSecurity.setGlobalSecurityConstraintsRefs(globals);
            pageManager.updatePageSecurity(pageSecurity);
            count++;
        }
        catch (Exception e)
        {
View Full Code Here

        if (name == null)
            throw new AJAXException("Missing 'name' parameter");
       
        try
        {
            PageSecurity pageSecurity = pageManager.getPageSecurity();       
            SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(name);
            if (def == null)
            {
                return 0;
            }
            List defs = pageSecurity.getSecurityConstraintsDefs();
            defs.remove(def);
            pageSecurity.setSecurityConstraintsDefs(defs);
            pageManager.updatePageSecurity(pageSecurity);
        }
        catch (Exception e)
        {
            throw new AJAXException(e);
View Full Code Here

            SAXBuilder saxBuilder = new SAXBuilder();
            StringReader reader = new StringReader(xml);
            Document document = saxBuilder.build(reader);
            Element root = document.getRootElement();
            String name = root.getAttribute("name").getValue();
            PageSecurity pageSecurity = pageManager.getPageSecurity();
            SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(name);
            int defsSize = 0;
            if (def == null)
            {
                def = pageManager.newSecurityConstraintsDef();
                def.setName(name);
                added = true;
            }
            int xmlSize = root.getChildren("security-constraint").size();
            if (added == false)
            {
                defsSize = def.getSecurityConstraints().size();
            }
            int min = (xmlSize < defsSize) ? xmlSize : defsSize;
            List xmlConstraints = root.getChildren("security-constraint");
            List constraints = def.getSecurityConstraints();
            Element owner = root.getChild("owner");
            if (owner != null)
            {
            }
            for (int ix = 0; ix < min; ix++)
            {
                Element xmlConstraint = (Element)xmlConstraints.get(ix);
                SecurityConstraint constraint =  (SecurityConstraint)constraints.get(ix);               
                updateConstraintValues(xmlConstraint, constraint);
                count++;               
            }
            if (xmlSize < defsSize)
            {
                // remove constraints
                List deletes = new ArrayList(defsSize - xmlSize);
                for (int ix = min; ix < defsSize; ix++)
                {
                    deletes.add(constraints.get(ix));
                }
                for (int ix = 0; ix < deletes.size(); ix++)
                {
                    constraints.remove(deletes.get(ix));
                    count++;                   
                }               
            }
            else if (xmlSize > defsSize)
            {
                // add new constraints
                for (int ix = min; ix < xmlSize; ix++)
                {
                    Element xmlConstraint = (Element)xmlConstraints.get(ix);
                    SecurityConstraint constraint =  pageManager.newPageSecuritySecurityConstraint();                   
                    updateConstraintValues(xmlConstraint, constraint);
                    constraints.add(constraint);                   
                    count++;
                }               
            }
            if (added)
            {               
                pageSecurity.getSecurityConstraintsDefs().add(def);
                pageSecurity.setSecurityConstraintsDefs(pageSecurity.getSecurityConstraintsDefs());
            }
            pageManager.updatePageSecurity(pageSecurity);
        }
        catch (Exception e)
        {
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.page.PageSecurity

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.