Skip to content

Instantly share code, notes, and snippets.

@xcesco
Created May 14, 2018 22:26
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save xcesco/670f1053afa0d251abee1a2662f03970 to your computer and use it in GitHub Desktop.
@BindType("item")
@BindXmlType(namespaces={
@BindXmlNamespace(prefix="dc",uri="http://purl.org/dc/elements/1.1/"),
@BindXmlNamespace(prefix="content",uri="http://purl.org/dc/elements/1.1/"),
})
@BindSqlType(name = "articles")
public class Article extends Entity {
public String title;
public String description;
public URL link;
public String author;
@BindSqlColumn(nullable = false, columnType = ColumnType.UNIQUE)
public String guid;
public URL comments;
@BindSqlColumn(parentEntity = Channel.class)
public long channelId;
@Bind("thumbnail")
@BindXml(namespace="media")
public Thumbnail thumbnail;
public boolean read;
}
@BindType
@BindSqlType(name="channels")
public class Channel extends Entity {
public String title;
@BindSqlColumn(columnType = ColumnType.UNIQUE)
public String link;
public String description;
public String language;
public String copyright;
@BindAdapter(adapter = DateAdapter.class)
public Date pubDate;
@BindAdapter(adapter = DateAdapter.class)
public Date lastBuildDate;
public Image image;
@BindSqlColumn(parentEntity = RssFeed.class)
public long rssFeedId;
@Bind("item")
@BindSqlRelation(foreignKey = "channelId")
public List<Article> articles;
}
@BindType
public class Image {
public String url;
public String title;
public String link;
public int width = 88;
public int height = 31;
}
@BindType(value="rss")
public class RssFeed extends Entity {
@BindSqlColumn(columnType = ColumnType.UNIQUE)
public String uid;
@BindXml(xmlType = XmlType.ATTRIBUTE)
public String version;
@Bind("channel")
@BindSqlRelation(foreignKey = "rssFeedId")
public List<Channel> channels;
}
@BindType
public class Thumbnail {
@BindXml(xmlType = XmlType.ATTRIBUTE)
public long width;
@BindXml(xmlType = XmlType.ATTRIBUTE)
public long height;
@BindXml(xmlType = XmlType.ATTRIBUTE)
public URL url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment