Examples of HLocale


Examples of org.zanata.model.HLocale

            GetProjectTransUnitLists action, ExecutionContext context)
            throws ActionException {
        identity.checkLoggedIn();
        log.info("Searching all targets for workspace {}",
                action.getWorkspaceId());
        HLocale hLocale;
        try {
            hLocale =
                    localeServiceImpl.validateLocaleByProjectIteration(action
                            .getWorkspaceId().getLocaleId(), action
                            .getWorkspaceId().getProjectIterationId()
                            .getProjectSlug(), action.getWorkspaceId()
                            .getProjectIterationId().getIterationSlug());
        } catch (ZanataServiceException e) {
            throw new ActionException(e);
        }

        HashMap<Long, List<TransUnit>> matchingTUs =
                new HashMap<Long, List<TransUnit>>();
        HashMap<Long, String> docPaths = new HashMap<Long, String>();
        if (Strings.isNullOrEmpty(action.getSearchString())) {
            // TODO empty searches shouldn't be requested, consider replacing
            // this
            // with an error, or making behaviour return all targets for the
            // project (consider performance).
            return new GetProjectTransUnitListsResult(action, docPaths,
                    matchingTUs);
        }

        FilterConstraints filterConstraints =
                FilterConstraints.builder().filterBy(action.getSearchString())
                        .caseSensitive(action.isCaseSensitive())
                        .checkInSource(action.isSearchInSource())
                        .checkInTarget(action.isSearchInTarget()).build();

        List<HTextFlow> matchingFlows =
                textFlowSearchServiceImpl.findTextFlows(
                        action.getWorkspaceId(), action.getDocumentPaths(),
                        filterConstraints);
        log.info("Returned {} results for search", matchingFlows.size());

        // FIXME remove when analyzer handles leading & trailing whitespace
        boolean needsWhitespaceCheck =
                !action.getSearchString().equals(
                        action.getSearchString().trim());
        Iterable<HTextFlow> result = matchingFlows;
        if (needsWhitespaceCheck) {
            // FIXME temporary check for leading and trailing whitespace to
            // compensate
            // for NGramAnalyzer trimming strings before tokenization. This
            // should
            // be removed when updating to a lucene version with the whitespace
            // issue resolved.
            result =
                    Iterables.filter(
                            matchingFlows,
                            new WhitespaceMatchPredicate(action, hLocale
                                    .getId()));
        }

        for (HTextFlow textFlow : result) {
            List<TransUnit> listForDoc =
View Full Code Here

Examples of org.zanata.model.HLocale

        public int compare(HLocale o1, HLocale o2) {
            SortingType.SortOption selectedSortOption =
                    sortingType.getSelectedSortOption();

            if (!selectedSortOption.isAscending()) {
                HLocale temp = o1;
                o1 = o2;
                o2 = temp;
            }

            // Need to get statistic for comparison
View Full Code Here

Examples of org.zanata.model.HLocale

        return update();
    }

    @Restrict("#{s:hasPermission(versionHome.instance, 'update')}")
    public void removeLanguage(LocaleId localeId) {
        HLocale locale = localeServiceImpl.getByLocaleId(localeId);
        getInstance().getCustomizedLocales().remove(locale);

        update();
        conversationScopeMessages.setMessage(FacesMessage.SEVERITY_INFO,
                msgs.format("jsf.iteration.LanguageRemoved",
                        locale.retrieveDisplayName()));
    }
View Full Code Here

Examples of org.zanata.model.HLocale

        @Override
        public void onSelectItemAction() {
            if (StringUtils.isEmpty(getSelectedItem())) {
                return;
            }
            HLocale locale = localeServiceImpl.getByLocaleId(getSelectedItem());

            getInstance().getCustomizedLocales().add(locale);

            update(conversationScopeMessages);
            reset();
            conversationScopeMessages.setMessage(FacesMessage.SEVERITY_INFO,
                    msgs.format("jsf.iteration.LanguageAdded",
                            locale.retrieveDisplayName()));

        }
View Full Code Here

Examples of org.zanata.model.HLocale

                || hTextFlowTarget.getState().isUntranslated()) {
            throw new ActionException(
                    "comment on untranslated message is pointless!");
        }

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

        identity.checkPermission("review-comment", locale, project);

        TranslationWorkspace workspace =
View Full Code Here

Examples of org.zanata.model.HLocale

    @Override
    public GetGlossaryDetailsResult execute(GetGlossaryDetailsAction action,
            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();

        log.info("Fetching glossary details for entry{} in locale {}",
                sourceIds, hLocale);
        List<HGlossaryTerm> srcTerms = glossaryDAO.findByIdList(sourceIds);
        ArrayList<GlossaryDetails> items =
                new ArrayList<GlossaryDetails>(srcTerms.size());

        for (HGlossaryTerm srcTerm : srcTerms) {
            HGlossaryEntry entry = srcTerm.getGlossaryEntry();
            List<String> srcComments = new ArrayList<String>();
            List<String> targetComments = new ArrayList<String>();

            HGlossaryTerm hGlossaryTerm = entry.getGlossaryTerms().get(hLocale);
            for (HTermComment termComment : srcTerm.getComments()) {
                srcComments.add(termComment.getComment());
            }

            for (HTermComment termComment : hGlossaryTerm.getComments()) {
                targetComments.add(termComment.getComment());
            }

            items.add(new GlossaryDetails(srcTerm.getContent(), hGlossaryTerm
                    .getContent(), srcComments, targetComments, entry
                    .getSourceRef(), entry.getSrcLocale().getLocaleId(),
                    hLocale.getLocaleId(), hGlossaryTerm.getVersionNum(),
                    hGlossaryTerm.getLastChanged()));
        }

        return new GetGlossaryDetailsResult(items);
    }
View Full Code Here

Examples of org.zanata.model.HLocale

         * has problems when invoking lazily loaded collections from postLoad
         * entity listener methods. In this case, the drools engine will attempt
         * to access the 'members' collection from inside the security
         * listener's postLoad method to evaluate rules.
         */
        HLocale locale =
                localeServiceImpl.getByLocaleId(new LocaleId(language));
        if (locale != null) {
            locale.getMembers();
        }
        return locale;
    }
View Full Code Here

Examples of org.zanata.model.HLocale

    @Override
    public TransMemoryDetailsList execute(GetTransMemoryDetailsAction action,
            ExecutionContext context) throws ActionException {
        identity.checkLoggedIn();
        LocaleId locale = action.getWorkspaceId().getLocaleId();
        HLocale hLocale;
        try {
            hLocale =
                    localeServiceImpl
                            .validateLocaleByProjectIteration(locale, action
                                    .getWorkspaceId().getProjectIterationId()
View Full Code Here

Examples of org.zanata.model.HLocale

        HGlossaryEntry entry =
                glossaryDAO.getEntryBySrcLocaleAndContent(
                        selectedDetailEntry.getSrcLocale(),
                        selectedDetailEntry.getSource());

        HLocale targetLocale =
                localeServiceImpl.getByLocaleId(selectedDetailEntry
                        .getTargetLocale());

        HGlossaryTerm targetTerm = entry.getGlossaryTerms().get(targetLocale);
        if (targetTerm == null) {
View Full Code Here

Examples of org.zanata.model.HLocale

        @SuppressWarnings("unchecked")
        List<Object[]> list = query.list();

        for (Object[] obj : list) {
            HLocale locale = (HLocale) obj[0];
            Long count = (Long) obj[1];
            int countInt = count == null ? 0 : count.intValue();
            result.put(locale, countInt);
        }
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.