Package org.zanata.rest

Examples of org.zanata.rest.NoSuchEntityException


        HProject hProject =
                hProjectIteration == null ? null : hProjectIteration
                        .getProject();

        if (hProjectIteration == null) {
            throw new NoSuchEntityException("Project version '" + projectSlug
                    + ":" + versionSlug + "' not found.");
        } else if (hProjectIteration.getStatus().equals(EntityStatus.OBSOLETE)
                || hProject.getStatus().equals(EntityStatus.OBSOLETE)) {
            throw new NoSuchEntityException("Project version '" + projectSlug
                    + ":" + versionSlug + "' not found.");
        } else if (writeOperation) {
            if (hProjectIteration.getStatus().equals(EntityStatus.READONLY)
                    || hProject.getStatus().equals(EntityStatus.READONLY)) {
                throw new ReadOnlyEntityException("Project version '"
View Full Code Here


        HProject hProject =
                hProjectIteration == null ? null : hProjectIteration
                        .getProject();

        if (hProjectIteration == null) {
            throw new NoSuchEntityException("Project Iteration '" + projectSlug
                    + ":" + iterationSlug + "' not found.");
        } else if (hProjectIteration.getStatus().equals(EntityStatus.OBSOLETE)
                || hProject.getStatus().equals(EntityStatus.OBSOLETE)) {
            throw new NoSuchEntityException("Project Iteration '" + projectSlug
                    + ":" + iterationSlug + "' not found.");
        } else if (writeOperation) {
            if (hProjectIteration.getStatus().equals(EntityStatus.READONLY)
                    || hProject.getStatus().equals(EntityStatus.READONLY)) {
                throw new ReadOnlyEntityException("Project Iteration '"
View Full Code Here

        HProject hProject =
                hProjectIteration == null ? null : hProjectIteration
                        .getProject();

        if (hProjectIteration == null) {
            throw new NoSuchEntityException("Project Iteration '" + projectSlug
                    + ":" + iterationSlug + "' not found.");
        } else if (hProjectIteration.getStatus().equals(EntityStatus.OBSOLETE)
                || hProject.getStatus().equals(EntityStatus.OBSOLETE)) {
            throw new NoSuchEntityException("Project Iteration '" + projectSlug
                    + ":" + iterationSlug + "' not found.");
        } else if (writeOperation) {
            if (hProjectIteration.getStatus().equals(EntityStatus.READONLY)
                    || hProject.getStatus().equals(EntityStatus.READONLY)) {
                throw new ReadOnlyEntityException("Project Iteration '"
View Full Code Here

    HProject retrieveAndCheckProject(@Nonnull String projectSlug,
            boolean requiresWriteAccess) {
        HProject hProject = projectDAO.getBySlug(projectSlug);
        if (hProject == null
                || hProject.getStatus().equals(EntityStatus.OBSOLETE)) {
            throw new NoSuchEntityException("Project '" + projectSlug
                    + "' not found.");
        }
        if (requiresWriteAccess
                && hProject.getStatus().equals(EntityStatus.READONLY)) {
            throw new ReadOnlyEntityException("Project '" + projectSlug
View Full Code Here

                retrieveAndCheckProject(projectSlug, requiresWriteAccess);
        HProjectIteration hProjectIteration =
                projectIterationDAO.getBySlug(hProject, iterationSlug);
        if (hProjectIteration == null
                || hProjectIteration.getStatus().equals(EntityStatus.OBSOLETE)) {
            throw new NoSuchEntityException("Project Iteration '" + projectSlug
                    + ":" + iterationSlug + "' not found.");
        }
        if (requiresWriteAccess
                && hProjectIteration.getStatus().equals(EntityStatus.READONLY)) {
            throw new ReadOnlyEntityException("Project Iteration '"
View Full Code Here

            String iterationSlug, String docId) {
        HDocument document =
                documentDAO.getByProjectIterationAndDocId(projectSlug,
                        iterationSlug, docId);
        if (document == null) {
            throw new NoSuchEntityException("Could not find document: "
                    + projectSlug + "/" + iterationSlug + "/" + docId);
        }

        // NB: Permission check happens in the Copy Trans service itself.
View Full Code Here

        HDocument document =
                documentDAO.getByProjectIterationAndDocId(projectSlug,
                        iterationSlug, docId);
        if (document == null) {
            throw new NoSuchEntityException("Could not find document: "
                    + projectSlug + "/" + iterationSlug + "/" + docId);
        }

        identity.checkPermission("copy-trans", document.getProjectIteration());

        CopyTransTaskHandle processHandle =
                copyTransManager.getCopyTransProcessHandle(document);

        if (processHandle == null) {
            throw new NoSuchEntityException(
                    "There are no current or recently finished Copy Trans processes for this document.");
        }

        CopyTransStatus status = new CopyTransStatus();
        status.setInProgress(!processHandle.isDone());
View Full Code Here

                                new Object[] { OBSOLETE })
                        .setComment("ETagUtils.generateTagForProject-project")
                        .uniqueResult();

        if (projectVersion == null)
            throw new NoSuchEntityException("Project '" + slug + "' not found.");

        @SuppressWarnings("unchecked")
        List<Integer> iterationVersions =
                session.createQuery(
                        "select i.versionNum from HProjectIteration i "
View Full Code Here

                                new Object[] { OBSOLETE })
                        .setComment("ETagUtils.generateETagForIteration")
                        .uniqueResult();

        if (iterationVersion == null)
            throw new NoSuchEntityException("Project Iteration '"
                    + iterationSlug + "' not found.");

        String hash = HashUtil.generateHash(String.valueOf(iterationVersion));

        return EntityTag.valueOf(hash);
View Full Code Here

    public EntityTag generateETagForDocument(HProjectIteration iteration,
            String id, Set<String> extensions) {
        HDocument doc = documentDAO.getByDocIdAndIteration(iteration, id);
        if (doc == null)
            throw new NoSuchEntityException("Document '" + id + "' not found.");

        Integer hashcode = 1;
        hashcode = hashcode * 31 + doc.getRevision();

        int extHash = 0;
View Full Code Here

TOP

Related Classes of org.zanata.rest.NoSuchEntityException

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.