Package org.zanata.exception

Examples of org.zanata.exception.ZanataServiceException


    }

    private void validateParams(HashMap<String, FileItem> params) {
        for (String mandatoryField : MANDATORY_FIELDS) {
            if (!params.containsKey(mandatoryField)) {
                throw new ZanataServiceException("Mandatory field '"
                        + mandatoryField + "' not found in form");
            }
        }

    }
View Full Code Here


    private Lock lockTM(String slug) {
        Lock tmLock = new Lock("tm", slug);
        String owner = lockManagerServiceImpl.attainLockOrReturnOwner(tmLock);
        if (owner != null) {
            throw new ZanataServiceException("Translation Memory '" + slug
                    + "' is locked by user: " + owner, 503);
        }
        return tmLock;
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    public void setWrappedData(Object o) {
        if (o instanceof DataPage) {
            this.page = (DataPage<E>) o;
        } else {
            throw new ZanataServiceException(
                    "Wrapped data class cast exception");
        }
    }
View Full Code Here

        return page;
    }

    public Object getRowData() {
        if (rowIndex < 0) {
            throw new ZanataServiceException("Invalid rowIndex" + rowIndex
                    + "for PagedListDataModel");
        }
        if (page == null) {
            page = fetchPage(rowIndex, pageSize);
        }
        int datasetSize = page.getDatasetSize();
        int startRow = page.getStartRow();
        int count = page.getData().size();
        int endRow = startRow + count;
        if (rowIndex >= datasetSize) {
            throw new ZanataServiceException("Invalid rowIndex" + rowIndex
                    + "for PagedListDataModel");
        }
        if (rowIndex < startRow) {
            page = fetchPage(rowIndex, pageSize);
            startRow = page.getStartRow();
View Full Code Here

            Base64 en = new Base64();
            String enVar = new String(en.encode(var.getBytes()), "UTF-8");
            String result = URLEncoder.encode(enVar, "UTF-8");
            return result;
        } catch (Exception e) {
            throw new ZanataServiceException(e);
        }
    }
View Full Code Here

            String deVar = URLDecoder.decode(var, "UTF-8");
            Base64 en = new Base64();
            String result = new String(en.decode(deVar.getBytes()), "UTF-8");
            return result;
        } catch (Exception e) {
            throw new ZanataServiceException(e);
        }

    }
View Full Code Here

        action.setWorkspaceId(new WorkspaceId(new ProjectIterationId(
                projectSlug, iterationSlug, ProjectType.Podir), localeId));
        when(
                localeService.validateLocaleByProjectIteration(localeId,
                        projectSlug, iterationSlug)).thenThrow(
                new ZanataServiceException("BANG!"));

        // When:
        handler.execute(action, executionContext);

        // Then:
View Full Code Here

        action.setWorkspaceId(workspaceId);
        when(
                localeService.validateLocaleByProjectIteration(localeId,
                        workspaceId.getProjectIterationId().getProjectSlug(),
                        workspaceId.getProjectIterationId().getIterationSlug()))
                .thenThrow(new ZanataServiceException("bad"));

        GetProjectTransUnitListsResult result = handler.execute(action, null);
    }
View Full Code Here

                    parseAdapterTranslationFile(tempFile, projectSlug,
                            iterationSlug, docId, localeId, fileName);
            removeTempFile(tempFile);
            return transRes;
        } else {
            throw new ZanataServiceException("Unsupported Translation file: "
                    + fileName);
        }
    }
View Full Code Here

            String projectSlug, String iterationSlug, String docId) {
        boolean originalIsPo = isPoDocument(projectSlug, iterationSlug, docId);
        try {
            return parsePoFile(fileContents, !originalIsPo);
        } catch (Exception e) {
            throw new ZanataServiceException(
                    "Invalid PO file contents on file: " + docId, e);
        }
    }
View Full Code Here

TOP

Related Classes of org.zanata.exception.ZanataServiceException

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.