parent
df91807a95
commit
d6a4d4d857
@ -0,0 +1,36 @@ |
||||
package de.kreth.vaadin.clubhelper.vaadinclubhelper.business.meldung; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Altersgruppe; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubEvent; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person; |
||||
|
||||
class MeldungEinzelWettkampfGenerator implements MeldungGenerator { |
||||
|
||||
/* |
||||
* (non-Javadoc) |
||||
* |
||||
* @see de.kreth.vaadin.clubhelper.vaadinclubhelper.business.MeldungGenerator# |
||||
* printMeldung() |
||||
*/ |
||||
@Override |
||||
public CharSequence printMeldung(ClubEvent event, Map<Altersgruppe, List<Person>> groups) { |
||||
StringBuilder txt = new StringBuilder(); |
||||
txt.append("\n\n für den Wettkampf "); |
||||
txt.append(event.getCaption()).append(" am ").append(event.getStart().toLocalDate().toString()) |
||||
.append(" melden wir für den MTV Groß-Buchholz folgende Starter:"); |
||||
List<Altersgruppe> groupList = new ArrayList<>(groups.keySet()); |
||||
groupList.sort((o1, o2) -> Integer.compare(o2.getStart(), o1.getStart())); |
||||
for (Altersgruppe g : groupList) { |
||||
txt.append("\n\n").append(g.getBezeichnung()); |
||||
for (Person p : groups.get(g)) { |
||||
txt.append("\n").append(p.getPrename()).append(" ").append(p.getSurname()).append("\t") |
||||
.append(p.getBirth().getYear()).append("\t").append(g.getPflicht().getName()); |
||||
} |
||||
} |
||||
return txt; |
||||
} |
||||
} |
||||
@ -0,0 +1,14 @@ |
||||
package de.kreth.vaadin.clubhelper.vaadinclubhelper.business.meldung; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Altersgruppe; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubEvent; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person; |
||||
|
||||
public interface MeldungGenerator { |
||||
|
||||
CharSequence printMeldung(ClubEvent event, Map<Altersgruppe, List<Person>> groups); |
||||
|
||||
} |
||||
@ -0,0 +1,23 @@ |
||||
package de.kreth.vaadin.clubhelper.vaadinclubhelper.business.meldung; |
||||
|
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.CompetitionType; |
||||
|
||||
public class MeldungGeneratorFactory { |
||||
|
||||
public static MeldungGenerator forType(CompetitionType.Type type) { |
||||
switch (type) { |
||||
case DOPPELMINI: |
||||
// break;
|
||||
case LIGA: |
||||
// break;
|
||||
case MANNSCHAFT: |
||||
// break;
|
||||
case SYNCHRON: |
||||
// break;
|
||||
case EINZEL: |
||||
default: |
||||
return new MeldungEinzelWettkampfGenerator(); |
||||
|
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue