Package net.customware.gwt.dispatch.shared

Examples of net.customware.gwt.dispatch.shared.ActionException


                            .getWorkspaceId().getLocaleId(), action
                            .getWorkspaceId().getProjectIterationId()
                            .getProjectSlug(), action.getWorkspaceId()
                            .getProjectIterationId().getIterationSlug());
        } catch (ZanataServiceException e) {
            throw new ActionException(e);
        }

        HTextFlow hTextFlow =
                textFlowDAO.findById(action.getTransUnitId().getId(), false);
View Full Code Here


                            .getWorkspaceId().getLocaleId(), action
                            .getWorkspaceId().getProjectIterationId()
                            .getProjectSlug(), action.getWorkspaceId()
                            .getProjectIterationId().getIterationSlug());
        } catch (ZanataServiceException e) {
            throw new ActionException(e);
        }

        HashMap<Long, List<TransUnit>> matchingTUs =
                new HashMap<Long, List<TransUnit>>();
        HashMap<Long, String> docPaths = new HashMap<Long, String>();
View Full Code Here

            throws ActionException {
        String searchText = action.getSearchText();
        String replaceText = action.getReplaceText();
        if (Strings.isNullOrEmpty(searchText)
                || Strings.isNullOrEmpty(replaceText)) {
            throw new ActionException("search or replace text is empty");
        }

        int flags =
                action.isCaseSensitive() ? Pattern.UNICODE_CASE
                        : Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE;
View Full Code Here

    }

    @Override
    public void rollback(ReplaceText action, UpdateTransUnitResult result,
            ExecutionContext context) throws ActionException {
        throw new ActionException("not supported");
    }
View Full Code Here

        HTextFlowTarget hTextFlowTarget =
                textFlowTargetDAO.getTextFlowTarget(action.getTransUnitId()
                        .getValue(), workspaceId.getLocaleId());
        if (hTextFlowTarget == null
                || hTextFlowTarget.getState().isUntranslated()) {
            throw new ActionException(
                    "comment on untranslated message is pointless!");
        }

        HLocale locale =
                localeServiceImpl.getByLocaleId(workspaceId.getLocaleId());
View Full Code Here

    private void
            throwExceptionIfCommentIsInvalid(AddReviewCommentAction action)
                    throws ActionException {
        if (StringUtils.isBlank(action.getContent())) {
            throw new ActionException("comment can not be blank");
        }
    }
View Full Code Here

    @Override
    public void rollback(PreviewReplaceText action,
            PreviewReplaceTextResult result, ExecutionContext context)
            throws ActionException {
        throw new ActionException("not supported");
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Override
    public <A extends Action<R>, R extends Result> R execute(A action)
            throws ActionException {
        if (!(action instanceof WrappedAction<?>)) {
            throw new ActionException("Invalid (non-wrapped) action received: "
                    + action.getClass());
        }
        WrappedAction<?> a = (WrappedAction<?>) action;
        HttpSession session =
                ServletContexts.instance().getRequest().getSession();
        if (session != null && !session.getId().equals(a.getCsrfToken())) {
            log.warn("Token mismatch. Client token: {}, Expected token: {}",
                    a.getCsrfToken(), session.getId());
            throw new InvalidTokenError(
                    "The csrf token sent with this request is not valid. It may be from an expired session, or may have been forged");
        }
        DefaultExecutionContext ctx = new DefaultExecutionContext(this);
        try {
            return (R) doExecute(a.getAction(), ctx);
        } catch (ActionException e) {
            ctx.rollback();
            throw e;
        } catch (NotLoggedInException e) {
            ctx.rollback();
            throw new AuthenticationError(e);
        } catch (AuthorizationException e) {
            ctx.rollback();
            throw new AuthorizationError(e);
        } catch (Throwable e) {
            ctx.rollback();
            log.error("Error dispatching action: " + e, e);
            throw new ActionException(e);
        }
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    public <A extends Action<R>, R extends Result> void rollback(A action,
            R result) throws ActionException {
        if (!(action instanceof WrappedAction<?>)) {
            throw new ActionException("Invalid (non-wrapped) action received: "
                    + action.getClass());
        }
        WrappedAction<?> a = (WrappedAction<?>) action;
        HttpSession session =
                ServletContexts.instance().getRequest().getSession();
        if (session != null && !session.getId().equals(a.getCsrfToken())) {
            throw new SecurityException(
                    "Blocked action without session id (CSRF attack?)");
        }
        DefaultExecutionContext ctx = new DefaultExecutionContext(this);
        try {
            doRollback((A) a.getAction(), result, ctx);
        } catch (ActionException e) {
            ctx.rollback();
            throw e;
        } catch (NotLoggedInException e) {
            ctx.rollback();
            throw new AuthenticationError(e);
        } catch (AuthorizationException e) {
            ctx.rollback();
            throw new AuthorizationError(e);
        } catch (Throwable e) {
            ctx.rollback();
            log.error("Error dispatching action: " + e, e);
            throw new ActionException(e);
        }
    }
View Full Code Here

        if (handle != null) {
            if (handle.isDone()) {
                try {
                    downloadId = handle.getResult();
                } catch (InterruptedException e) {
                    throw new ActionException(
                            "Zip file preparation was interrupted", e);
                } catch (ExecutionException e) {
                    throw new ActionException(
                            "Error preparing zip file for download", e);
                }
            }
            currentProgress = handle.getCurrentProgress();
            maxProgress = handle.getMaxProgress();
View Full Code Here

TOP

Related Classes of net.customware.gwt.dispatch.shared.ActionException

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.