/** * Adds a new person description. * * @param whoList person description */ public MessageEntry addWhoList(Who whoList) { super.addElement(Who.KEY, whoList); return this; }
/** * Returns the {@link GdAttributes#ETAG} value for this feed. A value of * {@code null} indicates the value is unknown. */ public String getEtag() { return getAttributeValue(GdAttributes.ETAG); }
/** * Returns the rating. * * @return rating */ public Rating getRating() { return super.getElement(Rating.KEY); }
/** * Deletes this entry by sending a request to the associated GData service. * * @throws ServiceException If there is no associated GData service or the * service is unable to perform the deletion. * * @throws UnsupportedOperationException If deletion is not supported for the * target entry. * * @throws IOException If there is an error communicating with the GData * service. */ public void delete() throws IOException, ServiceException { if (state.service == null) { throw new ServiceException(CoreErrorDomain.ERR.entryNotAssociated); } Link editLink = getEditLink(); if (editLink == null) { throw new UnsupportedOperationException("Entry cannot be deleted"); } // Delete the entry, using strong etag (if available) as a precondition. URI editUrl = editLink.getHrefUri(); String etag = getEtag(); state.service.delete(editUrl, GDataProtocol.isWeakEtag(etag) ? null : etag); }
public DateTime getPublished() { return getElementValue(PUBLISHED); }
public void executeDelete(Entry entry) throws IOException { HttpRequest request = requestFactory.buildDeleteRequest(new GenericUrl(entry.getEditLink())); if (entry instanceof EventEntry) { request.headers.ifMatch = ((EventEntry) entry).etag; } request.execute().ignore(); }
public Link addLink(String rel, String type, String href) { try { Link link = new Link(rel, type, new URI(href)); addLink(link); return link; } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } }
/** * Narrows this entry using categories with an appropriate kind value. * This will loop through the categories, checking if they represent kinds, * and adapting the entry to that kind of an appropriate adaptation was * found. This will return the most specific subtype of the narrowed type * that could be found. */ @Override protected Element narrow(ElementMetadata<?, ?> metadata, ValidationContext vc) { Element narrowed = super.narrow(metadata, vc); for (Category category : getCategories()) { if (Namespaces.gKind.equals(category.getScheme())) { narrowed = adapt(narrowed, metadata, category.getTerm()); } } return narrowed; } }
/** * Draft status. * * @return True if draft status is set and equals true. */ public boolean isDraft() { Control control = getControl(); return (control != null && control.isDraft()); }
public Set<Category> getCategories() { return getElementSet(Category.KEY); }
/** * Assumes the content element's contents are text and returns them as a * TextContent. * * @return A TextContent containing the value of the content tag. * * @throws IllegalStateException If the content element is not a text type. */ public TextContent getTextContent() { Content content = getContent(); if (content == null) { return null; } if (!(content instanceof TextContent)) { throw new IllegalStateException("Content object is not a TextContent"); } return (TextContent) content; }
/** * Narrows this entry using categories with an appropriate kind value. This * will loop through the categories, checking if they represent kinds, and * adapting the entry to that kind of an appropriate adaptation was found. * This will return the most specific subtype of the narrowed type that could * be found. */ @Override protected Element narrow(ElementMetadata<?, ?> metadata, ValidationContext vc) { String term = Kinds.getElementKind(this); if (term != null) { return adapt(this, metadata, term); } return super.narrow(metadata, vc); } }
/** * Deletes this entry by sending a request to the associated GData service. * * @throws ServiceException If there is no associated GData service or the * service is unable to perform the deletion. * * @throws UnsupportedOperationException If deletion is not supported for the * target entry. * * @throws IOException If there is an error communicating with the GData * service. */ public void delete() throws IOException, ServiceException { if (state.service == null) { throw new ServiceException(CoreErrorDomain.ERR.entryNotAssociated); } Link editLink = getEditLink(); if (editLink == null) { throw new UnsupportedOperationException("Entry cannot be deleted"); } // Delete the entry, using strong etag (if available) as a precondition. URI editUrl = editLink.getHrefUri(); String etag = getEtag(); state.service.delete(editUrl, GDataProtocol.isWeakEtag(etag) ? null : etag); }
public DateTime getUpdated() { return getElementValue(UPDATED); }
CoreErrorDomain.ERR.entryNotAssociated); Link editLink = getEditLink(); if (editLink == null) { throw new UnsupportedOperationException("Entry cannot be updated");
public Link addLink(String rel, String type, String href) { try { Link link = new Link(rel, type, new URI(href)); addLink(link); return link; } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } }
/** * Draft status. * * @return True if draft status is set and equals true. */ public boolean isDraft() { Control control = getControl(); return (control != null && control.isDraft()); }
public Set<Category> getCategories() { return getElementSet(Category.KEY); }
/** * Assumes the content element's contents are text and returns them as a * TextContent. * * @return A TextContent containing the value of the content tag. * * @throws IllegalStateException If the content element is not a text type. */ public TextContent getTextContent() { Content content = getContent(); if (content == null) { return null; } if (!(content instanceof TextContent)) { throw new IllegalStateException("Content object is not a TextContent"); } return (TextContent) content; }
/** * Narrows this entry using categories with an appropriate kind value. This * will loop through the categories, checking if they represent kinds, and * adapting the entry to that kind of an appropriate adaptation was found. * This will return the most specific subtype of the narrowed type that could * be found. */ @Override protected Element narrow(ElementMetadata<?, ?> metadata, ValidationContext vc) { String term = Kinds.getElementKind(this); if (term != null) { return adapt(this, metadata, term); } return super.narrow(metadata, vc); } }