Refactor submit logic into gerrit-server

This change moves logic that was duplicated over the ssh command and the rpc
handler into a Submit class in gerrit-server.

Change-Id: I70cf5aa04d091e5652d8bc3e5a254339a80bd6fd
This commit is contained in:
Conley Owens
2012-01-20 17:15:05 -08:00
committed by Edwin Kempin
parent c5635f2131
commit 6ada0d28c8
6 changed files with 286 additions and 246 deletions

View File

@@ -52,25 +52,59 @@ public class ReviewResult {
ABANDON_NOT_PERMITTED,
/** Not permitted to restore this change. */
RESTORE_NOT_PERMITTED
RESTORE_NOT_PERMITTED,
/** Not permitted to submit this change. */
SUBMIT_NOT_PERMITTED,
/** Approvals or dependencies are lacking for submission. */
SUBMIT_NOT_READY,
/** Review operation invalid because change is closed. */
CHANGE_IS_CLOSED,
/** Review operation not permitted by rule. */
RULE_ERROR
}
protected Type type;
protected String message;
protected Error() {
}
public Error(final Type type) {
this.type = type;
this.message = null;
}
public Error(final Type type, final String message) {
this.type = type;
this.message = message;
}
public Type getType() {
return type;
}
public String getMessage() {
return message;
}
public String getMessageOrType() {
if (message != null) {
return message;
}
return "" + type;
}
@Override
public String toString() {
return type + "";
String ret = type + "";
if (message != null) {
ret += " " + message;
}
return ret;
}
}
}