Package org.zanata.rest.dto.resource

Examples of org.zanata.rest.dto.resource.Resource


            // Perform translation of Hibernate DTOs to JAXB DTOs
            TranslationsResource transRes =
                    (TranslationsResource) this.translatedDocResourceService
                            .getTranslations(docId, new LocaleId(locale),
                                    extensions, true, null).getEntity();
            Resource res = this.resourceUtils.buildResource(document);

            StreamingOutput output =
                    new POStreamingOutput(res, transRes,
                            FILE_TYPE_OFFLINE_PO.equals(fileType));
            response =
View Full Code Here


            params =
                    documentDAO.getAdapterParams(id.getProjectSlug(),
                            id.getVersionSlug(), id.getDocId());
        }
        try {
            Resource doc =
                    translationFileServiceImpl.parseUpdatedAdapterDocumentFile(
                            tempFile.toURI(), id.getDocId(),
                            uploadForm.getFileType(), params);
            doc.setLang(LocaleId.EN_US);
            // TODO Copy Trans values
            document =
                    documentServiceImpl.saveDocument(id.getProjectSlug(),
                            id.getVersionSlug(), doc,
                            Collections.<String> emptySet(), false);
View Full Code Here

        String projectType = "gettext";
        restCaller.createProjectAndVersion(projectSlug, iterationSlug,
                projectType);

        String docId = "test.pot";
        Resource sourceResource =
                buildSourceResource(docId,
                        buildTextFlow("res1", "hello world"),
                        buildTextFlow("res2", "greetings"));
        restCaller.postSourceDocResource(projectSlug, iterationSlug,
                sourceResource, false);
View Full Code Here

        String projectType = "gettext";
        restCaller.createProjectAndVersion(projectSlug, iterationSlug,
                projectType);

        String docId = "test.pot";
        Resource sourceResource =
                buildSourceResource(docId,
                        buildTextFlow("res1", "hello world"),
                        buildTextFlow("res2", "greetings"));
        restCaller.postSourceDocResource(projectSlug, iterationSlug,
                sourceResource, false);
View Full Code Here

    private void parsePotFile(InputStream potStream, GlobalDocumentId id,
            DocumentFileUploadForm uploadForm) {
        // real upload filename not available, but the service only cares about
        // the suffix.
        String uploadFileName = "." + uploadForm.getFileType();
        Resource doc = translationFileServiceImpl.parseUpdatedPotFile(potStream,
                        id.getDocId(), uploadFileName,
                        useOfflinePo(id));
        doc.setLang(LocaleId.EN_US);
        // TODO Copy Trans values
        documentServiceImpl.saveDocument(id.getProjectSlug(),
                id.getVersionSlug(), doc,
                new StringSet(ExtensionType.GetText.toString()), false);
    }
View Full Code Here

    private DashboardBasePage dashboard;

    @Before
    public void setUp() {
        ZanataRestCaller restCaller = new ZanataRestCaller();
        Resource resource =
                buildSourceResource("a", buildTextFlow("res1", "content"));
        // create 6 activities
        for (int i = 0; i < 6; i++) {
            String projectSlug = "activity" + i;
            String iterationSlug = "v" + i;
View Full Code Here

                projectType);
        restCaller.createProjectAndVersion(PROJECT_SLUG, "3.5",
                projectType);

        final int numOfTextFlows = 2000;
        Resource message1 =
                buildSourceResource("message1", generateTextFlows(
                        numOfTextFlows));
        Resource message2 =
                buildSourceResource("message2", generateTextFlows(
                        numOfTextFlows));
        Resource message3 =
                buildSourceResource("message3", generateTextFlows(
                        numOfTextFlows));
        Resource message4 =
                buildSourceResource("message4", generateTextFlows(
                        numOfTextFlows));
        resources = new Resource[] { message1/*, message2, message3, message4*/ };

        TranslationsResource translation1 =
View Full Code Here

     */
    @Test(timeout = ZanataTestCase.MAX_SHORT_TEST_DURATION)
    public void obsoleteTextTest() {
        restCaller
                .createProjectAndVersion("obsolete-test", "master", "gettext");
        Resource resource1 =
                buildSourceResource("message1",
                        buildTextFlow("res1", "message one"),
                        buildTextFlow("res2", "message two"),
                        buildTextFlow("res3", "message three"),
                        buildTextFlow("res4", "message four"));

        Resource resource2 =
                buildSourceResource("message2",
                        buildTextFlow("res1", "message one"),
                        buildTextFlow("res2", "message two"),
                        buildTextFlow("res3", "message three"),
                        buildTextFlow("res4", "message four"));

        restCaller.postSourceDocResource("obsolete-test", "master", resource1,
                false);
        restCaller.postSourceDocResource("obsolete-test", "master", resource2,
                false);

        // edit first entry and save
        new LoginWorkFlow().signIn("admin", "admin");
        final EditorPage editorPage = openEditor();
        editorPage.translateTargetAtRowIndex(0, "message one translated")
                .approveTranslationAtRow(0);

        // delete resource 2
        resource2.getTextFlows().clear();
        restCaller.deleteSourceDoc("obsolete-test", "master", "message2");
        // remove last entry from resource 1
        resource1.getTextFlows().remove(3);
        restCaller.putSourceDocResource("obsolete-test", "master", "message1",
                resource1, true);
View Full Code Here

    public SampleProjectRule sampleProjectRule = new SampleProjectRule();

    @Before
    public void setUp() {
        ZanataRestCaller restCaller = new ZanataRestCaller();
        Resource sourceResource =
                buildSourceResource(document,
                        buildTextFlow("res1", "hello world"),
                        buildTextFlow("res2", "greetings"),
                        buildTextFlow("res3", "hey"));
        restCaller.postSourceDocResource("about-fedora", "master",
View Full Code Here

        String projectType = "gettext";
        restCaller.createProjectAndVersion(projectSlug, iterationSlug,
                projectType);

        String docId = "messages";
        Resource sourceResource = buildSourceResource(docId);
        TranslationsResource transResource = buildTranslationResource();
        int numOfMessages = 520;
        for (int i = 0; i < numOfMessages; i++) {
            String resId = "res" + i;
            String content = "content" + i;
            sourceResource.getTextFlows().add(buildTextFlow(resId, content));
            transResource.getTextFlowTargets().add(
                    buildTextFlowTarget(resId, content));
        }
        restCaller.asyncPushSource(projectSlug, iterationSlug, sourceResource, false);
        restCaller.asyncPushTarget(projectSlug, iterationSlug, docId,
View Full Code Here

TOP

Related Classes of org.zanata.rest.dto.resource.Resource

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.