package org.openlmis.referencedata.domain;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

import javax.persistence.Embeddable;

/**
 * Represents a unique designation.
 */
@Embeddable
public class Code {
  private final String code;

  protected Code() {
    this.code = "";
  }

  private Code(String code) {
    this.code = code.replaceAll("\\s", "");
  }

  /**
   * ProductCode equality ignores whitespace and case.
   * @param object the ProductCode to test against.
   * @return true if both represent the same code, false otherwise.
   */
  @Override
  public final boolean equals(Object object) {
    if (null == object) {
      return false;
    }

    if (!(object instanceof Code)) {
      return false;
    }

    return this.code.equalsIgnoreCase(((Code) object).code);
  }

  @Override
  public final int hashCode() {
    return code.toUpperCase().hashCode();
  }

  @Override
  @JsonValue
  public String toString() {
    return code;
  }

  /**
   * Creates a new ProductCode value.
   * @param productCode the product's code
   * @return a new ProductCode with the given code.  Uses a blank code if given null.
   */
  @JsonCreator
  public static final Code code(String productCode) {
    String workingCode = (null == productCode) ? "" : productCode;
    return new Code(workingCode);
  }
}

@@ -422,23 +422,16 @@
 **%0A   * 
-Product
 Code equ
@@ -488,23 +488,16 @@
 ect the 
-Product
 Code to 
@@ -1014,31 +1014,24 @@
 eates a new 
-Product
 Code value.%0A
@@ -1046,33 +1046,16 @@
 ram 
-productCode the product's
+code the
  cod
@@ -1079,15 +1079,8 @@
 new 
-Product
 Code
@@ -1195,24 +1195,17 @@
 (String 
-productC
+c
 ode) %7B%0A 
@@ -1237,24 +1237,17 @@
 null == 
-productC
+c
 ode) ? %22
@@ -1254,16 +1254,9 @@
 %22 : 
-productC
+c
 ode;

Remove all references to product in the Code class