summaryrefslogtreecommitdiffstats
path: root/src/com/gitblit/wicket/models/RefModel.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2011-04-04 09:10:51 -0400
committerJames Moger <james.moger@gitblit.com>2011-04-04 09:10:51 -0400
commit5fe7df81eb38dc66f2cfc4bf1973863a19f55cf2 (patch)
tree3f1b1b3f953aa8a5ed60e149043598fbdaf4d42f /src/com/gitblit/wicket/models/RefModel.java
downloadgitblit-5fe7df81eb38dc66f2cfc4bf1973863a19f55cf2.tar.gz
gitblit-5fe7df81eb38dc66f2cfc4bf1973863a19f55cf2.zip
Initial import of Git:Blit.
Change-Id: Ifce000c85c8947c3a768e782c841e41a8953d314
Diffstat (limited to 'src/com/gitblit/wicket/models/RefModel.java')
-rw-r--r--src/com/gitblit/wicket/models/RefModel.java54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/com/gitblit/wicket/models/RefModel.java b/src/com/gitblit/wicket/models/RefModel.java
new file mode 100644
index 00000000..e76b489d
--- /dev/null
+++ b/src/com/gitblit/wicket/models/RefModel.java
@@ -0,0 +1,54 @@
+package com.gitblit.wicket.models;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import org.eclipse.jgit.lib.ObjectId;
+import org.eclipse.jgit.lib.Ref;
+import org.eclipse.jgit.revwalk.RevCommit;
+
+import com.gitblit.utils.JGitUtils;
+
+
+public class RefModel implements Serializable, Comparable<RefModel> {
+
+ private static final long serialVersionUID = 1L;
+ final String displayName;
+ transient Ref ref;
+ final RevCommit commit;
+
+ public RefModel(String displayName, Ref ref, RevCommit commit) {
+ this.displayName = displayName;
+ this.ref = ref;
+ this.commit = commit;
+ }
+
+ public Date getDate() {
+ return JGitUtils.getCommitDate(commit);
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public String getName() {
+ return ref.getName();
+ }
+
+ public ObjectId getCommitId() {
+ return commit.getId();
+ }
+
+ public String getShortLog() {
+ return commit.getShortMessage();
+ }
+
+ public ObjectId getObjectId() {
+ return ref.getObjectId();
+ }
+
+ @Override
+ public int compareTo(RefModel o) {
+ return getDate().compareTo(o.getDate());
+ }
+} \ No newline at end of file