public String resolveEquals(DataObject dataObject, String indent) {

    StringBuilder head = new StringBuilder();
    // head.append(EOL);
    head.append(indent + "@Override" + EOL);
    head.append(indent + "public boolean equals(Object o) {" + EOL);
    head.append(indent + TAB + "if (this == o) return true;" + EOL);
    head.append(indent + TAB + "if (o == null || getClass() != o.getClass()) return false;" + EOL);
    head.append(
        indent
            + TAB
            + dataObject.getClassName()
            + " that = ("
            + dataObject.getClassName()
            + ")o;"
            + EOL);

    StringBuilder end = new StringBuilder();
    end.append(indent + "}");

    StringBuilder sb = new StringBuilder();
    Map<String, ObjectProperty> props = dataObject.getProperties();

    boolean hasTerms = false;
    if (props != null && props.size() > 0) {
      for (String propName : props.keySet()) {
        ObjectProperty prop = props.get(propName);
        String _propName = toJavaVar(propName);
        if (prop.getAnnotation(org.kie.api.definition.type.Key.class.getName()) != null) {
          // Construction: "if (<_propName> != null ? !<_propName>.equals(that.<_propName>) :
          // that.<_propName> != null) return false;"
          sb.append(indent + TAB + "if (");
          sb.append(_propName)
              .append(" != null ? !")
              .append(_propName)
              .append(".equals(that.")
              .append(_propName)
              .append(")");
          sb.append(" : that.").append(_propName).append(" != null").append(") return false;");
          sb.append(EOL);
          hasTerms = true;
        }
      }
    }

    if (hasTerms) {
      sb.append(indent + TAB + "return true;" + EOL);
      head.append(sb);
      head.append(end);
      return head.toString();
    } else {
      return "";
    }
  }
 public String resolveKeyFieldsConstructor(DataObject dataObject, String indent) {
   if (!dataObject.getProperties().isEmpty()) {
     List<ObjectProperty> sortedProperties = new ArrayList<ObjectProperty>();
     for (ObjectProperty property : dataObject.getProperties().values()) {
       if (property.getAnnotation(KeyAnnotationDefinition.getInstance().getClassName()) != null) {
         // the property is marked as key.
         sortedProperties.add(property);
       }
     }
     if (sortedProperties.size() > 0
         && sortedProperties.size() < dataObject.getProperties().size()) {
       return resolveConstructor(dataObject, sortByPosition(sortedProperties), indent);
     }
   }
   return "";
 }
  public String resolveHashCode(DataObject dataObject, String indent) {

    StringBuilder head = new StringBuilder();
    // head.append(EOL);
    head.append(indent + "@Override" + EOL);
    head.append(indent + "public int hashCode() {" + EOL);
    head.append(indent + TAB + "int result = 17;" + EOL);

    StringBuilder end = new StringBuilder();
    end.append(indent + "}");

    StringBuilder sb = new StringBuilder();
    Map<String, ObjectProperty> props = dataObject.getProperties();

    boolean hasTerms = false;
    if (props != null && props.size() > 0) {
      for (String propName : props.keySet()) {
        ObjectProperty prop = props.get(propName);
        String _propName = toJavaVar(propName);
        if (prop.getAnnotation(org.kie.api.definition.type.Key.class.getName()) != null) {
          // Construction: "result = 13 * result + (<_propName> != null ? <_propName>.hashCode() :
          // 0);"
          sb.append(indent + TAB + "result = 13 * result + (")
              .append(_propName)
              .append(" != null ? ")
              .append(_propName)
              .append(".hashCode() : 0);");
          sb.append(EOL);
          hasTerms = true;
        }
      }
    }

    if (hasTerms) {
      sb.append(indent + TAB + "return result;" + EOL);
      head.append(sb);
      head.append(end);
      return head.toString();
    } else {
      return "";
    }
  }