/** * Erstellt eine neue Zuordnung zwischen einem Spiel und einem Spieler, falls diese noch nicht * existiert * * @param src * @throws JAXBException * @throws FileNotFoundException */ @POST @Path("/spieler") @Consumes(MediaType.APPLICATION_XML) public void createSpielSpieler(SpielSpieler src) throws JAXBException, FileNotFoundException, DatatypeConfigurationException { SpieleSpieler spieleSpieler = (SpieleSpieler) XmlTools.unmarshal(SpieleSpieler.class); for (SpielSpieler ss : spieleSpieler.getSpielSpieler()) { // System.out.println("SpielSpieler iteration: ss.spielerid: " + ss.getSpielerId() + " // src.spielerid: " + src.getSpielerId() + " -- ss.spielid: " + ss.getSpielId() + " // src.spielid: " + src.getSpielId()); if (ss.getSpielerId().intValue() == src.getSpielerId().intValue() && ss.getSpielId().intValue() == src.getSpielId().intValue()) { throw new WebApplicationException(Response.Status.CONFLICT); } } XMLGregorianCalendar xgc = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()); src.setDatumzeit(xgc); spieleSpieler.getSpielSpieler().add(src); XmlTools.marshal(SpieleSpieler.class, spieleSpieler); throw new WebApplicationException(Response.Status.CREATED); }