r3010 - in trunk: lima-business/src/main/java/org/chorem/lima/business lima-business/src/main/java/org/chorem/lima/business/accountingrules lima-business/src/main/java/org/chorem/lima/business/ejb lima-business/src/main/java/org/chorem/lima/business/ejbinterface lima-business/src/main/java/org/chorem/lima/business/utils lima-business/src/test/java/org/chorem/lima/business lima-swing/src/main/java/org/chorem/lima/service lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart lima-
Author: jpepin Date: 2010-08-21 01:46:18 +0200 (Sat, 21 Aug 2010) New Revision: 3010 Url: http://chorem.org/repositories/revision/lima/3010 Log: D?\195?\169bogue et optimisation ?\195?\160 partir du rapport Sonar. Removed: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/RecordServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/UserServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/RecordService.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/RecordServiceLocal.java trunk/lima-business/src/test/java/org/chorem/lima/business/RecordServiceImplTest.java trunk/lima-business/src/test/java/org/chorem/lima/business/UserServiceImplTest.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceMonitorable.java trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.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/FiscalPeriodServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountService.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountServiceLocal.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/DocumentService.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/DocumentServiceLocal.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/EntryBookServiceLocal.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ExportService.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FinancialStatementService.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FinancialStatementServiceLocal.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FinancialTransactionService.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FinancialTransactionServiceLocal.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/HttpServerService.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/IdentityService.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/IdentityServiceLocal.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ImportService.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ReportServiceLocal.java trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountComparator.java trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountEBPComparator.java trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryComparator.java trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryEBPComparator.java trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FiscalPeriodComparator.java trunk/lima-business/src/test/java/org/chorem/lima/business/LimaConfigTest.java trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -18,8 +18,8 @@ */ package org.chorem.lima.business; + import java.util.List; - import org.chorem.lima.entity.Account; import org.chorem.lima.entity.ClosedPeriodicEntryBook; import org.chorem.lima.entity.Entry; @@ -42,11 +42,11 @@ * @param account * @throws LimaException */ - public void createAccountRules(Account masterAccount, Account account) throws LimaException; - public void createSubLedgerRules(Account masterAccount, Account account) throws LimaException; - public void updateAccountRules(Account masterAccount, Account account) throws LimaException; - public void updateSubLedgerRules(Account account) throws LimaException; - public void removeAccountRules(Account account, TopiaContext transaction) throws LimaException; + void createAccountRules(Account masterAccount, Account account) throws LimaException; + void createSubLedgerRules(Account masterAccount, Account account) throws LimaException; + void updateAccountRules(Account masterAccount, Account account) throws LimaException; + void updateSubLedgerRules(Account account) throws LimaException; + void removeAccountRules(Account account, TopiaContext transaction) throws LimaException; /** * Entrybook rules @@ -54,7 +54,7 @@ * @param topiaTransaction * @throws LimaException */ - public void removeEntryBookRules(EntryBook entryBook, TopiaContext topiaTransaction) throws LimaException; + void removeEntryBookRules(EntryBook entryBook, TopiaContext topiaTransaction) throws LimaException; /** * Fiscal Period rules @@ -62,8 +62,8 @@ * @param transaction * @throws LimaException */ - public List<FinancialPeriod> createFiscalPeriodRules(FiscalPeriod fiscalPeriod, TopiaContext transaction) throws LimaException; - public void blockFiscalPeriodRules(FiscalPeriod fiscalPeriod, TopiaContext transaction) throws LimaException; + List<FinancialPeriod> createFiscalPeriodRules(FiscalPeriod fiscalPeriod, TopiaContext transaction) throws LimaException; + void blockFiscalPeriodRules(FiscalPeriod fiscalPeriod, TopiaContext transaction) throws LimaException; /** * Entry rules @@ -71,14 +71,14 @@ * @param topiaTransaction * @throws LimaException */ - public void updateEntryRules(Entry entry, Entry entryOld, TopiaContext topiaTransaction) throws LimaException; - public void updateFinancialTransactionDateRules(FinancialTransaction financialTransaction, FinancialTransaction financialTransactionOld, TopiaContext topiaContext) throws LimaException, LimaBusinessException; + void updateEntryRules(Entry entry, Entry entryOld, TopiaContext topiaTransaction) throws LimaException; + void updateFinancialTransactionDateRules(FinancialTransaction financialTransaction, FinancialTransaction financialTransactionOld, TopiaContext topiaContext) throws LimaException; /** * Financialperiod/entrybook rules * @param financialTransaction * @param topiaContext * @throws LimaException */ - public void checkFinancialPeriodBlockedWithFinancialTransaction(FinancialTransaction financialTransaction, TopiaContext topiaContext) throws LimaException; - public void blockClosedPeriodicEntryBookRules(ClosedPeriodicEntryBook closedPeriodicEntryBook, TopiaContext topiaContext) throws LimaException; + void checkFinancialPeriodBlockedWithFinancialTransaction(FinancialTransaction financialTransaction, TopiaContext topiaContext) throws LimaException; + void blockClosedPeriodicEntryBookRules(ClosedPeriodicEntryBook closedPeriodicEntryBook, TopiaContext topiaContext) throws LimaException; } Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -43,9 +43,9 @@ private static final Log log = LogFactory.getLog(LimaConfig.class); - protected static LimaConfig instance; + private static LimaConfig instance; - private static final String configFile = "lima.properties"; + private static final String CONFIGFILE = "lima.properties"; protected AccountingRules accountingRules; @@ -59,7 +59,7 @@ public static LimaConfig getInstance() { if (instance == null) { instance = new LimaConfig(); - instance.loadConfiguration(configFile); + instance.loadConfiguration(CONFIGFILE); } return instance; } @@ -136,41 +136,41 @@ HTTP_PORT("lima.httpport", _("lima.config.httpport"), "5462", String.class, false, false), SERVER_ADRESS("lima.serveraddress", _("lima.config.serveraddress"), "", String.class, false, false); - public final String key; - public final String description; - public String defaultValue; - public final Class<?> type; - public boolean _transient; - public boolean _final; + private final String key; + private final String description; + private String defaultValue; + private final Class<?> type; + private boolean transientBoolean; + private boolean finalBoolean; private Option(String key, String description, String defaultValue, - Class<?> type, boolean _transient, boolean _final) { + Class<?> type, boolean transientBoolean, boolean finalBoolean) { this.key = key; this.description = description; this.defaultValue = defaultValue; this.type = type; - this._final = _final; - this._transient = _transient; + this.finalBoolean = finalBoolean; + this.transientBoolean = transientBoolean; } @Override public boolean isFinal() { - return _final; + return finalBoolean; } @Override - public void setFinal(boolean _final){ - this._final=_final; + public void setFinal(boolean finalBoolean){ + this.finalBoolean=finalBoolean; } @Override public boolean isTransient() { - return _transient; + return transientBoolean; } @Override - public void setTransient(boolean _transient) { - this._transient=_transient; + public void setTransient(boolean transientBoolean) { + this.transientBoolean = transientBoolean; } @Override @@ -180,7 +180,7 @@ @Override public void setDefaultValue(String defaultValue) { - this.defaultValue=defaultValue; + this.defaultValue = defaultValue; } @Override Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceMonitorable.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceMonitorable.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ServiceMonitorable.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -20,6 +20,6 @@ package org.chorem.lima.business; public interface ServiceMonitorable { - public void addListener(ServiceListener l); - public void removeListener(ServiceListener l); + void addListener(ServiceListener l); + void removeListener(ServiceListener l); } Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -131,7 +131,7 @@ /** * Check if entrybook have financial transaction */ - @Override + @Override public void removeEntryBookRules(EntryBook entryBook, TopiaContext topiaTransaction) throws LimaException { try { FinancialTransactionDAO financialTransactionDAO = LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction); Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -89,8 +89,8 @@ /** * Rules to check before create subledger */ - public void createSubLedgerRules(Account masterAccount, Account account) throws LimaException { - super.createSubLedgerRules(masterAccount, account); + public void createSubLedgerRules(Account masterAccount, Account account) throws LimaException { + super.createSubLedgerRules(masterAccount, account); // check if the master account number is begin with 4 if (!masterAccount.getAccountNumber().startsWith("4")){ @@ -308,24 +308,4 @@ } throw new LimaException("Exception during query", cause); } - - /** - * Generic code used too close a transaction. - * - * @param transaction transaction to close - * @param log log (can be null) - * @throws LimaException - */ - protected void doFinally(TopiaContext transaction, Log log) throws LimaException { - if (transaction != null) { - try { - transaction.closeContext(); - } catch (TopiaException ex) { - if (log != null && log.isErrorEnabled()) { - log.error("Can't close transaction", ex); - } - throw new LimaException("Can't close transaction", ex); - } - } - } } Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -22,11 +22,8 @@ import static org.nuiton.i18n.I18n._; import java.util.ArrayList; import java.util.Collections; -import java.util.HashSet; import java.util.List; -import java.util.StringTokenizer; import javax.ejb.Stateless; -import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.AccountingRules; @@ -44,7 +41,6 @@ import org.nuiton.topia.TopiaException; import org.nuiton.topia.TopiaNotFoundException; import org.nuiton.topia.framework.TopiaQuery; -import org.nuiton.topia.framework.TopiaQuery.Op; /** * Permet d'implémenter le Plan Comptable Général. @@ -78,8 +74,7 @@ @Override - public void createAccountWithTransaction(Account masterAccount, Account account, TopiaContext topiaContext) throws LimaException, - LimaBusinessException { + public void createAccountWithTransaction(Account masterAccount, Account account, TopiaContext topiaContext) throws LimaException { try { // check if account number already exist Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -43,7 +43,6 @@ import org.chorem.lima.business.LimaException; import org.chorem.lima.business.ejbinterface.DocumentService; import org.chorem.lima.business.ejbinterface.DocumentServiceLocal; -import org.chorem.lima.business.ejbinterface.EntryBookService; import org.chorem.lima.business.ejbinterface.FinancialStatementService; import org.chorem.lima.business.ejbinterface.IdentityService; import org.chorem.lima.business.ejbinterface.ReportService; @@ -92,17 +91,14 @@ //Services @EJB - IdentityService identityService; + private IdentityService identityService; @EJB - EntryBookService entryBookService; + private FinancialStatementService financialStatementService; @EJB - FinancialStatementService financialStatementService; + private ReportService reportService; - @EJB - ReportService reportService; - protected String path; //SDFs @@ -261,7 +257,7 @@ for (int i=0;i<size;i++) { FinancialStatementAmounts fStatementAmounts = financialStatementAmounts.get(i); - if (fStatementAmounts.getLevel() == 1 && fStatementAmounts.getSubAmount() == false){ + if (fStatementAmounts.getLevel() == 1 && !fStatementAmounts.getSubAmount()){ if (first){ first=false; } @@ -406,9 +402,9 @@ } else { //cell1 - String tab = ""; + StringBuffer tab = new StringBuffer(); for (int i = 0; i < level; i++) { - tab += "\t"; + tab.append("\t"); } Phrase phrase = null; if (financialStatementAmount.getHeader()){ Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -146,16 +146,16 @@ */ public List<EntryBook> getAllEntryBooks() throws LimaException { - List<EntryBook> EntryBooksList = new ArrayList<EntryBook>(); + List<EntryBook> entryBooksList = new ArrayList<EntryBook>(); TopiaContext transaction = null; try { transaction = beginTransaction(); // check if entrybook with is name already exist - EntryBookDAO EntryBookDAO = + EntryBookDAO entryBookDAO = LimaCallaoDAOHelper.getEntryBookDAO(transaction); - List<EntryBook> EntryBooks = EntryBookDAO.findAll(); - EntryBooksList.addAll(EntryBooks); + List<EntryBook> entryBooks = entryBookDAO.findAll(); + entryBooksList.addAll(entryBooks); } catch (TopiaException ex) { doCatch(transaction, ex, log); @@ -164,7 +164,7 @@ doFinally(transaction, log); } - return EntryBooksList; + return entryBooksList; } /** @@ -213,9 +213,9 @@ accountingRules.removeEntryBookRules(entryBook, topiaTransaction); //delete - EntryBookDAO EntryBookDAO = + EntryBookDAO entryBookDAO = LimaCallaoDAOHelper.getEntryBookDAO(topiaTransaction); - EntryBookDAO.delete(entryBook); + entryBookDAO.delete(entryBook); commitTransaction(topiaTransaction); } Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -73,7 +73,7 @@ private TopiaContext rootContext; - private static final SimpleDateFormat SDateFormat = new SimpleDateFormat("dd,MM,yyyy HH:mm:ss"); + private static final SimpleDateFormat SDATEFORMAT = new SimpleDateFormat("dd,MM,yyyy HH:mm:ss"); public ExportServiceImpl() { LimaConfig config = LimaConfig.getInstance(); @@ -96,7 +96,7 @@ public String exportEntriesAsEBP() throws LimaException { TopiaContext topiaContext = null; SimpleDateFormat epbDateFormat = new SimpleDateFormat("ddMMyyyy"); - String result = ""; + StringBuffer result = new StringBuffer(); int num = 0; try { @@ -151,10 +151,10 @@ string = nextln; } if (i==8){ - result+=string+"\r\n"; + result.append(string+"\r\n"); } else { - result+=string+","; + result.append(string+","); } } } @@ -169,7 +169,7 @@ finally { doFinally(topiaContext, log); } - return result; + return result.toString(); } /** @@ -310,17 +310,17 @@ for (FinancialStatement financialStatement : listFinancialStatements) { nextLine[0] = ImportExportEntityEnum.FINANCIALSTATEMENT.getLabel(); nextLine[1] = financialStatement.getLabel(); - nextLine[2] = new Boolean( - financialStatement.getHeader()).toString(); + nextLine[2] = Boolean.toString( + financialStatement.getHeader()); nextLine[3] = financialStatement.getAccounts(); nextLine[4] = financialStatement.getDebitAccounts(); nextLine[5] = financialStatement.getCreditAccounts(); nextLine[6] = financialStatement. getProvisionDeprecationAccounts(); - nextLine[7] = new Boolean( - financialStatement.getSubAmount()).toString(); - nextLine[8] = new Boolean( - financialStatement.getHeaderAmount()).toString(); + nextLine[7] = Boolean.toString( + financialStatement.getSubAmount()); + nextLine[8] = Boolean.toString( + financialStatement.getHeaderAmount()); FinancialStatement masterFinancialStatement = financialStatement.getMasterFinancialStatement(); String masterFinancialStatementString = ""; @@ -491,14 +491,14 @@ nextLine[0] = ImportExportEntityEnum.FINANCIALTRANSACTION.getLabel(); nextLine[1] = String.valueOf(numTransaction); nextLine[2] = - SDateFormat.format(financialTransaction.getTransactionDate()); + SDATEFORMAT.format(financialTransaction.getTransactionDate()); nextLine[3] = financialTransaction.getAmountDebit().toString(); nextLine[4] = financialTransaction.getAmountCredit().toString(); nextLine[5] = - SDateFormat.format(financialTransaction.getFinancialPeriod(). + SDATEFORMAT.format(financialTransaction.getFinancialPeriod(). getBeginDate()); nextLine[6] = - SDateFormat.format(financialTransaction.getFinancialPeriod(). + SDATEFORMAT.format(financialTransaction.getFinancialPeriod(). getEndDate()); EntryBook entryBook = financialTransaction.getEntryBook(); if (entryBook != null){ @@ -513,7 +513,7 @@ nextLine[1] = String.valueOf(numTransaction); nextLine[2] = entry.getDescription(); nextLine[3] = entry.getAmount().toString(); - nextLine[4] = new Boolean(entry.getDebit()).toString(); + nextLine[4] = Boolean.toString(entry.getDebit()); nextLine[5] = entry.getLettering(); nextLine[6] = entry.getDetail(); nextLine[7] = entry.getVoucher(); @@ -546,9 +546,9 @@ // For all Entry for (FiscalPeriod fiscalPeriod : listFiscalPeriod) { nextLine[0] = ImportExportEntityEnum.FISCALPERIOD.getLabel(); - nextLine[1] = SDateFormat.format(fiscalPeriod.getBeginDate()); - nextLine[2] = SDateFormat.format(fiscalPeriod.getEndDate()); - nextLine[3] = new Boolean(fiscalPeriod.getLocked()).toString(); + nextLine[1] = SDATEFORMAT.format(fiscalPeriod.getBeginDate()); + nextLine[2] = SDATEFORMAT.format(fiscalPeriod.getEndDate()); + nextLine[3] = Boolean.toString(fiscalPeriod.getLocked()); // Ajoute la ligne au fichier csvWriter.writeNext(nextLine); } @@ -574,13 +574,13 @@ // For all Entry for (ClosedPeriodicEntryBook closedPeriodicEntryBook : listClosedPeriodicEntryBook) { nextLine[0] = ImportExportEntityEnum.CLOSEDPERIODICENTRYBOOK.getLabel(); - nextLine[1] = new Boolean( - closedPeriodicEntryBook.getLocked()).toString(); + nextLine[1] = Boolean.toString( + closedPeriodicEntryBook.getLocked()); nextLine[2] = - SDateFormat.format(closedPeriodicEntryBook.getFinancialPeriod(). + SDATEFORMAT.format(closedPeriodicEntryBook.getFinancialPeriod(). getBeginDate()); nextLine[3] = - SDateFormat.format(closedPeriodicEntryBook.getFinancialPeriod(). + SDATEFORMAT.format(closedPeriodicEntryBook.getFinancialPeriod(). getEndDate()); nextLine[4] = closedPeriodicEntryBook.getEntryBook().getCode(); // Ajoute la ligne au fichier Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -37,7 +37,6 @@ import org.chorem.lima.beans.FinancialStatementDatasImpl; import org.chorem.lima.beans.ReportsDatas; import org.chorem.lima.business.AccountingRules; -import org.chorem.lima.business.LimaBusinessException; import org.chorem.lima.business.LimaConfig; import org.chorem.lima.business.LimaException; import org.chorem.lima.business.ejbinterface.FinancialStatementService; @@ -66,7 +65,7 @@ protected AccountingRules accountingRules; @EJB - ReportServiceLocal reportServiceLocal; + private ReportServiceLocal reportServiceLocal; public FinancialStatementServiceImpl() { LimaConfig config = LimaConfig.getInstance(); @@ -84,7 +83,7 @@ public void createFinancialStatementWithTransaction( FinancialStatement masterFinancialStatement, FinancialStatement financialStatement, TopiaContext topiaContext) - throws LimaException, LimaBusinessException { + throws LimaException { try { @@ -126,7 +125,7 @@ } @Override - public void createFinancialStatement(FinancialStatement masterFinancialStatement, FinancialStatement financialStatement) throws LimaException, LimaBusinessException { + public void createFinancialStatement(FinancialStatement masterFinancialStatement, FinancialStatement financialStatement) throws LimaException { TopiaContext transaction = null; try { @@ -144,7 +143,7 @@ @Override - public void removeFinancialStatement(FinancialStatement financialStatement) throws LimaException, LimaBusinessException { + public void removeFinancialStatement(FinancialStatement financialStatement) throws LimaException { TopiaContext transaction = null; try { @@ -189,8 +188,7 @@ @Override - public void removeAllFinancialStatement() throws LimaException, - LimaBusinessException { + public void removeAllFinancialStatement() throws LimaException { for (FinancialStatement financialStatement : getChildrenFinancialStatement(null)) { removeFinancialStatement(financialStatement); } @@ -212,7 +210,7 @@ } @Override - public List<FinancialStatement> getAllChildrenFinancialStatement(FinancialStatement financialStatement, List<FinancialStatement> result) throws LimaException, LimaBusinessException { + public List<FinancialStatement> getAllChildrenFinancialStatement(FinancialStatement financialStatement, List<FinancialStatement> result) throws LimaException { List<FinancialStatement> childFinancialStatements = getChildrenFinancialStatement(financialStatement); for (FinancialStatement childFinancialStatement: childFinancialStatements) { @@ -250,7 +248,7 @@ @Override - public void updateFinancialStatement(FinancialStatement financialStatement) throws LimaException, LimaBusinessException { + public void updateFinancialStatement(FinancialStatement financialStatement) throws LimaException { TopiaContext transaction = null; try { transaction = beginTransaction(); @@ -460,8 +458,8 @@ if (accountsNumberList != null){ //Remove Spaces AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(topiaContext); - accountsNumberList = StringUtils.deleteWhitespace(accountsNumberList); - StringTokenizer stQuote = new StringTokenizer(accountsNumberList, "-"); + String result = StringUtils.deleteWhitespace(accountsNumberList); + StringTokenizer stQuote = new StringTokenizer(result, "-"); while (stQuote.hasMoreTokens()) { String s = stQuote.nextToken(); List<Account> accountsList = accountDAO.stringToListAccounts(s, false); @@ -526,7 +524,7 @@ @Override public String checkFinancialStatementChart() throws LimaException { - String result =_("lima-business.financialstatement.check.warn"); + StringBuffer result = new StringBuffer(_("lima-business.financialstatement.check.warn")); TopiaContext transaction = null; try { transaction = beginTransaction(); @@ -562,8 +560,8 @@ for (Account account : accountsList) { - result += _("lima-business.financialstatement.check.nothing") - + " : "+account.getAccountNumber()+" - "+account.getLabel()+"\n"; + result.append(_("lima-business.financialstatement.check.nothing") + + " : "+account.getAccountNumber()+" - "+account.getLabel()+"\n"); } } @@ -573,7 +571,7 @@ finally { doFinally(transaction, log); } - return result; + return result.toString(); } public List<FinancialStatement> findFinancialStatementByAccountNumber(String accountNumber, TopiaContext topiaContext) throws TopiaException{ 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 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -19,9 +19,7 @@ package org.chorem.lima.business.ejb; -import static org.nuiton.i18n.I18n._; import java.math.BigDecimal; -import java.util.ArrayList; import java.util.Date; import java.util.HashSet; import java.util.List; @@ -651,12 +649,12 @@ else if (accountsList != null){ AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(topiaContext); List<Account> accounts = accountDAO.stringToListAccounts(accountsList, false); - String accountNumbers = "0,"; + StringBuffer accountNumbers = new StringBuffer("0,"); int max = accounts.size(); for (int i = 1; i <= max; i++) { - accountNumbers += accounts.get(i-1).getAccountNumber(); + accountNumbers.append(accounts.get(i-1).getAccountNumber()); if (i != max){ - accountNumbers += ","; + accountNumbers.append(","); } } if (accounts.size() > 0){ Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -19,7 +19,6 @@ package org.chorem.lima.business.ejb; -import static org.nuiton.i18n.I18n._; import java.util.Calendar; import java.util.Date; import java.util.List; @@ -63,7 +62,7 @@ protected AccountingRules accountingRules; @EJB - FinancialPeriodServiceLocal financialPeriodService; + private FinancialPeriodServiceLocal financialPeriodService; public FiscalPeriodServiceImpl() { LimaConfig config = LimaConfig.getInstance(); @@ -222,7 +221,7 @@ try { transaction = beginTransaction(); - if (fiscalPeriod.getLocked()==true){ + if (fiscalPeriod.getLocked()){ throw new LimaBusinessException("Fiscal Period already blocked"); } //check rules Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -57,11 +57,10 @@ @Stateless public class HttpServerServiceImpl extends AbstractLimaService implements HttpServerService, HttpServerServiceLocal { - private static final Log log = - LogFactory.getLog(HttpServerServiceImpl.class); + private static final Log log = LogFactory.getLog(HttpServerServiceImpl.class); @EJB - DocumentService documentService; + private DocumentService documentService; protected Server server; @@ -69,8 +68,7 @@ protected int port; - private static SimpleDateFormat dateFormat = - new SimpleDateFormat("yyyy-MM-dd"); + private static SimpleDateFormat DATEFORMAT = new SimpleDateFormat("yyyy-MM-dd"); public HttpServerServiceImpl() { path = LimaConfig.getInstance().getReportsDir(); @@ -110,7 +108,7 @@ /** this servlet send a static html page */ public class MainServlet extends HttpServlet { private static final long serialVersionUID = 1L; - String serverAddressConfig = LimaConfig.getInstance().getAddressServer(); + private String serverAddressConfig = LimaConfig.getInstance().getAddressServer(); @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { @@ -139,8 +137,8 @@ + model +formatsEnum.getExtension()); //create docs try { - Date beginDateFormat = dateFormat.parse(beginDate); - Date endDateFormat = dateFormat.parse(endDate); + Date beginDateFormat = DATEFORMAT.parse(beginDate); + Date endDateFormat = DATEFORMAT.parse(endDate); switch (DocumentsEnum.valueOfLink(model)) { case BALANCE: @@ -177,7 +175,7 @@ // else return home html else { resp.setContentType(FormatsEnum.HTML.getMimeType()); - String pageContent = ""; + StringBuffer pageContent = new StringBuffer(); String serverAdress = "http://"; log.info("Page load"); @@ -198,7 +196,7 @@ beginDatePicker = DateUtils.truncate(beginDatePicker, Calendar.YEAR); - pageContent = "<!DOCTYPE html>\n" + pageContent.append("<!DOCTYPE html>\n" + "<html lang=\"fr\">\n" + "<head>\n" + "<title>LIMA Documents Report</title>\n" @@ -216,29 +214,29 @@ + "<td rowspan=3><form method=GET action=" + serverAdress + ">\n" + _("lima-business.document.date.begin") - + "<input value=\""+dateFormat.format(beginDatePicker) + + "<input value=\""+DATEFORMAT.format(beginDatePicker) + "\" type=\"date\" name=\"beginDate\">\n" + _("lima-business.document.date.end") - + "<input value=\""+dateFormat.format(endDatePicker) + + "<input value=\""+DATEFORMAT.format(endDatePicker) + "\" type=\"date\" name=\"endDate\">\n<br/><br/>" - + "Format : <select name=\"format\">"; + + "Format : <select name=\"format\">"); for (FormatsEnum formatsEnum : FormatsEnum.values()) { - pageContent += "<option value=\"" + pageContent.append("<option value=\"" + formatsEnum.getExtension()+"\">" - + formatsEnum.getDescription()+"</option>\n"; + + formatsEnum.getDescription()+"</option>\n"); } - pageContent += "</select>\n" - + "Documents : <select name=\"model\">"; + pageContent.append("</select>\n" + + "Documents : <select name=\"model\">"); for (DocumentsEnum documentsEnum : DocumentsEnum.values()) { - pageContent += "<option value=\"" + pageContent.append("<option value=\"" + documentsEnum.getFileName()+"\">" - + documentsEnum.getDescription()+"</option>\n"; + + documentsEnum.getDescription()+"</option>\n"); } - pageContent += "</select>\n" + pageContent.append("</select>\n" + "<tr><td><img src=\"?img=entries.png\"/></td></tr>\n" + "<tr><td><img src=\"?img=accounts.png\"/></td></tr>\n" + "<tr><td><img src=\"?img=entrybooks.png\"/></td>\n" @@ -247,9 +245,9 @@ + "<tr><td><img src=\"?img=fiscalperiods.png\"/></td></tr>\n" + "</table>\n" + "</body>\n" - + "</html>"; + + "</html>"); - resp.getWriter().write(pageContent); + resp.getWriter().write(pageContent.toString()); } } 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 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -123,27 +123,27 @@ // Services @EJB - AccountServiceLocal accountService; + private AccountServiceLocal accountService; @EJB - FiscalPeriodServiceLocal fiscalPeriodService; + private FiscalPeriodServiceLocal fiscalPeriodService; @EJB - FinancialPeriodServiceLocal financialPeriodService; + private FinancialPeriodServiceLocal financialPeriodService; @EJB - FinancialTransactionServiceLocal financialTransactionService; + private FinancialTransactionServiceLocal financialTransactionService; @EJB - FinancialStatementServiceLocal financialStatementService; + private FinancialStatementServiceLocal financialStatementService; @EJB - EntryBookServiceLocal entryBookService; + private EntryBookServiceLocal entryBookService; @EJB - IdentityServiceLocal identityService; + private IdentityServiceLocal identityService; - private static final SimpleDateFormat SDateFormat = new SimpleDateFormat( + private static final SimpleDateFormat SDATEFORMAT = new SimpleDateFormat( "dd,MM,yyyy HH:mm:ss"); public ImportServiceImpl() { @@ -162,7 +162,7 @@ @Override public String importEntriesFromEbp(String datas) throws LimaException { SimpleDateFormat epbDateFormat = new SimpleDateFormat("dd/MM/yyyy"); - String result = ""; + StringBuffer result = new StringBuffer(); TopiaContext topiaContext = null; try { @@ -232,9 +232,9 @@ else if (date.compareTo(beginDate) < 0 || date.compareTo(endDate) > 0){ - result += "WARNING : " + date + " entries is out of range of" + + result.append("WARNING : " + date + " entries is out of range of" + " opened fiscal periods. " - + "Entry was skip !\n"; + + "Entry was skip !\n"); } else { entry.setAccount(account); @@ -260,8 +260,8 @@ entryBook.setCode(entryBookCode); // create it entryBookService.createEntryBook(entryBook); - result += "WARNING : Entrybook " + entryBook - + "not exist was created !\n"; + result.append("WARNING : Entrybook " + entryBook + + "not exist was created !\n"); } if (financialTransaction == null @@ -287,15 +287,15 @@ financialTransactionService .createFinancialTransactionWithTransaction( financialTransaction, topiaContext); - result += "SUCCES : FinancialTransaction" + date + " " - + entryBook.getCode() + " added\n"; + result.append("SUCCES : FinancialTransaction" + date + " " + + entryBook.getCode() + " added\n"); } financialTransaction.addEntry(entry); financialTransactionService.createEntryWithTransaction( entry, topiaContext); - result += "SUCCES : Entry" + entry.getDescription() + " " - + entry.getAmount() + " added\n"; + result.append("SUCCES : Entry" + entry.getDescription() + " " + + entry.getAmount() + " added\n"); } } // update last financial transaction @@ -320,12 +320,12 @@ } finally { doFinally(topiaContext, log); } - return result; + return result.toString(); } @Override public String importAccountsChartFromEbp(String datas) throws LimaException { - String result = ""; + StringBuffer result = new StringBuffer(); TopiaContext topiaContext = null; try { @@ -355,8 +355,8 @@ for (AccountEBP accountEBP : list) { String accountNumber = accountEBP.getNumero(); if (accountDAO.findByAccountNumber(accountNumber) != null) { - result += "FAILED : Account" + accountNumber - + " already exist \n"; + result.append("FAILED : Account" + accountNumber + + " already exist \n"); } else { String label = accountEBP.getIntitule(); Account account = new AccountImpl(); @@ -376,8 +376,8 @@ } accountService.createSubLedgerWithTransaction( masterAccount, account, topiaContext); - result += "SUCCES : Account" + accountNumber + " " - + label + " added\n"; + result.append("SUCCES : Account" + accountNumber + " " + + label + " added\n"); } // else is account else { @@ -386,8 +386,8 @@ if (nbCharAccountNumber == 1) { accountService.createAccountWithTransaction(null, account, topiaContext); - result += "SUCCES : Account" + accountNumber + " " - + label + " added\n"; + result.append("SUCCES : Account" + accountNumber + " " + + label + " added\n"); } else { Account masterAccount = null; @@ -401,8 +401,8 @@ } accountService.createAccountWithTransaction( masterAccount, account, topiaContext); - result += "SUCCES : Account" + accountNumber + " " - + label + " added\n"; + result.append("SUCCES : Account" + accountNumber + " " + + label + " added\n"); } } } @@ -417,7 +417,7 @@ doFinally(topiaContext, log); } - return result; + return result.toString(); } @Override @@ -439,7 +439,7 @@ */ @Override public String importAllAsCSV(String datas) throws LimaException { - String result = ""; + StringBuffer result = new StringBuffer(); Map<String, AccountImport> accounts = new TreeMap<String, AccountImport>(); @@ -470,20 +470,20 @@ if (importExportEntityEnum != null) { switch (importExportEntityEnum) { case ACCOUNT: - result += importAccountsChartsCSV(nextLine, accounts, - topiaContext); + result.append(importAccountsChartsCSV(nextLine, accounts, + topiaContext)); break; case ENTRYBOOK: - result += importEntryBooksChartCSV(nextLine, - topiaContext); + result.append(importEntryBooksChartCSV(nextLine, + topiaContext)); break; case FINANCIALSTATEMENT: - result += importFinancialsStatementChartCSV(nextLine, - financialStatements, topiaContext); + result.append(importFinancialsStatementChartCSV(nextLine, + financialStatements, topiaContext)); break; case FISCALPERIOD: - result += importFiscalPeriodCSV(nextLine, - fiscalPeriods, topiaContext); + result.append(importFiscalPeriodCSV(nextLine, + fiscalPeriods, topiaContext)); break; case CLOSEDPERIODICENTRYBOOK: importClosedPeriodicEntryBookCSV(nextLine, @@ -504,19 +504,19 @@ } // create accounts - result += createAccounts(accounts, topiaContext); + result.append(createAccounts(accounts, topiaContext)); // create financialStatements - result += createFinancialStatements(financialStatements, - topiaContext); + result.append(createFinancialStatements(financialStatements, + topiaContext)); // create fiscalperiod Collections.sort(fiscalPeriods, new FiscalPeriodComparator()); - result += createFiscalPeriod(fiscalPeriods, topiaContext); + result.append(createFiscalPeriod(fiscalPeriods, topiaContext)); // update closedperiodicentrybooks - result += updateClosedPeriodicEntryBooks(closedPeriodicEntryBooks, - topiaContext); + result.append(updateClosedPeriodicEntryBooks(closedPeriodicEntryBooks, + topiaContext)); // create financialtransaction and entries - result += createFinancialTransactionsAndEntries( - financialTransactions, entries, topiaContext); + result.append(createFinancialTransactionsAndEntries( + financialTransactions, entries, topiaContext)); commitTransaction(topiaContext); @@ -527,7 +527,7 @@ } finally { doFinally(topiaContext, log); } - return result; + return result.toString(); } /** @@ -536,7 +536,7 @@ */ @Override public String importAsCSV(String datas, ImportExportEntityEnum importExportEntityEnum) throws LimaException { - String result = ""; + StringBuffer result = new StringBuffer(); // FinancialStatements LinkedHashMap<String, ArrayList<FinancialStatementImport>> financialStatements = null; @@ -563,17 +563,17 @@ if (ImportExportEntityEnum.valueOfLabel(nextLine[0]) == importExportEntityEnum) { switch (importExportEntityEnum) { case ENTRYBOOK: - result += importEntryBooksChartCSV(nextLine, topiaContext); + result.append(importEntryBooksChartCSV(nextLine, topiaContext)); break; case ACCOUNT: - result += importAccountsChartsCSV(nextLine, accounts, - topiaContext); + result.append(importAccountsChartsCSV(nextLine, accounts, + topiaContext)); break; case FINANCIALSTATEMENT: - result += importFinancialsStatementChartCSV(nextLine, - financialStatements, topiaContext); + result.append(importFinancialsStatementChartCSV(nextLine, + financialStatements, topiaContext)); break; } } @@ -582,11 +582,11 @@ //create entity switch (importExportEntityEnum) { case ACCOUNT: - result += createAccounts(accounts, topiaContext); + result.append(createAccounts(accounts, topiaContext)); break; case FINANCIALSTATEMENT: - result += createFinancialStatements(financialStatements, - topiaContext); + result.append(createFinancialStatements(financialStatements, + topiaContext)); break; } @@ -597,7 +597,7 @@ } finally { doFinally(topiaContext, log); } - return result; + return result.toString(); } @@ -610,7 +610,7 @@ public String importAccountsChartsCSV(String[] nextLine, Map<String, AccountImport> accounts, TopiaContext topiaContext) throws LimaException { - String result = ""; + StringBuffer result = new StringBuffer(); String accountNumber = nextLine[1]; String label = nextLine[2]; String thirdParty = nextLine[3]; @@ -633,13 +633,13 @@ // put it in hashset accounts.put(accountNumber, accountImport); } else { - result += "FAILED : The account " + accountNumber - + " already exists !\n"; + result.append("FAILED : The account " + accountNumber + + " already exists !\n"); } } catch (TopiaException eeeTE) { doCatch(topiaContext, eeeTE, log); } - return result; + return result.toString(); } /** @@ -649,24 +649,24 @@ public String importFiscalPeriodCSV(String[] nextLine, List<FiscalPeriod> fiscalPeriods, TopiaContext topiaContext) throws LimaException { - String result = ""; + StringBuffer result = new StringBuffer(); try { FiscalPeriodDAO fiscalPeriodDAO = LimaCallaoDAOHelper .getFiscalPeriodDAO(topiaContext); FiscalPeriod fiscalPeriod = new FiscalPeriodImpl(); - Date beginDate = SDateFormat.parse(nextLine[1]); + Date beginDate = SDATEFORMAT.parse(nextLine[1]); fiscalPeriod.setBeginDate(beginDate); - Date endDate = SDateFormat.parse(nextLine[2]); + Date endDate = SDATEFORMAT.parse(nextLine[2]); fiscalPeriod.setEndDate(endDate); - fiscalPeriod.setLocked(new Boolean(nextLine[3])); + fiscalPeriod.setLocked(Boolean.parseBoolean(nextLine[3])); // if not exist, skip if (fiscalPeriodDAO.findByNaturalId(beginDate, endDate) == null) { fiscalPeriods.add(fiscalPeriod); } else { - result += "FAILED : The fiscalperiod " + beginDate + "-" - + endDate + " already exists !\n"; + result.append("FAILED : The fiscalperiod " + beginDate + "-" + + endDate + " already exists !\n"); } } catch (ParseException eeePE) { if (log.isDebugEnabled()) { @@ -675,7 +675,7 @@ } catch (TopiaException eeeTE) { doCatch(topiaContext, eeeTE, log); } - return result; + return result.toString(); } /** @@ -683,7 +683,7 @@ */ public String importEntryBooksChartCSV(String[] nextLine, TopiaContext topiaContext) throws LimaException { - String result = ""; + StringBuffer result = new StringBuffer(); try { EntryBookDAO entryBookDAO = LimaCallaoDAOHelper @@ -696,18 +696,18 @@ // if exist, skip if (entryBookDAO.findByCode(entryBook.getCode()) != null) { - result += "FAILED : The entrybook " + entryBook.getLabel() - + " already exists !\n"; + result.append("FAILED : The entrybook " + entryBook.getLabel() + + " already exists !\n"); } else { // create it entryBookService.createEntryBook(entryBook); - result += "SUCCESS : The financialStatement " - + entryBook.getLabel() + " is created ! \n"; + result.append("SUCCESS : The financialStatement " + + entryBook.getLabel() + " is created ! \n"); } } catch (TopiaException eeeTE) { doCatch(topiaContext, eeeTE, log); } - return result; + return result.toString(); } /** @@ -722,7 +722,7 @@ String endDate = nextLine[3]; String entryBookCode = nextLine[4]; - if (new Boolean(locked)) { + if (Boolean.parseBoolean(locked)) { ClosedPeriodicEntryBookImport closedPeriodicEntryBookImport = new ClosedPeriodicEntryBookImportImpl(); closedPeriodicEntryBookImport.setLocked(locked); closedPeriodicEntryBookImport @@ -744,7 +744,7 @@ public String importFinancialsStatementChartCSV(String[] nextLine, LinkedHashMap<String, ArrayList<FinancialStatementImport>> financialStatements, TopiaContext topiaContext) throws LimaException { - String result = ""; + StringBuffer result = new StringBuffer(); String label = nextLine[1]; String header = nextLine[2]; @@ -788,13 +788,13 @@ financialStatements.put(label, (ArrayList<FinancialStatementImport>) list); } } else { - result += "FAILED : The financialstatement " + label - + " already exists !\n"; + result.append("FAILED : The financialstatement " + label + + " already exists !\n"); } } catch (TopiaException eeeTE) { doCatch(topiaContext, eeeTE, log); } - return result; + return result.toString(); } /** @@ -852,7 +852,7 @@ public String createFinancialStatements(LinkedHashMap<String, ArrayList<FinancialStatementImport>> financialStatements, TopiaContext topiaContext) throws LimaException { - String result = ""; + StringBuffer result = new StringBuffer(); try { FinancialStatementDAO financialStatementDAO = LimaCallaoDAOHelper @@ -911,18 +911,18 @@ masterFinancialStatement, financialStatement, topiaContext); - result += "SUCCESS : The financialStatement " + result.append("SUCCESS : The financialStatement " + financialStatementImport.getLabel() - + " is created ! \n"; + + " is created ! \n"); itr2.remove(); } else if (!financialStatements .containsKey(masterFinancialStatementLabel)) { - result += "FAILED : The financialStatement " + result.append("FAILED : The financialStatement " + financialStatementImport.getLabel() + " have masterFinancialStatement : " + masterFinancialStatementLabel - + "which not exist \n"; + + "which not exist \n"); itr2.remove(); } } @@ -934,30 +934,30 @@ } catch (TopiaException eeeTE) { doCatch(topiaContext, eeeTE, log); } - return result; + return result.toString(); } public String createFiscalPeriod(List<FiscalPeriod> fiscalPeriods, TopiaContext topiaContext) { - String result = ""; + StringBuffer result = new StringBuffer(); for (FiscalPeriod fiscalPeriod : fiscalPeriods) { // create fiscalPeriod try { fiscalPeriodService.createFiscalPeriodWithTransaction( fiscalPeriod, topiaContext); - result += "SUCCESS : The fiscalPeriod " + result.append("SUCCESS : The fiscalPeriod " + fiscalPeriod.getBeginDate() + "-" - + fiscalPeriod.getEndDate() + " is created ! \n"; + + fiscalPeriod.getEndDate() + " is created ! \n"); } catch (LimaException eee) { - result += "FAILED : " + eee + " \n"; + result.append("FAILED : " + eee + " \n"); } } - return result; + return result.toString(); } public String createAccounts(Map<String, AccountImport> accounts, TopiaContext topiaContext) throws LimaException { - String result = ""; + StringBuffer result = new StringBuffer(); try { AccountDAO accountDAO = LimaCallaoDAOHelper @@ -993,16 +993,16 @@ accountService.createAccountWithTransaction( masterAccount, account, topiaContext); } - result += "SUCCESS : The account " + result.append("SUCCESS : The account " + accountImport.getAccountNumber() - + " is created ! \n"; + + " is created ! \n"); itr.remove(); } else if (!accounts.containsKey(masterAccountNumber) && !accounts.containsKey(generalLedgerNumber)) { - result += "FAILED : The account " + result.append("FAILED : The account " + accountImport.getAccountNumber() + " have masterAccount : " - + masterAccountNumber + "which not exist \n"; + + masterAccountNumber + "which not exist \n"); itr.remove(); } } @@ -1010,13 +1010,13 @@ } catch (TopiaException eeeTE) { doCatch(topiaContext, eeeTE, log); } - return result; + return result.toString(); } public String updateClosedPeriodicEntryBooks( List<ClosedPeriodicEntryBookImport> closedPeriodicEntryBooks, TopiaContext topiaContext) throws LimaException { - String result = ""; + StringBuffer result = new StringBuffer(); try { FinancialPeriodDAO financialPeriodDAO = LimaCallaoDAOHelper @@ -1027,10 +1027,10 @@ .getClosedPeriodicEntryBookDAO(topiaContext); for (ClosedPeriodicEntryBookImport closedPeriodicEntryBookImport : closedPeriodicEntryBooks) { // update closedPeriodicEntryBook - Date beginDateFinancialPeriod = SDateFormat + Date beginDateFinancialPeriod = SDATEFORMAT .parse(closedPeriodicEntryBookImport .getBeginDateFinancialPeriod()); - Date endDateFinancialPeriod = SDateFormat + Date endDateFinancialPeriod = SDATEFORMAT .parse(closedPeriodicEntryBookImport .getEndDateFinancialPeriod()); FinancialPeriod financialPeriod = financialPeriodDAO @@ -1046,12 +1046,12 @@ financialPeriodService .blockClosedPeriodicEntryBookWithTransaction( closedPeriodicEntryBook, topiaContext); - result += "SUCCESS : The blockClosedPeriodicEntryBook " + result.append("SUCCESS : The blockClosedPeriodicEntryBook " + beginDateFinancialPeriod + "-" + endDateFinancialPeriod + ", " + codeEntryBook - + " is updated ! \n"; + + " is updated ! \n"); } catch (LimaException eee) { - result += "FAILED : " + eee + " \n"; + result.append("FAILED : " + eee + " \n"); } } } catch (TopiaException eeeTE) { @@ -1061,14 +1061,14 @@ log.debug("Can't parse date", eeePE); } } - return result; + return result.toString(); } public String createFinancialTransactionsAndEntries( Map<Integer, FinancialTransactionImport> financialTransactions, Map<Integer, List<EntryImport>> entries, TopiaContext topiaContext) throws LimaException { - String result = ""; + StringBuffer result = new StringBuffer(); try { EntryBookDAO entryBookDAO = LimaCallaoDAOHelper .getEntryBookDAO(topiaContext); @@ -1085,7 +1085,7 @@ FinancialTransactionImport financialTransactionImport = map .getValue(); FinancialTransaction financialTransaction = new FinancialTransactionImpl(); - Date dateFinancialTransaction = SDateFormat + Date dateFinancialTransaction = SDATEFORMAT .parse(financialTransactionImport.getDate()); financialTransaction .setTransactionDate(dateFinancialTransaction); @@ -1112,7 +1112,7 @@ entry.setAccount(account); entry.setDescription(entryImport.getDescription()); entry.setAmount(new BigDecimal(entryImport.getAmount())); - entry.setDebit(new Boolean(entryImport.getDebit())); + entry.setDebit(Boolean.parseBoolean(entryImport.getDebit())); entry.setLettering(entryImport.getLettering()); entry.setDetail(entryImport.getDetail()); entry.setVoucher(entryImport.getVoucher()); @@ -1128,12 +1128,12 @@ log.debug("Can't parse date", eeePE); } } - return result; + return result.toString(); } public String importIdentity(String[] nextLine, TopiaContext topiaContext) throws LimaException { - String result = ""; + StringBuffer result = new StringBuffer(); Identity identity = new IdentityImpl(); nextLine[0] = ImportExportEntityEnum.IDENTITY.getLabel(); @@ -1151,10 +1151,10 @@ identityService.updateIdentityWithTransaction(identity, topiaContext); // create it - result += "SUCCESS : The identity " + identity.getName() - + " is created ! \n"; + result.append("SUCCESS : The identity " + identity.getName() + + " is created ! \n"); - return result; + return result.toString(); } protected TopiaContext beginTransaction() throws TopiaException { Deleted: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/RecordServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/RecordServiceImpl.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/RecordServiceImpl.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -1,371 +0,0 @@ -/* *##% Lima Business - * Copyright (C) 2008 - 2010 CodeLutin - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * ##%* - */ - -package org.chorem.lima.business.ejb; - -import java.util.ArrayList; -import java.util.List; - -import javax.ejb.Stateless; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.LimaConfig; -import org.chorem.lima.business.LimaException; -import org.chorem.lima.business.ejbinterface.RecordService; -import org.chorem.lima.business.ejbinterface.RecordServiceLocal; -import org.chorem.lima.entity.LimaCallaoDAOHelper; -import org.chorem.lima.entity.Record; -import org.chorem.lima.entity.RecordDAO; -import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaContextFactory; -import org.nuiton.topia.TopiaException; -import org.nuiton.topia.TopiaNotFoundException; - -/** - * Permet d'ajouter des logs au systeme. - * - * ATTENTION on ne peut supprimer un log. - * - * @author Rémi Chapelet - */ -@Stateless -public class RecordServiceImpl implements RecordService, RecordServiceLocal { - - /** log */ - private static final Log log = LogFactory.getLog(RecordServiceImpl.class); - - private TopiaContext rootContext; - - - public RecordServiceImpl() { - LimaConfig config = LimaConfig.getInstance(); - try { - rootContext = TopiaContextFactory.getContext(config.getOptions()); - } catch (TopiaNotFoundException ex) { - if (log.isErrorEnabled()) { - log.error("Can't init topia context", ex); - } - } - } - - /** - * Création d'un log dans le systeme. - * - * @param entryLog date de creation du log - * @throws LimaException - */ - public void addLog(Record entryLog) throws LimaException { - /*String result = ServiceHelper.RESPOND_ERROR; - try { - // Acces BDD - TopiaContext topiaContext = rootContext.beginTransaction(); - // Chargement du DAO - EntryLogDAO logDAO = LimaCallaoDAOHelper.getEntryLogDAO(topiaContext); - // Creation du log - EntryLog newlog = logDAO.create(); - newlog.setLogDate(logDate); - newlog.setTransDate(transDate); - newlog.setVoucherRef(voucherRef); - newlog.setType(type); - newlog.setTransDesc(transDesc); - newlog.setEntryDesc(entryDesc); - newlog.setAmount(amount); - newlog.setDebit(debit); - newlog.setLettering(lettering); - // Création BDD - topiaContext.commitTransaction(); - // Fermeture BDD - topiaContext.closeContext(); - // Affichage pour les logs - String topiaId = newlog.getTopiaId(); - if (log.isInfoEnabled()) { - log.info("Log created: "+ topiaId); - } - result = ServiceHelper.RESPOND_SUCCESS; - }catch (TopiaException e) { - log.error(e); - } - return result;*/ - - TopiaContext transaction = null; - try { - // basic check done, make check in database - // TODO move it into JTA - transaction = rootContext.beginTransaction(); - - // creation - RecordDAO recordDAO = LimaCallaoDAOHelper - .getRecordDAO(transaction); - recordDAO.create(entryLog); - - // commit - transaction.commitTransaction(); - } catch (TopiaException ex) { - if (transaction != null) { - try { - transaction.rollbackTransaction(); - } catch (TopiaException e) { - if (log.isErrorEnabled()) { - log.error("Error during rollback context", ex); - } - } - } - if (log.isErrorEnabled()) { - log.error("Error during create account", ex); - } - throw new LimaException("Can't create entry log", ex); - } finally { - if (transaction != null) { - try { - transaction.closeContext(); - } catch (TopiaException ex) { - if (log.isErrorEnabled()) { - log.error("Error during rollback context", ex); - } - throw new LimaException("Can't create entry log", ex); - } - } - } - } - - /* - * Création d'un log à partir d'un log DTO. - * @param logDTO log en format DTO qu'on souhaite créer - * @return - * - public String addLog (LogDTO logDTO) { - String result = ServiceHelper.RESPOND_ERROR; - // Vérifie si logDTO existe - if (logDTO != null) - { - result = addLog(logDTO.getLogDate(),logDTO.getTransDate(),logDTO.getType(), - logDTO.getVoucherRef(),logDTO.getTransDesc(),logDTO.getEntryDesc(), - logDTO.getAmount(),logDTO.isDebit(),logDTO.getLettering()); - } - return result; - }*/ - - /** - * Recherche tous les logs dans la base de donnees. - * - * @return la liste des logs - * @throws LimaException - */ - public List<Record> listeAllLog() throws LimaException { - /*List<EntryLog> listelog = null; - try { - // Acces BDD - TopiaContext topiaContext = rootContext.beginTransaction(); - // Chargement du DAO - EntryLogDAO logDAO = LimaCallaoDAOHelper - .getEntryLogDAO(topiaContext); - // recherche des log - listelog = logDAO.findAll(); - // Fermeture BDD - topiaContext.closeContext(); - if (log.isInfoEnabled()) { - log.info("Search all logs"); - } - } catch (TopiaException e) { - log.error(e); - } - return listelog;*/ - - List<Record> entryLogsList = new ArrayList<Record>(); - TopiaContext transaction = null; - try { - // basic check done, make check in database - // TODO move it into JTA - transaction = rootContext.beginTransaction(); - - // creation - RecordDAO recordDAO = LimaCallaoDAOHelper - .getRecordDAO(transaction); - List<Record> entryLogs = recordDAO.findAll(); - entryLogsList.addAll(entryLogs); - - // commit - transaction.commitTransaction(); - } catch (TopiaException ex) { - if (transaction != null) { - try { - transaction.rollbackTransaction(); - } catch (TopiaException e) { - if (log.isErrorEnabled()) { - log.error("Error during rollback context", ex); - } - } - } - if (log.isErrorEnabled()) { - log.error("Error during create account", ex); - } - throw new LimaException("Can't create entry log", ex); - } finally { - if (transaction != null) { - try { - transaction.closeContext(); - } catch (TopiaException ex) { - if (log.isErrorEnabled()) { - log.error("Error during rollback context", ex); - } - throw new LimaException("Can't create entry log", ex); - } - } - } - - return entryLogsList; - } - - /* - * Permet de renvoyer tous les logs au format DTO. - * @return - * - public List<LogDTO> listeAllLogDTO() { - List<LogDTO> listLogDTO = new ArrayList<LogDTO>(); - // On recherche tous les logs. - List<EntryLog> listLog = listeAllLog(); - // Pour chaque log, on le converti en logDTO et on l'ajoute à la nouvelle liste de DTO - for (EntryLog log : listLog) { - // conerti de l'entity en DTO - LogDTO logDTO = convertLog.logEntityToDto(log); - // Ajoute à la liste des logs DTO - listLogDTO.add(logDTO); - } - return listLogDTO; - }*/ - - /* - * Renvoie une liste de tous les logs suivant la date de creation - * @param datecreate date de creation des logs recherchés - * @return une liste des logs trouves - * - public List<EntryLog> searchLogWithDateCreate(Date dateCreate) { - List<EntryLog> listelog = null; - try { - // Acces BDD - TopiaContext topiaContext = rootContext.beginTransaction(); - // Chargement du DAO - EntryLogDAO logDAO = LimaCallaoDAOHelper - .getEntryLogDAO(topiaContext); - // recherche des log - listelog = logDAO.findAllByLogDate(dateCreate); - // Fermeture BDD - topiaContext.closeContext(); - if (log.isInfoEnabled()) { - log.info("Log(s) find : " + listelog.size() + "log(s)"); - } - } catch (TopiaException e) { - log.error(e); - } - return listelog; - }*/ - - /* - * Permet de rechercher tous les logs suivant la date de création, c'est à - * dire de l'opération effectuée sur une entry à un jour précis, et qui a - * déclenchée automatiquement une création de log. - * La méthode renvoie sous forme de liste, en convertissant les objets - * entitys en DTO. - * @param dateCreate date de création des logs recherchés - * @return - * - public List<LogDTO> searchLogDTOWithDateCreate(Date dateCreate) { - List<LogDTO> listLogDTO = new ArrayList<LogDTO>(); - // On recherche tous les logs suivant la date de création. - List<EntryLog> listLog = searchLogWithDateCreate(dateCreate); - // Pour chaque log, on le converti en logDTO et on l'ajoute à la nouvelle liste de DTO - for (EntryLog log : listLog) { - // conerti de l'entity en DTO - LogDTO logDTO = convertLog.logEntityToDto(log); - // Ajoute à la liste des logs DTO - listLogDTO.add(logDTO); - } - return listLogDTO; - }*/ - - /* - * Recherche un log avec son identifiant topiaId. - * @param topiaId identifiant d'un log - * @return - * - public EntryLog searchLogWithTopiaId(String topiaId) { - EntryLog logSearch = null; - try { - // Acces BDD - TopiaContext topiaContext = rootContext.beginTransaction(); - // Chargement du DAO - EntryLogDAO logDAO = LimaCallaoDAOHelper - .getEntryLogDAO(topiaContext); - // Creation du journal - logSearch = logDAO.findByTopiaId(topiaId); - // Fermeture BDD - topiaContext.closeContext(); - } catch (TopiaException e) { - log.error(e); - } - return logSearch; - }*/ - - /* - * Efface un log : uniquement utilisé pour supprimer les logs dans les tests - * unitaires. - * @param topiaId identifiant du log à supprimer - * @return - * - public String removeLog(String topiaId) { - String result = ServiceHelper.RESPOND_ERROR; - EntryLog logDelete = searchLogWithTopiaId(topiaId); - // Si le log n'existe pas - if (logDelete == null) { - if (log.isWarnEnabled()) { - log.warn("Le log " + topiaId + " n'existe pas !"); - } - } else // Sinon on efface le log - { - try { - // Acces BDD - TopiaContext topiaContext = rootContext.beginTransaction(); - // Chargement du DAO - EntryLogDAO logDAO = LimaCallaoDAOHelper - .getEntryLogDAO(topiaContext); - // Supprime le log - logDAO.delete(logDelete); - // Création BDD - topiaContext.commitTransaction(); - // Fermeture BDD - topiaContext.closeContext(); - result = ServiceHelper.RESPOND_SUCCESS; - } catch (TopiaException e) { - log.error(e); - } - } - return result; - }*/ - - /* - * Permet de supprimer un log à partir de son DTO. - * @param logDTO log à supprimer - * @return - * - public String removeLog(LogDTO logDTO) { - String result = removeLog(logDTO.getId()); - return result; - }*/ -} Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -105,7 +105,7 @@ BigDecimal solde = new BigDecimal(0); List<Entry> entries = new ArrayList<Entry>(); if (account != null){ - + //Get allsubaccounts and thirdParts accounts List<Account> accounts = (List<Account>) account.getSubAccounts(); if (thirdPartAccountsMode){ @@ -183,7 +183,6 @@ * Get list entries * Calculate all credit, debit and solde amounts for the accounts reports */ - @SuppressWarnings("unchecked") protected ReportsDatas generateSubAccountReportsWithTransaction(Account account, Date beginDate, Date endDate, TopiaContext topiaContext) throws LimaException { ReportsDatas reportsDatas = new ReportsDatasImpl(); BigDecimal credit = new BigDecimal(0); @@ -254,7 +253,6 @@ * * Get all entries if true */ - @SuppressWarnings("unchecked") protected ReportsDatas generateSubAccountBalanceWithTransaction(Account account, Date beginDate, Date endDate, Boolean getEntries, TopiaContext topiaContext) throws LimaException { ReportsDatas reportsDatas = new ReportsDatasImpl(); BigDecimal credit = new BigDecimal(0); @@ -332,7 +330,6 @@ * Just balanced transaction are calculated * */ - @SuppressWarnings({ "unchecked" }) @Override public ReportsDatas generateEntryBooksReports(EntryBook entryBook, Date beginDate, Date endDate) throws LimaException { ReportsDatas reportsDatas = new ReportsDatasImpl(); @@ -468,15 +465,15 @@ List<Account> accounts =null; //Remove Spaces - selectedAccounts = StringUtils.deleteWhitespace(selectedAccounts); + String result = StringUtils.deleteWhitespace(selectedAccounts); //if no filter account - if (selectedAccounts == null || selectedAccounts.equals("")){ + if (result == null || result.equals("")){ accounts = accountDAO.findAll(); } //build list account from selectedAccounts else{ accounts = accountDAO.stringToListAccounts( - selectedAccounts, false); + result, false); } for (Account account : accounts) { ReportsDatas reportsDatas = @@ -549,15 +546,4 @@ return topiaTransaction; } - protected void commitTransaction(TopiaContext topiaTransaction) throws TopiaException { - try { - topiaTransaction.commitTransaction(); - } catch (TopiaException eee) { - if (log.isErrorEnabled()) { - log.error("Error during commit context", eee); - } - throw eee; - } - } - } Deleted: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/UserServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/UserServiceImpl.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/UserServiceImpl.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -1,114 +0,0 @@ -/* *##% Lima Business - * Copyright (C) 2008 - 2010 CodeLutin - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * ##%* - */ - -package org.chorem.lima.business.ejb; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.LimaConfig; -import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaContextFactory; -import org.nuiton.topia.TopiaNotFoundException; - -/** - * User service. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class UserServiceImpl { - - /** log */ - private static final Log log = LogFactory.getLog(UserServiceImpl.class); - - private TopiaContext rootContext; - - public UserServiceImpl() { - LimaConfig config = LimaConfig.getInstance(); - try { - rootContext = TopiaContextFactory.getContext(config.getOptions()); - } catch (TopiaNotFoundException ex) { - if (log.isErrorEnabled()) { - log.error("Can't init topia context", ex); - } - } - } - - /** - * Add new user. - * - * @param name new user name - * @throws LimaException - */ - /* - public void addUser(User user/*String name) throws LimaException { - // Attention doublon utilisateur - try { - // Acces BDD - TopiaContext topiaContext = rootContext.beginTransaction(); - // Chargement du DAO - UsersDAO userdao = LimaCallaoDAOHelper.getUsersDAO(topiaContext); - // Création de l'user - Users newuser = userdao.create(); - newuser.setMatcher(name); - // Création BDD - topiaContext.commitTransaction(); - topiaContext.closeContext(); - if (log.isInfoEnabled()) { - log.info("Add user : " + name); - } - } catch (TopiaException ex) { - if (log.isErrorEnabled()) { - log.error("Can't create user", ex); - throw new LimaException("Can't create user", ex); - } - - } - }*/ - - /** - * Find user with name. - * - * @param name - * @throws LimaException - */ - /*public void findUser(String name) throws LimaException { - /*try { - // Acces BDD - TopiaContext topiaContext = rootContext.beginTransaction(); - // Chargement du DAO - UsersDAO userdao = LimaCallaoDAOHelper.getUsersDAO(topiaContext); - // Recherche du user - Users newuser = userdao.findByMatcher(name); - // Fermeture BDD - topiaContext.closeContext(); - if (newuser == null) { - throw new LimaBusinessException("can't find user " + name); - } - } catch (TopiaException ex) { - if (log.isErrorEnabled()) { - log.error("Can't find user", ex); - throw new LimaException("Can't find user", ex); - } - } - }*/ -} Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountService.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountService.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountService.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -21,7 +21,6 @@ import java.util.List; import javax.ejb.Remote; -import org.chorem.lima.business.LimaBusinessException; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.Account; @@ -51,13 +50,13 @@ * @throws LimaException */ //EJB Remote - void createAccount(Account masterAccount, Account account) throws LimaException, LimaBusinessException; + void createAccount(Account masterAccount, Account account) throws LimaException; - void createSubLedger(Account masterAccount, Account account) throws LimaException, LimaBusinessException; + void createSubLedger(Account masterAccount, Account account) throws LimaException; - void updateAccount(Account account) throws LimaException, LimaBusinessException; + void updateAccount(Account account) throws LimaException; - void removeAccount(Account account) throws LimaException, LimaBusinessException; + void removeAccount(Account account) throws LimaException; void removeAllAccount() throws LimaException; List<Account> getAllChildrenAccounts(Account masterAccount, List<Account> accounts) throws LimaException; Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountServiceLocal.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountServiceLocal.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountServiceLocal.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -19,10 +19,7 @@ package org.chorem.lima.business.ejbinterface; -import java.util.List; import javax.ejb.Local; - -import org.chorem.lima.business.LimaBusinessException; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.Account; import org.nuiton.topia.TopiaContext; @@ -40,7 +37,7 @@ @Local public interface AccountServiceLocal extends AccountService{ - void createAccountWithTransaction(Account masterAccount, Account account, TopiaContext topiaContext) throws LimaException, LimaBusinessException; + void createAccountWithTransaction(Account masterAccount, Account account, TopiaContext topiaContext) throws LimaException; void createSubLedgerWithTransaction(Account masterAccount, Account account, TopiaContext topiaContext) throws LimaException; } \ No newline at end of file Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/DocumentService.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/DocumentService.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/DocumentService.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -33,10 +33,10 @@ @Remote public interface DocumentService { - public void createFinancialStatementsDocuments(Date beginDate, Date endDate, FormatsEnum format) throws LimaException; - public void createLedgerDocuments(Date beginDate, Date endDate, FormatsEnum format) throws LimaException; - public void createEntryBooksDocuments(Date beginDate, Date endDate, FormatsEnum format) throws LimaException; - public void createBalanceDocuments(Date beginDate, Date endDate, FormatsEnum format) throws LimaException; - public void createGeneralEntryBooksDocuments(Date beginDate, Date endDate, FormatsEnum format) throws LimaException; + void createFinancialStatementsDocuments(Date beginDate, Date endDate, FormatsEnum format) throws LimaException; + void createLedgerDocuments(Date beginDate, Date endDate, FormatsEnum format) throws LimaException; + void createEntryBooksDocuments(Date beginDate, Date endDate, FormatsEnum format) throws LimaException; + void createBalanceDocuments(Date beginDate, Date endDate, FormatsEnum format) throws LimaException; + void createGeneralEntryBooksDocuments(Date beginDate, Date endDate, FormatsEnum format) throws LimaException; } Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/DocumentServiceLocal.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/DocumentServiceLocal.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/DocumentServiceLocal.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -30,5 +30,4 @@ @Local public interface DocumentServiceLocal { - } Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/EntryBookServiceLocal.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/EntryBookServiceLocal.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/EntryBookServiceLocal.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -39,6 +39,6 @@ @Local public interface EntryBookServiceLocal extends EntryBookService { - public void createEntryBookWithTransaction(EntryBook entryBook, TopiaContext topiaContext) throws LimaException; + void createEntryBookWithTransaction(EntryBook entryBook, TopiaContext topiaContext) throws LimaException; } Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ExportService.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ExportService.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ExportService.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -43,32 +43,32 @@ * @return export as byte array * @throws LimaException */ - public String exportAsCSV() throws LimaException; + String exportAsCSV() throws LimaException; /** * export entrybook chart as CSV. */ - public String exportEntryBookChartAsCSV() throws LimaException; + String exportEntryBookChartAsCSV() throws LimaException; /** * export financialstatement chart as CSV. */ - public String exportFinancialStatementChartAsCSV() throws LimaException; + String exportFinancialStatementChartAsCSV() throws LimaException; /** * export accounts chart as CSV. */ - public String exportAccountsChartAsCSV() throws LimaException; + String exportAccountsChartAsCSV() throws LimaException; /** * export entries as EBP */ - public String exportEntriesAsEBP() throws LimaException; + String exportEntriesAsEBP() throws LimaException; /** * export accounts as EBP */ - public String exportAccountsAsEBP() throws LimaException; + String exportAccountsAsEBP() throws LimaException; } Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FinancialStatementService.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FinancialStatementService.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FinancialStatementService.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -23,7 +23,6 @@ import java.util.List; import javax.ejb.Remote; import org.chorem.lima.beans.FinancialStatementAmounts; -import org.chorem.lima.business.LimaBusinessException; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.FinancialStatement; @@ -31,17 +30,17 @@ public interface FinancialStatementService { - public void createFinancialStatement(FinancialStatement masterFinancialStatement, FinancialStatement financialStatement) throws LimaException, LimaBusinessException; - public void updateFinancialStatement(FinancialStatement financialStatement) throws LimaException, LimaBusinessException; - public void removeFinancialStatement(FinancialStatement financialStatement) throws LimaException, LimaBusinessException; - public void removeAllFinancialStatement() throws LimaException, LimaBusinessException; + void createFinancialStatement(FinancialStatement masterFinancialStatement, FinancialStatement financialStatement) throws LimaException; + void updateFinancialStatement(FinancialStatement financialStatement) throws LimaException; + void removeFinancialStatement(FinancialStatement financialStatement) throws LimaException; + void removeAllFinancialStatement() throws LimaException; - public List<FinancialStatement> getAllFinancialStatements() throws LimaException; - public List<FinancialStatement> getChildrenFinancialStatement(FinancialStatement financialStatement) throws LimaException; - public List<FinancialStatement> getAllChildrenFinancialStatement(FinancialStatement financialStatement, List<FinancialStatement> financialStatements) throws LimaException, LimaBusinessException; + List<FinancialStatement> getAllFinancialStatements() throws LimaException; + List<FinancialStatement> getChildrenFinancialStatement(FinancialStatement financialStatement) throws LimaException; + List<FinancialStatement> getAllChildrenFinancialStatement(FinancialStatement financialStatement, List<FinancialStatement> financialStatements) throws LimaException; - public List<FinancialStatementAmounts> financialStatementReport(Date selectedBeginDate, Date selectedEndDate) throws LimaException; + List<FinancialStatementAmounts> financialStatementReport(Date selectedBeginDate, Date selectedEndDate) throws LimaException; - public String checkFinancialStatementChart() throws LimaException; + String checkFinancialStatementChart() throws LimaException; } Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FinancialStatementServiceLocal.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FinancialStatementServiceLocal.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FinancialStatementServiceLocal.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -20,8 +20,6 @@ package org.chorem.lima.business.ejbinterface; import javax.ejb.Local; - -import org.chorem.lima.business.LimaBusinessException; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.FinancialStatement; import org.nuiton.topia.TopiaContext; @@ -29,8 +27,8 @@ @Local public interface FinancialStatementServiceLocal extends FinancialStatementService { - public void createFinancialStatementWithTransaction(FinancialStatement masterFinancialStatement, - FinancialStatement financialStatement, TopiaContext topiaContext) throws LimaException, LimaBusinessException; + void createFinancialStatementWithTransaction(FinancialStatement masterFinancialStatement, + FinancialStatement financialStatement, TopiaContext topiaContext) throws LimaException; } Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FinancialTransactionService.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FinancialTransactionService.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FinancialTransactionService.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -22,11 +22,8 @@ import java.util.Date; import java.util.List; import java.util.Set; - import javax.ejb.Remote; - import org.chorem.lima.FinancialStatementWayEnum; -import org.chorem.lima.business.LimaBusinessException; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.Entry; @@ -69,7 +66,7 @@ void createFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException; - void updateFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException, LimaBusinessException; + void updateFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException; void removeFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException; Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FinancialTransactionServiceLocal.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FinancialTransactionServiceLocal.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/FinancialTransactionServiceLocal.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -21,8 +21,6 @@ import java.util.List; import javax.ejb.Local; - -import org.chorem.lima.business.LimaBusinessException; import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.FinancialTransaction; @@ -41,11 +39,11 @@ @Local public interface FinancialTransactionServiceLocal extends FinancialTransactionService { - public List<FinancialTransaction> getAllFinancialTransactionsBalanced(TopiaContext topiaContext) throws LimaException; + List<FinancialTransaction> getAllFinancialTransactionsBalanced(TopiaContext topiaContext) throws LimaException; void createFinancialTransactionWithTransaction(FinancialTransaction financialtransaction, TopiaContext topiaContext) throws LimaException; - void updateFinancialTransactionWithTransaction(FinancialTransaction financialtransaction, TopiaContext topiaContext) throws LimaException, LimaBusinessException; + void updateFinancialTransactionWithTransaction(FinancialTransaction financialtransaction, TopiaContext topiaContext) throws LimaException; void createEntryWithTransaction(Entry entry, TopiaContext topiaContext) throws LimaException; Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/HttpServerService.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/HttpServerService.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/HttpServerService.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -25,7 +25,7 @@ @Remote public interface HttpServerService { - public void start(); - public int getHttpPort(); + void start(); + int getHttpPort(); } Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/IdentityService.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/IdentityService.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/IdentityService.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -27,7 +27,7 @@ @Remote public interface IdentityService { - public Identity getIdentity() throws LimaException; - public void updateIdentity(Identity identity) throws LimaException; + Identity getIdentity() throws LimaException; + void updateIdentity(Identity identity) throws LimaException; } Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/IdentityServiceLocal.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/IdentityServiceLocal.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/IdentityServiceLocal.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -28,7 +28,7 @@ @Local public interface IdentityServiceLocal { - public void updateIdentityWithTransaction(Identity identity, TopiaContext topiaContext) throws LimaException; - public Identity getIdentityWithTransaction(TopiaContext topiaContext) throws LimaException; + void updateIdentityWithTransaction(Identity identity, TopiaContext topiaContext) throws LimaException; + Identity getIdentityWithTransaction(TopiaContext topiaContext) throws LimaException; } 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 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ImportService.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -43,8 +43,8 @@ * @param data * @throws LimaException */ - public String importEntriesFromEbp(String datas) throws LimaException; - public String importAccountsChartFromEbp(String datas) throws LimaException; + String importEntriesFromEbp(String datas) throws LimaException; + String importAccountsChartFromEbp(String datas) throws LimaException; /** @@ -53,7 +53,7 @@ * @param data * @throws LimaException */ - public void importAsSage(byte[] data) throws LimaException; + void importAsSage(byte[] data) throws LimaException; /** * Import data as Ciel Compta export. @@ -61,13 +61,13 @@ * @param data * @throws LimaException */ - public void importAsCiel(byte[] data) throws LimaException; + void importAsCiel(byte[] data) throws LimaException; /** * import CSV. * Return result log */ - public String importAllAsCSV(String path) throws LimaException; + String importAllAsCSV(String path) throws LimaException; - public String importAsCSV(String path, ImportExportEntityEnum importExportEntityEnum) throws LimaException; + String importAsCSV(String path, ImportExportEntityEnum importExportEntityEnum) throws LimaException; } Deleted: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/RecordService.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/RecordService.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/RecordService.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -1,44 +0,0 @@ -/* *##% Lima Business - * Copyright (C) 2008 - 2010 CodeLutin - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * ##%* - */ - -package org.chorem.lima.business.ejbinterface; - -import javax.ejb.Remote; - -/** - * Fiscal period service. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ - -@Remote -public interface RecordService { - - //List<FiscalPeriod> getAllFiscalPeriods() throws LimaException; - - //void createFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException; - - //void updateFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException; - - //void removeFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException; -} Deleted: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/RecordServiceLocal.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/RecordServiceLocal.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/RecordServiceLocal.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -1,37 +0,0 @@ -/* *##% Lima Business - * Copyright (C) 2008 - 2010 CodeLutin - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * ##%* - */ - -package org.chorem.lima.business.ejbinterface; - -import javax.ejb.Local; - -/** - * Fiscal period service. - * - * @author chatellier - * @version $Revision: 2902 $ - * - * Last update : $Date: 2010-05-19 18:38:02 +0200 (mer. 19 mai 2010) $ - * By : $Author: jpepin $ - */ - -@Local -public interface RecordServiceLocal extends RecordService { - -} Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ReportServiceLocal.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ReportServiceLocal.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ReportServiceLocal.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -46,6 +46,6 @@ @Local public interface ReportServiceLocal extends ReportService { - public ReportsDatas generateAccountReportsWithTransaction (Account account, Boolean thirdPartAccountsMode, Date beginDate, Date endDate, TopiaContext topiaContext) throws LimaException; + ReportsDatas generateAccountReportsWithTransaction (Account account, Boolean thirdPartAccountsMode, Date beginDate, Date endDate, TopiaContext topiaContext) throws LimaException; } Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountComparator.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountComparator.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountComparator.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -19,12 +19,15 @@ package org.chorem.lima.business.utils; +import java.io.Serializable; import java.util.Comparator; import org.chorem.lima.entity.Account; -public class AccountComparator implements Comparator<Account>{ +public class AccountComparator implements Serializable, Comparator<Account>{ - /** + private static final long serialVersionUID = 1L; + + /** * sort by accout number in lexicographical order */ @Override Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountEBPComparator.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountEBPComparator.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountEBPComparator.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -1,11 +1,14 @@ package org.chorem.lima.business.utils; +import java.io.Serializable; import java.util.Comparator; import org.chorem.lima.beans.AccountEBP; -public class AccountEBPComparator implements Comparator<AccountEBP> { +public class AccountEBPComparator implements Serializable, Comparator<AccountEBP> { + private static final long serialVersionUID = 1L; + @Override public int compare(AccountEBP o1, AccountEBP o2) { return o1.getNumero().compareTo(o2.getNumero()); Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryComparator.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryComparator.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryComparator.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -19,11 +19,14 @@ package org.chorem.lima.business.utils; +import java.io.Serializable; import java.util.Comparator; import org.chorem.lima.entity.Entry; -public class EntryComparator implements Comparator<Entry>{ +public class EntryComparator implements Serializable, Comparator<Entry>{ + private static final long serialVersionUID = 1L; + @Override public int compare(Entry o1, Entry o2) { return o1.getTopiaCreateDate().compareTo(o2.getTopiaCreateDate()); Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryEBPComparator.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryEBPComparator.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryEBPComparator.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -19,11 +19,14 @@ package org.chorem.lima.business.utils; +import java.io.Serializable; import java.util.Comparator; import org.chorem.lima.beans.EntryEBP; -public class EntryEBPComparator implements Comparator<EntryEBP>{ +public class EntryEBPComparator implements Serializable, Comparator<EntryEBP>{ + private static final long serialVersionUID = 1L; + @Override public int compare(EntryEBP o1, EntryEBP o2) { Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FiscalPeriodComparator.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FiscalPeriodComparator.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FiscalPeriodComparator.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -19,11 +19,14 @@ package org.chorem.lima.business.utils; +import java.io.Serializable; import java.util.Comparator; import org.chorem.lima.entity.FiscalPeriod; -public class FiscalPeriodComparator implements Comparator<FiscalPeriod>{ +public class FiscalPeriodComparator implements Serializable, Comparator<FiscalPeriod>{ + private static final long serialVersionUID = 1L; + /** * sort by fiscal begin date */ Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/LimaConfigTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/LimaConfigTest.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/LimaConfigTest.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -20,9 +20,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.entity.LimaCallaoDAOHelper; import org.junit.Ignore; -import org.nuiton.util.ArgumentsParserException; /** * TODO add comment here. @@ -40,12 +38,13 @@ private static final String configFile = "lima_test.properties"; + /* public static LimaConfig getInstance() { - + if (instance == null) { instance = new LimaConfig(); instance.loadConfiguration(configFile); } return instance; - } + }*/ } Deleted: trunk/lima-business/src/test/java/org/chorem/lima/business/RecordServiceImplTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/RecordServiceImplTest.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/RecordServiceImplTest.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -1,109 +0,0 @@ -package org.chorem.lima.business; - -import java.util.Date; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.ejb.RecordServiceImpl; -import org.chorem.lima.entity.Record; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * Tests pour la gestion des timespans - * @author Rémi Chapelet - */ -public class RecordServiceImplTest { - - /** log. */ - private static final org.apache.commons.logging.Log log = LogFactory - .getLog(UserServiceImplTest.class); - - private static RecordServiceImpl instance; - - @BeforeClass - public static void setUpClass() throws Exception { - LimaConfigTest.getInstance(); - } - - @Before - public void setUp() { - instance = new RecordServiceImpl(); - } - - @AfterClass - public static void tearDownClass() throws Exception { - /*List<LogDTO> list = instance.listeAllLogDTO(); - for (LogDTO logDTO : list) - { - instance.removeLog(logDTO); - }*/ - } - - /** - * Permet de tester la recherche de tous les logs - */ - @Test - public void listeAllLogTest() { - /*// Ajout d'un log - Date logDate = new Date(2008,1,1); - Date transDate = new Date(); - instance.addLog(logDate, transDate, "test", "test", "test", - "test", "test", true, "test"); - // Recherche des logs - List<EntryLog> result = instance.listeAllLog(); - if (log.isDebugEnabled()) { - log.debug("Nombre de log : " + result.size()); - } - // trouve un log - Assert.assertEquals(1,result.size());*/ - } - - /** - * Test de la fonction de recherche de tous les logs suivant la date - * de création - */ - @Test - public void searchDateCreateTest() { - /*// Ajout d'un log avec comme date de creation 01/01/2009 - Date logDate = new Date(2009,1,1); - Date transDate = new Date(); - instance.addLog(logDate, transDate, "test", "test", "test", - "test", "test", true, "test"); - // Recherche des logs suivant la date - List<EntryLog> result = instance.searchLogWithDateCreate(logDate); - if (log.isDebugEnabled()) { - log.debug("Nombre de log recherche pour la date de creation : " - + result.size()); - } - // Apres avoir inséré un log a la date, il doit obligatoirement - // avoir au moins un log. - Assert.assertEquals(1,result.size());*/ - } - - /** - * Permet de tester la recherche de logs en format DTO. - */ - @Test - public void searchLogDTOWithDateCreate() { - - // Création de trois logs DTO - /*Date logDate = new Date(2000,1,1); - Date transDate = new Date(); - // Création logDTO - LogDTO logDTO = new LogDTO("",logDate, "test", transDate, "test", "test", - "test", "test", true, "test"); - // Ajout de trois logs - instance.addLog(logDTO); - instance.addLog(logDTO); - instance.addLog(logDTO); - // Recherche de ses trois logs sous forme de list de DTO - List<LogDTO> listLogDTO = instance.searchLogDTOWithDateCreate(logDate); - Assert.assertEquals(3,listLogDTO.size());*/ - } - -} Deleted: trunk/lima-business/src/test/java/org/chorem/lima/business/UserServiceImplTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/UserServiceImplTest.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/UserServiceImplTest.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -1,52 +0,0 @@ -package org.chorem.lima.business; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.ejb.UserServiceImpl; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * Tests pour la gestion des timespans - * @author Rémi Chapelet - */ -public class UserServiceImplTest { - - /** log. */ - private static final Log log = LogFactory.getLog(UserServiceImplTest.class); - - private UserServiceImpl instance; - - @BeforeClass - public static void setUpClass() throws Exception { - LimaConfigTest.getInstance(); - } - - @Before - public void setUp() { - instance = new UserServiceImpl(); - } - - @AfterClass - public static void tearDownClass() throws Exception { - - } - - public UserServiceImplTest() { - } - - /** - * Permet de tester l'ajout d'un utilisateur dans la base de données - */ - @Test - public void addUserTest() { - /*String result = instance.addUser("test-add-user"); - if (log.isDebugEnabled()) { - log.debug("Ajout utilisateur (name is test-add-user) : result " + result); - } - Assert.assertEquals("success", instance.findUser("test-add-user"));*/ - } - -} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -32,8 +32,6 @@ import org.apache.openejb.assembler.classic.Assembler; import org.apache.openejb.loader.SystemInstance; import org.chorem.lima.LimaMain; -import org.chorem.lima.business.ServiceMonitorable; -import org.chorem.lima.business.ejb.AbstractLimaService; /** * This class is a service factory based on embedded openejb container. @@ -44,7 +42,7 @@ private static Log log = LogFactory.getLog(LimaServiceFactory.class); /** Single instance. */ - protected static LimaServiceFactory instance; + private static LimaServiceFactory instance; protected HashMap<Class, Object> services = new HashMap<Class, Object>(); /** JNDI context used to look for EJB. */ @@ -108,215 +106,9 @@ } return result; } - - - /** - * Get Account service. - * - * @return account service proxy - */ - /*public AccountServiceMonitorable getAccountService() { - // TODO EC-20100410 put lookup name in configuration - // name should be fully configurable due to custom implementation used - String lookupName = "AccountServiceImplRemote"; - AccountService ejbHome = null; - try { - ejbHome = (AccountService)ctx.lookup(lookupName); - } catch (NamingException eee) { - if (log.isErrorEnabled()) { - log.error("Can't lookup for service : " + lookupName, eee); - } - } - InvocationHandler handler = new ServiceMonitorableHandler(ejbHome); - AccountServiceMonitorable result = (AccountServiceMonitorable)Proxy.newProxyInstance( - AccountServiceMonitorable.class.getClassLoader(), - new Class[]{AccountServiceMonitorable.class}, handler); - return result; - } - - /** - * Get FiscalPeriod service. - * - * @return fiscalPeriod service proxy - * - public FiscalPeriodService getFiscalPeriodService() { - // TODO EC-20100410 put lookup name in configuration - // name should be fully configurable due to custom implementation used - String lookupName = "FiscalPeriodServiceImplRemote"; - FiscalPeriodService ejbHome = null; - try { - ejbHome = (FiscalPeriodService)ctx.lookup(lookupName); - } catch (NamingException eee) { - if (log.isErrorEnabled()) { - log.error("Can't lookup for service : " + lookupName, eee); - } - } - return ejbHome; - } - /** - * Get FinancialPeriod service. - * - * @return Financial Period service proxy - * - public FinancialPeriodService getFinancialPeriodService() { - - // TODO EC-20100410 put lookup name in configuration - // name should be fully configurable due to custom implementation used - String lookupName = "FinancialPeriodServiceImplRemote"; - FinancialPeriodService ejbHome = null; - try { - ejbHome = (FinancialPeriodService)ctx.lookup(lookupName); - } catch (NamingException eee) { - if (log.isErrorEnabled()) { - log.error("Can't lookup for service : " + lookupName, eee); - } - } - return ejbHome; - } - - /** - * Get transaction service. - * - * @return transaction service proxy - * - public FinancialTransactionService getTransactionService() { - - // TODO EC-20100410 put lookup name in configuration - // name should be fully configurable due to custom implementation used - String lookupName = "FinancialTransactionServiceImplRemote"; - FinancialTransactionService ejbHome = null; - try { - ejbHome = (FinancialTransactionService)ctx.lookup(lookupName); - } catch (NamingException eee) { - if (log.isErrorEnabled()) { - log.error("Can't lookup for service : " + lookupName, eee); - } - } - return ejbHome; - } - - /** - * Get entrybook service. - * - * @return entrybook service proxy - * - public EntryBookService getEntryBookService() { - - // TODO EC-20100410 put lookup name in configuration - // name should be fully configurable due to custom implementation used - String lookupName = "EntryBookServiceImplRemote"; - EntryBookService ejbHome = null; - try { - ejbHome = (EntryBookService)ctx.lookup(lookupName); - } catch (NamingException eee) { - if (log.isErrorEnabled()) { - log.error("Can't lookup for service : " + lookupName, eee); - } - } - return ejbHome; - } - - - /** - * Get report service. - * - * - public ReportService getReportService() { - - // TODO EC-20100410 put lookup name in configuration - // name should be fully configurable due to custom implementation used - String lookupName = "ReportServiceImplRemote"; - ReportService ejbHome = null; - try { - ejbHome = (ReportService)ctx.lookup(lookupName); - } catch (NamingException eee) { - if (log.isErrorEnabled()) { - log.error("Can't lookup for service : " + lookupName, eee); - } - } - return ejbHome; - } - - /** - * Get financial statement service. - * - * - public FinancialStatementService getFinancialStatementService() { - - String lookupName = "FinancialStatementServiceImplRemote"; - FinancialStatementService ejbHome = null; - try { - ejbHome = (FinancialStatementService)ctx.lookup(lookupName); - } catch (NamingException eee) { - if (log.isErrorEnabled()) { - log.error("Can't lookup for service : " + lookupName, eee); - } - } - return ejbHome; - } - - /** - * Get import service. - * - * - public ImportService getImportService() { - - String lookupName = "ImportServiceImplRemote"; - ImportService ejbHome = null; - try { - ejbHome = (ImportService)ctx.lookup(lookupName); - } catch (NamingException eee) { - if (log.isErrorEnabled()) { - log.error("Can't lookup for service : " + lookupName, eee); - } - } - return ejbHome; - } - - - /** - * Get export service. - * - * - public ExportService getExportService() { - - String lookupName = "ExportServiceImplRemote"; - ExportService ejbHome = null; - try { - ejbHome = (ExportService)ctx.lookup(lookupName); - } catch (NamingException eee) { - if (log.isErrorEnabled()) { - log.error("Can't lookup for service : " + lookupName, eee); - } - } - return ejbHome; - } - - /** - * Get record service. - * - * @return record service proxy - * - public RecordService getRecordService() { - - // TODO EC-20100410 put lookup name in configuration - // name should be fully configurable due to custom implementation used - String lookupName = "RecordServiceImplRemote"; - RecordService ejbHome = null; - try { - ejbHome = (RecordService)ctx.lookup(lookupName); - } catch (NamingException eee) { - if (log.isErrorEnabled()) { - log.error("Can't lookup for service : " + lookupName, eee); - } - } - return ejbHome; - }*/ - - /** * Destroy openejb jndi context. * * Code taken from openEJB faq : Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -88,8 +88,8 @@ // null == cancel action newFinancialStatementHeader = financialStatementHeaderForm.getFinancialStatement(); - newFinancialStatementHeader.setHeader(true); if (newFinancialStatementHeader != null) { + newFinancialStatementHeader.setHeader(true); // get current selection path TreePath treePath = null; int selectedRow = treeTable.getSelectedRow(); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java 2010-08-20 12:11:16 UTC (rev 3009) +++ trunk/lima-swing/src/main/java/org/chorem/lima/util/ErrorHelper.java 2010-08-20 23:46:18 UTC (rev 3010) @@ -114,19 +114,20 @@ email.setSubject("Project error notification : Lima"); // message description - String message = formatMessage("Project", "Lima " + LimaMain.config.getVersion()); - message += formatMessage("Date", new Date().toString()); - message += formatMessage("Title", errorInfo.getTitle()); - message += formatMessage("Description", errorInfo.getBasicErrorMessage().replaceAll("<[^>]+>", "")); + StringBuffer message = new StringBuffer(); + message.append(formatMessage("Project", "Lima " + LimaMain.config.getVersion())); + message.append(formatMessage("Date", new Date().toString())); + message.append(formatMessage("Title", errorInfo.getTitle())); + message.append(formatMessage("Description", errorInfo.getBasicErrorMessage().replaceAll("<[^>]+>", ""))); // message configuration - message += formatMessage("Configuration", null); + message.append(formatMessage("Configuration", null)); List<String> propertiesNames = new ArrayList<String>(LimaMain.config.getOptions().stringPropertyNames()); Collections.sort(propertiesNames); for (String propertyName : propertiesNames) { // security, don't send string containing password : if (!propertyName.contains("pass")) { - message += "\t" + propertyName + " : " + LimaMain.config.getOptions().getProperty(propertyName) + "\n"; + message.append("\t" + propertyName + " : " + LimaMain.config.getOptions().getProperty(propertyName) + "\n"); } } @@ -134,10 +135,10 @@ StringWriter out = new StringWriter(); PrintWriter writer = new PrintWriter(out); errorInfo.getErrorException().printStackTrace(writer); - message += formatMessage("Exception", out.toString()); + message.append(formatMessage("Exception", out.toString())); // TODO EC-20100409 i18n files are iso encoded ? - email.setContent(message, "text/plain; charset=ISO-8859-9"); + email.setContent(message.toString(), "text/plain; charset=ISO-8859-9"); // send mail email.send();
participants (1)
-
jpepin@users.chorem.org