use of com.google.gerrit.server.data.ChangeAttribute in project gerrit by GerritCodeReview.
the class EventFactory method asChangeAttribute.
/**
* Create a ChangeAttribute for the given change suitable for serialization to JSON.
*
* @param db Review database
* @param change
* @return object suitable for serialization to JSON
*/
public ChangeAttribute asChangeAttribute(ReviewDb db, Change change) {
ChangeAttribute a = new ChangeAttribute();
a.project = change.getProject().get();
a.branch = change.getDest().getShortName();
a.topic = change.getTopic();
a.id = change.getKey().get();
a.number = change.getId().get();
a.subject = change.getSubject();
try {
a.commitMessage = changeDataFactory.create(db, change).commitMessage();
} catch (Exception e) {
log.error("Error while getting full commit message for change " + a.number);
}
a.url = getChangeUrl(change);
a.owner = asAccountAttribute(change.getOwner());
a.assignee = asAccountAttribute(change.getAssignee());
a.status = change.getStatus();
return a;
}
Aggregations