Package org.apache.syncope.common.reqres

Examples of org.apache.syncope.common.reqres.BulkActionResult


        }
        return result;
    }

    public BulkActionResult provision(final String etag, final long roleId, final List<StatusBean> statuses) {
        BulkActionResult result;
        synchronized (this) {
            RoleService service = getService(etag, RoleService.class);
            result = service.bulkAssociation(roleId, ResourceAssociationActionType.PROVISION,
                    CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(),
                            ResourceName.class)).
View Full Code Here


        }
        return result;
    }

    public BulkActionResult unassign(final String etag, final long roleId, final List<StatusBean> statuses) {
        BulkActionResult result;
        synchronized (this) {
            RoleService service = getService(etag, RoleService.class);
            result = service.bulkDeassociation(roleId, ResourceDeassociationActionType.UNASSIGN,
                    CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(),
                            ResourceName.class)).
View Full Code Here

        }
        return result;
    }

    public BulkActionResult assign(final String etag, final long roleId, final List<StatusBean> statuses) {
        BulkActionResult result;
        synchronized (this) {
            RoleService service = getService(etag, RoleService.class);
            result = service.bulkAssociation(roleId, ResourceAssociationActionType.ASSIGN,
                    CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(),
                            ResourceName.class)).
View Full Code Here

        return result;
    }

    @PreAuthorize("hasRole('RESOURCE_DELETE') and #bulkAction.operation == #bulkAction.operation.DELETE")
    public BulkActionResult bulk(final BulkAction bulkAction) {
        BulkActionResult res = new BulkActionResult();

        if (bulkAction.getOperation() == BulkAction.Type.DELETE) {
            for (String name : bulkAction.getTargets()) {
                try {
                    res.add(delete(name).getName(), BulkActionResult.Status.SUCCESS);
                } catch (Exception e) {
                    LOG.error("Error performing delete for resource {}", name, e);
                    res.add(name, BulkActionResult.Status.FAILURE);
                }
            }
        }

        return res;
View Full Code Here

        AbstractResourceAssociator<? extends AbstractAttributableTO> associator = subjectType == SubjectType.USER
                ? userController
                : roleController;

        final BulkActionResult res = new BulkActionResult();

        for (SubjectId id : subjectIds) {
            final Set<String> resources = Collections.singleton(resourceName);
            try {
                switch (type) {
                    case DEPROVISION:
                        associator.deprovision(id.getElement(), resources);
                        break;

                    case UNASSIGN:
                        associator.unassign(id.getElement(), resources);
                        break;

                    case UNLINK:
                        associator.unlink(id.getElement(), resources);
                        break;

                    default:
                }

                res.add(id, BulkActionResult.Status.SUCCESS);
            } catch (Exception e) {
                LOG.warn("While executing {} on {} {}", type, subjectType, id.getElement(), e);
                res.add(id, BulkActionResult.Status.FAILURE);
            }
        }

        return res;
    }
