Examples of HProjectIteration


Examples of org.zanata.model.HProjectIteration

        }
    }

    private void failIfVersionCannotAcceptUpload(GlobalDocumentId id)
            throws ChunkUploadException {
        HProjectIteration projectIteration =
                projectIterationDAO.getBySlug(id.getProjectSlug(),
                        id.getVersionSlug());
        if (projectIteration == null) {
            throw new ChunkUploadException(Status.NOT_FOUND,
                    "The specified project-version \"" + id.getProjectSlug()
                            + ":" + id.getVersionSlug()
                            + "\" does not exist on this server.");
        }

        if (projectIteration.getProject().getStatus() != EntityStatus.ACTIVE) {
            throw new ChunkUploadException(Status.FORBIDDEN, "The project \""
                    + id.getProjectSlug()
                    + "\" is not active. Document upload is not allowed.");
        }

        if (projectIteration.getStatus() != EntityStatus.ACTIVE) {
            throw new ChunkUploadException(
                    Status.FORBIDDEN,
                    "The project-version \""
                            + id.getProjectSlug()
                            + ":"
View Full Code Here

Examples of org.zanata.model.HProjectIteration

        return upload;
    }

    private HDocumentUpload createMultipartUpload(GlobalDocumentId id,
            DocumentFileUploadForm uploadForm, HLocale locale) {
        HProjectIteration projectIteration =
                projectIterationDAO.getBySlug(id.getProjectSlug(),
                        id.getVersionSlug());
        HDocumentUpload newUpload = new HDocumentUpload();
        newUpload.setProjectIteration(projectIteration);
        newUpload.setDocId(id.getDocId());
View Full Code Here

Examples of org.zanata.model.HProjectIteration

            }

            Map<String, String> downloadExtensions =
                    new HashMap<String, String>();

            HProjectIteration projectIteration = hDoc.getProjectIteration();
            ProjectType type = projectIteration.getProjectType();
            if (type == null) {
                type = projectIteration.getProject().getDefaultProjectType();
            }

            if (type == null) {
                // no .po download link
            } else if (type == ProjectType.Gettext || type == ProjectType.Podir) {
View Full Code Here

Examples of org.zanata.model.HProjectIteration

    private AsyncTaskHandleManager asyncTaskHandleManager;

    @Override
    public DownloadAllFilesResult execute(DownloadAllFilesAction action,
            ExecutionContext context) throws ActionException {
        HProjectIteration version =
                projectIterationDAO.getBySlug(action.getProjectSlug(),
                        action.getVersionSlug());
        if (identity.hasPermission(version, "download-all")) {
            AsyncTaskHandle<String> handle = new AsyncTaskHandle<String>();
            Serializable taskKey =
View Full Code Here

Examples of org.zanata.model.HProjectIteration

    public WordStatistic getStatisticForVersion(String versionSlug) {
        WordStatistic statistic;
        if (statisticMap.containsKey(versionSlug)) {
            statistic = statisticMap.get(versionSlug);
        } else {
            HProjectIteration version =
                    projectIterationDAO.getBySlug(slug, versionSlug);
            statistic = getAllLocaleStatisticForVersion(version);
            statisticMap.put(versionSlug, statistic);
        }
        statistic
View Full Code Here

Examples of org.zanata.model.HProjectIteration

        public int compare(HProjectIteration o1, HProjectIteration o2) {
            SortingType.SortOption selectedSortOption =
                    sortingType.getSelectedSortOption();

            if (!selectedSortOption.isAscending()) {
                HProjectIteration temp = o1;
                o1 = o2;
                o2 = temp;
            }

            // Need to get statistic for comparison
View Full Code Here

Examples of org.zanata.model.HProjectIteration

        return locale;
    }

    private boolean isTranslationUploadAllowed(GlobalDocumentId id,
            HLocale locale) {
        HProjectIteration projectIteration =
                projectIterationDAO.getBySlug(id.getProjectSlug(),
                        id.getVersionSlug());
        // TODO should this check be "add-translation" or "modify-translation"?
        // They appear to be granted identically at the moment.
        return projectIteration.getStatus() == EntityStatus.ACTIVE
                && projectIteration.getProject().getStatus() == EntityStatus.ACTIVE
                && identity != null
                && identity.hasPermission("add-translation",
                        projectIteration.getProject(), locale);
    }
View Full Code Here

Examples of org.zanata.model.HProjectIteration

            WorkspaceId workspaceId) throws NoSuchWorkspaceException {
        String projectSlug =
                workspaceId.getProjectIterationId().getProjectSlug();
        String iterationSlug =
                workspaceId.getProjectIterationId().getIterationSlug();
        HProjectIteration projectIteration =
                getProjectIterationDAO().getBySlug(projectSlug, iterationSlug);

        if (projectIteration == null) {
            throw new NoSuchWorkspaceException("Invalid workspace Id");
        }
        HProject project = projectIteration.getProject();
        if (project.getStatus() == EntityStatus.OBSOLETE) {
            throw new NoSuchWorkspaceException("Project is obsolete");
        }
        if (projectIteration.getStatus() == EntityStatus.OBSOLETE) {
            throw new NoSuchWorkspaceException("Project Iteration is obsolete");
        }
        HLocale locale =
                getLocaleService().getByLocaleId(workspaceId.getLocaleId());
        if (locale == null) {
            throw new NoSuchWorkspaceException("Invalid Workspace Locale");
        }
        if (!locale.isActive()) {
            throw new NoSuchWorkspaceException("Locale '"
                    + locale.retrieveDisplayName() + "' disabled in server");
        }

        String workspaceName =
                project.getName() + " (" + projectIteration.getSlug() + ")";
        String localeDisplayName =
                ULocale.getDisplayName(workspaceId.getLocaleId().toJavaName(),
                        ULocale.ENGLISH);

        return new WorkspaceContext(workspaceId, workspaceName,
View Full Code Here

Examples of org.zanata.model.HProjectIteration

                            + "\".");
        }
    }

    private boolean isDocumentUploadAllowed(GlobalDocumentId id) {
        HProjectIteration projectIteration =
                projectIterationDAO.getBySlug(id.getProjectSlug(),
                        id.getVersionSlug());
        return projectIteration.getStatus() == EntityStatus.ACTIVE
                && projectIteration.getProject().getStatus() == EntityStatus.ACTIVE
                && identity != null
                && identity.hasPermission("import-template", projectIteration);
    }
View Full Code Here

Examples of org.zanata.model.HProjectIteration

        ResponseBuilder response = request.evaluatePreconditions(etag);
        if (response != null) {
            return response.build();
        }

        HProjectIteration hProjectIteration =
                projectIterationDAO.getBySlug(getProjectSlug(),
                        getIterationSlug());
        if (hProjectIteration == null) {
            return Response.status(Status.NOT_FOUND).build();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.