@Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }

    if (!(obj instanceof BudgetItem)) {
      return false;
    }

    BudgetItem budgetItem = (BudgetItem) obj;

    long primaryKey = budgetItem.getPrimaryKey();

    if (getPrimaryKey() == primaryKey) {
      return true;
    } else {
      return false;
    }
  }
  @Override
  public int compareTo(BudgetItem budgetItem) {
    long primaryKey = budgetItem.getPrimaryKey();

    if (getPrimaryKey() < primaryKey) {
      return -1;
    } else if (getPrimaryKey() > primaryKey) {
      return 1;
    } else {
      return 0;
    }
  }
  /**
   * Converts the soap model instance into a normal model instance.
   *
   * @param soapModel the soap model instance to convert
   * @return the normal model instance
   */
  public static BudgetItem toModel(BudgetItemSoap soapModel) {
    if (soapModel == null) {
      return null;
    }

    BudgetItem model = new BudgetItemImpl();

    model.setBudgetItemId(soapModel.getBudgetItemId());
    model.setGroupId(soapModel.getGroupId());
    model.setCompanyId(soapModel.getCompanyId());
    model.setUserId(soapModel.getUserId());
    model.setUserName(soapModel.getUserName());
    model.setCreateDate(soapModel.getCreateDate());
    model.setModifiedDate(soapModel.getModifiedDate());
    model.setBudgetId(soapModel.getBudgetId());
    model.setAccountItemId(soapModel.getAccountItemId());
    model.setAccountItemName(soapModel.getAccountItemName());
    model.setItemCode(soapModel.getItemCode());
    model.setBudgetTotal(soapModel.getBudgetTotal());
    model.setBudgetUsed(soapModel.getBudgetUsed());

    return model;
  }