Examples of HProjectIteration


Examples of org.zanata.model.HProjectIteration

    @Override
    @Restrict("#{s:hasPermission(sourceDocResourceService.securedIteration, 'import-template')}")
    public
            Response deleteResource(String idNoSlash) {
        String id = URIHelper.convertFromDocumentURIId(idNoSlash);
        HProjectIteration hProjectIteration = retrieveAndCheckIteration(true);

        EntityTag etag =
                eTagUtils.generateETagForDocument(hProjectIteration, id,
                        new HashSet<String>());
View Full Code Here

Examples of org.zanata.model.HProjectIteration

    @Override
    public Response getResourceMeta(String idNoSlash, Set<String> extensions) {
        log.debug("start to get resource meta");
        String id = URIHelper.convertFromDocumentURIId(idNoSlash);
        HProjectIteration hProjectIteration = retrieveAndCheckIteration(false);

        EntityTag etag =
                eTagUtils.generateETagForDocument(hProjectIteration, id,
                        extensions);
View Full Code Here

Examples of org.zanata.model.HProjectIteration

    public
            Response putResourceMeta(String idNoSlash,
                    ResourceMeta messageBody, Set<String> extensions) {
        log.debug("start to put resource meta");
        String id = URIHelper.convertFromDocumentURIId(idNoSlash);
        HProjectIteration hProjectIteration = retrieveAndCheckIteration(true);

        EntityTag etag =
                eTagUtils.generateETagForDocument(hProjectIteration, id,
                        extensions);
View Full Code Here

Examples of org.zanata.model.HProjectIteration

                .build();

    }

    private HProjectIteration retrieveAndCheckIteration(boolean writeOperation) {
        HProjectIteration hProjectIteration =
                projectIterationDAO.getBySlug(projectSlug, iterationSlug);
        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 '"
                        + projectSlug + ":" + iterationSlug + "' is read-only.");
            } else {
                return hProjectIteration;
View Full Code Here

Examples of org.zanata.model.HProjectIteration

     *         given project (exclude translations from target document's
     *         iteration)
     */
    public long getTranslationCandidateCountWithProjectAndLocale(
            HDocument document, HLocale targetLocale) {
        HProjectIteration projectIteration = document.getProjectIteration();
        HProject project = projectIteration.getProject();
        String queryString =
                "select count(*) from HTextFlowTarget tft " +
                        "where tft.textFlow.document.projectIteration.project = :project " +
                        "and tft.locale = :locale " +
                        "and tft.textFlow.obsolete = false " +
View Full Code Here

Examples of org.zanata.model.HProjectIteration

    @Override
    public ProcessStatus startSourceDocCreation(final String idNoSlash,
            final String projectSlug, final String iterationSlug,
            final Resource resource, final Set<String> extensions,
            final boolean copytrans) {
        HProjectIteration hProjectIteration =
                retrieveAndCheckIteration(projectSlug, iterationSlug, true);

        resourceUtils.validateExtensions(extensions); // gettext, comment

        HDocument document =
View Full Code Here

Examples of org.zanata.model.HProjectIteration

    public ProcessStatus startSourceDocCreationOrUpdate(final String idNoSlash,
            final String projectSlug, final String iterationSlug,
            final Resource resource, final Set<String> extensions,
            final boolean copytrans) {

        HProjectIteration hProjectIteration =
                retrieveAndCheckIteration(projectSlug, iterationSlug, true);

        resourceUtils.validateExtensions(extensions); // gettext, comment

        String name = "SourceDocCreationOrUpdate: "+projectSlug+"-"+iterationSlug+"-"+idNoSlash;
View Full Code Here

Examples of org.zanata.model.HProjectIteration

        return status;
    }

    private HProjectIteration retrieveAndCheckIteration(String projectSlug,
            String iterationSlug, boolean writeOperation) {
        HProjectIteration hProjectIteration =
                projectIterationDAO.getBySlug(projectSlug, iterationSlug);
        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 '"
                        + projectSlug + ":" + iterationSlug + "' is read-only.");
            } else {
                return hProjectIteration;
View Full Code Here

Examples of org.zanata.model.HProjectIteration

    public @Nonnull
    HProjectIteration retrieveAndCheckIteration(@Nonnull String projectSlug,
            @Nonnull String iterationSlug, boolean requiresWriteAccess) {
        HProject hProject =
                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 '"
                    + projectSlug + ":" + iterationSlug + "' is read-only.");
        }
        return hProjectIteration;
    }
View Full Code Here

Examples of org.zanata.model.HProjectIteration

                getEntity(activity.getContextType(), activity.getContextId());

        if (isTranslationUpdateActivity(activity.getActivityType())
                || activity.getActivityType() == ActivityType.UPLOAD_SOURCE_DOCUMENT
                || activity.getActivityType() == ActivityType.UPLOAD_TRANSLATION_DOCUMENT) {
            HProjectIteration version = (HProjectIteration) context;
            return urlUtil.projectUrl(version.getProject().getSlug());
        }
        return "";
    }
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.