package eu.dnetlib.domain.functionality;


public class CommunityRegistration {
	private int id = 0;
	private String communityId = null;
	private boolean alertOnChange = false;
	private Boolean includeInQueries = false;

	public boolean isAlertOnChange() {
		return alertOnChange;
	}

	public void setAlertOnChange(boolean alertOnChange) {
		this.alertOnChange = alertOnChange;
	}

	public String getCommunityId() {
		return communityId;
	}

	public void setCommunityId(String communityId) {
		this.communityId = communityId;
	}

	public Boolean getIncludeInQueries() {
		return includeInQueries;
	}

	public void setIncludeInQueries(Boolean includeInQueries) {
		this.includeInQueries = includeInQueries;
	}
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public boolean equals(Object o) {
		if (!(o instanceof CommunityRegistration))
			return false;
		else
			return equals((CommunityRegistration) o);
	}

	public boolean equals(CommunityRegistration comRegistration) {
		if ((this.communityId == null && comRegistration.getCommunityId() != null)
				|| (this.communityId != null && comRegistration
						.getCommunityId() == null)) {
			return false;
		}
		if (this.communityId != null
				&& comRegistration.getCommunityId() != null
				&& this.communityId.equals(comRegistration.getCommunityId())) {
			return false;
		}

		if (this.alertOnChange != comRegistration.isAlertOnChange()
				|| this.includeInQueries.booleanValue() != comRegistration
						.getIncludeInQueries().booleanValue()) {
			return false;
		}

		return true;
	}
}
