Package org.zanata.rest.dto.extensions.gettext

Examples of org.zanata.rest.dto.extensions.gettext.PoHeader


            ExtensionSet<AbstractResourceMetaExtension> from, HDocument to,
            Set<String> enabledExtensions) {
        boolean changed = false;

        if (enabledExtensions.contains(PoHeader.ID)) {
            PoHeader poHeaderExt = from.findByType(PoHeader.class);
            if (poHeaderExt != null) {
                HPoHeader poHeader = to.getPoHeader();
                if (poHeader == null) {
                    log.debug("create a new HPoHeader");
                    poHeader = new HPoHeader();
View Full Code Here


    public void transferToResourceExtensions(HDocument from,
            ExtensionSet<AbstractResourceMetaExtension> to,
            Set<String> enabledExtensions) {
        if (enabledExtensions.contains(PoHeader.ID)) {
            PoHeader poHeaderExt = new PoHeader();
            if (from.getPoHeader() != null) {
                transferToPoHeader(from.getPoHeader(), poHeaderExt);
                to.add(poHeaderExt);
            }
        }
View Full Code Here

    }

    public Resource getPoHeaderTest() {
        Resource sr = getTextFlowTest();

        PoHeader poHeaderExt =
                new PoHeader("comment", new HeaderEntry("h1", "v1"),
                        new HeaderEntry("h2", "v2"), new HeaderEntry(
                                "Content-Type", "charset=UTF-8"));
        sr.getExtensions(true).add(poHeaderExt);
        return sr;
    }
View Full Code Here

    }

    public ResourceMeta getPoHeaderResourceMeta() {
        ResourceMeta entity = getResourceMeta();
        entity.getExtensions(true).add(
                new PoHeader("comment", new HeaderEntry("ref", "test ref")));
        log.debug("create a new resource meta:" + entity.toString());
        return entity;
    }
View Full Code Here

            }
        }
    }

    static void addPoHeader(Resource res, String key, String value) {
        PoHeader poHeader = res.getExtensions(true).findByType(PoHeader.class);

        if (poHeader == null) {
            poHeader = new PoHeader();
            res.getExtensions().add(poHeader);
        }

        poHeader.getEntries().add(new HeaderEntry(key, value));
    }
View Full Code Here

    @Test
    void transferFromResourceMetadata() {
        ResourceMeta from = new ResourceMeta("resId");
        from.setContentType(ContentType.TextPlain);
        PoHeader poHeader = new PoHeader();
        poHeader.setComment("comment");
        poHeader.getEntries().add(new HeaderEntry("key", "value"));
        from.getExtensions(true).add(poHeader);
        from.setLang(LocaleId.ES);
        from.setName("name");
        from.setType(ResourceType.FILE);
View Full Code Here

        List<String> refs = poData.getReferences();
        refs.add("ref1.xml:7");
        refs.add("ref1.xml:21");

        Resource doc = newDoc(id, textflow);
        PoHeader poHeader = new PoHeader();
        poHeader.setComment("poheader comment");
        List<HeaderEntry> poEntries = poHeader.getEntries();
        poEntries.add(new HeaderEntry("Project-Id-Version", "en"));
        poEntries.add(new HeaderEntry("Content-Type",
                "application/x-publican; charset=UTF-8\n"));
        doc.getExtensions(true).add(poHeader);
View Full Code Here

TOP

Related Classes of org.zanata.rest.dto.extensions.gettext.PoHeader

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.