Package org.apache.syncope.common.to

Examples of org.apache.syncope.common.to.BulkAction


        resourceService.create(buildResourceTO("forBulk2"));

        assertNotNull(resourceService.read("forBulk1"));
        assertNotNull(resourceService.read("forBulk2"));

        final BulkAction bulkAction = new BulkAction();
        bulkAction.setOperation(BulkAction.Type.DELETE);

        bulkAction.addTarget(String.valueOf("forBulk1"));
        bulkAction.addTarget(String.valueOf("forBulk2"));

        resourceService.bulkAction(bulkAction);

        try {
            resourceService.read("forBulk1");
View Full Code Here


        }
    }

    @Test
    public void bulkActions() {
        final BulkAction bulkAction = new BulkAction();

        for (int i = 0; i < 10; i++) {
            UserTO userTO = getUniqueSampleTO("bulk_" + i + "@apache.org");
            bulkAction.addTarget(String.valueOf(createUser(userTO).getId()));
        }

        // check for a fail
        bulkAction.addTarget(String.valueOf(Long.MAX_VALUE));

        assertEquals(11, bulkAction.size());

        bulkAction.setOperation(BulkAction.Type.SUSPEND);
        BulkActionRes res = userService.bulkAction(bulkAction);
        assertEquals(10, res.getResultByStatus(Status.SUCCESS).size());
        assertEquals(1, res.getResultByStatus(Status.FAILURE).size());
        assertEquals("suspended", userService.read(
                Long.parseLong(res.getResultByStatus(Status.SUCCESS).get(3).toString())).getStatus());

        bulkAction.setOperation(BulkAction.Type.REACTIVATE);
        res = userService.bulkAction(bulkAction);
        assertEquals(10, res.getResultByStatus(Status.SUCCESS).size());
        assertEquals(1, res.getResultByStatus(Status.FAILURE).size());
        assertEquals("active", userService.read(
                Long.parseLong(res.getResultByStatus(Status.SUCCESS).get(3).toString())).getStatus());

        bulkAction.setOperation(BulkAction.Type.DELETE);
        res = userService.bulkAction(bulkAction);
        assertEquals(10, res.getResultByStatus(Status.SUCCESS).size());
        assertEquals(1, res.getResultByStatus(Status.FAILURE).size());
    }
View Full Code Here

        }
    }

    @Test
    public void bulkActions() {
        final BulkAction bulkAction = new BulkAction();

        for (int i = 0; i < 10; i++) {
            UserTO userTO = getUniqueSampleTO("bulk_" + i + "@apache.org");
            bulkAction.addTarget(String.valueOf(createUser(userTO).getId()));
        }

        // check for a fail
        bulkAction.addTarget(String.valueOf(Long.MAX_VALUE));

        assertEquals(11, bulkAction.size());

        bulkAction.setOperation(BulkAction.Type.SUSPEND);
        BulkActionRes res = userService.bulkAction(bulkAction);
        assertEquals(10, res.getResultByStatus(Status.SUCCESS).size());
        assertEquals(1, res.getResultByStatus(Status.FAILURE).size());
        assertEquals("suspended", userService.read(
                Long.parseLong(res.getResultByStatus(Status.SUCCESS).get(3).toString())).getStatus());

        bulkAction.setOperation(BulkAction.Type.REACTIVATE);
        res = userService.bulkAction(bulkAction);
        assertEquals(10, res.getResultByStatus(Status.SUCCESS).size());
        assertEquals(1, res.getResultByStatus(Status.FAILURE).size());
        assertEquals("active", userService.read(
                Long.parseLong(res.getResultByStatus(Status.SUCCESS).get(3).toString())).getStatus());

        bulkAction.setOperation(BulkAction.Type.DELETE);
        res = userService.bulkAction(bulkAction);
        assertEquals(10, res.getResultByStatus(Status.SUCCESS).size());
        assertEquals(1, res.getResultByStatus(Status.FAILURE).size());
    }
