Examples of GlossaryEntry


Examples of com.google.gdata.data.gtt.GlossaryEntry

    SimpleCommandLineParser parser = new SimpleCommandLineParser(args);

    String id = parser.getValue("id");
    URL feedUrl = FeedUris.getGlossaryFeedUrl(id);

    GlossaryEntry requestEntry = service.getEntry(feedUrl, GlossaryEntry.class);

    System.out.println("You want to update glossary with id:" + id + " ...");

    if (parser.containsKey("title")) {
      String title = parser.getValue("title");
      System.out.println("...by changing title to " + title);
      requestEntry.setTitle(new PlainTextConstruct(title));
    }

    if (parser.containsKey("file")) {
      String filename = parser.getValue("file");
      System.out.println("...by appending contents from file " + filename);
      File file = new File(filename);
      String mimeType = "text/csv";

      MediaFileSource fileSource = new MediaFileSource(file, mimeType);
      MediaContent content = new MediaContent();
      content.setMediaSource(fileSource);
      content.setMimeType(new ContentType(mimeType));

      requestEntry.setContent(content);
    }

    System.out.print("Updating glossaries....");
    System.out.flush();
    GlossaryEntry resultEntry = null;
    if (requestEntry.getContent() == null) {
      resultEntry = service.update(feedUrl, requestEntry);
    } else {
      resultEntry = service.updateMedia(feedUrl, requestEntry);
    }
View Full Code Here

Examples of com.google.gdata.data.gtt.GlossaryEntry

  private AddGlossaryCommand() {
  }

  public void execute(GttService service, String[] args)
      throws IOException, ServiceException {
    GlossaryEntry requestEntry = createEntryFromArgs(args);

    System.out.print("Adding glossary....");
    System.out.flush();

    URL feedUrl = FeedUris.getGlossariesFeedUrl();
    GlossaryEntry resultEntry = service.insert(feedUrl, requestEntry);

    printResults(resultEntry);
  }
View Full Code Here

Examples of com.google.gdata.data.gtt.GlossaryEntry

      throws IOException {
    SimpleCommandLineParser parser = new SimpleCommandLineParser(args);

    System.out.println("You asked to add a glossary...");

    GlossaryEntry entry = new GlossaryEntry();

    String title = parser.getValue("title");
    System.out.println("...with title " + title);
    entry.setTitle(new PlainTextConstruct(title));

    String filename = parser.getValue("file");
    System.out.println("...with contents from " + filename);
    File file = new File(filename);
    String mimeType = "text/csv";
    MediaFileSource fileSource = new MediaFileSource(file, mimeType);
    MediaContent content = new MediaContent();
    content.setMediaSource(fileSource);
    content.setMimeType(new ContentType(mimeType));
    entry.setContent(content);

    return entry;
  }
View Full Code Here

Examples of org.eclipse.xtext.xdoc.xdoc.GlossaryEntry

import org.eclipse.xtext.xdoc.xdoc.GlossaryEntry;

