mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-17 01:31:01 +00:00
Initial implementation of NotificationPreferences
This commit is contained in:
1 parent
d8118553c8
commit
ac2b198709
5 files changed
+185
No files matched your search
+41
@@ -0,0 +1,41 @@
|
||||
package com.sap.sailing.domain.common.preferences;
|
||||
|
||||
import com.sap.sse.common.settings.generic.AbstractGenericSerializableSettings;
|
||||
import com.sap.sse.common.settings.generic.BooleanSetting;
|
||||
import com.sap.sse.common.settings.generic.StringSetting;
|
||||
|
||||
public class BoatClassNotificationPreference extends AbstractGenericSerializableSettings {
|
||||
private static final long serialVersionUID = -6510535362114348707L;
|
||||
|
||||
private transient StringSetting boatClassName;
|
||||
private transient BooleanSetting notifyAboutUpcomingRaces;
|
||||
private transient BooleanSetting notifyAboutResults;
|
||||
|
||||
public BoatClassNotificationPreference() {
|
||||
}
|
||||
|
||||
public BoatClassNotificationPreference(String boatClassName, boolean notifyAboutRaces, boolean notifyAboutResults) {
|
||||
this.boatClassName.setValue(boatClassName);
|
||||
this.notifyAboutUpcomingRaces.setValue(notifyAboutRaces);
|
||||
this.notifyAboutResults.setValue(notifyAboutResults);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addChildSettings() {
|
||||
boatClassName = new StringSetting("boatClassName", this);
|
||||
notifyAboutUpcomingRaces = new BooleanSetting("notifyAboutUpcomingRaces", this, false);
|
||||
notifyAboutResults = new BooleanSetting("notifyAboutResults", this, false);
|
||||
}
|
||||
|
||||
public String getBoatClassName() {
|
||||
return boatClassName.getValue();
|
||||
}
|
||||
|
||||
public boolean isNotifyAboutUpcomingRaces() {
|
||||
return Boolean.TRUE.equals(notifyAboutUpcomingRaces.getValue());
|
||||
}
|
||||
|
||||
public boolean isNotifyAboutResults() {
|
||||
return Boolean.TRUE.equals(notifyAboutResults.getValue());
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.sap.sailing.domain.common.preferences;
|
||||
|
||||
import com.sap.sse.common.settings.generic.AbstractGenericSerializableSettings;
|
||||
import com.sap.sse.common.settings.generic.SettingsFactory;
|
||||
import com.sap.sse.common.settings.generic.SettingsList;
|
||||
|
||||
public class BoatClassNotificationPreferences extends AbstractGenericSerializableSettings {
|
||||
private static final long serialVersionUID = -3682996540081614053L;
|
||||
|
||||
private transient SettingsList<BoatClassNotificationPreference> boatClasses;
|
||||
|
||||
public BoatClassNotificationPreferences() {
|
||||
}
|
||||
|
||||
public BoatClassNotificationPreferences(String name, AbstractGenericSerializableSettings settings) {
|
||||
super(name, settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addChildSettings() {
|
||||
boatClasses = new SettingsList<>("boatClasses", this, new SettingsFactory<BoatClassNotificationPreference>() {
|
||||
@Override
|
||||
public BoatClassNotificationPreference newInstance() {
|
||||
return new BoatClassNotificationPreference();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Iterable<BoatClassNotificationPreference> getBoatClasses() {
|
||||
return boatClasses.getValues();
|
||||
}
|
||||
|
||||
public void setBoatClasses(Iterable<BoatClassNotificationPreference> boatClasses) {
|
||||
this.boatClasses.setValues(boatClasses);
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.sap.sailing.domain.common.preferences;
|
||||
|
||||
import com.sap.sse.common.settings.generic.AbstractGenericSerializableSettings;
|
||||
import com.sap.sse.common.settings.generic.BooleanSetting;
|
||||
import com.sap.sse.common.settings.generic.StringSetting;
|
||||
|
||||
public class CompetitorNotificationPreference extends AbstractGenericSerializableSettings {
|
||||
private static final long serialVersionUID = -6510535362114348707L;
|
||||
|
||||
private transient StringSetting competitorId;
|
||||
private transient BooleanSetting notifyAboutResults;
|
||||
|
||||
public CompetitorNotificationPreference() {
|
||||
}
|
||||
|
||||
public CompetitorNotificationPreference(String competitorId, boolean notifyAboutResults) {
|
||||
this.competitorId.setValue(competitorId);
|
||||
this.notifyAboutResults.setValue(notifyAboutResults);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addChildSettings() {
|
||||
competitorId = new StringSetting("competitorId", this);
|
||||
notifyAboutResults = new BooleanSetting("notifyAboutResults", this, false);
|
||||
}
|
||||
|
||||
public String getCompetitorId() {
|
||||
return competitorId.getValue();
|
||||
}
|
||||
|
||||
public boolean isNotifyAboutResults() {
|
||||
return Boolean.TRUE.equals(notifyAboutResults.getValue());
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.sap.sailing.domain.common.preferences;
|
||||
|
||||
import com.sap.sse.common.settings.generic.AbstractGenericSerializableSettings;
|
||||
import com.sap.sse.common.settings.generic.SettingsFactory;
|
||||
import com.sap.sse.common.settings.generic.SettingsList;
|
||||
|
||||
public class CompetitorNotificationPreferences extends AbstractGenericSerializableSettings {
|
||||
private static final long serialVersionUID = -3682996540081614053L;
|
||||
|
||||
private transient SettingsList<CompetitorNotificationPreference> competitors;
|
||||
|
||||
public CompetitorNotificationPreferences() {
|
||||
}
|
||||
|
||||
public CompetitorNotificationPreferences(String name, AbstractGenericSerializableSettings settings) {
|
||||
super(name, settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addChildSettings() {
|
||||
competitors = new SettingsList<>("competitors", this, new SettingsFactory<CompetitorNotificationPreference>() {
|
||||
@Override
|
||||
public CompetitorNotificationPreference newInstance() {
|
||||
return new CompetitorNotificationPreference();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Iterable<CompetitorNotificationPreference> getCompetitors() {
|
||||
return competitors.getValues();
|
||||
}
|
||||
|
||||
public void setCompetitors(Iterable<CompetitorNotificationPreference> boatClasses) {
|
||||
this.competitors.setValues(boatClasses);
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.sap.sailing.domain.common.preferences;
|
||||
|
||||
import com.sap.sse.common.settings.generic.AbstractGenericSerializableSettings;
|
||||
|
||||
/**
|
||||
* Preferences for Sailing users that define for which Objects a user wants to receive specific notifications.
|
||||
* This currently includes:
|
||||
* <ul>
|
||||
* <li>Results for a favourite Competitor</li>
|
||||
* <li>Results for a favourite BoatClass</li>
|
||||
* <li>Upcoming races for a favourite BoatClass</li>
|
||||
* </ul>
|
||||
*/
|
||||
public class NotificationPreferences extends AbstractGenericSerializableSettings {
|
||||
private static final long serialVersionUID = 8865010526321472376L;
|
||||
|
||||
public static final String PREF_NAME = "sailing.notifications";
|
||||
|
||||
private transient BoatClassNotificationPreferences boatClassPreferences;
|
||||
private transient CompetitorNotificationPreferences competitorPreferences;
|
||||
|
||||
public NotificationPreferences() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addChildSettings() {
|
||||
boatClassPreferences = new BoatClassNotificationPreferences("boatClassPreferences", this);
|
||||
competitorPreferences = new CompetitorNotificationPreferences("competitorPreferences", this);
|
||||
}
|
||||
|
||||
public BoatClassNotificationPreferences getBoatClassPreferences() {
|
||||
return boatClassPreferences;
|
||||
}
|
||||
|
||||
public CompetitorNotificationPreferences getCompetitorPreferences() {
|
||||
return competitorPreferences;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user