From 59d2a029fcc02f538478ede3413ebba612d1c372 Mon Sep 17 00:00:00 2001 From: Alba Carro Date: Fri, 24 Aug 2012 23:54:28 +0200 Subject: [PATCH] Interface to import orders Defines the generic interface to import external projects into the Libreplan database. FEA: ItEr77S05BasicProjectImport --- .../orders/imports/OrderImporter.java | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 libreplan-business/src/main/java/org/libreplan/business/orders/imports/OrderImporter.java diff --git a/libreplan-business/src/main/java/org/libreplan/business/orders/imports/OrderImporter.java b/libreplan-business/src/main/java/org/libreplan/business/orders/imports/OrderImporter.java new file mode 100644 index 000000000..f8521e8da --- /dev/null +++ b/libreplan-business/src/main/java/org/libreplan/business/orders/imports/OrderImporter.java @@ -0,0 +1,65 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2012 Igalia, S.L. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.business.orders.imports; + +import java.io.InputStream; + +import org.libreplan.business.orders.entities.Order; + +/** + * Contract for the {@link OrderImporterMPXJ}. + * + * Has all the methods needed to successfully import some external project files + * into Libreplan. + * + * @author Alba Carro Pérez + */ +public interface OrderImporter { + + /** + * Makes a {@link ImportData} from a InputStream. + * + * @param file + * InputStream to extract data from. + * @param filename + * String with the name of the original file of the InputStream. + * @return ImportData with the data that we want to import. + */ + public ImportData getImportData(InputStream file, String filename); + + /** + * Makes a {@link Order} from a {@link ImportData}. + * + * @param project + * ImportData to extract data from. + * @return Order with all the data that we want. + */ + public Order convertImportDataToOrder(ImportData project); + + /** + * Saves a {@link Order} which has all the data that we want to store in the + * database. + * + * @param Order + * Order with the data. + */ + public void storeOrder(Order order); + +}