package fr.univnantes.atal.web.trashnao.model;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable
public class Notification {

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Address address;
    @Persistent
    private NotificationTransport transport;
    @Persistent
    private boolean notifyOnYellowDay;
    @Persistent
    private boolean notifyOnBlueDayblue;

    public Address getAddress() {
        return address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }

    public NotificationTransport getTransport() {
        return transport;
    }

    public void setTransport(NotificationTransport transport) {
        this.transport = transport;
    }

    public boolean isNotifyOnYellowDay() {
        return notifyOnYellowDay;
    }

    public void setNotifyOnYellowDay(boolean notifyOnYellowDay) {
        this.notifyOnYellowDay = notifyOnYellowDay;
    }

    public boolean isNotifyOnBlueDayblue() {
        return notifyOnBlueDayblue;
    }

    public void setNotifyOnBlueDayblue(boolean notifyOnBlueDayblue) {
        this.notifyOnBlueDayblue = notifyOnBlueDayblue;
    }
}

@@ -41,16 +41,126 @@
 model;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.Collection;%0Aimport java.util.Collections;%0Aimport java.util.List;%0A
 import j
@@ -517,16 +517,21 @@
 private 
+List%3C
 Notifica
@@ -543,26 +543,29 @@
 ransport
- transport
+%3E onYellowDay
 ;%0A    @P
@@ -590,91 +590,161 @@
 ate 
-boolean notifyOnYellow
+List%3CNotificationTransport%3E onBlue
 Day;%0A
+%0A
     
-@Persistent%0A    private boolean notifyOnBlueDayblue;
+public Notification() %7B%0A        onBlueDay = new ArrayList%3C%3E();%0A        onYellowDay = new ArrayList%3C%3E();%0A    %7D
 %0A%0A  
@@ -894,32 +894,62 @@
   %7D%0A%0A    public 
+void addNotificationOnBlueDay(
 NotificationTran
@@ -958,20 +958,17 @@
 ort 
-getT
+t
 ransport
 () %7B
@@ -963,17 +963,16 @@
 ransport
-(
 ) %7B%0A    
@@ -975,23 +975,80 @@
         
-return 
+if (!onBlueDay.contains(transport)) %7B%0A            onBlueDay.add(
 transpor
@@ -1040,34 +1040,45 @@
 ay.add(transport
+)
 ;%0A
+        %7D%0A
     %7D%0A%0A    publi
@@ -1088,20 +1088,34 @@
 oid 
-setTransport
+addNotificationOnYellowDay
 (Not
@@ -1158,25 +1158,76 @@
     
-this.transport = 
+if (!onYellowDay.contains(transport)) %7B%0A            onYellowDay.add(
 tran
@@ -1235,225 +1235,281 @@
 port
+)
 ;%0A    
+ 
-%7D%0A%0A    public boolean isNotifyOnYellowDay() %7B%0A        return notifyOnYellowDay;%0A    %7D%0A%0A    public void setNotifyOnYellowDay(boolean notifyOnYellowDay) %7B%0A        this.notifyOnYellowDay = notifyOnYellowDay
+   %7D%0A    %7D%0A    %0A    public void removeNotificationOnBlueDay(NotificationTransport transport) %7B%0A        onBlueDay.remove(transport);%0A    %7D%0A%0A    public void removeNotificationOnYellowDay(NotificationTransport transport) %7B%0A        onYellowDay.remove(transport)
 ;%0A    %7D%0A
 %0A   
@@ -1496,32 +1496,36 @@
 ansport);%0A    %7D%0A
+    
 %0A    public bool
@@ -1524,24 +1524,58 @@
 lic 
-boolean isNotify
+Collection%3CNotificationTransport%3E getNotifications
 OnBl
@@ -1579,20 +1579,16 @@
 nBlueDay
-blue
 () %7B%0A   
@@ -1599,31 +1599,60 @@
  return 
-notifyO
+Collections.unmodifiableCollection(o
 nBlueDay
 blue;%0A  
@@ -1643,28 +1643,25 @@
 nBlueDay
-blue
+)
 ;%0A    %7D%0A
 %0A    pub
@@ -1644,32 +1644,36 @@
 BlueDay);%0A    %7D%0A
+    
 %0A    public void
@@ -1672,121 +1672,136 @@
 lic 
-void setNotifyOnBlueDayblue(boolean notifyOnBlueDayblue) %7B%0A        this.notifyOnBlueDayblue = notifyOnBlueDayblue
+Collection%3CNotificationTransport%3E getNotificationsOnYellowDay() %7B%0A        return Collections.unmodifiableCollection(onYellowDay)
 ;%0A  

make the notification model sensible (or more sensible) regarding the data we're modelling