Examples of Integration


Examples of org.nxplanner.domain.Integration

        return null;
    }

    private ActionForward onStartRequest(Session session, ActionMapping actionMapping, HttpServletRequest request, int projectId)
            throws Exception {
        Integration activeIntegration = getFirstIntegrationInState(session, Integration.ACTIVE, projectId);
        if (activeIntegration == null) {
            Integration integration = getFirstIntegrationInState(session, Integration.PENDING, projectId);
            startIntegration(integration);
            return actionMapping.findForward("display");
        } else {
            saveError(request, "integrations.error.alreadyactive");
            return actionMapping.findForward("error");
View Full Code Here

Examples of org.nxplanner.domain.Integration

        terminateIntegration(session, Integration.FINISHED, request, projectId);
    }

    private void terminateIntegration(Session session, char terminalState, HttpServletRequest request, int projectId)
            throws Exception {
        Integration integration = getFirstIntegrationInState(session, Integration.ACTIVE, projectId);
        integration.setState(terminalState);
        integration.setWhenComplete(new Date());

        Integration readyIntegration = getFirstIntegrationInState(session, Integration.PENDING, projectId);
        if (isNotificationEnabled(request) && readyIntegration != null) {
            fireIntegrationEvent(IntegrationListener.INTEGRATION_READY_EVENT, readyIntegration, request);
        }
    }
View Full Code Here

Examples of org.nxplanner.domain.Integration

        if (StringUtils.isEmpty(personId) || personId.equals("0")) {
            saveError(request, "integrations.error.noperson");
            return actionMapping.findForward("error");
        }
        Integration integration = new Integration();
        integration.setProjectId(Integer.parseInt(request.getParameter("projectId")));
        integration.setPersonId(Integer.parseInt(personId));
        integration.setComment(comment);
        integration.setState(Integration.PENDING);
        integration.setWhenRequested(new Date());

        List pendingIntegrations = getIntegrationsInState(session, Integration.PENDING, projectId);
        if (pendingIntegrations.size() == 0) {
            Integration activeIntegration = getFirstIntegrationInState(session, Integration.ACTIVE, projectId);
            if (activeIntegration == null) {
                startIntegration(integration);
            }
        }
View Full Code Here

Examples of org.nxplanner.domain.Integration

    private void onLeaveRequest(Session session, HttpServletRequest request, int projectId) throws Exception {
        Integer oid = getLeaveOid(request);

        List pendingIntegrations = getIntegrationsInState(session, Integration.PENDING, projectId);
        Integration firstPendingIntegration = (Integration)pendingIntegrations.get(0);

        Integration leavingIntegration = (Integration)session.load(Integration.class, oid);
        session.delete(leavingIntegration);

        if (isNotificationEnabled(request) &&
                leavingIntegration.getId() == firstPendingIntegration.getId() &&
                pendingIntegrations.size() > 1) {
            fireIntegrationEvent(IntegrationListener.INTEGRATION_READY_EVENT,
                    (Integration)pendingIntegrations.get(1), request);
        }
    }
View Full Code Here

Examples of org.nxplanner.domain.Integration

        return null;
    }

    private ActionForward onStartRequest(Session session, ActionMapping actionMapping, HttpServletRequest request, int projectId)
            throws Exception {
        Integration activeIntegration = getFirstIntegrationInState(session, Integration.ACTIVE, projectId);
        if (activeIntegration == null) {
            Integration integration = getFirstIntegrationInState(session, Integration.PENDING, projectId);
            startIntegration(integration);
            return actionMapping.findForward("display");
        } else {
            saveError(request, "integrations.error.alreadyactive");
            return actionMapping.findForward("error");
View Full Code Here

Examples of org.nxplanner.domain.Integration

        terminateIntegration(session, Integration.FINISHED, request, projectId);
    }

    private void terminateIntegration(Session session, char terminalState, HttpServletRequest request, int projectId)
            throws Exception {
        Integration integration = getFirstIntegrationInState(session, Integration.ACTIVE, projectId);
        integration.setState(terminalState);
        integration.setWhenComplete(new Date());

        Integration readyIntegration = getFirstIntegrationInState(session, Integration.PENDING, projectId);
        if (isNotificationEnabled(request) && readyIntegration != null) {
            fireIntegrationEvent(IntegrationListener.INTEGRATION_READY_EVENT, readyIntegration, request);
        }
    }
View Full Code Here

Examples of org.nxplanner.domain.Integration

        Logger.getRootLogger().setLevel(logLevel);
    }

    public void testJoin() throws Exception {
        mockSession.find3Return = new ArrayList();
        mockSession.find3Return.add(new Integration());
        support.request.setParameterValue("action.join", new String[]{""});
        support.request.setParameterValue("personId", new String[]{"1"});
        support.request.setParameterValue("comment", new String[]{"a comment"});
        replay();

        ActionForward forward = support.executeAction(action);

        verify();
        assertEquals(addProjectId("DISPLAY"), forward.getPath());
        assertTrue("no integration saved", mockSession.saveCalled);
        Integration integration = (Integration)mockSession.saveObject;
        assertEquals(PROJECT_ID, integration.getProjectId());
        assertEquals(1, integration.getPersonId());
        assertEquals("a comment", integration.getComment());
        assertEquals(Integration.PENDING, integration.getState());
        assertNotNull(integration.getWhenRequested());
        assertNull(integration.getWhenStarted());
        assertNull(integration.getWhenComplete());

        assertCommit();
    }
