当前位置: 首页>>代码示例>>Java>>正文


Java PlainTextConstruct类代码示例

本文整理汇总了Java中com.google.gdata.data.PlainTextConstruct的典型用法代码示例。如果您正苦于以下问题:Java PlainTextConstruct类的具体用法?Java PlainTextConstruct怎么用?Java PlainTextConstruct使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PlainTextConstruct类属于com.google.gdata.data包,在下文中一共展示了PlainTextConstruct类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createNew

import com.google.gdata.data.PlainTextConstruct; //导入依赖的package包/类
/**
 * Create a new item in the DocList.
 *
 * @param title the title of the document to be created.
 * @param type the type of the document to be created. One of "spreadsheet",
 *        "presentation", or "document".
 *
 * @throws DocumentListException
 * @throws ServiceException
 * @throws IOException
 * @throws MalformedURLException
 */
public DocumentListEntry createNew(String title, String type) throws MalformedURLException,
    IOException, ServiceException,
    DocumentListException {
  if (title == null || type == null) {
    throw new DocumentListException("null title or type");
  }

  DocumentListEntry newEntry = null;
  if (type.equals("document")) {
    newEntry = new DocumentEntry();
  } else if (type.equals("presentation")) {
    newEntry = new PresentationEntry();
  } else if (type.equals("spreadsheet")) {
    newEntry = new SpreadsheetEntry();
  } else if (type.equals("folder")) {
    newEntry = new FolderEntry();
  }

  newEntry.setTitle(new PlainTextConstruct(title));
  return service.insert(buildUrl(URL_DEFAULT + URL_DOCLIST_FEED), newEntry);
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:34,代码来源:DocumentList.java

示例2: uploadFile

import com.google.gdata.data.PlainTextConstruct; //导入依赖的package包/类
/**
 * Upload a file.
 *
 * @param filepath path to uploaded file.
 * @param title title to use for uploaded file.
 *
 * @throws ServiceException when the request causes an error in the Doclist
 *         service.
 * @throws IOException when an error occurs in communication with the Doclist
 *         service.
 * @throws DocumentListException
 */
public DocumentListEntry uploadFile(String filepath, String title)
    throws IOException, ServiceException, DocumentListException {
  if (filepath == null || title == null) {
    throw new DocumentListException("null passed in for required parameters");
  }

  File file = new File(filepath);
  String mimeType = DocumentListEntry.MediaType.fromFileName(file.getName())
      .getMimeType();

  DocumentEntry newDocument = new DocumentEntry();
  newDocument.setFile(file, mimeType);
  newDocument.setTitle(new PlainTextConstruct(title));

  return service
      .insert(buildUrl(URL_DEFAULT + URL_DOCLIST_FEED), newDocument);
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:30,代码来源:DocumentList.java

示例3: createCalendar

import com.google.gdata.data.PlainTextConstruct; //导入依赖的package包/类
/**
 * Creates a new secondary calendar using the owncalendars feed.
 * 
 * @param service An authenticated CalendarService object.
 * @return The newly created calendar entry.
 * @throws IOException If there is a problem communicating with the server.
 * @throws ServiceException If the service is unable to handle the request.
 */
private static CalendarEntry createCalendar(CalendarService service)
    throws IOException, ServiceException {
  System.out.println("Creating a secondary calendar");

  // Create the calendar
  CalendarEntry calendar = new CalendarEntry();
  calendar.setTitle(new PlainTextConstruct("Little League Schedule"));
  calendar.setSummary(new PlainTextConstruct(
      "This calendar contains the practice schedule and game times."));
  calendar.setTimeZone(new TimeZoneProperty("America/Los_Angeles"));
  calendar.setHidden(HiddenProperty.FALSE);
  calendar.setColor(new ColorProperty(BLUE));
  calendar.addLocation(new Where("", "", "Oakland"));

  // Insert the calendar
  return service.insert(owncalendarsFeedUrl, calendar);
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:26,代码来源:CalendarFeedDemo.java

示例4: createAlbum

import com.google.gdata.data.PlainTextConstruct; //导入依赖的package包/类
private void createAlbum() throws Exception {
  AlbumEntry album = new AlbumEntry();

  String title = getString("Title");
  album.setTitle(new PlainTextConstruct(title));
  String description = getString("Description");
  album.setDescription(new PlainTextConstruct(description));

  String access = "";
  while (!access.equals("public") && !access.equals("private")) {
    access = getString("Access (public | private)");
  }

  album.setAccess(access);

  String location = getString("Location");
  album.setLocation(location);
  album.setDate(new Date());

  insertAlbum(album);
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:22,代码来源:PicasawebCommandLine.java

示例5: createPhoto

import com.google.gdata.data.PlainTextConstruct; //导入依赖的package包/类
private void createPhoto(AlbumEntry albumEntry) throws Exception {
  PhotoEntry photo = new PhotoEntry();

  String title = getString("Title");
  photo.setTitle(new PlainTextConstruct(title));
  String description = getString("Description");
  photo.setDescription(new PlainTextConstruct(description));
  photo.setTimestamp(new Date());

  OtherContent content = new OtherContent();


  File file = null;
  while (file == null || !file.canRead()) {
    file = new File(getString("Photo location"));
  }
  content.setBytes(getBytes(file));
  content.setMimeType(new ContentType("image/jpeg"));
  photo.setContent(content);

  insert(albumEntry, photo);
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:23,代码来源:PicasawebCommandLine.java

示例6: createSite

import com.google.gdata.data.PlainTextConstruct; //导入依赖的package包/类
/**
 * Creates a new Google Sites.
 *
 * @param title A name for the site.
 * @param summary A description for the site.
 * @param theme A theme to create the site with.
 * @return The created site entry.
 * @throws ServiceException 
 * @throws IOException 
 * @throws MalformedURLException 
 */
public SiteEntry createSite(String title, String summary, String theme)
    throws MalformedURLException, IOException, ServiceException {
  SiteEntry entry = new SiteEntry();
  entry.setTitle(new PlainTextConstruct(title));
  entry.setSummary(new PlainTextConstruct(summary));

  // Set theme if user specified it.
  if (theme !=  null) {
    Theme tt = new Theme();
    tt.setValue(theme);
    entry.setTheme(tt);
  }

  return service.insert(new URL(getSiteFeedUrl()), entry);
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:27,代码来源:SitesHelper.java

示例7: uploadWebAttachment

import com.google.gdata.data.PlainTextConstruct; //导入依赖的package包/类
/**
 * Creates a web attachment under the selected file cabinet.
 *
 * @param contentUrl The full URL of the hosted file.
 * @param filecabinet File cabinet to create the web attachment on.
 * @param title A title for the attachment.
 * @param description A description for the attachment.
 * @return The created web attachment.
 * @throws ServiceException
 * @throws IOException
 * @throws MalformedURLException
 */
public WebAttachmentEntry uploadWebAttachment(String contentUrl,
    FileCabinetPageEntry filecabinet, String title, String description)
    throws MalformedURLException, IOException, ServiceException {
  MediaContent content = new MediaContent();
  content.setUri(contentUrl);

  WebAttachmentEntry webAttachment = new WebAttachmentEntry();
  webAttachment.setTitle(new PlainTextConstruct(title));
  webAttachment.setSummary(new PlainTextConstruct(description));
  webAttachment.setContent(content);
  webAttachment.addLink(SitesLink.Rel.PARENT, Link.Type.ATOM,
      filecabinet.getSelfLink().getHref());

  return service.insert(new URL(getContentFeedUrl()), webAttachment);
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:28,代码来源:SitesHelper.java

示例8: updateWorksheet

import com.google.gdata.data.PlainTextConstruct; //导入依赖的package包/类
/**
 * Updates the worksheet specified by the oldTitle parameter, with the given
 * title and sizes. Note that worksheet titles are not unique, so this method
 * just updates the first worksheet it finds. Hey, it's just sample code - no
 * refunds!
 * 
 * @param oldTitle a String specifying the worksheet to update.
 * @param newTitle a String containing the new name for the worksheet.
 * @param rowCount the number of rows the new worksheet should have.
 * @param colCount the number of columns the new worksheet should have.
 * 
 * @throws ServiceException when the request causes an error in the Google
 *         Spreadsheets service.
 * @throws IOException when an error occurs in communication with the Google
 *         Spreadsheets service.
 */
private void updateWorksheet(String oldTitle, String newTitle, int rowCount,
    int colCount) throws IOException, ServiceException {
  WorksheetFeed worksheetFeed = service.getFeed(worksheetFeedUrl,
      WorksheetFeed.class);
  for (WorksheetEntry worksheet : worksheetFeed.getEntries()) {
    String currTitle = worksheet.getTitle().getPlainText();
    if (currTitle.equals(oldTitle)) {
      worksheet.setTitle(new PlainTextConstruct(newTitle));
      worksheet.setRowCount(rowCount);
      worksheet.setColCount(colCount);
      worksheet.update();
      System.out.println("Worksheet updated.");
      return;
    }
  }

  // If it got this far, the worksheet wasn't found.
  System.out.println("Worksheet not found: " + oldTitle);
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:36,代码来源:WorksheetDemo.java

示例9: createEntryFromArgs

import com.google.gdata.data.PlainTextConstruct; //导入依赖的package包/类
private GlossaryEntry createEntryFromArgs(String[] args)
    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;
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:25,代码来源:AddGlossaryCommand.java

示例10: testNormalRevision

import com.google.gdata.data.PlainTextConstruct; //导入依赖的package包/类
@Test
public void testNormalRevision() throws IOException {
  final BasePageEntry<?> revision = new WebPageEntry();
  revision.setTitle(new PlainTextConstruct("Title"));
  revision.setRevision(new Revision(3));
  revision.setId("http://revision");
  
  context.checking(new Expectations() {{
    oneOf (revisionRenderer).renderRevision(revision); 
        will(returnValue(new XmlElement("div")));
    oneOf (titleRenderer).renderTitle(revision);
        will(returnValue(new XmlElement("div")));
  }});
  
  revisionExporter.exportRevision(revision, out);
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:17,代码来源:RevisionExporterImplTest.java

示例11: testListPageRevision

import com.google.gdata.data.PlainTextConstruct; //导入依赖的package包/类
@Test
public void testListPageRevision() throws IOException {
  final ListPageEntry revision = new ListPageEntry();
  revision.setTitle(new PlainTextConstruct("Title"));
  revision.setRevision(new Revision(3));
  revision.setId("http://revision");
  
  context.checking(new Expectations() {{
    oneOf (revisionRenderer).renderRevision(revision); 
        will(returnValue(new XmlElement("div")));
    oneOf (titleRenderer).renderTitle(revision);
        will(returnValue(new XmlElement("div")));
    oneOf (listRenderer).renderList(revision, new ArrayList<ListItemEntry>());
        will(returnValue(new XmlElement("div")));
  }});
  
  revisionExporter.exportRevision(revision, out);
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:19,代码来源:RevisionExporterImplTest.java

示例12: prepareRemoteAlbum

import com.google.gdata.data.PlainTextConstruct; //导入依赖的package包/类
public AlbumEntry prepareRemoteAlbum(AlbumEntry albumEntry) throws IOException, ServiceException {

        // See if the AlbumEntry was valid remotely (i.e., it has an ID). If not, create it
        if ( albumEntry.getId() == null )
        {
                albumEntry.setDescription(new PlainTextConstruct("Automatically created by Picasync"));
                albumEntry = insertAlbum(albumEntry);

            if( albumEntry.getId() == null || albumEntry.getId().isEmpty()) {
                log.error("Unable to create new album: " + albumEntry.getTitle().getPlainText() );
                return null;
            }
        }

        return albumEntry;
    }
 
开发者ID:Webreaper,项目名称:GooglePhotoSync,代码行数:17,代码来源:PicasawebClient.java

示例13: run

import com.google.gdata.data.PlainTextConstruct; //导入依赖的package包/类
@Override
public void run() throws PccException {
    calendarEventEntry = new CalendarEventEntry();

    final String title = getTitle(booking.getProcess()
                    .getName());

    calendarEventEntry.setTitle(new PlainTextConstruct(title));

    final When eventTime = new When();
    final DateTime startDateTime =
            new DateTime(booking.getStartDateTime().getTime());
    final DateTime endDateTime =
            new DateTime(booking.getEndDateTime().getTime());

    eventTime.setStartTime(startDateTime);
    eventTime.setEndTime(endDateTime);

    calendarEventEntry.addTime(eventTime);
}
 
开发者ID:dpisarenko,项目名称:pcc-worker,代码行数:21,代码来源:DefaultBooking2CalendarEventEntryConverter.java

示例14: addNewWorksheet

import com.google.gdata.data.PlainTextConstruct; //导入依赖的package包/类
private void addNewWorksheet(SpreadsheetEntry spreadsheet, String worksheetId, int numberOfRows, int numberOfColumns) throws Throwable
{
    if (spreadsheet != null) {
        WorksheetEntry worksheet = new WorksheetEntry();
        worksheet.setTitle(new PlainTextConstruct(worksheetId));
        worksheet.setRowCount(numberOfRows);
        worksheet.setColCount(numberOfColumns);

        URL worksheetFeedUrl = spreadsheet.getWorksheetFeedUrl();
        spreadsheetService.insert(worksheetFeedUrl, worksheet);
    }
}
 
开发者ID:Netflix,项目名称:q,代码行数:13,代码来源:GoogleSheetsService.java

示例15: createEvent

import com.google.gdata.data.PlainTextConstruct; //导入依赖的package包/类
/**
 * Helper method to create either single-instance or recurring events. For
 * simplicity, some values that might normally be passed as parameters (such
 * as author name, email, etc.) are hard-coded.
 * 
 * @param service An authenticated CalendarService object.
 * @param eventTitle Title of the event to create.
 * @param eventContent Text content of the event to create.
 * @param recurData Recurrence value for the event, or null for
 *        single-instance events.
 * @param isQuickAdd True if eventContent should be interpreted as the text of
 *        a quick add event.
 * @param wc A WebContent object, or null if this is not a web content event.
 * @return The newly-created CalendarEventEntry.
 * @throws ServiceException If the service is unable to handle the request.
 * @throws IOException Error communicating with the server.
 */
private static CalendarEventEntry createEvent(CalendarService service,
    String eventTitle, String eventContent, String recurData,
    boolean isQuickAdd, WebContent wc) throws ServiceException, IOException {
  CalendarEventEntry myEntry = new CalendarEventEntry();

  myEntry.setTitle(new PlainTextConstruct(eventTitle));
  myEntry.setContent(new PlainTextConstruct(eventContent));
  myEntry.setQuickAdd(isQuickAdd);
  myEntry.setWebContent(wc);

  // If a recurrence was requested, add it. Otherwise, set the
  // time (the current date and time) and duration (30 minutes)
  // of the event.
  if (recurData == null) {
    Calendar calendar = new GregorianCalendar();
    DateTime startTime = new DateTime(calendar.getTime(), TimeZone
        .getDefault());

    calendar.add(Calendar.MINUTE, 30);
    DateTime endTime = new DateTime(calendar.getTime(), 
        TimeZone.getDefault());

    When eventTimes = new When();
    eventTimes.setStartTime(startTime);
    eventTimes.setEndTime(endTime);
    myEntry.addTime(eventTimes);
  } else {
    Recurrence recur = new Recurrence();
    recur.setValue(recurData);
    myEntry.setRecurrence(recur);
  }

  // Send the request and receive the response:
  return service.insert(eventFeedUrl, myEntry);
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:53,代码来源:EventFeedDemo.java


注:本文中的com.google.gdata.data.PlainTextConstruct类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。