Package org.apache.jetspeed.ajax

Examples of org.apache.jetspeed.ajax.AJAXException


                page.setHidden(!page.isHidden());                                   
            count++;
        }
        catch (Exception e)
        {
            throw new AJAXException(e);
        }       
        return count;
    }
View Full Code Here


                page.setHidden(!page.isHidden());                                   
            count++;
        }
        catch (Exception e)
        {
            throw new AJAXException(e);
        }       
        return count;
    }
View Full Code Here

    protected int removeConstraintDefinition(RequestContext requestContext, Map resultMap)
    throws AJAXException
    {
        String name = getActionParameter(requestContext, "name");
        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);
        }       
        return 1;
    }
View Full Code Here

    {
        int count = 0;
        boolean added = false;
        String xml = getActionParameter(requestContext, "xml");
        if (xml == null)
            throw new AJAXException("Missing 'xml' parameter");
        try
        {
            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)
        {
            throw new AJAXException(e);
        }
        return count;
    }
View Full Code Here

    throws AJAXException
    {
        int count = 0;
        String name = getActionParameter(requestContext, "name");
        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)
        {
            throw new AJAXException(e);
        }       
        return count;
    }
View Full Code Here

    throws AJAXException
    {
        int count = 0;
        String name = getActionParameter(requestContext, "name");
        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)
        {
            throw new AJAXException(e);
        }       
        return count;
    }
View Full Code Here

        {
            iMoveType = CARTESIAN;
        }
        else
        {
            throw new AJAXException("invalid move type of:" + p_sMoveType);
        }
    }
View Full Code Here

     
      boolean duplicateFound = isDuplicateFragment(page.getRootFragment(), portletId);
     
      // Throw an exception if a duplicate is found
      if(duplicateFound == true) {
        throw new AJAXException(portletId + " is already on the page, duplicates are not allowed");
      }
    }
View Full Code Here

                return success;
            }          
            int count = 0;
            String path = getActionParameter(requestContext, "path");
            if (path == null)
                throw new AJAXException("Missing 'path' parameter");            
            Folder folder = null;
            if (!method.equals("add"))
            {
                folder = pageManager.getFolder(path);
            }      
View Full Code Here

                folder.setHidden(!folder.isHidden());                                   
            count++;
        }
        catch (Exception e)
        {
            throw new AJAXException(e);
        }       
        return count;
    }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.ajax.AJAXException

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.