Package de.danet.an.workflow.api

Examples of de.danet.an.workflow.api.MethodInvocationBatch$Result


    }

    private Result scanResultsByExtension(String ns, String actionName, String pathPrefix,
            String resultCode, ActionContext actionContext) {
        Map<String, ResultTypeConfig> resultsByExtension = conventionsService.getResultTypesByExtension(parentPackage);
        Result result = null;
        for (String ext : resultsByExtension.keySet()) {
            if (LOG.isTraceEnabled()) {
                String fqan = ns + "/" + actionName;
                LOG.trace("Trying to locate the correct result for the FQ action [#0]"
                        + " with an file extension of [#1] in the directory [#2] " + "and a result code of [#3]",
View Full Code Here


        PackageConfig pkg = configuration.getPackageConfig(actionConfig.getPackageName());
        String ns = pkg.getNamespace();
        String pathPrefix = determinePath(actionConfig, ns);

        Result result = scanResultsByExtension(ns, actionName, pathPrefix, resultCode, actionContext);

        if (result == null) {
            // Try /idx/action/index.jsp
            Map<String, ResultTypeConfig> resultsByExtension = conventionsService.getResultTypesByExtension(pkg);
            for (String ext : resultsByExtension.keySet()) {
View Full Code Here

        ObjectFactory workingFactory = configuration.getContainer().getInstance(ObjectFactory.class);
        ConventionUnknownHandler uh = new ConventionUnknownHandler(configuration, workingFactory, context, mockContainer, "struts-default", null, "-");
        ActionContext actionContext = new ActionContext(Collections.EMPTY_MAP);

        Result result = uh.handleUnknownResult(actionContext, "foo", pkgConfig.getActionConfigs().get("foo"), "bar");
        assertNotNull(result);
        assertTrue(result instanceof ActionChainResult);
        ActionChainResult chainResult = (ActionChainResult) result;
        ActionChainResult chainResultToCompare = new ActionChainResult(null, "foo-bar", null);
        assertEquals(chainResultToCompare, chainResult);
View Full Code Here

    /**
     * Iterate over UnknownHandlers and return the result of the first one that can handle it
     */
    public Result handleUnknownResult(ActionContext actionContext, String actionName, ActionConfig actionConfig, String resultCode) {
        for (UnknownHandler unknownHandler : unknownHandlers) {
            Result result = unknownHandler.handleUnknownResult(actionContext, actionName, actionConfig, resultCode);
            if (result != null)
                return result;
        }

        return null;
View Full Code Here

        DefaultActionMapper defaultActionMapper = new DefaultActionMapper();
        defaultActionMapper.setContainer(container);
        ActionMapping actionMapping = defaultActionMapper.getMapping(request, configManager);

        Result result = actionMapping.getResult();
        assertNotNull(result);
        assertTrue(result instanceof ServletRedirectResult);

        Mock invMock = new Mock(ActionInvocation.class);
        ActionInvocation inv = (ActionInvocation) invMock.proxy();
        ActionContext ctx = ActionContext.getContext();
        ctx.put(ServletActionContext.HTTP_REQUEST, request);
        StrutsMockHttpServletResponse response = new StrutsMockHttpServletResponse();
        ctx.put(ServletActionContext.HTTP_RESPONSE, response);
        invMock.expectAndReturn("getInvocationContext", ctx);
        invMock.expectAndReturn("getStack", ctx.getValueStack());
        result.execute(inv);
        assertEquals("http://www.google.com", response.getRedirectURL());
        //TODO: need to test location but there's noaccess to the property/method, unless we use reflection
    }
View Full Code Here

        DefaultActionMapper defaultActionMapper = new DefaultActionMapper();
        defaultActionMapper.setContainer(container);
        ActionMapping actionMapping = defaultActionMapper.getMapping(request, configManager);
       

        Result result = actionMapping.getResult();
        assertNotNull(result);
        assertTrue(result instanceof ServletRedirectResult);

        // TODO: need to test location but there's noaccess to the property/method, unless we use reflection
    }
View Full Code Here

            proxy.setMethod(method);
            request.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, proxy.getInvocation().getStack());

            // if the ActionMapping says to go straight to a result, do it!
            if (mapping.getResult() != null) {
                Result result = mapping.getResult();
                result.execute(proxy.getInvocation());
            } else {
                proxy.execute();
            }

            // If there was a previous value stack then set it back onto the request
View Full Code Here

    /**
     * Update data if not already updated in this lifecycle.
     * @throws RemoteException
     */
    protected void update() throws RemoteException {
        MethodInvocationBatch mib = new MethodInvocationBatch ();
        WorkflowService wfs = WorkflowServiceConnection
            .instance("workflowServiceConnection").getWorkflowService();
        if (processCache == null) {
            ProcessDirectory pd = wfs.processDirectory();
            mib.addInvocation
                (pd, "lookupProcess",
                 new String[] {"java.lang.String", "java.lang.String"},
                 new Object[] {mgrName, processKey});
            mib.addInvocation(-1, "processDefinition", null, null, false);
            mib.addInvocation(-1, "packageId", null, null, false);
            mib.addInvocation(-2, "packageName", null, null, false);
            mib.addInvocation(-3, "processId", null, null, false);
            mib.addInvocation(-4, "processName", null, null, true);
            mib.addInvocation(-5, "name", null, null, false);
            mib.addInvocation(-6, "priority", null, null, false);
            mib.addInvocation(-7, "state", null, null, false);
            mib.addInvocation(-8, "createTime", null, null, false);
            mib.addInvocation(-9, "lastStateTime", null, null, false);
            mib.addInvocation(-10, "requester", null, null, false);
        } else {
            mib.addInvocation(processCache, "key", null, null);
            mib.addInvocation
                (processCache, "processDefinition", null, null);
            mib.addInvocation(-1, "mgrName", null, null, false);
            mib.addInvocation(-2, "packageId", null, null, false);
            mib.addInvocation(-3, "packageName", null, null, false);
            mib.addInvocation(-4, "processId", null, null, false);
            mib.addInvocation(-5, "processName", null, null, true);
            mib.addInvocation(processCache, "name", null, null);
            mib.addInvocation(processCache, "priority", null, null);
            mib.addInvocation(processCache, "state", null, null);
            mib.addInvocation(processCache, "createTime", null, null);
            mib.addInvocation(processCache, "lastStateTime", null, null);
            mib.addInvocation(processCache, "requester", null, null);
        }
        MethodInvocationBatch.Result mir = null;
        try {
            mir = (MethodInvocationBatch.Result)wfs.executeBatch(mib);
        } catch (InvocationTargetException e) {
            throw (IllegalStateException)
                (new IllegalStateException (e.getMessage())).initCause(e);
        }
        if (mir.hasExceptions ()) {
            Exception e = mir.firstException ();
            if (e instanceof RemoteException) {
                throw (RemoteException)e;
            }
            throw (IllegalStateException)
                (new IllegalStateException(e.getMessage())).initCause(e);
        }
        int resPos = 0;
        if (processCache == null) {
            processCache = (Process)mir.result(resPos++);
        } else {
            processKey = mir.resultAsString(resPos++);
            mgrName = mir.resultAsString(resPos++);
        }
        packageId = mir.resultAsString(resPos++);
        packageName = mir.resultAsString(resPos++);
        processId = mir.resultAsString(resPos++);
        processName = mir.resultAsString(resPos++);
        name = mir.resultAsString(resPos++);
        priority = mir.resultAsInt(resPos++);
        state = mir.resultAsString(resPos++);
        createTime = mir.resultAsDate(resPos++);
        lastStateTime = mir.resultAsDate(resPos++);
        WfRequester requester = (WfRequester)mir.result(resPos++);
        if (requester instanceof WfActivity) {
            mib = new MethodInvocationBatch ();
            mib.addInvocation(requester, "name", null, null);
            mib.addInvocation(requester, "key", null, null);
            mib.addInvocation(requester, "container", null, null);
            mib.addInvocation(-1, "manager", null, null, false);
            mib.addInvocation(-1, "name", null, null, true);
            mib.addInvocation(-2, "key", null, null, true);
            mir = null;
            try {
                mir = (MethodInvocationBatch.Result)wfs.executeBatch(mib);
            } catch (InvocationTargetException e) {
                throw (IllegalStateException)
View Full Code Here

     * @param wfs the workflow service
     * @param act the activity
     */
    public ActivityWrapper (WorkflowService wfs, Activity act)
        throws RemoteException {
        MethodInvocationBatch mib = new MethodInvocationBatch ();
        mib.addInvocation(act, "activityInfo", null, null);
        mib.addInvocation(act, "state", null, null);
        mib.addInvocation(act, "assignments", null, null);
        mib.addInvocation(act, "executor", null, null);
        mib.addInvocation(act, "validStates", null, null);
        mib.addInvocation(act, "handledExceptions", null, null);
        mib.addInvocation(act, "deadlines", null, null);
        mib.addInvocation(act, "debugEnabled", null, null);
        mib.addInvocation(act, "lastStateTime", null, null);
        MethodInvocationBatch.Result mir = null;
        try {
            mir = (MethodInvocationBatch.Result)wfs.executeBatch(mib);
        } catch (InvocationTargetException e) {
            throw (IllegalStateException)
View Full Code Here

        try {
            activity = activity();
        } catch (InvalidKeyException e) {
            // TODO:
        }
        MethodInvocationBatch mib = new MethodInvocationBatch(true);
        if (dl == null
                || (dl.getExecutionMode() == Activity.DeadlineInfo.SYNCHR)) {
            // not an asynchronous deadline, abandon if not aborted
            if (!state.startsWith("open.running.debug.abandoning")) {
                mib.addInvocation(activity, "abandon",
                        new String[] { "java.lang.String" },
                        new Object[] { exception });
            }
            mib.addInvocation(activity, "changeState",
                    new String[] { "java.lang.String" },
                    new Object[] { "open.running.debug.awaiting_exception" });
            mib.addInvocation(activity, "abandon",
                    new String[] { "java.lang.String" },
                    new Object[] { exception });
        } else {
            // asynchronous deadline, simply have it sent
            mib.addInvocation(activity, "changeState",
                    new String[] { "java.lang.String" },
                    new Object[] { "open.running.debug.forwarding_exception" });
            mib.addInvocation(activity, "abandon",
                    new String[] { "java.lang.String" },
                    new Object[] { exception });
        }
        try {
            MethodInvocationBatch.Result mir = (MethodInvocationBatch.Result)
View Full Code Here

TOP

Related Classes of de.danet.an.workflow.api.MethodInvocationBatch$Result

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.