if (description == null) {
description = "";
}
DAOFactory daoFactory = DAOFactory.getDAOFactory(DAOFactory.FactoryType.JDBC);
MashupDAO mashupDAO = (MashupDAO) daoFactory.getDAO(Mashup.class);
Mashup mashup = null;
if (idSt != null) {
int id = Integer.parseInt(idSt);
mashup = new Mashup(id, name, description, json);
mashupDAO.updateJson(mashup);
} else {
mashup = new Mashup(name, description, json);
int id = mashupDAO.saveAndGetId(mashup);
mashup.setId(id);
}
out.write(XMLFormatter.toXML(mashup));
} catch (NumberFormatException nbe) {
Logger.getLogger(MashupController.class.getName()).log(Level.SEVERE, null, nbe);