本文整理汇总了Java中com.google.gdata.data.Person类的典型用法代码示例。如果您正苦于以下问题:Java Person类的具体用法?Java Person怎么用?Java Person使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Person类属于com.google.gdata.data包,在下文中一共展示了Person类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeUpdatingComment
import com.google.gdata.data.Person; //导入依赖的package包/类
/**
* Creates a comment that updates an existing issue.
*/
protected IssueCommentsEntry makeUpdatingComment() {
Person author = new Person();
author.setName(username);
// Create issue updates
Updates updates = new Updates();
updates.setSummary(new Summary("New issue summary"));
updates.setStatus(new Status("Accepted"));
updates.setOwnerUpdate(new OwnerUpdate(username));
updates.addLabel(new Label("-Priority-High"));
updates.addLabel(new Label("Priority-Low"));
updates.addLabel(new Label("-Milestone-2009"));
updates.addLabel(new Label("Milestone-2010"));
updates.addLabel(new Label("Type-Enhancement"));
updates.addCcUpdate(new CcUpdate("-" + username));
// Create issue comment entry
IssueCommentsEntry entry = new IssueCommentsEntry();
entry.getAuthors().add(author);
entry.setContent(new HtmlTextConstruct("some comment"));
entry.setUpdates(updates);
entry.setSendEmail(new SendEmail("False"));
return entry;
}
示例2: makeClosingComment
import com.google.gdata.data.Person; //导入依赖的package包/类
/**
* Creates a comment that closes an issue by setting Status to "Fixed".
*/
protected IssueCommentsEntry makeClosingComment() {
Person author = new Person();
author.setName(username);
// Set the Status as Fixed
Updates updates = new Updates();
updates.setStatus(new Status("Fixed"));
// Create issue comment entry
IssueCommentsEntry entry = new IssueCommentsEntry();
entry.getAuthors().add(author);
entry.setContent(new HtmlTextConstruct("This was fixed last week."));
entry.setUpdates(updates);
entry.setSendEmail(new SendEmail("False"));
return entry;
}
示例3: parseHCard
import com.google.gdata.data.Person; //导入依赖的package包/类
private void parseHCard(Element element, Person author) {
NodeList nodeList = element.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Node node = nodeList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
Element child = (Element) node;
if (hasClass(child, "fn")) {
author.setName(child.getTextContent());
String href = child.getAttribute("href");
if (href.startsWith("mailto:") && (author.getEmail() == null)) {
author.setEmail(href.substring(7));
}
} else if (hasClass(child, "n")) {
author.setName(child.getTextContent());
} else if (hasClass(child, "email")) {
author.setEmail(child.getTextContent());
} else {
parseHCard(child, author);
}
}
}
}
示例4: Recipe
import com.google.gdata.data.Person; //导入依赖的package包/类
/**
* Creates a recipe out of a GoogleBaseEntry.
*
* @param entry an entry that represents a recipe
*/
public Recipe(GoogleBaseEntry entry) {
id = extractIdFromUrl(entry.getId());
title = entry.getTitle().getPlainText();
url = entry.getHtmlLink().getHref();
String description = null;
if (entry.getContent() != null) {
Content content = entry.getContent();
if (content instanceof TextContent) {
description = ((TextContent)content).getContent().getPlainText();
} else if (content instanceof OtherContent) {
description = ((OtherContent)content).getText();
}
}
this.description = description;
mainIngredient = new HashSet<String>(entry.getGoogleBaseAttributes().
getTextAttributeValues(MAIN_INGREDIENT_ATTRIBUTE));
cuisine = new HashSet<String>(entry.getGoogleBaseAttributes().
getTextAttributeValues(CUISINE_ATTRIBUTE));
cookingTime = entry.getGoogleBaseAttributes().
getIntUnitAttribute(COOKING_TIME_ATTRIBUTE);
postedOn = entry.getPublished();
// if an entry has no author specified, will set it to empty string
List<Person> authors = entry.getAuthors();
postedBy = (authors.isEmpty() ? AUTHOR_UNKNOWN : authors.get(0).getName());
}
示例5: makeNewIssue
import com.google.gdata.data.Person; //导入依赖的package包/类
/**
* Creates a new issue that can be inserted to the issues feed.
*/
protected IssuesEntry makeNewIssue() {
Person author = new Person();
author.setName(username);
Owner owner = new Owner();
owner.setUsername(new Username(username));
Cc cc = new Cc();
cc.setUsername(new Username(username));
IssuesEntry entry = new IssuesEntry();
entry.getAuthors().add(author);
// Uncomment the following line to set the owner along with issue creation.
// It's intentionally commented out so we can demonstrate setting the owner
// field using setOwnerUpdate() as shown in makeUpdatingComment() below.
// entry.setOwner(owner);
entry.setContent(new HtmlTextConstruct("issue description"));
entry.setTitle(new PlainTextConstruct("issue summary"));
entry.setStatus(new Status("New"));
entry.addLabel(new Label("Priority-High"));
entry.addLabel(new Label("Milestone-2009"));
entry.addCc(cc);
entry.setSendEmail(new SendEmail("False"));
return entry;
}
示例6: makePlainComment
import com.google.gdata.data.Person; //导入依赖的package包/类
/**
* Creates a comment without any updates.
*/
protected IssueCommentsEntry makePlainComment() {
Person author = new Person();
author.setName(username);
// Create issue comment entry
IssueCommentsEntry entry = new IssueCommentsEntry();
entry.getAuthors().add(author);
entry.setContent(new HtmlTextConstruct("Some comment"));
entry.setSendEmail(new SendEmail("False"));
return entry;
}
示例7: getModifyingUser
import com.google.gdata.data.Person; //导入依赖的package包/类
/**
* @return the user who modified the document/created the revision
*/
public Person getModifyingUser() {
if (getAuthors().size() > 0) {
return getAuthors().get(0);
}
return null;
}
示例8: declareExtensions
import com.google.gdata.data.Person; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public void declareExtensions(ExtensionProfile extProfile) {
declare(extProfile, GphotoId.getDefaultDescription(false, false));
declare(extProfile, GphotoType.getDefaultDescription(false, false));
extProfile.declareArbitraryXmlExtension(extClass);
// Declare that the person extension point can have user, nick, or thumb.
extProfile.declare(Person.class,
GphotoUsername.getDefaultDescription(false, false));
extProfile.declare(Person.class,
GphotoNickname.getDefaultDescription(false, false));
extProfile.declare(Person.class,
GphotoThumbnail.getDefaultDescription(false, false));
}
示例9: parseAuthor
import com.google.gdata.data.Person; //导入依赖的package包/类
@Override
public Person parseAuthor(Element element) {
checkNotNull(element);
Person author = new Person();
parseElement(element, author);
return author;
}
示例10: parseElement
import com.google.gdata.data.Person; //导入依赖的package包/类
/**
* Parses the given element and populates the given Person object accordingly.
*/
private void parseElement(Element element, Person author) {
NodeList nodeList = element.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Node node = nodeList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
Element child = (Element) node;
if (hasClass(child, "vcard")) {
parseHCard(child, author);
} else {
parseElement(child, author);
}
}
}
}
示例11: testUnusualStructure
import com.google.gdata.data.Person; //导入依赖的package包/类
@Test
public void testUnusualStructure() {
final Element entryElement = document.createElement("div");
entryElement.setAttribute("class", "hentry announcementspage");
final Element row = document.createElement("tr");
final Element cell = document.createElement("td");
final Element authorElement = document.createElement("span");
authorElement.setAttribute("class", "vcard");
cell.appendChild(authorElement);
row.appendChild(cell);
final Element contentElement = document.createElement("td");
contentElement.setAttribute("class", "entry-content");
row.appendChild(contentElement);
entryElement.appendChild(document.createElement("table").appendChild(row));
final Element titleElement = document.createElement("h3");
titleElement.setAttribute("class", "entry-title");
entryElement.appendChild(document.createElement("b")
.appendChild(document.createElement("i").appendChild(titleElement)));
final Person author = context.mock(Person.class);
final Content content = context.mock(Content.class);
final TextConstruct title = context.mock(TextConstruct.class);
context.checking(new Expectations() {{
oneOf (authorParser).parseAuthor(authorElement);
will(returnValue(author));
oneOf (contentParser).parseContent(contentElement);
will(returnValue(content));
oneOf (titleParser).parseTitle(titleElement);
will(returnValue(title));
}});
BaseContentEntry<?> entry = entryParser.parseEntry(entryElement);
assertTrue(EntryType.getType(entry) == EntryType.ANNOUNCEMENTS_PAGE);
assertEquals(author, entry.getAuthors().get(0));
assertEquals(content, entry.getContent());
assertEquals(title, entry.getTitle());
}
示例12: testGetAuthorElement
import com.google.gdata.data.Person; //导入依赖的package包/类
@Test
public void testGetAuthorElement() {
Person author = new Person();
author.setName("Ben Simon");
author.setEmail("[email protected]");
BaseContentEntry<?> entry = new WebPageEntry();
entry.getAuthors().add(author);
XmlElement element = RendererUtils.getAuthorElement(entry);
assertEquals("<span class=\"author\"><span class=\"vcard\"><a class=\"fn\" href=\"" +
"mailto:[email protected]\">Ben Simon</a></span></span>", element.toString());
}
示例13: YoutubeAccount
import com.google.gdata.data.Person; //导入依赖的package包/类
public YoutubeAccount(Person user) {
if (user == null)
return;
//Id
setId(Sources.YOUTUBE + "#" + user.getName());
//The name of the user
username = user.getName();
source = Sources.YOUTUBE;
//The link to the user's profile
pageUrl = user.getUri();
}
示例14: YoutubeStreamUser
import com.google.gdata.data.Person; //导入依赖的package包/类
public YoutubeStreamUser(Person user) {
super(SocialNetworkSource.Youtube.toString(), Operation.NEW);
if (user == null) return;
//Id
id = SocialNetworkSource.Youtube+"#"+user.getName();
//The id of the user in the network
userid = user.getName();
//The name of the user
username = user.getName();
//streamId
streamId = SocialNetworkSource.Youtube.toString();
//The link to the user's profile
linkToProfile = user.getUri();
}
示例15: createPost
import com.google.gdata.data.Person; //导入依赖的package包/类
/**
* Creates a new post on a blog. The new post can be stored as a draft or
* published based on the value of the isDraft paramter. The method creates an
* Entry for the new post using the title, content, authorName and isDraft
* parameters. Then it uses the given GoogleService to insert the new post. If
* the insertion is successful, the added post will be returned.
*
* @param myService An authenticated GoogleService object.
* @param title Text for the title of the post to create.
* @param content Text for the content of the post to create.
* @param authorName Display name of the author of the post.
* @param userName username of the author of the post.
* @param isDraft True to save the post as a draft, False to publish the post.
* @return An Entry containing the newly-created post.
* @throws ServiceException If the service is unable to handle the request.
* @throws IOException If the URL is malformed.
*/
public static Entry createPost(BloggerService myService, String title,
String content, String authorName, String userName, Boolean isDraft)
throws ServiceException, IOException {
// Create the entry to insert
Entry myEntry = new Entry();
myEntry.setTitle(new PlainTextConstruct(title));
myEntry.setContent(new PlainTextConstruct(content));
Person author = new Person(authorName, null, userName);
myEntry.getAuthors().add(author);
myEntry.setDraft(isDraft);
// Ask the service to insert the new entry
URL postUrl = new URL(feedUri + POSTS_FEED_URI_SUFFIX);
return myService.insert(postUrl, myEntry);
}