Package org.zanata.model

Examples of org.zanata.model.HProject


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

            HProject hProject = projectDAO.getBySlug(projectSlug);
            Project project =
                    org.zanata.rest.service.ProjectService.toResource(hProject,
                            MediaType.APPLICATION_JSON_TYPE);
            return Response.ok(project).tag(etag).build();
        } catch (NoSuchEntityException e) {
View Full Code Here


    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

    @Override
    public Response getProjectTranslationMemory(@Nonnull String projectSlug,
            @Nullable LocaleId locale) {
        log.debug("exporting TMX for project {}, locale {}", projectSlug,
                locale);
        HProject hProject =
                restSlugValidator.retrieveAndCheckProject(projectSlug, false);
        if (locale != null) {
            restSlugValidator.validateTargetLocale(locale, projectSlug);
            // TODO findTextFlowsByProjectAndLocale
        }
View Full Code Here

    }

    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

     *         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

    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

    private ProjectIterationDAO projectIterationDAO;

    public @Nonnull
    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
                    + "' is read-only.");
        }
        return hProject;
    }
View Full Code Here

     * @see ProjectService#retrieveAndCheckProject
     */
    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)) {
View Full Code Here

    public HProject getProject() {
        return projectDAO.getBySlug(projectSlug);
    }

    public List<VersionItem> getOtherVersions() {
        HProject project = getProject();
        if (project != null) {
            List<HProjectIteration> versionList =
                    projectIterationDAO.getByProjectSlug(projectSlug,
                            EntityStatus.ACTIVE, EntityStatus.READONLY);
View Full Code Here

    public void copyVersion() {
        getInstance().setStatus(EntityStatus.READONLY);

        // create basic version here
        HProject project = getProject();
        project.addIteration(getInstance());
        super.persist();

        copyVersionManager.startCopyVersion(projectSlug,
                copyFromVersionSlug, getInstance().getSlug());
View Full Code Here

TOP

Related Classes of org.zanata.model.HProject

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.