Author: echatellier Date: 2012-02-22 11:28:29 +0100 (Wed, 22 Feb 2012) New Revision: 3339 Url: http://chorem.org/repositories/revision/lima/3339 Log: Add doc in import service. Fix method visibility. Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ImportService.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2012-02-22 09:57:58 UTC (rev 3338) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2012-02-22 10:28:29 UTC (rev 3339) @@ -125,20 +125,14 @@ import static org.nuiton.i18n.I18n._; /** - * CSV import export service. - * - * @version $Revision$ - * <p/> - * Last update : $Date: 2010-07-26 18:32:09 +0200 (lun., 26 juil. 2010) - * $ By : $Author$ + * Import export service. + * Currently import and export as CSV and EBP. */ @Stateless public class ImportServiceImpl extends AbstractLimaService implements ImportService, ImportServiceLocal { private TopiaContext rootContext; - // Services - @EJB private AccountServiceLocal accountService; @@ -396,18 +390,6 @@ return result.toString(); } - @Override - public void importAsCiel(byte[] data) throws LimaException { - // TODO Auto-generated method stub - - } - - @Override - public void importAsSage(byte[] data) throws LimaException { - // TODO Auto-generated method stub - - } - // ################ IMPORT ################ /** Remote methode to call all entities import from UI */ @@ -655,7 +637,7 @@ * @return * @throws LimaException */ - public String importAccountsChartsCSV(String[] nextLine, + protected String importAccountsChartsCSV(String[] nextLine, Map<String, AccountImport> accounts, TopiaContext topiaContext) throws LimaException { @@ -700,7 +682,7 @@ * @return * @throws LimaException */ - public String importFiscalPeriodCSV(String[] nextLine, + protected String importFiscalPeriodCSV(String[] nextLine, List<FiscalPeriod> fiscalPeriods, TopiaContext topiaContext) throws LimaException { @@ -738,7 +720,7 @@ * @return * @throws LimaException */ - public String importEntryBooksChartCSV(String[] nextLine, + protected String importEntryBooksChartCSV(String[] nextLine, TopiaContext topiaContext) throws LimaException { StringBuilder result = new StringBuilder(); try { @@ -773,7 +755,7 @@ * @return * @throws LimaException */ - public String importLetterCSV(String[] nextLine, + protected String importLetterCSV(String[] nextLine, TopiaContext topiaContext) throws LimaException { StringBuilder result = new StringBuilder(); try { @@ -807,7 +789,7 @@ * @param topiaContext * @throws LimaException */ - public void importClosedPeriodicEntryBookCSV(String[] nextLine, + protected void importClosedPeriodicEntryBookCSV(String[] nextLine, List<ClosedPeriodicEntryBookImport> closedPeriodicEntryBooks, TopiaContext topiaContext) throws LimaException { String locked = nextLine[1]; @@ -839,8 +821,7 @@ * @return * @throws LimaException */ - - public String importFinancialsStatementChartCSV(String[] nextLine, + protected String importFinancialsStatementChartCSV(String[] nextLine, LinkedHashMap<String, ArrayList<FinancialStatementImport>> financialStatements, TopiaContext topiaContext) throws LimaException { StringBuilder result = new StringBuilder(); @@ -905,8 +886,7 @@ * @return * @throws LimaException */ - - public String importVatStatementChartCSV(String[] nextLine, + protected String importVatStatementChartCSV(String[] nextLine, Map<String, ArrayList<VatStatementImport>> vatStatements, TopiaContext topiaContext) throws LimaException { @@ -961,7 +941,7 @@ * @param topiaContext * @throws LimaException */ - public void importFinancialTransactionsCSV(String[] nextLine, + protected void importFinancialTransactionsCSV(String[] nextLine, Map<Integer, FinancialTransactionImport> financialTransactions, TopiaContext topiaContext) throws LimaException { int num = new Integer(nextLine[1]); @@ -987,7 +967,7 @@ * @param topiaContext * @throws LimaException */ - public void importEntriesCSV(String[] nextLine, + protected void importEntriesCSV(String[] nextLine, Map<Integer, List<EntryImport>> entries, TopiaContext topiaContext) throws LimaException { int num = new Integer(nextLine[1]); @@ -1014,7 +994,7 @@ // ################ CREATE ENTITY IN DB FOR IMPORT ################ - public String createFinancialStatements(Map<String, ArrayList<FinancialStatementImport>> financialStatements, + protected String createFinancialStatements(Map<String, ArrayList<FinancialStatementImport>> financialStatements, TopiaContext topiaContext) throws LimaException { StringBuilder result = new StringBuilder(); try { @@ -1098,7 +1078,7 @@ return result.toString(); } - public String createVatStatements(Map<String, ArrayList<VatStatementImport>> vatStatements, + protected String createVatStatements(Map<String, ArrayList<VatStatementImport>> vatStatements, TopiaContext topiaContext) throws LimaException { StringBuilder result = new StringBuilder(); @@ -1163,7 +1143,7 @@ return result.toString(); } - public String createFiscalPeriod(List<FiscalPeriod> fiscalPeriods, + protected String createFiscalPeriod(List<FiscalPeriod> fiscalPeriods, TopiaContext topiaContext) { StringBuilder result = new StringBuilder(); for (FiscalPeriod fiscalPeriod : fiscalPeriods) { @@ -1190,7 +1170,7 @@ * @return * @throws LimaException */ - public Letter createLetter(String letterCode, + protected Letter createLetter(String letterCode, TopiaContext topiaContext) throws LimaException { Letter letter = null; try { @@ -1208,7 +1188,7 @@ return letter; } - public String createAccounts(Map<String, AccountImport> accounts, + protected String createAccounts(Map<String, AccountImport> accounts, TopiaContext topiaContext) throws LimaException { StringBuilder result = new StringBuilder(); @@ -1265,7 +1245,7 @@ return result.toString(); } - public String updateClosedPeriodicEntryBooks( + protected String updateClosedPeriodicEntryBooks( List<ClosedPeriodicEntryBookImport> closedPeriodicEntryBooks, TopiaContext topiaContext) throws LimaException { StringBuilder result = new StringBuilder(); @@ -1312,7 +1292,7 @@ return result.toString(); } - public String createFinancialTransactionsAndEntries( + protected String createFinancialTransactionsAndEntries( Map<Integer, FinancialTransactionImport> financialTransactions, Map<Integer, List<EntryImport>> entries, TopiaContext topiaContext) throws LimaException { @@ -1378,7 +1358,7 @@ return result.toString(); } - public String importIdentity(String[] nextLine, + protected String importIdentity(String[] nextLine, TopiaContext topiaContext) throws LimaException { StringBuilder result = new StringBuilder(); Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ImportService.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ImportService.java 2012-02-22 09:57:58 UTC (rev 3338) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ImportService.java 2012-02-22 10:28:29 UTC (rev 3339) @@ -32,54 +32,56 @@ /** * Import export service. - * <p/> - * Currently import and export as XML. - * - * @author chatellier - * @version $Revision$ - * <p/> - * Last update : $Date$ - * By : $Author$ + * Currently import and export as CSV and EBP. */ @Remote public interface ImportService { /** - * Import data as EBP CSV export. + * Import accounts as EBP import. * - * @param datas + * @param data import file content as string (remote service can't take File) + * @return result log * @throws LimaException */ - String importEntriesFromEbp(String datas) throws LimaException; + String importAccountsChartFromEbp(String data) throws LimaException; - String importAccountsChartFromEbp(String datas) throws LimaException; - /** - * Import data as Sage Maestria export. + * Import entries as EBP import. * - * @param data + * @param data import file content as string (remote service can't take File) + * @return result log * @throws LimaException */ - void importAsSage(byte[] data) throws LimaException; + String importEntriesFromEbp(String data) throws LimaException; /** - * Import data as Ciel Compta export. - * - * @param data - * @throws LimaException + * Import data as lima CSV import. + * + * Read first line to detect file type and call {@link #importAsCSV(String, ImportExportEntityEnum)}. + * + * @param data import file content as string (remote service can't take File) + * @return result log + * @throws LimaException */ - void importAsCiel(byte[] data) throws LimaException; + String importAllAsCSV(String data) throws LimaException; /** - * import CSV. - * Return result log + * Import content as CSV depending on import type. + * + * @param data import file content as string (remote service can't take File) + * @param importExportEntityEnum import type + * @return result log + * @throws LimaException */ - String importAllAsCSV(String path) throws LimaException; - - String importAsCSV(String datas, + String importAsCSV(String data, ImportExportEntityEnum importExportEntityEnum) throws LimaException; - String importAsPDF(String datas, + /** + * @deprecated import file (local, can't be used in remote mode) + * and wrong place for this method + */ + String importAsPDF(String data, ImportExportEntityEnum importExportEntityEnum, boolean saveMode) throws LimaException; }