Package org.zanata.webtrans.shared.model

Examples of org.zanata.webtrans.shared.model.ProjectIterationId


        String iterationSlug = projectIteration.getSlug();
        String projectSlug = projectIteration.getProject().getSlug();
        ProjectType projectType = projectIteration.getProjectType();

        WorkspaceId workspaceId =
                new WorkspaceId(new ProjectIterationId(projectSlug,
                        iterationSlug, projectType), localeId);
        Optional<TranslationWorkspace> workspaceOptional =
                translationWorkspaceManager.tryGetWorkspace(workspaceId);
        if (!workspaceOptional.isPresent()) {
            return;
View Full Code Here


            ExecutionContext context) throws ActionException {
        identity.checkLoggedIn();
        LocaleId locale = action.getWorkspaceId().getLocaleId();
        HLocale hLocale;
        try {
            ProjectIterationId projectIterationId =
                    action.getWorkspaceId().getProjectIterationId();
            hLocale =
                    localeServiceImpl.validateLocaleByProjectIteration(locale,
                            projectIterationId.getProjectSlug(),
                            projectIterationId.getIterationSlug());
        } catch (ZanataServiceException e) {
            throw new ActionException(e);
        }
        List<Long> sourceIds = action.getSourceIdList();
View Full Code Here

    @Override
    public GetDocumentListResult execute(GetDocumentList action,
            ExecutionContext context) throws ActionException {
        identity.checkLoggedIn();

        ProjectIterationId iterationId =
                action.getWorkspaceId().getProjectIterationId();

        List<DocumentInfo> docs = new ArrayList<DocumentInfo>();

        List<HDocument> hDocs = getDocumentList(action);

        for (HDocument hDoc : hDocs) {
            HPerson person = hDoc.getLastModifiedBy();
            String lastModifiedBy = "";
            if (person != null) {
                lastModifiedBy = person.getAccount().getUsername();
            }

            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) {
                downloadExtensions.put(".po", "po?docId=" + hDoc.getDocId());
            } else {
                downloadExtensions.put("offline .po",
                        "offlinepo?docId=" + hDoc.getDocId());
            }
            GlobalDocumentId id =
                    new GlobalDocumentId(iterationId.getProjectSlug(),
                            iterationId.getIterationSlug(), hDoc.getDocId());
            if (filePersistService.hasPersistedDocument(id)) {
                String extension =
                        "."
                                + translationFileServiceImpl.getFileExtension(
                                        iterationId.getProjectSlug(),
                                        iterationId.getIterationSlug(),
                                        hDoc.getPath(), hDoc.getName());
                downloadExtensions.put(extension,
                        "baked?docId=" + hDoc.getDocId());
            }
View Full Code Here

    public void rollback(GetDocumentList action, GetDocumentListResult result,
            ExecutionContext context) throws ActionException {
    }

    private List<HDocument> getDocumentList(GetDocumentList action) {
        ProjectIterationId iterationId =
                action.getWorkspaceId().getProjectIterationId();

        if (hasDocIdFilters(action)) {
            return documentDAO.getByProjectIterationAndDocIdList(
                    iterationId.getProjectSlug(),
                    iterationId.getIterationSlug(), action.getDocIdFilters());
        } else {
            return documentDAO.getAllByProjectIteration(
                    iterationId.getProjectSlug(),
                    iterationId.getIterationSlug());
        }
    }
View Full Code Here

                "Project {} iteration {} updated, status={}, isProjectActive={}, projectType={}",
                new Object[] { projectSlug, iterSlug,
                        projectIteration.getStatus(), isProjectActive,
                        projectType });

        ProjectIterationId iterId =
                new ProjectIterationId(projectSlug, iterSlug,
                        projectIteration.getProjectType());
        for (TranslationWorkspace workspace : projIterWorkspaceMap.get(iterId)) {
            WorkspaceContextUpdate event =
                    new WorkspaceContextUpdate(isProjectActive, projectType,
                            validationStates);
View Full Code Here

        String projectSlug = Window.Location.getParameter("project");
        String iterationSlug = Window.Location.getParameter("iteration");
        if (projectSlug == null || iterationSlug == null) {
            return null;
        }
        return new ProjectIterationId(projectSlug, iterationSlug, null);
    }
View Full Code Here

    @Override
    public GetLocaleListResult execute(GetLocaleList action,
            ExecutionContext context) throws ActionException {
        identity.checkLoggedIn();

        ProjectIterationId iterationId =
                action.getWorkspaceId().getProjectIterationId();
        String projectSlug = iterationId.getProjectSlug();

        List<HLocale> hLocales =
                localeServiceImpl.getSupportedLanguageByProjectIteration(
                        projectSlug, iterationId.getIterationSlug());

        List<Locale> locales = Lists.newArrayList();
        for (HLocale hLocale : hLocales) {
            Locale locale =
                    new Locale(new IdForLocale(hLocale.getId(),
View Full Code Here

                for (VersionGroupJoinAction.SelectableProject version : versionGroupJoinAction.getProjectVersions()) {
                    if (version.isSelected()) {
                        HProjectIteration projIter =
                                version.getProjectIteration();
                        projectIterIds.add(new ProjectIterationId(
                                projIter.getProject().getSlug(),
                                projIter.getSlug(),
                                projIter.getProjectType()));
                    }
                }
View Full Code Here

    @Test(expectedExceptions = ActionException.class)
    public void invalidLocaleWillThrowException() throws ActionException {
        // Given:
        String projectSlug = "rhel";
        String iterationSlug = "7.0";
        action.setWorkspaceId(new WorkspaceId(new ProjectIterationId(
                projectSlug, iterationSlug, ProjectType.Podir), localeId));
        when(
                localeService.validateLocaleByProjectIteration(localeId,
                        projectSlug, iterationSlug)).thenThrow(
                new ZanataServiceException("BANG!"));
View Full Code Here

    @Test
    public void canGetEmptyHistoryForTextFlowWithNoTranslation()
            throws ActionException {
        // Given: text flow has empty targets
        action.setWorkspaceId(new WorkspaceId(new ProjectIterationId("rhel",
                "7.0", ProjectType.Podir), localeId));
        when(
                localeService.validateLocaleByProjectIteration(localeId,
                        "rhel", "7.0")).thenReturn(hLocale);
        HTextFlow hTextFlow = createHTextFlow();
View Full Code Here

TOP

Related Classes of org.zanata.webtrans.shared.model.ProjectIterationId

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.