Package org.apache.jetspeed.ajax

Examples of org.apache.jetspeed.ajax.AJAXException


                folder.setHidden(!folder.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

    {
        String name = getActionParameter(requestContext, "name");
        String language = getActionParameter(requestContext, "lang");
        String value = getActionParameter(requestContext, "value");
        if (isBlank(name) || isBlank(language))
            throw new AJAXException("Invalid Metadata: name, language invalid data.");
        Locale locale = new Locale(language);
        node.getMetadata().addField(locale, name, value);       
        return 1;
    }
View Full Code Here

        String value = getActionParameter(requestContext, "value");
        String oldName = getActionParameter(requestContext, "oldname");
        String oldLanguage = getActionParameter(requestContext, "oldlang");

        if (isBlank(name) || isBlank(language) || isBlank(oldName) || isBlank(oldLanguage))
            throw new AJAXException("Invalid Metadata: name, language invalid data.");
               
        Collection cfields = node.getMetadata().getFields(oldName);
        if (cfields == null || cfields.size() == 0)
        {
            return insertMetadata(requestContext, resultMap, node);           
View Full Code Here

    throws AJAXException
    {
        String name = getActionParameter(requestContext, "name");
        String language = getActionParameter(requestContext, "lang");
        if (isBlank(name) || isBlank(language))
            throw new AJAXException("Invalid Metadata: name, language invalid data.");
        Collection cfields = node.getMetadata().getFields(name);
        Collection allFields = node.getMetadata().getFields();
        if (cfields == null || cfields.size() == 0)
        {
            return 0;           
View Full Code Here

    throws AJAXException
    {
        String name = getActionParameter(requestContext, "name");
        String kind = getActionParameter(requestContext, "kind");
        if (isBlank(name) || isBlank(kind))
            throw new AJAXException("Invalid Security Ref: name invalid data.");
        if (node.getSecurityConstraints() == null)
        {
            SecurityConstraints cons = node.newSecurityConstraints();
            node.setSecurityConstraints(cons);            
        }
View Full Code Here

    {
        String name = getActionParameter(requestContext, "name");
        String oldName = getActionParameter(requestContext, "oldname");
        String kind = getActionParameter(requestContext, "kind");
        if (isBlank(name) || isBlank(oldName) || isBlank(kind))
            throw new AJAXException("Invalid Security Ref: name invalid data.");
        if (node.getSecurityConstraints() == null)
        {
            SecurityConstraints cons = node.newSecurityConstraints();
            node.setSecurityConstraints(cons);            
        }               
View Full Code Here

    throws AJAXException
    {
        String name = getActionParameter(requestContext, "name");
        String kind = getActionParameter(requestContext, "kind");
        if (isBlank(name) || isBlank(kind))
            throw new AJAXException("Invalid Security Ref: name invalid data.");
        if (node.getSecurityConstraints() == null)
        {
            return 0;
        }
        if (kind.equals("Owner"))
View Full Code Here

    protected int removeSecurityDef(RequestContext requestContext, Map resultMap, Node node)
    throws AJAXException
    {
        String id = getActionParameter(requestContext, "id");
        if (isBlank(id))
            throw new AJAXException("Invalid Security Ref: id invalid data.");
        if (node.getSecurityConstraints() == null)
        {
            return 0;
        }
        List defs = node.getSecurityConstraints().getSecurityConstraints();
View Full Code Here

        {
            buildErrorContext(p_oRequestContext, p_oResultMap);
            p_oResultMap.put(STATUS, "failure");
            p_oResultMap.put(REASON, "command parameters not found");

            throw new AJAXException("command parameters not found");
        }

        // Tokenize the commands into single commands
        StringTokenizer a_oCommandTok = new StringTokenizer(a_sCommands,
                COMMAND_TOKEN);

        // Process each command
        while (a_oCommandTok.hasMoreTokens())
        {
            // Get the token
            String a_sCommand = a_oCommandTok.nextToken();

            // Strip off the opening (
            a_sCommand = a_sCommand.substring(1);

            // Tokenize the single commands into parameters
            StringTokenizer a_oParamTok = new StringTokenizer(a_sCommand,
                    PARAM_TOKEN);
            if (a_oParamTok == null || a_oParamTok.hasMoreTokens() == false)
            {
                buildErrorContext(p_oRequestContext, p_oResultMap);
                p_oResultMap.put(STATUS, "failure");
                p_oResultMap.put(REASON, "incorrect url request");

                throw new AJAXException("incorrect url request");
            }

            // Get the action - which is the first item in the list
            String a_sAction = a_oParamTok.nextToken();

            // Lookup the action from the action map
            Object a_oActionObject = actionMap.get(a_sAction);
            if (a_oActionObject == null
                    && !(a_oActionObject instanceof AjaxAction))
            {
                buildErrorContext(p_oRequestContext, p_oResultMap);
                p_oResultMap.put(REASON, "unknown action requested==>"
                        + a_sAction);

                throw new AJAXException("unknown action requested==>"
                        + a_sAction);
            }

            AjaxAction a_oAction = (AjaxAction) a_oActionObject;

            JetspeedRequestContext a_oJetspeedRequestContext = (JetspeedRequestContext) p_oRequestContext;

            // Process each parameter for this action
            while (a_oParamTok.hasMoreTokens())
            {
                String a_sName = a_oParamTok.nextToken(VALUE_TOKEN);
                // Strip of the leading ; if present
                if (a_sName.indexOf(';') >= 0)
                {
                    a_sName = a_sName.substring(1);
                }

                String a_sValue = a_oParamTok.nextToken();

                // Put the parameters on the request context
                a_oJetspeedRequestContext.setAttribute(a_sName, a_sValue);
            }

            // Invoke the action
            Map a_oResultMap = new HashMap();
            boolean a_bSuccess;

            try
            {
                a_bSuccess = a_oAction.runBatch(a_oJetspeedRequestContext,
                        a_oResultMap);
            } catch (Exception e)
            {
                // Move the reason into the return map
                p_oResultMap.put(REASON, a_oResultMap.get(REASON));

                throw new AJAXException(e);
            }

            // Check for success
            if (a_bSuccess)
            {
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.