package de.peacei.gae.foodsupplier.parser;
import com.google.inject.Singleton;
import de.peacei.gae.foodsupplier.data.Mensa;
import de.peacei.gae.foodsupplier.data.Weekplan;
@Singleton
public class MensaParserService {
public Weekplan readCurrentWeekplanForMensaWeekAndYear(Mensa mensa, int weekNumber, int year, String content) {
if (mensa != null) {
try {
MensaParser mensaParser = mensa.getParserClass().newInstance();
Weekplan weekplan = null;
if (content != null) {
weekplan = mensaParser.readWeekplanForWeek(content, weekNumber);
}
return weekplan;
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
}