Examples of HTextFlowTarget


Examples of org.zanata.model.HTextFlowTarget

            if (result.length < 2 || result[1] == null) {
                tu = transUnitUtils.buildTransUnitFull(textFlow, null,
                        locale.getLocaleId());
            }
            else {
                HTextFlowTarget textFlowTarget = (HTextFlowTarget) result[1];
                tu = transUnitUtils.buildTransUnitFull(textFlow,
                        textFlowTarget, locale.getLocaleId());
            }
            transUnits.put(textFlow.getId().toString(), tu);
        }
View Full Code Here

Examples of org.zanata.model.HTextFlowTarget

            TransUnit tu;
            if (result.length < 2 || result[1] == null) {
                tu = transUnitUtils.buildTargetTransUnit(
                        hTextFlow, null, locale.getLocaleId());
            } else {
                HTextFlowTarget hTarget = (HTextFlowTarget) result[1];
                tu = transUnitUtils.buildTargetTransUnit(hTextFlow, hTarget,
                        locale.getLocaleId());
            }
            transUnits.put(hTextFlow.getId().toString(), tu);
        }
View Full Code Here

Examples of org.zanata.model.HTextFlowTarget

        }

        HTextFlow hTextFlow =
                textFlowDAO.findById(action.getTransUnitId().getId(), false);

        HTextFlowTarget hTextFlowTarget =
                hTextFlow.getTargets().get(hLocale.getId());
        Map<Integer, HTextFlowTargetHistory> history = Maps.newHashMap();
        TransHistoryItem latest = null;
        if (hTextFlowTarget != null) {
            String lastModifiedBy =
                    nameOrEmptyString(hTextFlowTarget.getLastModifiedBy());
            int nPlurals =
                    resourceUtils.getNumPlurals(hTextFlow.getDocument(),
                            hLocale);

            latest =
                    new TransHistoryItem(hTextFlowTarget.getVersionNum()
                            .toString(),
                            GwtRpcUtil.getTargetContentsWithPadding(hTextFlow,
                                    hTextFlowTarget, nPlurals),
                            hTextFlowTarget.getState(), lastModifiedBy,
                            hTextFlowTarget.getLastChanged());
            // history translation
            history = hTextFlowTarget.getHistory();
        }

        Iterable<TransHistoryItem> historyItems =
                Iterables.transform(history.values(),
                        new TargetHistoryToTransHistoryItemFunction());
View Full Code Here

Examples of org.zanata.model.HTextFlowTarget

        // method, if target is not eagerly loaded it will cause hibernate n+1.
        // We may want to have a method as transform(Collection<HTextFlow>
        // hTextFlows, HLocale hLocale) and use query internally or change
        // caller
        // code to always eager load targets.
        HTextFlowTarget target = hTextFlow.getTargets().get(hLocale.getId());

        return transform(hTextFlow, target, hLocale);
    }
View Full Code Here

