コード例 #1
0
    /**
     * Makes a {@link OrderDTO} from a InputStream.
     *
     * Uses the ProjectReader of the class. It must be created before.
     *
     * @param filename
     *            String with the name of the original file of the InputStream.
     * @return OrderDTO with the data that we want to import.
     */
    @Override
    public OrderDTO getOrderDTO(String filename) {
        try {

            return MPXJProjectFileConverter.convert(projectFile, filename);

        } catch (Exception e) {

            throw new RuntimeException(e);

        }

    }
コード例 #2
0
    /**
     * Makes a list of {@link CalendarDTO} from a InputStream.
     *
     * @param file
     *            InputStream to extract data from.
     * @return List<CalendarDTO> with the calendar data that we want to import.
     */
    @Override
    public List<CalendarDTO> getCalendarDTOs(InputStream file, String filename) {

        try {

            ProjectReader reader = ProjectReaderUtility.getProjectReader(filename);

            // In case that orders are imported too
            projectFile = reader.read(file);

            return MPXJProjectFileConverter.convertCalendars(projectFile);

        } catch (Exception e) {

            throw new RuntimeException(e);

        }

    }