package org.wontovlab.model;

import org.wontovlab.model.TO.PropertyTO;

public class Property {
	private String name;
	private String value;
	private String propertyOntologyReference;
	
/*	public Property(String ontologyPropertyURI, String ontologyPropertyValue) {
		this.propertyOntologyReference = ontologyPropertyURI;
		this.value = ontologyPropertyValue;
	}*/
	
	public Property() {
		
	}
	
	public Property(PropertyTO propertyTO) {
		this.value = propertyTO.getValue();
		this.propertyOntologyReference = propertyTO.getPropertyOntologyReference();
		this.name = propertyTO.getName();
	}
	
	
	public Property(String name, String ontologyPropertyURI) {
		this.propertyOntologyReference = ontologyPropertyURI;
		this.name = name;
	}
	
	public Property(String name, String ontologyPropertyURI, String ontologyPropertyValue) {
		this.propertyOntologyReference = ontologyPropertyURI;
		this.value = ontologyPropertyValue;
		this.name = name;
	}
	

	
	
	
	public String getPropertyOntologyReference() {
		return propertyOntologyReference;
	}
	public void setPropertyOntologyReference(String propertyOntologyReference) {
		this.propertyOntologyReference = propertyOntologyReference;
	}

	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	public String getValue() {
		return value;
	}
	public void setValue(String value) {
		this.value = value;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (obj == null && this.propertyOntologyReference == null && this.value == null)
			return true;
		
		if (obj == null && this.propertyOntologyReference != null && this.value != null)
			return false;
		
		if (((Property) obj).getValue() == null && this.value == null &&
				((Property) obj).getPropertyOntologyReference().equals(this.propertyOntologyReference))
			return true;
		
		if (((Property) obj).getPropertyOntologyReference().equals(this.propertyOntologyReference) && 
				((Property) obj).getValue().equals(this.value))
			return true;
		
		return false;
			
	}
	
}
