package bl;

import java.util.UUID;

import dl.Dto;

public class Gadget implements Dto<Gadget> {
	
	public enum Condition {NEW, GOOD, DAMAGED, WASTE, LOST }		
	private final String inventoryNumber;	
	private Condition condition;
	private double price;
	private String manufacturer;
	private String name;
	
	public Gadget(String name) {
		this.name = name;
		inventoryNumber = ""+Math.abs(UUID.randomUUID().getMostSignificantBits());
		condition = Condition.NEW;
	}

 
	public Condition getCondition() {
		return condition;
	}

	public void setCondition(Condition condition) {
		this.condition = condition;
	}

	public String getInventoryNumber() {
		return inventoryNumber;
	}


	public double getPrice() {
		return price;
	}


	public void setPrice(double price) {
		this.price = price;
	}


	public String getManufacturer() {
		return manufacturer;
	}


	public void setManufacturer(String manufacturer) {
		this.manufacturer = manufacturer;
	}


	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}
	
	 
	@Override
	public void setData(Gadget gadget)
	{
		this.setCondition(gadget.getCondition());
		this.setManufacturer(gadget.getManufacturer());
		this.setName(gadget.getName());
		this.setPrice(gadget.getPrice());		
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((inventoryNumber == null) ? 0 : inventoryNumber.hashCode());
		return result;
	}


	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Gadget other = (Gadget) obj;
		if (inventoryNumber == null) {
			if (other.inventoryNumber != null)
				return false;
		} else if (!inventoryNumber.equals(other.inventoryNumber))
			return false;
		return true;
	}
}

@@ -31,16 +31,46 @@
 l.UUID;%0D
+%0Aimport java.util.Observable;%0D
 %0A%0D%0Aimpor
@@ -82,16 +82,18 @@
 Dto;%0D%0A%0D%0A
+%0D%0A
 public c
@@ -104,16 +104,35 @@
  Gadget 
+extends Observable 
 implemen
@@ -145,17 +145,16 @@
 %3CGadget%3E
- 
 %7B%0D%0A%09%0D%0A%09p
@@ -1388,18 +1388,31 @@
 rice());
-%09%09
+%0D%0A%09%09doNotify();
 %0D%0A%09%7D%0D%0A%0D%0A
@@ -2019,11 +2019,93 @@
 e;%0D%0A%09%7D%0D%0A
+%09%0D%0A%09public void doNotify()%7B%0D%0A%09%09this.setChanged();%0D%0A%09%09this.notifyObservers();%0D%0A%09%7D%0D%0A
 %7D%0D%0A

Update Gadget.java