Examples of HProjectIteration


Examples of org.zanata.model.HProjectIteration

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

        HProjectIteration hProjectIteration =
                projectIterationDAO.getBySlug(projectSlug, versionSlug);
        if (hProjectIteration == null) {
            return Response.status(Response.Status.NOT_FOUND).build();
        }
View Full Code Here

Examples of org.zanata.model.HProjectIteration

    }

    @Override
    public Response getLocales(@PathParam("projectSlug") String projectSlug,
            @PathParam("versionSlug") String versionSlug) {
        HProjectIteration version =
                projectIterationDAO.getBySlug(projectSlug, versionSlug);
        if (version == null) {
            return Response.status(Response.Status.NOT_FOUND).build();
        }
View Full Code Here

Examples of org.zanata.model.HProjectIteration

    }

    @Override
    public Response getDocuments(@PathParam("projectSlug") String projectSlug,
            @PathParam("versionSlug") String versionSlug) {
        HProjectIteration hProjectIteration =
                retrieveAndCheckIteration(projectSlug, versionSlug, false);

        EntityTag etag =
                projectIterationDAO.getResourcesETag(hProjectIteration);

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

        List<ResourceMeta> resources = new ArrayList<ResourceMeta>();

        for (HDocument doc : hProjectIteration.getDocuments().values()) {

            ResourceMeta resource = new ResourceMeta();
            resourceUtils.transferToAbstractResourceMeta(doc, resource);
            resources.add(resource);
        }
View Full Code Here

Examples of org.zanata.model.HProjectIteration

        return Response.ok(entity).build();
    }

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

Examples of org.zanata.model.HProjectIteration

    public Response getProjectIterationTranslationMemory(
            @Nonnull String projectSlug, @Nonnull String iterationSlug,
            @Nullable LocaleId locale) {
        log.debug("exporting TMX for project {}, iteration {}, locale {}",
                projectSlug, iterationSlug, locale);
        HProjectIteration hProjectIteration =
                restSlugValidator.retrieveAndCheckIteration(projectSlug,
                        iterationSlug, false);
        if (locale != null) {
            restSlugValidator.validateTargetLocale(locale, projectSlug,
                    iterationSlug);
View Full Code Here

Examples of org.zanata.model.HProjectIteration

    @In
    private ETagUtils eTagUtils;

    @Override
    public Response head() {
        HProjectIteration hProjectIteration = retrieveAndCheckIteration(false);
        EntityTag etag =
                projectIterationDAO.getResourcesETag(hProjectIteration);
        Response.ResponseBuilder response = request.evaluatePreconditions(etag);
        if (response != null) {
            return response.build();
View Full Code Here

Examples of org.zanata.model.HProjectIteration

        return Response.ok().tag(etag).build();
    }

    @Override
    public Response get(Set<String> extensions) {
        HProjectIteration hProjectIteration = retrieveAndCheckIteration(false);

        EntityTag etag =
                projectIterationDAO.getResourcesETag(hProjectIteration);

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

        List<ResourceMeta> resources = new ArrayList<ResourceMeta>();

        for (HDocument doc : hProjectIteration.getDocuments().values()) {
            // TODO we shouldn't need this check
            if (!doc.isObsolete()) {
                ResourceMeta resource = new ResourceMeta();
                resourceUtils.transferToAbstractResourceMeta(doc, resource);
                resources.add(resource);
View Full Code Here

Examples of org.zanata.model.HProjectIteration

    @Override
    @Restrict("#{s:hasPermission(sourceDocResourceService.securedIteration, 'import-template')}")
    public
            Response post(Resource resource, Set<String> extensions,
                    boolean copytrans) {
        HProjectIteration hProjectIteration = retrieveAndCheckIteration(true);

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

        String resourceName = resource.getName();
        if (!Pattern.matches(SourceDocResource.RESOURCE_NAME_REGEX,
View Full Code Here

Examples of org.zanata.model.HProjectIteration

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

        resourceUtils.validateExtensions(extensions);

        final Set<String> extSet = new HashSet<String>(extensions);
        EntityTag etag =
View Full Code Here

Examples of org.zanata.model.HProjectIteration

            Response putResource(String idNoSlash, Resource resource,
                    Set<String> extensions, boolean copytrans) {
        log.debug("start put resource");
        String id = URIHelper.convertFromDocumentURIId(idNoSlash);
        Response.ResponseBuilder response;
        HProjectIteration hProjectIteration = retrieveAndCheckIteration(true);

        resourceUtils.validateExtensions(extensions);

        HDocument document =
                this.documentDAO.getByDocIdAndIteration(hProjectIteration, id);
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.