Package org.eurekastreams.commons.actions.service

Examples of org.eurekastreams.commons.actions.service.ServiceAction


     * Test.
     */
    @Test(expected = InvalidActionException.class)
    public void testExecuteMissingValidation()
    {
        ServiceAction action = new ServiceAction(null, authorizationStrategy, executionStrategy, false);
        final ServiceActionContext context = new ServiceActionContext(null, principalMock);
        sut.execute(context, action);
        mockery.assertIsSatisfied();
    }
View Full Code Here


     * Test.
     */
    @Test(expected = InvalidActionException.class)
    public void testExecuteMissingAuthorization()
    {
        ServiceAction action = new ServiceAction(validationStrategy, null, executionStrategy, false);
        final ServiceActionContext context = new ServiceActionContext(null, principalMock);
        sut.execute(context, action);
        mockery.assertIsSatisfied();
    }
View Full Code Here

     * Test.
     */
    @Test(expected = InvalidActionException.class)
    public void testExecuteMissingExecution()
    {
        ServiceAction action = new ServiceAction(validationStrategy, authorizationStrategy, null, false);
        final ServiceActionContext context = new ServiceActionContext(null, principalMock);
        sut.execute(context, action);
        mockery.assertIsSatisfied();
    }
View Full Code Here

        log.debug("Executing action {} for user {}.", actionName, principal.getAccountId());

        // execute (or not) based on type of bean
        if (springBean instanceof ServiceAction)
        {
            ServiceAction action = (ServiceAction) springBean;

            if (readOnly && !action.isReadOnly())
            {
                throw new ExecutionException(String.format("Action '%s' is not read-only.", actionName));
            }
            return serviceActionController.execute(actionContext, action);
        }
        else if (springBean instanceof TaskHandlerServiceAction)
        {
            TaskHandlerServiceAction action = (TaskHandlerServiceAction) springBean;
            if (readOnly && !action.isReadOnly())
            {
                throw new ExecutionException(String.format("Action '%s' is not read-only.", actionName));
            }
            return serviceActionController.execute(actionContext, action);
        }
View Full Code Here

            @RequestParam("id") final long id, final HttpServletResponse response)
    {
        Principal principal = principalPopulator.getPrincipal(null, null);

        // get info about stream
        ServiceAction action = typeToFetchActionIndex.get(streamType);
        if (action == null)
        {
            throw new ExecutionException("Stream type not supported.");
        }
        Identifiable entity = (Identifiable) serviceActionController.execute(new ServiceActionContext(id, principal),
View Full Code Here

            PrincipalActionContext actionContext = new ServiceActionContext(actionSelection.getParams(),
                    new DefaultPrincipal(person.getAccountId(), person.getOpenSocialId(), person.getId()));
            actionContext.setActionId(actionSelection.getActionKey());
            if (springBean instanceof ServiceAction)
            {
                ServiceAction action = (ServiceAction) springBean;
                serviceActionController.execute(actionContext, action);
            }
            else if (springBean instanceof TaskHandlerServiceAction)
            {
                TaskHandlerServiceAction action = (TaskHandlerServiceAction) springBean;
View Full Code Here

            // not an interface,
            // the check and cast will fail
            // however, the check and cast works if you use an interface here
            if (springBean instanceof ServiceAction)
            {
                ServiceAction action = (ServiceAction) springBean;

                // grab serializable parameter object.
                Serializable actionParameter = actionRequest.getParam();

                ServiceActionContext actionContext = new ServiceActionContext(actionParameter,
View Full Code Here

            log.debug("executing action: " + actionKey + " for user: " + principal.getAccountId());

            Serializable result = "empty result";
            if (springBean instanceof ServiceAction)
            {
                ServiceAction action = (ServiceAction) springBean;

                if (readOnly && !action.isReadOnly())
                {
                    throw new IllegalStateException("Action requested is not read-only.");
                }
                result = serviceActionController.execute(actionContext, action);
            }
            else if (springBean instanceof TaskHandlerServiceAction)
            {
                TaskHandlerServiceAction action = (TaskHandlerServiceAction) springBean;
                if (readOnly && !action.isReadOnly())
                {
                    throw new IllegalStateException("Action requested is not read-only.");
                }
                result = serviceActionController.execute(actionContext, action);
            }
View Full Code Here

TOP

Related Classes of org.eurekastreams.commons.actions.service.ServiceAction

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.