Examples of org.zanata.model.HTextFlowTarget

     * @param hLocale
     *            The locale for the text flow target.
     */
    public HTextFlowTarget getOrCreateTarget(HTextFlow hTextFlow,
            HLocale hLocale) {
        HTextFlowTarget hTextFlowTarget = getTextFlowTarget(hTextFlow, hLocale);

        if (hTextFlowTarget == null) {
            hTextFlowTarget = new HTextFlowTarget(hTextFlow, hLocale);
            hTextFlowTarget.setVersionNum(0); // this will be incremented when
                                              // content is set (below)
            // TODO getTargets just to make sure hTextFlowTarget is persisted in
            // the end
            hTextFlow.getTargets().put(hLocale.getId(), hTextFlowTarget);
            // getSession().persist(hTextFlowTarget);
View Full Code Here

Examples of org.zanata.model.HTextFlowTarget

     * @param hLocale
     *            The locale for the text flow target.
     */
    public HTextFlowTarget getTextFlowTarget(HTextFlow hTextFlow,
            HLocale hLocale) {
        HTextFlowTarget hTextFlowTarget =
                (HTextFlowTarget) getSession()
                        .createQuery(
                                "select tft from HTextFlowTarget tft "
                                        + "where tft.textFlow = :textFlow "
                                        + "and tft.locale = :locale")
View Full Code Here

Examples of org.zanata.model.HTextFlowTarget

        return hTextFlowTarget;
    }

    public HTextFlowTarget
            getTextFlowTarget(Long hTextFlowId, LocaleId localeId) {
        HTextFlowTarget hTextFlowTarget =
                (HTextFlowTarget) getSession()
                        .createQuery(
                                "select tft from HTextFlowTarget tft "
                                        + "where tft.textFlow.id = :hTextFlowId "
                                        + "and tft.locale.localeId = :localeId")
View Full Code Here

Examples of org.zanata.model.HTextFlowTarget

        return query.list();
    }

    public HTextFlowTarget getTextFlowTarget(HTextFlow hTextFlow,
            LocaleId localeId) {
        HTextFlowTarget hTextFlowTarget =
                (HTextFlowTarget) getSession()
                        .createQuery(
                                "select tft from HTextFlowTarget tft "
                                        + "where tft.textFlow = :textFlow "
                                        + "and tft.locale.localeId = :localeId")
View Full Code Here

Examples of org.zanata.model.HTextFlowTarget

                getEntity(activity.getLastTargetType(),
                        activity.getLastTargetId());

        if (isTranslationUpdateActivity(activity.getActivityType())) {
            HProjectIteration version = (HProjectIteration) context;
            HTextFlowTarget tft = (HTextFlowTarget) lastTarget;

            return urlUtil.editorTransUnitUrl(version.getProject().getSlug(),
                    version.getSlug(), tft.getLocaleId(), tft.getTextFlow()
                            .getLocale(), tft.getTextFlow().getDocument()
                            .getDocId(), tft.getTextFlow().getId());
        } else if (activity.getActivityType() == ActivityType.UPLOAD_SOURCE_DOCUMENT) {
            // not supported for upload source action
        } else if (activity.getActivityType() == ActivityType.UPLOAD_TRANSLATION_DOCUMENT) {
            HProjectIteration version = (HProjectIteration) context;
            HDocument document = (HDocument) lastTarget;
            HTextFlowTarget tft =
                    documentDAO.getLastTranslatedTargetOrNull(document.getId());

            if (tft != null) {
                return urlUtil.editorTransUnitUrl(version.getProject()
                        .getSlug(), version.getSlug(), tft.getLocaleId(),
                        document.getSourceLocaleId(), tft.getTextFlow()
                                .getDocument().getDocId(), tft.getTextFlow()
                                .getId());
            }
        }
        return "";
    }
View Full Code Here

Examples of org.zanata.model.HTextFlowTarget

                getEntity(activity.getLastTargetType(),
                        activity.getLastTargetId());

        if (isTranslationUpdateActivity(activity.getActivityType())) {
            HProjectIteration version = (HProjectIteration) context;
            HTextFlowTarget tft = (HTextFlowTarget) lastTarget;

            return urlUtil.editorDocumentUrl(version.getProject().getSlug(),
                    version.getSlug(), tft.getLocaleId(), tft.getTextFlow()
                            .getLocale(), tft.getTextFlow().getDocument()
                            .getDocId());
        } else if (activity.getActivityType() == ActivityType.UPLOAD_SOURCE_DOCUMENT) {
            HProjectIteration version = (HProjectIteration) context;
            return urlUtil.sourceFilesViewUrl(version.getProject().getSlug(),
                    version.getSlug());
        } else if (activity.getActivityType() == ActivityType.UPLOAD_TRANSLATION_DOCUMENT) {
            HProjectIteration version = (HProjectIteration) context;
            HDocument document = (HDocument) lastTarget;
            HTextFlowTarget tft =
                    documentDAO.getLastTranslatedTargetOrNull(document.getId());

            if (tft != null) {
                return urlUtil.editorDocumentUrl(
                        version.getProject().getSlug(), version.getSlug(),
                        tft.getLocaleId(), document.getSourceLocaleId(), tft
                                .getTextFlow().getDocument().getDocId());
            }
        }
        return "";
    }
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.