/** * Imports an InputStream. * * @param streamData * InputStream with the data that is going to be imported. * @param file * Name of the file that we want to import. */ @Transactional private void importProject(InputStream streamData, String file) { OrderDTO importData = orderImporterMPXJ.getImportData(streamData, file); Order order = orderImporterMPXJ.convertImportDataToOrder(importData, false); TaskGroup taskGroup = orderImporterMPXJ.createTask(importData, false); List<Dependency> dependencies = orderImporterMPXJ.createDependencies(importData); orderImporterMPXJ.storeOrder(order, taskGroup, dependencies); }
/** * Imports calendars, orders, task and dependencies from a InputStream. * * @param streamData * InputStream with the data that is going to be imported. * @param file * Name of the file that we want to import. */ @Transactional private void importAll(InputStream streamData, String file) throws InstanceNotFoundException, ValidationException { List<CalendarDTO> calendarDTOs = calendarImporterMPXJ.getCalendarDTOs( streamData, file); List<BaseCalendar> baseCalendars = calendarImporterMPXJ .getBaseCalendars(calendarDTOs); calendarImporterMPXJ.storeBaseCalendars(baseCalendars); OrderDTO importData = calendarImporterMPXJ.getOrderDTO(file); Order order = orderImporterMPXJ.convertImportDataToOrder(importData, true); TaskGroup taskGroup = orderImporterMPXJ.createTask(importData, true); List<Dependency> dependencies = orderImporterMPXJ.createDependencies(importData); orderImporterMPXJ.storeOrder(order, taskGroup, dependencies); }