View Full Code Here

Examples of org.nxplanner.domain.Integration

        ActionForward forward = support.executeAction(action);

        verify();
        assertEquals(addProjectId("DISPLAY"), forward.getPath());
        assertTrue("no integration saved", mockSession.saveCalled);
        Integration integration = (Integration)mockSession.saveObject;
        assertEquals(1, integration.getPersonId());
        assertEquals(PROJECT_ID, integration.getProjectId());
        assertEquals("a comment", integration.getComment());
        assertEquals(Integration.ACTIVE, integration.getState());
        assertNotNull(integration.getWhenRequested());
        assertNotNull(integration.getWhenStarted());
        assertNull(integration.getWhenComplete());

        assertCommit();
    }
View Full Code Here

Examples of org.nxplanner.domain.Integration

        assertFalse("session accessed", mockSession.find3Called);
        assertFalse("session accessed", mockSession.saveCalled);
    }

    public void testLeaveWhenNotFirst() throws Exception {
        Integration integration1 = new Integration();
        integration1.setId(400);
        integration1.setState(Integration.PENDING);
        Integration integration2 = new Integration();
        integration2.setId(234);
        integration2.setState(Integration.PENDING);
        ArrayList results1 = new ArrayList();
        results1.add(integration1);
        results1.add(integration2);
        ArrayList results2 = new ArrayList();
        results2.add(integration1);
        mockSession.find3Returns = new ArrayList();
        mockSession.find3Returns.add(results1);
        mockSession.find3Returns.add(results2);
        Integration integration = new Integration();
        mockSession.loadReturn = integration;
        support.request.setParameterValue("action.leave.234", new String[]{""});
        replay();

        ActionForward forward = support.executeAction(action);
View Full Code Here

Examples of org.nxplanner.domain.Integration

        assertFalse("listeners notified", mockIntegrationListener.onEventCalled);
        assertCommit();
    }

    public void testLeaveWhenFirst() throws Exception {
        Integration integration1 = new Integration();
        integration1.setId(234);
        integration1.setState(Integration.PENDING);
        Integration integration2 = new Integration();
        integration2.setId(400);
        integration2.setState(Integration.PENDING);
        ArrayList results1 = new ArrayList();
        results1.add(integration1);
        results1.add(integration2);
        ArrayList results2 = new ArrayList();
        results2.add(integration2);
        mockSession.find3Returns = new ArrayList();
        mockSession.find3Returns.add(results1);
        mockSession.find3Returns.add(results2);
        Integration integration = new Integration();
        integration.setId(234);
        mockSession.loadReturn = integration;
        support.request.setParameterValue("action.leave.234", new String[]{""});
        replay();

        ActionForward forward = support.executeAction(action);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.