mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-17 02:31:14 +01:00
#8630 add the changeset endpoint getAll
This commit is contained in:
@@ -33,27 +33,20 @@
|
||||
|
||||
package sonia.scm.repository;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import sonia.scm.BasicPropertiesAware;
|
||||
import sonia.scm.Validateable;
|
||||
import sonia.scm.ModelObject;
|
||||
import sonia.scm.util.Util;
|
||||
import sonia.scm.util.ValidationUtil;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a changeset/commit of a repository.
|
||||
@@ -62,43 +55,58 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||
*/
|
||||
@XmlRootElement(name = "changeset")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class Changeset extends BasicPropertiesAware
|
||||
implements Validateable, Serializable
|
||||
{
|
||||
public class Changeset extends BasicPropertiesAware implements ModelObject {
|
||||
|
||||
/** Field description */
|
||||
private static final long serialVersionUID = -8373308448928993039L;
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
/**
|
||||
* The author of the changeset
|
||||
*/
|
||||
private Person author;
|
||||
|
||||
/**
|
||||
* Constructs a new instance of changeset.
|
||||
*
|
||||
* The name of the branches on which the changeset was committed.
|
||||
*/
|
||||
private List<String> branches;
|
||||
|
||||
/**
|
||||
* The date when the changeset was committed
|
||||
*/
|
||||
private Long date;
|
||||
|
||||
/**
|
||||
* The text of the changeset description
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* The changeset identification string
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* List of files changed by this changeset
|
||||
*/
|
||||
@XmlElement(name = "modifications")
|
||||
private Modifications modifications;
|
||||
|
||||
/**
|
||||
* parent changeset ids
|
||||
*/
|
||||
private List<String> parents;
|
||||
|
||||
/**
|
||||
* The tags associated with the changeset
|
||||
*/
|
||||
private List<String> tags;
|
||||
|
||||
public Changeset() {}
|
||||
|
||||
/**
|
||||
* Constructs a new instance of changeset.
|
||||
*
|
||||
*
|
||||
* @param id id of the changeset
|
||||
* @param date date of the changeset
|
||||
* @param author author of the changeset
|
||||
*/
|
||||
public Changeset(String id, Long date, Person author)
|
||||
{
|
||||
this(id, date, author, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new instance of changeset.
|
||||
*
|
||||
*
|
||||
* @param id id of the changeset
|
||||
* @param date date of the changeset
|
||||
* @param author author of the changeset
|
||||
* @param description description of the changeset
|
||||
*/
|
||||
public Changeset(String id, Long date, Person author, String description)
|
||||
{
|
||||
this.id = id;
|
||||
@@ -107,16 +115,6 @@ public class Changeset extends BasicPropertiesAware
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
*
|
||||
* @param obj
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
@@ -125,15 +123,14 @@ public class Changeset extends BasicPropertiesAware
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getClass() != obj.getClass())
|
||||
{
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Changeset other = (Changeset) obj;
|
||||
|
||||
//J-
|
||||
return Objects.equal(id, other.id)
|
||||
return Objects.equal(id, other.id)
|
||||
&& Objects.equal(date, other.date)
|
||||
&& Objects.equal(author, other.author)
|
||||
&& Objects.equal(description, other.description)
|
||||
@@ -195,7 +192,21 @@ public class Changeset extends BasicPropertiesAware
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Returns a timestamp of the creation date of the {@link Changeset}.
|
||||
*
|
||||
* @return a timestamp of the creation date of the {@link Changeset}
|
||||
*/
|
||||
public Long getCreationDate() {
|
||||
return getDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCreationDate(Long timestamp) {
|
||||
this.setDate(timestamp);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the author of the changeset.
|
||||
@@ -203,14 +214,13 @@ public class Changeset extends BasicPropertiesAware
|
||||
*
|
||||
* @return author of the changeset
|
||||
*/
|
||||
public Person getAuthor()
|
||||
{
|
||||
public Person getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the branches of the changeset. In the most cases a changeset is
|
||||
* only related to one branch, but in the case of receive hooks it is possible
|
||||
* Returns the branches of the changeset. In the most cases a changeset is
|
||||
* only related to one branch, but in the case of receive hooks it is possible
|
||||
* that a changeset is related to more than a branch.
|
||||
*
|
||||
*
|
||||
@@ -254,11 +264,27 @@ public class Changeset extends BasicPropertiesAware
|
||||
*
|
||||
* @return id of the changeset
|
||||
*/
|
||||
public String getId()
|
||||
{
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLastModified(Long timestamp) {
|
||||
this.setDate(timestamp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getLastModified() {
|
||||
return getCreationDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "Changeset";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the file modifications, which was done with this changeset.
|
||||
*
|
||||
@@ -321,8 +347,6 @@ public class Changeset extends BasicPropertiesAware
|
||||
&& (date != null);
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Sets the author of the changeset.
|
||||
*
|
||||
@@ -412,30 +436,4 @@ public class Changeset extends BasicPropertiesAware
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** The author of the changeset */
|
||||
private Person author;
|
||||
|
||||
/** The name of the branches on which the changeset was committed. */
|
||||
private List<String> branches;
|
||||
|
||||
/** The date when the changeset was committed */
|
||||
private Long date;
|
||||
|
||||
/** The text of the changeset description */
|
||||
private String description;
|
||||
|
||||
/** The changeset identification string */
|
||||
private String id;
|
||||
|
||||
/** List of files changed by this changeset */
|
||||
@XmlElement(name = "modifications")
|
||||
private Modifications modifications;
|
||||
|
||||
/** parent changeset ids */
|
||||
private List<String> parents;
|
||||
|
||||
/** The tags associated with the changeset */
|
||||
private List<String> tags;
|
||||
}
|
||||
|
||||
@@ -36,18 +36,16 @@ package sonia.scm.repository;
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import sonia.scm.Validateable;
|
||||
import sonia.scm.util.Util;
|
||||
import sonia.scm.util.ValidationUtil;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.io.Serializable;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* The {@link Person} (author) of a changeset.
|
||||
@@ -251,9 +249,11 @@ public class Person implements Validateable, Serializable
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** name of the person */
|
||||
/** mail address of the person */
|
||||
private String mail;
|
||||
|
||||
/** mail address of the person */
|
||||
/**
|
||||
* name of the person
|
||||
*/
|
||||
private String name;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ public class VndMediaType {
|
||||
public static final String GROUP = PREFIX + "group" + SUFFIX;
|
||||
public static final String REPOSITORY = PREFIX + "repository" + SUFFIX;
|
||||
public static final String PERMISSION = PREFIX + "permission" + SUFFIX;
|
||||
public static final String CHANGESET = PREFIX + "changeset" + SUFFIX;
|
||||
public static final String CHANGESET_COLLECTION = PREFIX + "changesetCollection" + SUFFIX;
|
||||
public static final String BRANCH = PREFIX + "branch" + SUFFIX;
|
||||
public static final String USER_COLLECTION = PREFIX + "userCollection" + SUFFIX;
|
||||
public static final String GROUP_COLLECTION = PREFIX + "groupCollection" + SUFFIX;
|
||||
|
||||
Reference in New Issue
Block a user