View Full Code Here

    @PreAuthorize("(hasRole('TASK_DELETE') and #bulkAction.operation == #bulkAction.operation.DELETE) or "
            + "(hasRole('TASK_EXECUTE') and "
            + "(#bulkAction.operation == #bulkAction.operation.EXECUTE or "
            + "#bulkAction.operation == #bulkAction.operation.DRYRUN))")
    public BulkActionResult bulk(final BulkAction bulkAction) {
        BulkActionResult res = new BulkActionResult();

        switch (bulkAction.getOperation()) {
            case DELETE:
                for (String taskId : bulkAction.getTargets()) {
                    try {
                        res.add(delete(Long.valueOf(taskId)).getId(), BulkActionResult.Status.SUCCESS);
                    } catch (Exception e) {
                        LOG.error("Error performing delete for task {}", taskId, e);
                        res.add(taskId, BulkActionResult.Status.FAILURE);
                    }
                }
                break;

            case DRYRUN:
                for (String taskId : bulkAction.getTargets()) {
                    try {
                        execute(Long.valueOf(taskId), true);
                        res.add(taskId, BulkActionResult.Status.SUCCESS);
                    } catch (Exception e) {
                        LOG.error("Error performing dryrun for task {}", taskId, e);
                        res.add(taskId, BulkActionResult.Status.FAILURE);
                    }
                }
                break;

            case EXECUTE:
                for (String taskId : bulkAction.getTargets()) {
                    try {
                        execute(Long.valueOf(taskId), false);
                        res.add(taskId, BulkActionResult.Status.SUCCESS);
                    } catch (Exception e) {
                        LOG.error("Error performing execute for task {}", taskId, e);
                        res.add(taskId, BulkActionResult.Status.FAILURE);
                    }
                }
                break;

            default:
View Full Code Here

                private static final long serialVersionUID = -3722207913631435501L;

                @Override
                public void onClick(final AjaxRequestTarget target) {
                    try {
                        BulkActionResult bulkActionResult;
                        if (subjectTO instanceof UserTO) {
                            bulkActionResult = userRestClient.deprovision(
                                    subjectTO.getETagValue(),
                                    subjectTO.getId(),
                                    new ArrayList<StatusBean>(table.getModelObject()));
                        } else {
                            bulkActionResult = roleRestClient.deprovision(
                                    subjectTO.getETagValue(),
                                    subjectTO.getId(),
                                    new ArrayList<StatusBean>(table.getModelObject()));
                        }

                        ((BasePage) pageRef.getPage()).setModalResult(true);
                        loadBulkActionResultPage(table.getModelObject(), bulkActionResult);
                    } catch (Exception e) {
                        LOG.error("Error de-provisioning user", e);
                        error(getString(Constants.ERROR) + ": " + e.getMessage());
                        feedbackPanel.refresh(target);
                    }
                }
            }, ActionLink.ActionType.DEPROVISION, pageId);

            table.addAction(new ActionLink() {

                private static final long serialVersionUID = -3722207913631435501L;

                @Override
                public void onClick(final AjaxRequestTarget target) {

                    if (subjectTO instanceof UserTO) {
                        StatusModalPage.this.passwordManagement(
                                target, ResourceAssociationActionType.PROVISION, table.getModelObject());
                    } else {
                        try {
                            final BulkActionResult bulkActionResult = roleRestClient.provision(
                                    subjectTO.getETagValue(),
                                    subjectTO.getId(),
                                    new ArrayList<StatusBean>(table.getModelObject()));

                            ((BasePage) pageRef.getPage()).setModalResult(true);
                            loadBulkActionResultPage(table.getModelObject(), bulkActionResult);
                        } catch (Exception e) {
                            LOG.error("Error provisioning user", e);
                            error(getString(Constants.ERROR) + ": " + e.getMessage());
                            feedbackPanel.refresh(target);
                        }
                    }
                }
            }.feedbackPanelAutomaticReload(!(subjectTO instanceof UserTO)), ActionLink.ActionType.PROVISION, pageId);

            table.addAction(new ActionLink() {

                private static final long serialVersionUID = -3722207913631435501L;

                @Override
                public void onClick(final AjaxRequestTarget target) {
                    try {
                        final BulkActionResult bulkActionResult;
                        if (subjectTO instanceof UserTO) {
                            bulkActionResult = userRestClient.unassign(
                                    subjectTO.getETagValue(),
                                    subjectTO.getId(),
                                    new ArrayList<StatusBean>(table.getModelObject()));
                        } else {
                            bulkActionResult = roleRestClient.unassign(
                                    subjectTO.getETagValue(),
                                    subjectTO.getId(),
                                    new ArrayList<StatusBean>(table.getModelObject()));
                        }

                        ((BasePage) pageRef.getPage()).setModalResult(true);
                        loadBulkActionResultPage(table.getModelObject(), bulkActionResult);
                    } catch (Exception e) {
                        LOG.error("Error unassigning resources", e);
                        error(getString(Constants.ERROR) + ": " + e.getMessage());
                        feedbackPanel.refresh(target);
                    }
                }
            }, ActionLink.ActionType.UNASSIGN, pageId);

            table.addAction(new ActionLink() {

                private static final long serialVersionUID = -3722207913631435501L;

                @Override
                public void onClick(final AjaxRequestTarget target) {
                    if (subjectTO instanceof UserTO) {
                        StatusModalPage.this.passwordManagement(
                                target, ResourceAssociationActionType.ASSIGN, table.getModelObject());
                    } else {
                        try {
                            final BulkActionResult bulkActionResult = roleRestClient.assign(
                                    subjectTO.getETagValue(),
                                    subjectTO.getId(),
                                    new ArrayList<StatusBean>(table.getModelObject()));

                            ((BasePage) pageRef.getPage()).setModalResult(true);
View Full Code Here

                            if (StringUtils.isNotBlank(password.getModelObject())
                            && !password.getModelObject().equals(confirm.getModelObject())) {
                                throw new Exception(getString("passwordMismatch"));
                            }

                            final BulkActionResult bulkActionResult;
                            switch (type) {
                                case ASSIGN:
                                    bulkActionResult = userRestClient.assign(
                                            subjectTO.getETagValue(),
                                            subjectTO.getId(),
View Full Code Here

            resetClient(UserService.class);
        }
    }

    public BulkActionResult deprovision(final String etag, final long userId, final List<StatusBean> statuses) {
        BulkActionResult result;
        synchronized (this) {
            UserService service = getService(etag, UserService.class);
            result = service.bulkDeassociation(userId, ResourceDeassociationActionType.DEPROVISION,
                    CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(),
                            ResourceName.class)).
View Full Code Here

    }

    public BulkActionResult provision(final String etag, final long userId,
            final List<StatusBean> statuses, final boolean changepwd, final String password) {

        BulkActionResult result;
        synchronized (this) {
            UserService service = getService(etag, UserService.class);

            final ResourceAssociationMod associationMod = new ResourceAssociationMod();
            associationMod.getTargetResources().addAll(
View Full Code Here

TOP

Related Classes of org.apache.syncope.common.reqres.BulkActionResult

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.