Package sample.util

Examples of sample.util.SimpleCommandLineParser.containsKey()


      String url = parser.getValue("wikipediaurl");
      System.out.println("... with mediawiki contents from " + url);
      DocumentSource docSource = new DocumentSource(DocumentSource.Type.WIKI,
          url);
      entry.setDocumentSource(docSource);
    } else if (parser.containsKey("knolurl")) {
      String url = parser.getValue("knolurl");
      System.out.println("... with knol contents from " + url);
      DocumentSource docSource = new DocumentSource(DocumentSource.Type.KNOL,
          url);
      entry.setDocumentSource(docSource);
View Full Code Here


      String url = parser.getValue("knolurl");
      System.out.println("... with knol contents from " + url);
      DocumentSource docSource = new DocumentSource(DocumentSource.Type.KNOL,
          url);
      entry.setDocumentSource(docSource);
    } else if (parser.containsKey("file")) {
      String filename = parser.getValue("file");
      System.out.println("... with contents from file at " + filename);
      File file = new File(filename);
      String mimeType = MediaType.fromFileName(filename).getMimeType();
View Full Code Here

      content.setMimeType(new ContentType(mimeType));

      entry.setContent(content);
    }

    if (parser.containsKey("tmids")) {
      String tmIds = parser.getValue("tmids");
      System.out.println("...by adding translation memories with ids: "
          + tmIds);
      TmsElement tm = new TmsElement();
      for (String id : tmIds.split(",")) {
View Full Code Here

        tm.addLink(tmLink);
      }
      entry.setTranslationMemory(tm);
    }

    if (parser.containsKey("glids")) {
      String glIds = parser.getValue("glids");
      System.out.println("...by adding glossaries with ids: "
          + glIds);
      GlossariesElement gl = new GlossariesElement();
      for (String id : glIds.split(",")) {
View Full Code Here

  public void execute(GttService service, String[] args)
      throws IOException, ServiceException {
    SimpleCommandLineParser parser = new SimpleCommandLineParser(args);

    String docId = parser.getValue("id");
    boolean deletePermanently = parser.containsKey("perm");

    URL feedUrl;
    if (deletePermanently) {
      feedUrl = FeedUris.getDocumentPermDeleteUrl(docId);
    } else {
View Full Code Here

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

    String entryId = parser.getValue("id");

    if (parser.containsKey("list")) {
      URL feedUrl = FeedUris.getAclFeedUrl(feedName, entryId);

      System.out.println("Listing all accessors for " + feedName
          + " with id" + entryId + "  ...");
      // Get the list of accessors for this entry
View Full Code Here

          + " with id" + entryId + "  ...");
      // Get the list of accessors for this entry
      AclFeed aclFeed = service.getFeed(feedUrl, AclFeed.class);
      printAclInfo(aclFeed);

    } else if (parser.containsKey("changetype")) {
      String changeType = parser.getValue("changetype");
      String emailId = parser.getValue("email");

      if ("add".equals(changeType)) {
        AclScope scope = new AclScope(AclScope.Type.USER, emailId);
View Full Code Here

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

    if (parser.containsKey("file")) {
      String filename = parser.getValue("file");
      System.out.println("...with contents from " + filename);
      File file = new File(filename);
      String mimeType = "text/xml";
View Full Code Here

      content.setMimeType(new ContentType(mimeType));

      entry.setContent(content);
    }

    if (parser.containsKey("private")) {
      System.out.println("...with private access");
      entry.setScope(new ScopeEntry(ScopeEntry.Value.PRIVATE));
    } else {
      System.out.println("...with public access");
      entry.setScope(new ScopeEntry(ScopeEntry.Value.PUBLIC));
View Full Code Here

    SimpleCommandLineParser parser = new SimpleCommandLineParser(args);

    URL feedUrl = FeedUris.getTranslationMemoriesFeedUrl();
    TranslationMemoryQuery query = new TranslationMemoryQuery(feedUrl);

    if (parser.containsKey("onlyprivate")) {
      System.out.println("You asked to list all private translation "
          + "memories...");
      query.setScope(ScopeEntry.Value.PRIVATE.toString());
    } else if (parser.containsKey("onlypublic")) {
      System.out.println("You asked to list all public translation "
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.