@SuppressWarnings("all")
public class GlossaryExtensions {
  public GlossaryEntry getEntry(final Iterable<GlossaryEntry> glossary, final String aliasOrName) {
    GlossaryEntry _xblockexpression = null;
    {
      final Function1<GlossaryEntry, Boolean> _function = new Function1<GlossaryEntry, Boolean>() {
        public Boolean apply(final GlossaryEntry s) {
          String _name = s.getName();
          return Boolean.valueOf(Objects.equal(_name, aliasOrName));
        }
      };
      GlossaryEntry matchedEntry = IterableExtensions.<GlossaryEntry>findFirst(glossary, _function);
      GlossaryEntry _xifexpression = null;
      boolean _equals = Objects.equal(matchedEntry, null);
      if (_equals) {
        final Function1<GlossaryEntry, Boolean> _function_1 = new Function1<GlossaryEntry, Boolean>() {
          public Boolean apply(final GlossaryEntry s) {
            EList<String> _alias = s.getAlias();
View Full Code Here

Examples of org.zanata.rest.dto.GlossaryEntry

    }

    public void transferEntriesResource(List<HGlossaryEntry> hGlosssaryEntries,
            Glossary glossary) {
        for (HGlossaryEntry hGlossaryEntry : hGlosssaryEntries) {
            GlossaryEntry glossaryEntry = new GlossaryEntry();
            glossaryEntry.setSourcereference(hGlossaryEntry.getSourceRef());
            glossaryEntry.setSrcLang(hGlossaryEntry.getSrcLocale()
                    .getLocaleId());

            for (HGlossaryTerm hGlossaryTerm : hGlossaryEntry
                    .getGlossaryTerms().values()) {
                GlossaryTerm glossaryTerm = new GlossaryTerm();
                glossaryTerm.setContent(hGlossaryTerm.getContent());
                glossaryTerm.setLocale(hGlossaryTerm.getLocale().getLocaleId());

                for (HTermComment hTermComment : hGlossaryTerm.getComments()) {
                    glossaryTerm.getComments().add(hTermComment.getComment());
                }
                glossaryEntry.getGlossaryTerms().add(glossaryTerm);
            }
            glossary.getGlossaryEntries().add(glossaryEntry);
        }
    }
View Full Code Here

Examples of org.zanata.rest.dto.GlossaryEntry

    public static void transferEntriesLocaleResource(
            List<HGlossaryEntry> hGlosssaryEntries, Glossary glossary,
            LocaleId locale) {
        for (HGlossaryEntry hGlossaryEntry : hGlosssaryEntries) {
            GlossaryEntry glossaryEntry = new GlossaryEntry();
            glossaryEntry.setSrcLang(hGlossaryEntry.getSrcLocale()
                    .getLocaleId());
            glossaryEntry.setSourcereference(hGlossaryEntry.getSourceRef());
            for (HGlossaryTerm hGlossaryTerm : hGlossaryEntry
                    .getGlossaryTerms().values()) {
                if (hGlossaryTerm.getLocale().getLocaleId().equals(locale)) {
                    GlossaryTerm glossaryTerm = new GlossaryTerm();
                    glossaryTerm.setContent(hGlossaryTerm.getContent());
                    glossaryTerm.setLocale(hGlossaryTerm.getLocale()
                            .getLocaleId());

                    for (HTermComment hTermComment : hGlossaryTerm
                            .getComments()) {
                        glossaryTerm.getComments().add(
                                hTermComment.getComment());
                    }
                    glossaryEntry.getGlossaryTerms().add(glossaryTerm);
                }
            }
            glossary.getGlossaryEntries().add(glossaryEntry);
        }
    }
View Full Code Here

Examples of org.zanata.rest.dto.GlossaryEntry

    }

    @Test
    public void putGlossary() {
        Glossary glossary = new Glossary();
        GlossaryEntry glossaryEntry1 = new GlossaryEntry();
        glossaryEntry1.setSrcLang(LocaleId.EN_US);
        glossaryEntry1.setSourcereference("TEST SOURCE REF DATA");

        GlossaryTerm glossaryTerm1 = new GlossaryTerm();
        glossaryTerm1.setLocale(LocaleId.EN_US);
        glossaryTerm1.setContent("TEST DATA 1 EN_US");
        glossaryTerm1.getComments().add("COMMENT 1");

        GlossaryTerm glossaryTerm2 = new GlossaryTerm();
        glossaryTerm2.setLocale(LocaleId.DE);
        glossaryTerm2.setContent("TEST DATA 2 DE");
        glossaryTerm2.getComments().add("COMMENT 2");

        glossaryEntry1.getGlossaryTerms().add(glossaryTerm1);
        glossaryEntry1.getGlossaryTerms().add(glossaryTerm2);

        GlossaryEntry glossaryEntry2 = new GlossaryEntry();
        glossaryEntry2.setSrcLang(LocaleId.EN_US);
        glossaryEntry2.setSourcereference("TEST SOURCE REF DATA2");

        GlossaryTerm glossaryTerm3 = new GlossaryTerm();
        glossaryTerm3.setLocale(LocaleId.EN_US);
        glossaryTerm3.setContent("TEST DATA 3 EN_US");
        glossaryTerm3.getComments().add("COMMENT 3");

        GlossaryTerm glossaryTerm4 = new GlossaryTerm();
        glossaryTerm4.setLocale(LocaleId.DE);
        glossaryTerm4.setContent("TEST DATA 4 DE");
        glossaryTerm4.getComments().add("COMMENT 4");

        glossaryEntry2.getGlossaryTerms().add(glossaryTerm3);
        glossaryEntry2.getGlossaryTerms().add(glossaryTerm4);

        glossary.getGlossaryEntries().add(glossaryEntry1);
        glossary.getGlossaryEntries().add(glossaryEntry2);

        ClientResponse<String> response = glossaryService.put(glossary);
View Full Code Here

Examples of org.zanata.rest.dto.GlossaryEntry

    }

    @Test
    public void testPutGlossaries() {
        Glossary glossary = new Glossary();
        GlossaryEntry glossaryEntry1 = new GlossaryEntry();
        glossaryEntry1.setSrcLang(LocaleId.EN_US);
        glossaryEntry1.setSourcereference("TEST SOURCE REF DATA");

        GlossaryTerm glossaryTerm1 = new GlossaryTerm();
        glossaryTerm1.setLocale(LocaleId.EN_US);
        glossaryTerm1.setContent("test data content 1 (source lang)");
        glossaryTerm1.getComments().add("COMMENT 1");

        glossaryEntry1.getGlossaryTerms().add(glossaryTerm1);

        glossary.getGlossaryEntries().add(glossaryEntry1);

        ClientResponse<String> response = glossaryService.put(glossary);
View Full Code Here

Examples of org.zanata.rest.dto.GlossaryEntry

                Glossary glossary = jaxbUnmarshal(response, Glossary.class);
                assertThat(glossary.getGlossaryEntries().size(), is(1));

                // Glossary Entry
                GlossaryEntry entry = glossary.getGlossaryEntries().get(0);
                assertThat(entry.getSourcereference(), is("source reference"));
                assertThat(entry.getSrcLang(), is(LocaleId.EN_US));
                assertThat(entry.getGlossaryTerms().size(), is(3));

                // Expected / Actual glossary terms
                Set<GlossaryTerm> actualTerms =
                        new HashSet<GlossaryTerm>(entry.getGlossaryTerms());

                Set<GlossaryTerm> expectedTerms = new HashSet<GlossaryTerm>();
                GlossaryTerm expTerm = new GlossaryTerm();
                expTerm.setLocale(LocaleId.EN_US);
                expTerm.setContent("test data content 1 (source lang)");
View Full Code Here

Examples of org.zanata.rest.dto.GlossaryEntry

                Glossary glossary = jsonUnmarshal(response, Glossary.class);
                assertThat(glossary.getGlossaryEntries().size(), is(1));

                // Glossary Entry
                GlossaryEntry entry = glossary.getGlossaryEntries().get(0);
                assertThat(entry.getSourcereference(), is("source reference"));
                assertThat(entry.getSrcLang(), is(LocaleId.EN_US));
                assertThat(entry.getGlossaryTerms().size(), is(3));

                // Expected / Actual glossary terms
                Set<GlossaryTerm> actualTerms =
                        new HashSet<GlossaryTerm>(entry.getGlossaryTerms());

                Set<GlossaryTerm> expectedTerms = new HashSet<GlossaryTerm>();
                GlossaryTerm expTerm = new GlossaryTerm();
                expTerm.setLocale(LocaleId.EN_US);
                expTerm.setContent("test data content 1 (source lang)");
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.