View Full Code Here

        resourceService.create(buildResourceTO("forBulk2"));

        assertNotNull(resourceService.read("forBulk1"));
        assertNotNull(resourceService.read("forBulk2"));

        final BulkAction bulkAction = new BulkAction();
        bulkAction.setOperation(BulkAction.Type.DELETE);

        bulkAction.addTarget(String.valueOf("forBulk1"));
        bulkAction.addTarget(String.valueOf("forBulk2"));

        resourceService.bulkAction(bulkAction);

        try {
            resourceService.read("forBulk1");
View Full Code Here

        final ActionLinksPanel actionPanel = new ActionLinksPanel("actions", new Model(), getPageReference());
        add(actionPanel);

        for (ActionLink.ActionType action : actions) {
            final BulkAction bulkAction = new BulkAction();
            for (Object item : items) {
                try {
                    bulkAction.addTarget(getTargetId(item, idFieldName).toString());
                } catch (Exception e) {
                    LOG.error("Error retrieving item id {}", idFieldName, e);
                }
            }

            switch (action) {
                case DELETE:
                    bulkAction.setOperation(BulkAction.Type.DELETE);
                    break;
                case SUSPEND:
                    bulkAction.setOperation(BulkAction.Type.SUSPEND);
                    break;
                case REACTIVATE:
                    bulkAction.setOperation(BulkAction.Type.REACTIVATE);
                    break;
                case EXECUTE:
                    bulkAction.setOperation(BulkAction.Type.EXECUTE);
                    break;
                case DRYRUN:
                    bulkAction.setOperation(BulkAction.Type.DRYRUN);
                    break;
                default:
                    LOG.error("Bulk action type not supported");
            }

            actionPanel.add(new ActionLink() {

                private static final long serialVersionUID = -3722207913631435501L;

                @Override
                public void onClick(final AjaxRequestTarget target) {
                    try {
                        final BulkActionRes res = (BulkActionRes) bulkActionExecutor.getClass().
                                getMethod("bulkAction", BulkAction.class).invoke(bulkActionExecutor, bulkAction);

                        setResponsePage(new BulkActionResultModalPage(window, items, columns, res, idFieldName));
                    } catch (Exception e) {
                        LOG.error("Operation {} not supported", bulkAction.getOperation(), e);
                    }

                }
            }, action, pageId, !items.isEmpty());
        }
View Full Code Here

        }
    }

    @Test
    public void bulkActions() {
        final BulkAction bulkAction = new BulkAction();

        for (int i = 0; i < 10; i++) {
            UserTO userTO = getUniqueSampleTO("bulk_" + i + "@apache.org");
            bulkAction.addTarget(String.valueOf(createUser(userTO).getId()));
        }

        // check for a fail
        bulkAction.addTarget(String.valueOf(Long.MAX_VALUE));

        assertEquals(11, bulkAction.size());

        bulkAction.setOperation(BulkAction.Type.SUSPEND);
        BulkActionRes res = userService.bulkAction(bulkAction);
        assertEquals(10, res.getResultByStatus(Status.SUCCESS).size());
        assertEquals(1, res.getResultByStatus(Status.FAILURE).size());
        assertEquals("suspended", userService.read(
                Long.parseLong(res.getResultByStatus(Status.SUCCESS).get(3).toString())).getStatus());

        bulkAction.setOperation(BulkAction.Type.REACTIVATE);
        res = userService.bulkAction(bulkAction);
        assertEquals(10, res.getResultByStatus(Status.SUCCESS).size());
        assertEquals(1, res.getResultByStatus(Status.FAILURE).size());
        assertEquals("active", userService.read(
                Long.parseLong(res.getResultByStatus(Status.SUCCESS).get(3).toString())).getStatus());

        bulkAction.setOperation(BulkAction.Type.DELETE);
        res = userService.bulkAction(bulkAction);
        assertEquals(10, res.getResultByStatus(Status.SUCCESS).size());
        assertEquals(1, res.getResultByStatus(Status.FAILURE).size());
    }
View Full Code Here

        resourceService.create(buildResourceTO("forBulk2"));

        assertNotNull(resourceService.read("forBulk1"));
        assertNotNull(resourceService.read("forBulk2"));

        final BulkAction bulkAction = new BulkAction();
        bulkAction.setOperation(BulkAction.Type.DELETE);

        bulkAction.addTarget(String.valueOf("forBulk1"));
        bulkAction.addTarget(String.valueOf("forBulk2"));

        resourceService.bulkAction(bulkAction);

        try {
            resourceService.read("forBulk1");
View Full Code Here

        after.removeAll(before);

        assertFalse(after.isEmpty());

        final BulkAction bulkAction = new BulkAction();
        bulkAction.setOperation(BulkAction.Type.DELETE);

        for (TaskTO taskTO : after) {
            bulkAction.addTarget(String.valueOf(taskTO.getId()));
        }

        taskService.bulkAction(bulkAction);

        assertFalse(taskService.list(TaskType.PROPAGATION).containsAll(after));
View Full Code Here

        resourceService.create(buildResourceTO("forBulk2"));

        assertNotNull(resourceService.read("forBulk1"));
        assertNotNull(resourceService.read("forBulk2"));

        final BulkAction bulkAction = new BulkAction();
        bulkAction.setOperation(BulkAction.Type.DELETE);

        bulkAction.addTarget(String.valueOf("forBulk1"));
        bulkAction.addTarget(String.valueOf("forBulk2"));

        resourceService.bulkAction(bulkAction);

        try {
            resourceService.read("forBulk1");
View Full Code Here

        }
    }

    @Test
    public void bulkActions() {
        final BulkAction bulkAction = new BulkAction();

        for (int i = 0; i < 10; i++) {
            UserTO userTO = getUniqueSampleTO("bulk_" + i + "@apache.org");
            bulkAction.addTarget(String.valueOf(createUser(userTO).getId()));
        }

        // check for a fail
        bulkAction.addTarget(String.valueOf(Long.MAX_VALUE));

        assertEquals(11, bulkAction.size());

        bulkAction.setOperation(BulkAction.Type.SUSPEND);
        BulkActionRes res = userService.bulkAction(bulkAction);
        assertEquals(10, res.getResultByStatus(Status.SUCCESS).size());
        assertEquals(1, res.getResultByStatus(Status.FAILURE).size());
        assertEquals("suspended", userService.read(
                Long.parseLong(res.getResultByStatus(Status.SUCCESS).get(3).toString())).getStatus());

        bulkAction.setOperation(BulkAction.Type.REACTIVATE);
        res = userService.bulkAction(bulkAction);
        assertEquals(10, res.getResultByStatus(Status.SUCCESS).size());
        assertEquals(1, res.getResultByStatus(Status.FAILURE).size());
        assertEquals("active", userService.read(
                Long.parseLong(res.getResultByStatus(Status.SUCCESS).get(3).toString())).getStatus());

        bulkAction.setOperation(BulkAction.Type.DELETE);
        res = userService.bulkAction(bulkAction);
        assertEquals(10, res.getResultByStatus(Status.SUCCESS).size());
        assertEquals(1, res.getResultByStatus(Status.FAILURE).size());
    }
View Full Code Here

TOP

Related Classes of org.apache.syncope.common.to.BulkAction

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.