Replace ChangeJson.ChangeInfo with extensions.common.ChangeInfo

These have essentially the same public fields, except for a few that
were not previously exposed through ChangeApiImpl for no good reason.

The most invasive change this requires is to hold on to the
SubmitRecord.Label.Status value during label initialization in
ChangeJson, which we now do by holding a pair of (LabelInfo, Status).
This is an implementation detail of ChangeJson, so does not need to
leak into the ChangeInfo class.

Additionally, although we can kill most of ChangeInfoMapper, we still
need the mapping of Change.Status to ChangeStatus, to avoid exposing
an internal implementation detail of the database storage layer to the
extension API.

Change-Id: I20f78ed0bd893560bce1b55d47583d6cba3e3fb2
This commit is contained in:
Dave Borowitz
2014-11-25 13:39:35 -05:00
committed by David Pursehouse
parent f74f440635
commit bc485ee2fc
28 changed files with 174 additions and 297 deletions

View File

@@ -36,7 +36,6 @@ import com.google.gerrit.server.ChangeUtil;
import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.GerritPersonIdent;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.api.changes.ChangeInfoMapper;
import com.google.gerrit.server.events.CommitReceivedEvent;
import com.google.gerrit.server.git.GitRepositoryManager;
import com.google.gerrit.server.git.MergeUtil;
@@ -107,7 +106,7 @@ public class CreateChange implements
}
@Override
public Response<ChangeJson.ChangeInfo> apply(TopLevelResource parent,
public Response<ChangeInfo> apply(TopLevelResource parent,
ChangeInfo input) throws AuthException, OrmException,
BadRequestException, UnprocessableEntityException, IOException,
InvalidChangeOperationException, ResourceNotFoundException {
@@ -200,7 +199,8 @@ public class CreateChange implements
updateRef(git, rw, c, change, ins.getPatchSet());
change.setTopic(input.topic);
change.setStatus(ChangeInfoMapper.changeStatus2Status(input.status));
change.setStatus(input.status != null
? Change.Status.forChangeStatus(input.status) : Change.Status.NEW);
ins.insert();
return Response.created(json.format(change.getId()));