r3858 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business-api/src/main/java/org/chorem/lima/business/api lima-swing/src/main/java/org/chorem/lima/ui/importexport
Author: dcosse Date: 2014-07-23 16:27:23 +0200 (Wed, 23 Jul 2014) New Revision: 3858 Url: http://forge.chorem.org/projects/lima/repository/revisions/3858 Log: refs #1032 correction sur import EBP Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/ImportService.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2014-07-23 13:46:03 UTC (rev 3857) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2014-07-23 14:27:23 UTC (rev 3858) @@ -27,6 +27,7 @@ import com.google.common.base.Predicate; import com.google.common.collect.Collections2; +import com.google.common.collect.Lists; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -98,6 +99,10 @@ FinancialTransactionTopiaDao financialtransactionTopiaDao = getDaoHelper().getFinancialTransactionDao(); + if (financialtransaction.getEntry() == null) { + financialtransaction.setEntry(Lists.<Entry>newArrayList()); + } + FinancialTransaction result = financialtransactionTopiaDao.create(financialtransaction); return result; 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 2014-07-23 13:46:03 UTC (rev 3857) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2014-07-23 14:27:23 UTC (rev 3858) @@ -551,102 +551,6 @@ // ################ IMPORT ################ - /** Remote methode to call all entities import from UI */ - @Override - public String importAllAsCSV(String datas) throws ImportEbpException { - StringBuilder result = new StringBuilder(); - - Map<String, List<FinancialStatementImport>> financialStatements = - new LinkedHashMap<String, List<FinancialStatementImport>>(); - - Map<String, List<VatStatementImport>> vatStatements = - new LinkedHashMap<String, List<VatStatementImport>>(); - - List<FiscalPeriod> fiscalPeriods = new ArrayList<FiscalPeriod>(); - - List<ClosedPeriodicEntryBookImport> closedPeriodicEntryBooks = - new ArrayList<ClosedPeriodicEntryBookImport>(); - - Map<Integer, FinancialTransactionImport> financialTransactions = - new HashMap<Integer, FinancialTransactionImport>(); - - Map<Integer, List<EntryImport>> entries = - new HashMap<Integer, List<EntryImport>>(); - - CSVReader csvReader = null; - try { - - String[] nextLine; - csvReader = new CSVReader(new StringReader(datas), ';'); - - while ((nextLine = csvReader.readNext()) != null) { - ImportExportEntityEnum importExportEntityEnum = ImportExportEntityEnum - .valueOfLabel(nextLine[0]); - if (importExportEntityEnum != null) { - switch (importExportEntityEnum) { - case ACCOUNT: - result.append(importAccountsChartsCSV(nextLine)); - break; - case ENTRYBOOK: - result.append(importEntryBooksChartCSV(nextLine)); - break; - case FINANCIALSTATEMENT: - result.append(importFinancialsStatementChartCSV(nextLine, - financialStatements)); - break; - case VATSTATEMENT: - result.append(importVatStatementChartCSV(nextLine, - vatStatements)); - break; - case FISCALPERIOD: - result.append(importFiscalPeriodCSV(nextLine, - fiscalPeriods)); - break; - case CLOSEDPERIODICENTRYBOOK: - importClosedPeriodicEntryBookCSV(nextLine, - closedPeriodicEntryBooks); - break; - case FINANCIALTRANSACTION: - importFinancialTransactionsCSV(nextLine, - financialTransactions); - break; - case ENTRY: - importEntriesCSV(nextLine, entries); - break; - case IDENTITY: - importIdentity(nextLine); - break; - } - } - } - - // create financialStatements - result.append(createFinancialStatements(financialStatements)); - // create vatStatements - result.append(createVatStatements(vatStatements)); - // create fiscalperiod - Collections.sort(fiscalPeriods, new FiscalPeriodComparator()); - result.append(createFiscalPeriod(fiscalPeriods)); - // update closedperiodicentrybooks - result.append(updateClosedPeriodicEntryBooks(closedPeriodicEntryBooks)); - // create financialtransaction and entries - result.append(createFinancialTransactionsAndEntries( - financialTransactions, entries)); - - } catch (IOException e) { - throw new ImportEbpException("Can't import", e); - } finally { - if (csvReader != null) { - try { - csvReader.close(); - } catch (IOException e) { - // on fait rien - } - } - } - return result.toString(); - } - /** * Remote methode to call entity import from UI * This methode let import just on type of entity Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/ImportService.java =================================================================== --- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/ImportService.java 2014-07-23 13:46:03 UTC (rev 3857) +++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/ImportService.java 2014-07-23 14:27:23 UTC (rev 3858) @@ -63,17 +63,6 @@ String importEntriesFromEbp(String data) throws ImportEbpException; /** - * Import data as lima CSV import. - * <p/> - * 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 - */ - String importAllAsCSV(String data) throws ImportEbpException; - - /** * Import content as CSV depending on import type. * * @param data import file content as string (remote service can't take File) Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-07-23 13:46:03 UTC (rev 3857) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2014-07-23 14:27:23 UTC (rev 3858) @@ -243,10 +243,6 @@ //hidde wait dialog panel waitView.setVisible(false); - if(log.isInfoEnabled()) { - log.info(get()); - } - // display result dialog if (verboseMode) { String result = get();
participants (1)
-
dcosse@users.chorem.org