@Override public void declareExtensions(ExtensionProfile extProfile) { if (extProfile.isDeclared(FileCabinetPageEntry.class)) { return; } super.declareExtensions(extProfile); extProfile.declare(FileCabinetPageEntry.class, new ExtensionDescription(FeedLink.class, new XmlNamespace("gd", "http://schemas.google.com/g/2005"), "feedLink", true, false, false)); new FeedLink().declareExtensions(extProfile); }
@Override public void generate(XmlWriter w, ExtensionProfile extProfile) throws IOException { generateStartElement(w, Namespaces.gNs, "comments", null, null); if (feedLink != null) { feedLink.generate(w, extProfile); } // Invoke ExtensionPoint. generateExtensions(w, extProfile); w.endElement(Namespaces.gNs, "comments"); }
@Override public void generate(XmlWriter w, ExtensionProfile extProfile) throws IOException { ArrayList<XmlWriter.Attribute> attrs = new ArrayList<XmlWriter.Attribute>(); if (rel != null) { attrs.add(new XmlWriter.Attribute("rel", rel)); } if (href != null) { attrs.add(new XmlWriter.Attribute("href", href)); } if (readOnly) { attrs.add(new XmlWriter.Attribute("readOnly", "true")); } if (countHint != null) { attrs.add(new XmlWriter.Attribute("countHint", countHint.toString())); } generateStartElement(w, Namespaces.gNs, "feedLink", attrs, null); if (feed != null) { ExtensionProfile nestedExtProfile = extProfile.getFeedLinkProfile(); if (nestedExtProfile == null) { nestedExtProfile = extProfile; } feed.generateAtom(w, nestedExtProfile); } // Invoke ExtensionPoint. generateExtensions(w, extProfile); w.endElement(Namespaces.gNs, "feedLink"); }
@Override public ElementHandler getChildHandler(String namespace, String localName, Attributes attrs) throws ParseException, IOException { if (namespace.equals(Namespaces.g)) { if (localName.equals("feedLink")) { feedLink = new FeedLink<BaseFeed<?, ?>>(); return feedLink.getHandler(extProfile, namespace, localName, attrs); } } return super.getChildHandler(namespace, localName, attrs); } }
@Override public void declareExtensions(ExtensionProfile extProfile) { super.declareExtensions(extProfile); ExtensionProfile ep = new ExtensionProfile(); new AclFeed().declareExtensions(ep); extProfile.declareFeedLinkProfile(ep); } }
/** * Declares the {@link ExtensionDescription} of each {@link Extension} * expected by the implementing {@link ExtensionPoint} in the target profile. */ @Override public void declareExtensions(ExtensionProfile extProfile) { super.declareExtensions(extProfile); extProfile.declareAdditionalNamespace(YouTubeNamespace.NS); ExtensionDescription feedLinkDescription = FeedLink.getDefaultDescription(); feedLinkDescription.setRepeatable(true); extProfile.declare(UserProfileEntry.class, feedLinkDescription); extProfile.declareArbitraryXmlExtension(ChannelEntry.class); } }
@Override protected void visitChildren(ExtensionVisitor ev) throws ExtensionVisitor.StoppedException { if (feed != null) { this.visitChild(ev, feed); } super.visitChildren(ev); }
/** * Gets the URL of the enclosed feed. * * This method works both in version 1 and 2. * * @return URL to the enclosed feed or {@code null} */ public String getFeedUrl() { if (getContent() instanceof OutOfLineContent) { return ((OutOfLineContent) getContent()).getUri(); } FeedLink<?> feedLink = getFeedLink(); if (feedLink != null) { return feedLink.getHref(); } return null; }
/** * Gets an estimate of how many entries can be found * in the enclosed feed. * * This method works both in version 1 and 2 * * @return an estimate of the number of entries in the * enclosed feed or {@code null} */ public Integer getCountHint() { YtCountHint countHint = getExtension(YtCountHint.class); if (countHint != null) { return countHint.getValue(); } FeedLink<?> feedLink = getFeedLink(); if (feedLink != null) { return feedLink.getCountHint(); } return null; }
@Override public ElementHandler getChildHandler(String namespace, String localName, Attributes attrs) throws ParseException, IOException { if (namespace.equals(Namespaces.g)) { if (localName.equals("feedLink")) { feedLink = new FeedLink<BaseFeed<?, ?>>(); return feedLink.getHandler(extProfile, namespace, localName, attrs); } } return super.getChildHandler(namespace, localName, attrs); } }
@Override public void declareExtensions(ExtensionProfile extProfile) { super.declareExtensions(extProfile); ExtensionProfile ep = new ExtensionProfile(); new RevisionFeed().declareExtensions(ep); extProfile.declareFeedLinkProfile(ep); } }
/** * Declares the {@link ExtensionDescription} of each {@link Extension} * expected by the implementing {@link ExtensionPoint} in the target profile. */ @Override public void declareExtensions(ExtensionProfile extProfile) { super.declareExtensions(extProfile); extProfile.declareAdditionalNamespace(YouTubeNamespace.NS); ExtensionDescription feedLinkDescription = FeedLink.getDefaultDescription(); feedLinkDescription.setRepeatable(true); extProfile.declare(UserProfileEntry.class, feedLinkDescription); extProfile.declareArbitraryXmlExtension(ChannelEntry.class); } }
@Override protected void visitChildren(ExtensionVisitor ev) throws ExtensionVisitor.StoppedException { if (feed != null) { this.visitChild(ev, feed); } super.visitChildren(ev); }
/** * Gets the URL of the enclosed feed. * * This method works both in version 1 and 2. * * @return URL to the enclosed feed or {@code null} */ public String getFeedUrl() { if (getContent() instanceof OutOfLineContent) { return ((OutOfLineContent) getContent()).getUri(); } FeedLink<?> feedLink = getFeedLink(); if (feedLink != null) { return feedLink.getHref(); } return null; }
/** * Gets an estimate of how many entries can be found * in the enclosed feed. * * This method works both in version 1 and 2 * * @return an estimate of the number of entries in the * enclosed feed or {@code null} */ public Integer getCountHint() { YtCountHint countHint = getExtension(YtCountHint.class); if (countHint != null) { return countHint.getValue(); } FeedLink<?> feedLink = getFeedLink(); if (feedLink != null) { return feedLink.getCountHint(); } return null; }
@Override public void declareExtensions(ExtensionProfile extProfile) { if (extProfile.isDeclared(FileCabinetPageEntry.class)) { return; } super.declareExtensions(extProfile); extProfile.declare(FileCabinetPageEntry.class, new ExtensionDescription(FeedLink.class, new XmlNamespace("gd", "http://schemas.google.com/g/2005"), "feedLink", true, false, false)); new FeedLink().declareExtensions(extProfile); }
@Override public ElementHandler getChildHandler(String namespace, String localName, Attributes attrs) throws ParseException, IOException { if (namespace.equals(Namespaces.g)) { if (localName.equals("feedLink")) { feedLink = new FeedLink<BaseFeed<?, ?>>(); return feedLink.getHandler(extProfile, namespace, localName, attrs); } } return super.getChildHandler(namespace, localName, attrs); } }
@Override public void generate(XmlWriter w, ExtensionProfile extProfile) throws IOException { ArrayList<XmlWriter.Attribute> attrs = new ArrayList<XmlWriter.Attribute>(); if (rel != null) { attrs.add(new XmlWriter.Attribute("rel", rel)); } if (href != null) { attrs.add(new XmlWriter.Attribute("href", href)); } if (readOnly) { attrs.add(new XmlWriter.Attribute("readOnly", "true")); } if (countHint != null) { attrs.add(new XmlWriter.Attribute("countHint", countHint.toString())); } generateStartElement(w, Namespaces.gNs, "feedLink", attrs, null); if (feed != null) { ExtensionProfile nestedExtProfile = extProfile.getFeedLinkProfile(); if (nestedExtProfile == null) { nestedExtProfile = extProfile; } feed.generateAtom(w, nestedExtProfile); } // Invoke ExtensionPoint. generateExtensions(w, extProfile); w.endElement(Namespaces.gNs, "feedLink"); }
@Override public void declareExtensions(ExtensionProfile extProfile) { super.declareExtensions(extProfile); ExtensionProfile ep = new ExtensionProfile(); new RevisionFeed().declareExtensions(ep); extProfile.declareFeedLinkProfile(ep); } }
/** * Declares an Extension. */ @Override public void declareExtensions(ExtensionProfile extensionProfile) { // An EmailList extension is required for each entry ExtensionDescription desc = EmailList.getDefaultDescription(); desc.setRequired(true); extensionProfile.declare(EmailListEntry.class, desc); // FeedLink extension is not repeatable by default. desc = FeedLink.getDefaultDescription(); desc.setRepeatable(true); extensionProfile.declare(EmailListEntry.class, desc); // Declare our "apps" namespace extensionProfile.declareAdditionalNamespace( com.google.gdata.data.appsforyourdomain.Namespaces.APPS_NAMESPACE); }