Package org.zanata.model

Examples of org.zanata.model.HProject


        EnterWorkspace event = new EnterWorkspace(editorClientId, person);
        workspace.publish(event);

        HLocale locale =
                localeServiceImpl.getByLocaleId(workspaceId.getLocaleId());
        HProject project =
                projectDAO.getBySlug(workspaceId.getProjectIterationId()
                        .getProjectSlug());
        HProjectIteration projectIteration =
                projectIterationDAO.getBySlug(workspaceId
                        .getProjectIterationId().getProjectSlug(), workspaceId
                        .getProjectIterationId().getIterationSlug());

        boolean isProjectActive =
                isProjectIterationActive(project.getStatus(),
                        projectIteration.getStatus());
        boolean hasWriteAccess = hasWritePermission(project, locale);
        boolean hasGlossaryUpdateAccess = hasGlossaryUpdatePermission();
        boolean requireReview = projectIteration.getRequireTranslationReview();
        boolean hasReviewAccess = hasReviewerPermission(locale, project);
View Full Code Here


            throw new IllegalArgumentException(
                    "ContainingWorkspaceBridge used on a non HDocument or HTextFlow type");
        }

        HProjectIteration iteration = doc.getProjectIteration();
        HProject project = iteration.getProject();

        addStringField(IndexFieldLabels.PROJECT_FIELD, project.getSlug(),
                luceneDocument, luceneOptions);
        addStringField(IndexFieldLabels.ITERATION_FIELD, iteration.getSlug(),
                luceneDocument, luceneOptions);
        addStringField(IndexFieldLabels.DOCUMENT_ID_FIELD, doc.getDocId(),
                luceneDocument, luceneOptions);
View Full Code Here

    }

    @Nullable
    public HProjectIteration getBySlug(@Nonnull String projectSlug,
            @Nonnull String iterationSlug) {
        HProject project =
                (HProject) getSession().byNaturalId(HProject.class)
                        .using("slug", projectSlug).load();
        return getBySlug(project, iterationSlug);
    }
View Full Code Here

    }

    @Override
    public List<HLocale> getSupportedLanguageByProject(
            @Nonnull String projectSlug) {
        HProject proj = projectDAO.getBySlug(projectSlug);

        if (proj != null && proj.isOverrideLocales()) {
            return new ArrayList<HLocale>(proj.getCustomizedLocales());
        }
        return localeDAO.findAllActiveAndEnabledByDefault();
    }
View Full Code Here

    }

    @Override
    public Map<String, String>
            getIterationGlobalLocaleItems(String projectSlug) {
        HProject project = projectDAO.getBySlug(projectSlug);
        return project.isOverrideLocales() ? getCustomizedLocalesItems(projectSlug)
                : getGlobalLocaleItems();
    }
View Full Code Here

    }

    @Override
    public Map<String, String> getCustomizedLocalesItems(String projectSlug) {
        Map<String, String> customizedItems = new TreeMap<String, String>();
        HProject project = projectDAO.getBySlug(projectSlug);
        if (project != null && project.isOverrideLocales()) {
            Set<HLocale> locales = project.getCustomizedLocales();
            for (HLocale op : locales) {
                String name = getDescript(op);
                customizedItems.put(name, name);
            }
        }
View Full Code Here

                        event.getNewStats(), contentStates, percentMilestone);

        if (shouldPublish) {
            HProjectIteration version =
                    projectIterationDAO.findById(event.getProjectIterationId());
            HProject project = version.getProject();

            if (!project.getWebHooks().isEmpty()) {
                HDocument document = documentDAO.getById(event.getDocumentId());
                DocumentMilestoneEvent milestoneEvent =
                        new DocumentMilestoneEvent(project.getSlug(),
                                version.getSlug(), document.getDocId(),
                                event.getLocaleId(), message);
                for (WebHook webHook : project.getWebHooks()) {
                    publishDocumentMilestoneEvent(webHook, milestoneEvent);
                }
            }
        }
    }
View Full Code Here

    @Override
    public void checkWorkspaceAction(WorkspaceId workspaceId,
            TranslationAction translationAction)
            throws NoSuchWorkspaceException {
        HProject project = checkWorkspaceStatus(workspaceId);

        HLocale locale =
                localeServiceImpl.getByLocaleId(workspaceId.getLocaleId());

        identity.checkPermission(translationAction.action(), locale, project);
View Full Code Here

    }

    @Override
    public HProject checkWorkspaceStatus(WorkspaceId workspaceId) {
        identity.checkLoggedIn();
        HProject project =
                projectDAO.getBySlug(workspaceId.getProjectIterationId()
                        .getProjectSlug());
        HProjectIteration projectIteration =
                projectIterationDAO.getBySlug(workspaceId
                        .getProjectIterationId().getProjectSlug(), workspaceId
                        .getProjectIterationId().getIterationSlug());

        if (projectIterationIsInactive(project.getStatus(),
                projectIteration.getStatus())) {
            throw new AuthorizationException("Project or version is read-only");
        }
        return project;
    }
View Full Code Here

    @Override
    public Collection<ValidationAction>
            getValidationActions(String projectSlug) {
        if (!StringUtils.isEmpty(projectSlug)) {
            HProject project = projectDAO.getBySlug(projectSlug);
            return getValidationActions(project);
        }
        return getValidationFactory().getAllValidationActions().values();
    }
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.