Examples of SetPersonLockedStatusRequest


Examples of org.eurekastreams.server.action.request.SetPersonLockedStatusRequest

        listOfRequests.put(list.get(2).getActionKey(), list.get(2));
        listOfRequests.put(list.get(3).getActionKey(), list.get(3));
        assertTrue(listOfRequests.containsKey("lock"));
        assertTrue(listOfRequests.containsKey("refresh"));

        SetPersonLockedStatusRequest splsr = (SetPersonLockedStatusRequest) listOfRequests.get("lock").getParams();

        assertEquals(false, splsr.getLockedStatus());

        context.assertIsSatisfied();
    }
View Full Code Here

Examples of org.eurekastreams.server.action.request.SetPersonLockedStatusRequest

        boolean found = false;
        for (UserActionRequest uar : list)
        {
            if (uar.getActionKey() == "lock")
            {
                SetPersonLockedStatusRequest splsr = (SetPersonLockedStatusRequest) uar.getParams();
                assertEquals(true, splsr.getLockedStatus());
                found = true;
            }
        }
        assertTrue(found);
        context.assertIsSatisfied();
View Full Code Here

Examples of org.eurekastreams.server.action.request.SetPersonLockedStatusRequest

     * Test.
     */
    @Test
    public void testExecuteWhenLocking()
    {
        final SetPersonLockedStatusRequest request = new SetPersonLockedStatusRequest(ACCOUNT_ID, true);
        context.checking(new Expectations()
        {
            {
                oneOf(setLockedStatusDAO).execute(request);

View Full Code Here

Examples of org.eurekastreams.server.action.request.SetPersonLockedStatusRequest

     * Test.
     */
    @Test
    public void testExecuteWhenUnlocking()
    {
        final SetPersonLockedStatusRequest request = new SetPersonLockedStatusRequest(ACCOUNT_ID, false);
        context.checking(new Expectations()
        {
            {
                oneOf(setLockedStatusDAO).execute(request);

View Full Code Here

Examples of org.eurekastreams.server.action.request.SetPersonLockedStatusRequest

        // set all false
        getEntityManager().createQuery("UPDATE Person SET accountLocked = false").executeUpdate();

        // use sut to set one true.
        sut.execute(new SetPersonLockedStatusRequest("fordp", true));

        // get back account id of anyone that is true.
        List<String> oddball = getEntityManager().createQuery(
                "SELECT accountId FROM Person WHERE accountLocked = :lockedStatus").setParameter("lockedStatus", true)
                .getResultList();

        // verify that there's only one and it's the correct one.
        assertEquals(1, oddball.size());
        assertEquals("fordp", oddball.get(0));

        // lather rinse repeat with reversed value of locked.
        getEntityManager().createQuery("UPDATE Person SET accountLocked = true").executeUpdate();
        sut.execute(new SetPersonLockedStatusRequest("fordp", false));

        oddball = getEntityManager().createQuery("SELECT accountId FROM Person WHERE accountLocked = :lockedStatus")
                .setParameter("lockedStatus", false).getResultList();

        assertEquals(1, oddball.size());
View Full Code Here

Examples of org.eurekastreams.server.action.request.SetPersonLockedStatusRequest

                inActionContext.getUserActionRequests().add(new UserActionRequest(refreshPersonActionKey, null, p));

                if (queueLockAccounts)
                {
                    inActionContext.getUserActionRequests().add(
                            new UserActionRequest(lockPersonActionKey, null, new SetPersonLockedStatusRequest(acctId,
                                    false)));
                }
                toUnlock++;
            }
            else if (unLockedUserAccountIds.contains(acctId))
            {
                log.debug("Queuing up a refresh of person: " + acctId);

                // Queue action to refresh user info from AD
                inActionContext.getUserActionRequests().add(new UserActionRequest(refreshPersonActionKey, null, p));

                // remove from unlocked list, when done looping remaining ids will be locked.
                unLockedUserAccountIds.remove(acctId);
            }
            else
            {
                if (log.isInfoEnabled())
                {
                    log.info("Found user id: " + acctId + " (" + p.getDisplayName() + ") to be created.");
                }
                if (queueCreatePerson)
                {
                    inActionContext.getUserActionRequests().add(
                            new UserActionRequest(createPersonActionKey, null, new CreatePersonRequest(p,
                                    shouldSendEmail)));
                }
                toCreate++;
            }
        }

        // Everyone that hasn't been removed from the unLockedUserAccountIds collection by this point needs to be
        // locked.
        toLock = unLockedUserAccountIds.size();
        log.info("Determined there are " + unLockedUserAccountIds.size() + " user accounts to lock.");
        for (String id : unLockedUserAccountIds)
        {
            if (log.isInfoEnabled())
            {
                log.info("Found user AcctId: " + id + " to be locked.");
            }
            if (queueLockAccounts)
            {
                inActionContext.getUserActionRequests().add(
                        new UserActionRequest(lockPersonActionKey, null, new SetPersonLockedStatusRequest(id, true)));
            }
        }

        log.info("Summary: Lock: " + toLock + " unlock: " + toUnlock + " Create: " + toCreate
                + ". LOCK-UNLOCK ENABLED: " + queueLockAccounts + " CREATE ENABLED: " + queueCreatePerson);
View Full Code Here

Examples of org.eurekastreams.server.action.request.SetPersonLockedStatusRequest

     * @return null.
     */
    @Override
    public Serializable execute(final TaskHandlerActionContext<ActionContext> inActionContext)
    {
        SetPersonLockedStatusRequest request = (SetPersonLockedStatusRequest) inActionContext.getActionContext()
                .getParams();
        setLockedStatusDAO.execute(request);

        Long personId = personIdMapper.execute(request.getPersonAccountId());

        // when locking, just kill cache; when unlocking, reload
        if (request.getLockedStatus())
        {
            inActionContext.getUserActionRequests().add(
                    new UserActionRequest("deleteCacheKeysAction", null, (Serializable) Collections
                            .singleton(CacheKeys.PERSON_BY_ID + personId)));
        }
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.