log.info("Created new slot for company:" + company.getLastname());
log.info(entity.toString());
} else {
log.info("Did not find a company with login: " + login);
log.info("Trying to a find a publisher with login: " + login);
Publisher publisher = DatastoreProxy.getPublisherByLogin(login);
if (publisher != null) {
log.info("Found publisher with login: " + publisher.getFirstname() + " " + publisher.getLastname());
Slot slot = new Slot();
slot.setOwnerId(publisher.getId());
log.info("DTSTART :" + startDate.getValue());
Date parsedStartDate = icalFormatter.parse(startDate.getValue());
log.info("Parsed start date :" + logFormatter.format(parsedStartDate));
log.info("DTEND :" + endDate.getValue());
Date parsedEndDate = icalFormatter.parse(endDate.getValue());
log.info("Parsed end date :" + logFormatter.format(parsedEndDate));
slot.setStartDate(parsedStartDate);
slot.setEndDate(parsedEndDate);
slot.setStatus(SlotStatus.Ordered);
long slotInterval = parsedEndDate.getTime() - parsedStartDate.getTime();
log.info("Interval in miliseconds: " + slotInterval);
long slotDurationInMilisecondes = (long) duration * 60 * 1000;
log.info("Default slot duration in miliseconds: " + slotDurationInMilisecondes);
long nbSlots = slotInterval / slotDurationInMilisecondes;
log.info("Number of slots (Long): " + nbSlots);
slot.setNbSlots((int) nbSlots);
slot.setPrice(price);
Slot entity = DatastoreProxy.createSlot(slot);
log.info("Created new slot for publisher:" + publisher.getFirstname() + " " + publisher.getLastname());
log.info(entity.toString());
} else {
log.warning("Could not find publisher: " + login);
}
}