Replace ApprovalTypes with LabelTypes

This refactoring happened in the core server so the plugin needs
to be updated to use the new API classes.

Change-Id: Ic3d1e7e9bfd4eab69ebc61a1eeeb4b2d92a576cf
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/CreateReviewNotes.java b/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/CreateReviewNotes.java
index 2041ee5..69457a9 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/CreateReviewNotes.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/CreateReviewNotes.java
@@ -36,8 +36,8 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.gerrit.common.data.ApprovalType;
-import com.google.gerrit.common.data.ApprovalTypes;
+import com.google.gerrit.common.data.LabelType;
+import com.google.gerrit.common.data.LabelTypes;
 import com.google.gerrit.reviewdb.client.ApprovalCategory;
 import com.google.gerrit.reviewdb.client.Change;
 import com.google.gerrit.reviewdb.client.PatchSet;
@@ -70,7 +70,7 @@
   private final PersonIdent gerritServerIdent;
   private final AccountCache accountCache;
   private final String anonymousCowardName;
-  private final ApprovalTypes approvalTypes;
+  private final LabelTypes labelTypes;
   private final NotesBranchUtil.Factory notesBranchUtilFactory;
   private final String canonicalWebUrl;
   private final ReviewDb reviewDb;
@@ -85,7 +85,7 @@
   CreateReviewNotes(@GerritPersonIdent final PersonIdent gerritIdent,
       final AccountCache accountCache,
       final @AnonymousCowardName String anonymousCowardName,
-      ApprovalTypes approvalTypes,
+      LabelTypes approvalTypes,
       final NotesBranchUtil.Factory notesBranchUtilFactory,
       final @Nullable @CanonicalWebUrl String canonicalWebUrl,
       final @Assisted ReviewDb reviewDb,
@@ -94,7 +94,7 @@
     this.gerritServerIdent = gerritIdent;
     this.accountCache = accountCache;
     this.anonymousCowardName = anonymousCowardName;
-    this.approvalTypes = approvalTypes;
+    this.labelTypes = approvalTypes;
     this.notesBranchUtilFactory = notesBranchUtilFactory;
     this.canonicalWebUrl = canonicalWebUrl;
     this.reviewDb = reviewDb;
@@ -222,9 +222,9 @@
       } else if (ApprovalCategory.SUBMIT.equals(a.getCategoryId())) {
         submit = a;
       } else {
-        ApprovalType type = approvalTypes.byId(a.getCategoryId());
+        LabelType type = labelTypes.byId(a.getCategoryId().get());
         if (type != null) {
-          fmt.appendApproval(type.getCategory(), a.getValue(),
+          fmt.appendApproval(type, a.getValue(),
               accountCache.get(a.getAccountId()).getAccount());
         }
       }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/HeaderFormatter.java b/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/HeaderFormatter.java
index 72a29d2..9d910f4 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/HeaderFormatter.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/HeaderFormatter.java
@@ -14,11 +14,6 @@
 
 package com.googlesource.gerrit.plugins.reviewnotes;
 
-import com.google.gerrit.reviewdb.client.Account;
-import com.google.gerrit.reviewdb.client.ApprovalCategory;
-import com.google.gerrit.reviewdb.client.Branch;
-import com.google.gerrit.reviewdb.client.Change;
-
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
@@ -26,6 +21,11 @@
 import java.util.Locale;
 import java.util.TimeZone;
 
+import com.google.gerrit.common.data.LabelType;
+import com.google.gerrit.common.data.LabelValue;
+import com.google.gerrit.reviewdb.client.Account;
+import com.google.gerrit.reviewdb.client.Change;
+
 /**
  * Formatters for code review note headers.
  * <p>
@@ -51,10 +51,10 @@
     sb.append("Change-Id: ").append(changeKey.get()).append("\n");
   }
 
-  void appendApproval(ApprovalCategory category,
-      short value, Account user) {
-    sb.append(category.getLabelName());
-    sb.append(value < 0 ? "-" : "+").append(Math.abs(value)).append(": ");
+	void appendApproval(LabelType label, short value, Account user) {
+    sb.append(label.getName());
+    sb.append(LabelValue.formatValue(value));
+    sb.append(": ");
     appendUserData(user);
     sb.append("\n");
   }