r2984 - in trunk: lima-business/src/main/java/org/chorem/lima/business 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-callao/src/main/xmi lima-swing/src/main/java/org/chorem/lima/ui lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport lima-swing/src/main/java/org/chorem/lima/ui/identity lima-swing/src/main/resources/i18n lima-swing/src/mai
Author: jpepin Date: 2010-07-22 18:25:57 +0200 (Thu, 22 Jul 2010) New Revision: 2984 Url: http://chorem.org/repositories/revision/lima/2984 Log: Cr?\195?\169ation d'une fiche d'identit?\195?\169 en base pour l'export des documents html et pdf. Added: trunk/lima-business/src/main/java/org/chorem/lima/business/IdentityServiceMonitorable.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/IdentityServiceImpl.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-swing/src/main/java/org/chorem/lima/ui/identity/ trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityForm.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java trunk/lima-swing/src/main/resources/icons/action-identity.png 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/ExportServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/DocumentService.java trunk/lima-business/src/main/java/org/chorem/lima/business/utils/ImportExportEntityEnum.java trunk/lima-callao/src/main/xmi/accounting.zargo trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties trunk/lima-swing/src/main/resources/icons/action-config.png Added: trunk/lima-business/src/main/java/org/chorem/lima/business/IdentityServiceMonitorable.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/IdentityServiceMonitorable.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/IdentityServiceMonitorable.java 2010-07-22 16:25:57 UTC (rev 2984) @@ -0,0 +1,26 @@ +/* *##% 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; + +import org.chorem.lima.business.ejbinterface.IdentityService; + +public interface IdentityServiceMonitorable extends IdentityService, ServiceMonitorable { + +} 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-07-22 10:36:21 UTC (rev 2983) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2010-07-22 16:25:57 UTC (rev 2984) @@ -20,20 +20,27 @@ package org.chorem.lima.business.ejb; import static org.nuiton.i18n.I18n._; - import java.awt.Color; import java.io.FileNotFoundException; import java.io.FileOutputStream; 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.beans.FinancialStatementAmounts; +import org.chorem.lima.business.LimaConfig; +import org.chorem.lima.business.LimaException; import org.chorem.lima.business.ejbinterface.DocumentService; import org.chorem.lima.business.ejbinterface.DocumentServiceLocal; +import org.chorem.lima.entity.Identity; +import org.chorem.lima.entity.IdentityDAO; +import org.chorem.lima.entity.IdentityImpl; +import org.chorem.lima.entity.LimaCallaoDAOHelper; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.TopiaContextFactory; +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.TopiaNotFoundException; import com.lowagie.text.BadElementException; import com.lowagie.text.Cell; @@ -55,14 +62,29 @@ private static final Log log = LogFactory.getLog(DocumentServiceImpl.class); + + private TopiaContext rootContext; + + public DocumentServiceImpl() { + LimaConfig config = LimaConfig.getInstance(); + try { + rootContext = TopiaContextFactory.getContext(config.getOptions()); + } catch (TopiaNotFoundException ex) { + if (log.isErrorEnabled()) { + log.error("Can't init topia context", ex); + } + } + } @Override - public void createDocuments(List<FinancialStatementAmounts> financialStatementAmounts) { + public void createFinancialStatementsDocuments(List<FinancialStatementAmounts> financialStatementAmounts) throws LimaException { Document document = new Document(PageSize.A4, 5, 5, 5, 5); - try { - - PdfWriter pdfWriter = PdfWriter.getInstance(document, + TopiaContext topiaContext = null; + try { + topiaContext = beginTransaction(); + + PdfWriter pdfWriter = PdfWriter.getInstance(document, new FileOutputStream("/test_lima.pdf")); HtmlWriter htmlWriter = HtmlWriter.getInstance(document, new FileOutputStream("/test_lima.html")); @@ -70,7 +92,14 @@ document.open(); int nbpages = 1; + Identity identity = new IdentityImpl(); + IdentityDAO identityDAO = LimaCallaoDAOHelper.getIdentityDAO(topiaContext); + List<Identity> identities = identityDAO.findAll(); + if (identities.size() !=0){ + identity = identities.get(0); + } + //Split list by financialstatement type List<List<FinancialStatementAmounts>> listList = new ArrayList<List<FinancialStatementAmounts>>(); Boolean first = true; @@ -102,7 +131,7 @@ List <FinancialStatementAmounts> subFinancialStatementAmounts = list.subList(i, j); //create page : header + table + footer - Table header = createHeader(title, "01/01/2010", "31/12/2010"); + Table header = createHeader(title, identity, "01/01/2010", "31/12/2010"); Table table = createTable(subFinancialStatementAmounts); //new page Chapter chapter = new Chapter(0); @@ -132,12 +161,15 @@ log.error("Can't create pdf file", eeFNFE); } catch (DocumentException eeDE) { log.error("Can't create document", eeDE); - } + } catch (TopiaException eeTE) { + log.error("Can't get topiaContext", eeTE); + } } - public Table createHeader(String title, String beginDate, String endDate){ + public Table createHeader(String title, Identity identity, String beginDate, String endDate){ Table t = null; try { + //define table t = new Table(4, 5); float[] widths = {0.25f, 0.45f, 0.12f, 0.18f}; @@ -152,31 +184,31 @@ t.setDefaultCell(cell); //line 1 - t.addCell(new Phrase("Code Lutin SA", headerFontB)); + t.addCell(new Phrase(identity.getName(), headerFontB)); Cell titleCell = new Cell(new Phrase(title, new Font(Font.HELVETICA, 14, Font.BOLD, Color.BLACK))); titleCell.setVerticalAlignment(Element.ALIGN_MIDDLE); titleCell.setHorizontalAlignment(Element.ALIGN_CENTER); titleCell.setRowspan(2); t.addCell(titleCell); t.addCell(new Phrase("N° Siret", headerFontB)); - t.addCell(new Phrase("442116703", headerFont)); + t.addCell(new Phrase(identity.getBusinessNumber(), headerFont)); //line 2 t.addCell(new Phrase("SSL", headerFont)); t.addCell(new Phrase("NAF :", headerFontB)); - t.addCell(new Phrase("6201Z", headerFont)); + t.addCell(new Phrase(identity.getClassificationCode(), headerFont)); //line 3 - t.addCell(new Phrase("44 bd des Pas Enchantés", headerFont)); + t.addCell(new Phrase(identity.getAddress(), headerFont)); t.addCell(""); t.addCell(new Phrase("n°TVA", headerFontB)); - t.addCell(new Phrase("FR 57 442116703", headerFont)); + t.addCell(new Phrase(identity.getVatNumber(), headerFont)); //line 4 - t.addCell(new Phrase("44230 St Séb/Loire", headerFont)); + t.addCell(new Phrase(identity.getAddress2(), headerFont)); t.addCell(""); t.addCell(new Phrase("Période du", headerFontB)); t.addCell(new Phrase(beginDate, headerFont)); //line 5 + t.addCell(new Phrase(identity.getCity(), headerFont)); t.addCell(""); - t.addCell(""); t.addCell(new Phrase("au", headerFontB)); t.addCell(new Phrase(endDate, headerFont)); } catch (BadElementException eeBEE) { @@ -328,5 +360,13 @@ document.add(chapter1);*/ } - + + protected TopiaContext beginTransaction() throws TopiaException { + // basic check done, make check in database + // TODO move it into JTA + TopiaContext topiaTransaction; + topiaTransaction = rootContext.beginTransaction(); + log.trace("beginTransaction"+topiaTransaction); + return 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-07-22 10:36:21 UTC (rev 2983) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java 2010-07-22 16:25:57 UTC (rev 2984) @@ -45,6 +45,8 @@ import org.chorem.lima.entity.FinancialTransactionDAO; import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.entity.FiscalPeriodDAO; +import org.chorem.lima.entity.Identity; +import org.chorem.lima.entity.IdentityDAO; import org.chorem.lima.entity.LimaCallaoDAOHelper; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaContextFactory; @@ -235,6 +237,7 @@ exportFiscalPeriodAsCSV(csvWriter, topiaContext); exportClosedPeriodicEntryBooksAsCSV(csvWriter, topiaContext); exportFinancialTransactionsAndEntriesAsCSV(csvWriter, topiaContext); + exportIdentityAsCSV(csvWriter, topiaContext); // Write cache in string csvWriter.flush(); csvWriter.close(); @@ -523,7 +526,7 @@ */ public void exportFiscalPeriodAsCSV(CSVWriter csvWriter, TopiaContext topiaContext) throws LimaException { try { - String[] nextLine = new String[5]; + String[] nextLine = new String[4]; // Get all fiscalperiod FiscalPeriodDAO fiscalPeriodDAO = LimaCallaoDAOHelper.getFiscalPeriodDAO(topiaContext); @@ -577,6 +580,36 @@ doCatch(topiaContext, eeeTE, log); } } + + public void exportIdentityAsCSV(CSVWriter csvWriter, TopiaContext topiaContext) throws LimaException{ + try { + String[] nextLine = new String[12]; + // Get identity + IdentityDAO identityDAO = LimaCallaoDAOHelper.getIdentityDAO(topiaContext); + List<Identity> identities = identityDAO.findAll(); + if (identities.size() != 0){ + + Identity identity = identities.get(0); + nextLine[0] = ImportExportEntityEnum.IDENTITY.getLabel(); + nextLine[1] = identity.getName(); + nextLine[2] = identity.getDescription(); + nextLine[3] = identity.getAddress(); + nextLine[4] = identity.getAddress2(); + nextLine[5] = identity.getCity(); + nextLine[6] = identity.getPhoneNumber(); + nextLine[7] = identity.getEmail(); + nextLine[8] = identity.getZipCode(); + nextLine[9] = identity.getVatNumber(); + nextLine[10] = identity.getClassificationCode(); + nextLine[11] = identity.getBusinessNumber(); + // Ajoute la ligne au fichier + csvWriter.writeNext(nextLine); + } + } + catch (TopiaException eeeTE){ + doCatch(topiaContext, eeeTE, log); + } + } protected TopiaContext beginTransaction() throws TopiaException { // basic check done, make check in database Added: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/IdentityServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/IdentityServiceImpl.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/IdentityServiceImpl.java 2010-07-22 16:25:57 UTC (rev 2984) @@ -0,0 +1,138 @@ +/* *##% 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.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.IdentityService; +import org.chorem.lima.business.ejbinterface.IdentityServiceLocal; +import org.chorem.lima.entity.Identity; +import org.chorem.lima.entity.IdentityDAO; +import org.chorem.lima.entity.LimaCallaoDAOHelper; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.TopiaContextFactory; +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.TopiaNotFoundException; + +@Stateless +public class IdentityServiceImpl extends AbstractLimaService implements IdentityService, IdentityServiceLocal { + + private static final Log log = + LogFactory.getLog(AccountServiceImpl.class); + + private TopiaContext rootContext; + + public IdentityServiceImpl() { + LimaConfig config = LimaConfig.getInstance(); + try { + rootContext = TopiaContextFactory.getContext(config.getOptions()); + } catch (TopiaNotFoundException ex) { + if (log.isErrorEnabled()) { + log.error("Can't init topia context", ex); + } + } + } + + @Override + public Identity getIdentity() throws LimaException { + TopiaContext topiaContext = null; + Identity identity = null; + try { + topiaContext = beginTransaction(); + + IdentityDAO identityDAO = LimaCallaoDAOHelper.getIdentityDAO(topiaContext); + List<Identity> identities = identityDAO.findAll(); + if (identities.size() != 0){ + identity = identities.get(0); + } + } + catch (TopiaException ex) { + doCatch(topiaContext, ex, log); + } + finally { + doFinally(topiaContext, log); + } + return identity; + } + + + @Override + public void updateIdentityWithTransaction(Identity identity, + TopiaContext topiaContext) throws LimaException { + try { + IdentityDAO identityDAO = LimaCallaoDAOHelper.getIdentityDAO(topiaContext); + List<Identity> identities = identityDAO.findAll(); + if (identities.size() != 0){ + identityDAO.delete(identities.get(0)); + } + identityDAO.create(identity); + + commitTransaction(topiaContext); + } + catch (TopiaException ex) { + doCatch(topiaContext, ex, log); + } + } + + @Override + public void updateIdentity(Identity identity) throws LimaException { + TopiaContext topiaContext = null; + try { + topiaContext = beginTransaction(); + + updateIdentityWithTransaction(identity, topiaContext); + + commitTransaction(topiaContext); + } + catch (TopiaException ex) { + doCatch(topiaContext, ex, log); + } + finally { + doFinally(topiaContext, log); + } + } + + protected TopiaContext beginTransaction() throws TopiaException { + // basic check done, make check in database + // TODO move it into JTA + TopiaContext topiaContext; + topiaContext = rootContext.beginTransaction(); + log.trace("beginTransaction"+topiaContext); + return topiaContext; + } + + protected void commitTransaction(TopiaContext topiaContext) throws TopiaException { + try { + topiaContext.commitTransaction(); + } catch (TopiaException eee) { + if (log.isErrorEnabled()) { + log.error("Error during commit context", eee); + } + throw eee; + } + } + +} 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-07-22 10:36:21 UTC (rev 2983) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2010-07-22 16:25:57 UTC (rev 2984) @@ -59,6 +59,7 @@ import org.chorem.lima.business.ejbinterface.FinancialStatementServiceLocal; import org.chorem.lima.business.ejbinterface.FinancialTransactionServiceLocal; import org.chorem.lima.business.ejbinterface.FiscalPeriodServiceLocal; +import org.chorem.lima.business.ejbinterface.IdentityServiceLocal; import org.chorem.lima.business.ejbinterface.ImportService; import org.chorem.lima.business.ejbinterface.ImportServiceLocal; import org.chorem.lima.business.utils.AccountEBPComparator; @@ -86,6 +87,8 @@ import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.entity.FiscalPeriodDAO; import org.chorem.lima.entity.FiscalPeriodImpl; +import org.chorem.lima.entity.Identity; +import org.chorem.lima.entity.IdentityImpl; import org.chorem.lima.entity.LimaCallaoDAOHelper; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaContextFactory; @@ -131,6 +134,8 @@ @EJB EntryBookServiceLocal entryBookService; + @EJB + IdentityServiceLocal identityService; private static final SimpleDateFormat SDateFormat = new SimpleDateFormat("dd,MM,yyyy HH:mm:ss"); @@ -419,6 +424,9 @@ case ENTRY: importEntriesCSV(nextLine, entries, topiaContext); break; + case IDENTITY: + importIdentity(nextLine, topiaContext); + break; } } } @@ -1033,6 +1041,31 @@ return result; } + public String importIdentity(String[] nextLine, TopiaContext topiaContext) throws LimaException { + String result = ""; + + Identity identity = new IdentityImpl(); + nextLine[0] = ImportExportEntityEnum.IDENTITY.getLabel(); + identity.setName(nextLine[1]); + identity.setDescription(nextLine[2]); + identity.setAddress(nextLine[3]); + identity.setAddress2(nextLine[4]); + identity.setCity(nextLine[5]); + identity.setPhoneNumber(nextLine[6]); + identity.setEmail(nextLine[7]); + identity.setZipCode(nextLine[8]); + identity.setVatNumber(nextLine[9]); + identity.setClassificationCode(nextLine[10]); + identity.setBusinessNumber(nextLine[11]); + + identityService.updateIdentityWithTransaction(identity, topiaContext); + //create it + result += "SUCCESS : The identity " + + identity.getName() + " is created ! \n"; + + return result; + } + protected TopiaContext beginTransaction() throws TopiaException { // basic check done, make check in database // TODO move it into JTA 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-07-22 10:36:21 UTC (rev 2983) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/DocumentService.java 2010-07-22 16:25:57 UTC (rev 2984) @@ -24,6 +24,7 @@ import javax.ejb.Remote; import org.chorem.lima.beans.FinancialStatementAmounts; +import org.chorem.lima.business.LimaException; /** * Interface to create pdf and html docs @@ -34,6 +35,6 @@ @Remote public interface DocumentService { - public void createDocuments(List<FinancialStatementAmounts> financialStatementAmounts); + public void createFinancialStatementsDocuments(List<FinancialStatementAmounts> financialStatementAmounts) throws LimaException; } Added: 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 (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/IdentityService.java 2010-07-22 16:25:57 UTC (rev 2984) @@ -0,0 +1,33 @@ +/* *##% 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; + +import org.chorem.lima.business.LimaException; +import org.chorem.lima.entity.Identity; + +@Remote +public interface IdentityService { + + public Identity getIdentity() throws LimaException; + public void updateIdentity(Identity identity) throws LimaException; + +} Added: 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 (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/IdentityServiceLocal.java 2010-07-22 16:25:57 UTC (rev 2984) @@ -0,0 +1,34 @@ +/* *##% 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; + +import org.chorem.lima.business.LimaException; +import org.chorem.lima.entity.Identity; +import org.nuiton.topia.TopiaContext; + +@Local +public interface IdentityServiceLocal { + + public void updateIdentityWithTransaction(Identity identity, TopiaContext topiaContext) throws LimaException; + + +} Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/ImportExportEntityEnum.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/ImportExportEntityEnum.java 2010-07-22 10:36:21 UTC (rev 2983) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/ImportExportEntityEnum.java 2010-07-22 16:25:57 UTC (rev 2984) @@ -2,7 +2,10 @@ public enum ImportExportEntityEnum { - ACCOUNT("ACCN"), ENTRYBOOK("ENBK"), FINANCIALSTATEMENT("FNST"), FISCALPERIOD("FSCP"), CLOSEDPERIODICENTRYBOOK("CPEB"), FINANCIALTRANSACTION("FTRC"), ENTRY("NTRY"); + ACCOUNT("ACCN"), ENTRYBOOK("ENBK"), FINANCIALSTATEMENT("FNST"), + FISCALPERIOD("FSCP"), CLOSEDPERIODICENTRYBOOK("CPEB"), + FINANCIALTRANSACTION("FTRC"), ENTRY("NTRY"), + IDENTITY("IDNT"); private final String label; private ImportExportEntityEnum(String label) { Modified: trunk/lima-callao/src/main/xmi/accounting.zargo =================================================================== (Binary files differ) Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2010-07-22 10:36:21 UTC (rev 2983) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2010-07-22 16:25:57 UTC (rev 2984) @@ -106,31 +106,17 @@ </JMenu> </JMenu> <JSeparator/> - <JMenuItem text="lima.common.print" actionIcon='print'/> - <JSeparator/> - <JMenuItem id='menuFileFullscreen' - text="lima.action.fullscreen" - toolTipText="lima.action.fullscreen.tip" - actionIcon="fullscreen" - mnemonic="P" - visible="{!isUndecorated()}" - onActionPerformed="getHandler().changeScreen(this, true)"/> + <JMenuItem text="lima.identity" + actionIcon="identity" onActionPerformed="getHandler().showIdentity(this)"/> <JMenuItem text="lima.preferences" - actionIcon="config" onActionPerformed="getHandler().showConfig(this)"/> - <JMenuItem id='menuFileNormalscreen' - text="lima.action.normalscreen" - toolTipText="lima.action.normalscreen.tip" - actionIcon="leave-fullscreen" - mnemonic="N" - visible="{isUndecorated()}" - onActionPerformed="getHandler().changeScreen(this, false)"/> + actionIcon="config" onActionPerformed="getHandler().showConfig(this)"/> <JSeparator/> <JMenuItem mnemonic="{'Q'}" actionIcon='quit' text="lima.common.quit" onActionPerformed='getHandler().close(this)'/> </JMenu> - <JMenu text="lima.structure"> + <JMenu text="lima.structure" mnemonic="{'S'}"> <JMenuItem text="lima.charts.account" onActionPerformed='getHandler().showAccountView(this)' actionIcon='charts-accounts'/> <JMenuItem text="lima.charts.entrybook" onActionPerformed='getHandler().showEntryBookView(this)' @@ -143,7 +129,7 @@ actionIcon='charts-financialstatements'/> </JMenu> - <JMenu text="lima.entries"> + <JMenu text="lima.entries" mnemonic="{'E'}"> <JMenuItem text="lima.entries.addtransaction" onActionPerformed='getHandler().showTransactionView(this)' actionIcon='entries-balanced'/> <JMenuItem text="lima.entries.searchunbalancedtransaction" onActionPerformed='getHandler().showTransactionUnbalancedView(this)' @@ -158,7 +144,7 @@ selected="false" actionIcon='view'/> </JMenu> --> - <JMenu text="lima.reports"> + <JMenu text="lima.reports" mnemonic="{'R'}"> <JMenuItem text="lima.reports.accounts" onActionPerformed='getHandler().showAccountReports(this)' actionIcon='reports-account'/> <JMenuItem text="lima.reports.entrybooks" onActionPerformed='getHandler().showEntryBookReports(this)' @@ -172,6 +158,22 @@ </JMenu> + <JMenu text="lima.menu.window" mnemonic="{'W'}"> + <JMenuItem id='menuFileFullscreen' + text="lima.action.fullscreen" + toolTipText="lima.action.fullscreen.tip" + actionIcon="fullscreen" + mnemonic="P" + visible="{!isUndecorated()}" + onActionPerformed="getHandler().changeScreen(this, true)"/> + <JMenuItem id='menuFileNormalscreen' + text="lima.action.normalscreen" + toolTipText="lima.action.normalscreen.tip" + actionIcon="leave-fullscreen" + mnemonic="N" + visible="{isUndecorated()}" + onActionPerformed="getHandler().changeScreen(this, false)"/> + </JMenu> <JMenu text="lima.menu.help" mnemonic="{'H'}"> Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-07-22 10:36:21 UTC (rev 2983) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-07-22 16:25:57 UTC (rev 2984) @@ -31,6 +31,7 @@ import org.apache.commons.logging.LogFactory; import org.chorem.lima.LimaConfig; import org.chorem.lima.LimaContext; +import org.chorem.lima.entity.Identity; import org.chorem.lima.ui.account.AccountView; import org.chorem.lima.ui.accountsreports.AccountsReportsView; import org.chorem.lima.ui.balance.BalanceView; @@ -44,6 +45,7 @@ import org.chorem.lima.ui.financialtransaction.LetteringView; import org.chorem.lima.ui.financialtransactionunbalanced.FinancialTransactionUnbalancedView; import org.chorem.lima.ui.home.HomeView; +import org.chorem.lima.ui.identity.IdentityForm; import org.chorem.lima.ui.importexport.ImportExport; import org.chorem.lima.ui.importexport.ImportExportEnum; import org.chorem.lima.ui.ledger.LedgerView; @@ -281,6 +283,14 @@ HomeView homeView = new HomeView(mainView); mainView.showTab(_("lima.tab.home"), homeView, false); } + + public void showIdentity(JAXXContext rootContext) { + MainView mainView = getUI(rootContext); + IdentityForm identityForm = new IdentityForm(); + identityForm.setLocationRelativeTo(mainView); + identityForm.setVisible(true); + } + /** * Show account tree table view to create or modify accounts * @param rootContext Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2010-07-22 10:36:21 UTC (rev 2983) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2010-07-22 16:25:57 UTC (rev 2984) @@ -32,7 +32,6 @@ import org.chorem.lima.business.ImportServiceMonitorable; import org.chorem.lima.business.LimaException; import org.chorem.lima.business.ServiceListener; -import org.chorem.lima.business.ejbinterface.DocumentService; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.util.ErrorHelper; @@ -210,7 +209,13 @@ } public void createDocuments(){ - documentService.createDocuments(cacheDataList); + try { + documentService.createFinancialStatementsDocuments(cacheDataList); + } catch (LimaException e) { + if (log.isDebugEnabled()){ + log.debug("Error on create document",e); + } + } } @Override Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityForm.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityForm.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityForm.jaxx 2010-07-22 16:25:57 UTC (rev 2984) @@ -0,0 +1,165 @@ +<!-- ##% Lima Swing + 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. + ##% --> + +<JDialog modal="true"> + + <IdentityHandler id="handler" javaBean="new IdentityHandler()" /> + <org.chorem.lima.entity.Identity id="identity" javaBean='handler.getIdentity()'/> + + <script> + <![CDATA[ + + protected void performCancel() { + setIdentity(null); + dispose(); + } + ]]> + </script> + + <Table> + <row> + <cell fill="horizontal"> + <JLabel text="lima.identity.name"/> + </cell> + <cell fill="horizontal"> + <JTextField id="nameTextField" text="{getIdentity().getName()}"/> + <javax.swing.text.Document javaBean="getNameTextField().getDocument()" + onInsertUpdate='getIdentity().setName(getNameTextField().getText())' + onRemoveUpdate='getIdentity().setName(getNameTextField().getText())' /> + </cell> + </row> + <row> + <cell fill="horizontal"> + <JLabel text="lima.identity.description"/> + </cell> + <cell fill="horizontal"> + <JTextField id="descriptionTextField" text="{getIdentity().getDescription()}"/> + <javax.swing.text.Document javaBean="getDescriptionTextField().getDocument()" + onInsertUpdate='getIdentity().setDescription(getDescriptionTextField().getText())' + onRemoveUpdate='getIdentity().setDescription(getDescriptionTextField().getText())' /> + </cell> + </row> + <row> + <cell fill="horizontal"> + <JLabel text="lima.identity.address"/> + </cell> + <cell fill="horizontal"> + <JTextField id="addressTextField" text="{getIdentity().getAddress()}"/> + <javax.swing.text.Document javaBean="getAddressTextField().getDocument()" + onInsertUpdate='getIdentity().setAddress(getAddressTextField().getText())' + onRemoveUpdate='getIdentity().setAddress(getAddressTextField().getText())' /> + </cell> + </row> + <row> + <cell fill="horizontal"> + <JLabel text="lima.identity.address2"/> + </cell> + <cell fill="horizontal"> + <JTextField id="address2TextField" text="{getIdentity().getAddress2()}"/> + <javax.swing.text.Document javaBean="getAddress2TextField().getDocument()" + onInsertUpdate='getIdentity().setAddress2(getAddress2TextField().getText())' + onRemoveUpdate='getIdentity().setAddress2(getAddress2TextField().getText())' /> + </cell> + </row> + <row> + <cell fill="horizontal"> + <JLabel text="lima.identity.zipCode"/> + </cell> + <cell fill="horizontal"> + <JTextField id="zipCodeTextField" text="{getIdentity().getZipCode()}"/> + <javax.swing.text.Document javaBean="getZipCodeTextField().getDocument()" + onInsertUpdate='getIdentity().setZipCode(getZipCodeTextField().getText())' + onRemoveUpdate='getIdentity().setZipCode(getZipCodeTextField().getText())' /> + </cell> + </row> + <row> + <cell fill="horizontal"> + <JLabel text="lima.identity.city"/> + </cell> + <cell fill="horizontal"> + <JTextField id="cityTextField" text="{getIdentity().getCity()}"/> + <javax.swing.text.Document javaBean="getCityTextField().getDocument()" + onInsertUpdate='getIdentity().setCity(getCityTextField().getText())' + onRemoveUpdate='getIdentity().setCity(getCityTextField().getText())' /> + </cell> + </row> + <row> + <cell fill="horizontal"> + <JLabel text="lima.identity.businessNumber"/> + </cell> + <cell fill="horizontal"> + <JTextField id="businessNumberTextField" text="{getIdentity().getBusinessNumber()}"/> + <javax.swing.text.Document javaBean="getBusinessNumberTextField().getDocument()" + onInsertUpdate='getIdentity().setBusinessNumber(getBusinessNumberTextField().getText())' + onRemoveUpdate='getIdentity().setBusinessNumber(getBusinessNumberTextField().getText())' /> + </cell> + </row> + <row> + <cell fill="horizontal"> + <JLabel text="lima.identity.vatNumber"/> + </cell> + <cell fill="horizontal"> + <JTextField id="vatNumberTextField" text="{getIdentity().getVatNumber()}"/> + <javax.swing.text.Document javaBean="getVatNumberTextField().getDocument()" + onInsertUpdate='getIdentity().setVatNumber(getVatNumberTextField().getText())' + onRemoveUpdate='getIdentity().setVatNumber(getVatNumberTextField().getText())' /> + </cell> + </row> + <row> + <cell fill="horizontal"> + <JLabel text="lima.identity.classificationCode"/> + </cell> + <cell fill="horizontal"> + <JTextField id="classificationCodeTextField" text="{getIdentity().getClassificationCode()}"/> + <javax.swing.text.Document javaBean="getClassificationCodeTextField().getDocument()" + onInsertUpdate='getIdentity().setClassificationCode(getClassificationCodeTextField().getText())' + onRemoveUpdate='getIdentity().setClassificationCode(getClassificationCodeTextField().getText())' /> + </cell> + </row> + <row> + <cell fill="horizontal"> + <JLabel text="lima.identity.phoneNumber"/> + </cell> + <cell fill="horizontal"> + <JTextField id="phoneNumberTextField" text="{getIdentity().getPhoneNumber()}"/> + <javax.swing.text.Document javaBean="getPhoneNumberTextField().getDocument()" + onInsertUpdate='getIdentity().setPhoneNumber(getPhoneNumberTextField().getText())' + onRemoveUpdate='getIdentity().setPhoneNumber(getPhoneNumberTextField().getText())' /> + </cell> + </row> + <row> + <cell fill="horizontal"> + <JLabel text="lima.identity.email"/> + </cell> + <cell fill="horizontal"> + <JTextField id="emailTextField" text="{getIdentity().getEmail()}"/> + <javax.swing.text.Document javaBean="getEmailTextField().getDocument()" + onInsertUpdate='getIdentity().setEmail(getEmailTextField().getText())' + onRemoveUpdate='getIdentity().setEmail(getEmailTextField().getText())' /> + </cell> + </row> + <row> + <cell fill="none"> + <JButton text="lima.common.ok" onActionPerformed="handler.updateIdentity(getIdentity()); + dispose()"/> + </cell> + <cell fill="none"> + <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/> + </cell> + </row> + </Table> +</JDialog> \ No newline at end of file Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityForm.jaxx ___________________________________________________________________ Added: svn:executable + * Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/identity/IdentityHandler.java 2010-07-22 16:25:57 UTC (rev 2984) @@ -0,0 +1,69 @@ +/* *##% Lima Swing + * 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.ui.identity; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.business.IdentityServiceMonitorable; +import org.chorem.lima.business.LimaException; +import org.chorem.lima.business.ejbinterface.IdentityService; +import org.chorem.lima.entity.Identity; +import org.chorem.lima.entity.IdentityImpl; +import org.chorem.lima.service.LimaServiceFactory; + +public class IdentityHandler { + + protected IdentityService identityService; + + private static final Log log = LogFactory.getLog(IdentityHandler.class); + + + public IdentityHandler() { + identityService = + LimaServiceFactory.getInstance().getService( + IdentityServiceMonitorable.class); + } + + public Identity getIdentity(){ + Identity identity = null; + try { + identity = identityService.getIdentity(); + } catch (LimaException eee) { + if (log.isDebugEnabled()){ + log.debug("Can't get Identity", eee); + } + } + if (identity == null){ + identity = new IdentityImpl(); + } + return identity; + } + + public void updateIdentity(Identity identity){ + + try { + identityService.updateIdentity(identity); + } catch (LimaException eee) { + if (log.isDebugEnabled()){ + log.debug("Can't update Identity", eee); + } + } + } + +} Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties =================================================================== --- trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-07-22 10:36:21 UTC (rev 2983) +++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-07-22 16:25:57 UTC (rev 2984) @@ -98,7 +98,19 @@ lima.financialstatement.subamount= lima.fiscalperiod.addFiscalPeriod= lima.fiscalperiod.block= +lima.identity= +lima.identity.address= +lima.identity.address2= +lima.identity.businessNumber= +lima.identity.city= +lima.identity.classificationCode= lima.identity.contact= +lima.identity.description= +lima.identity.email= +lima.identity.name= +lima.identity.phoneNumber= +lima.identity.vatNumber= +lima.identity.zipCode= lima.import=Import lima.import.account=Import PCG lima.import.all=Import all datas @@ -134,6 +146,7 @@ lima.menu.help.i18n.fr=French lima.menu.help.i18n.uk=English lima.menu.help.site=WebSite +lima.menu.window= lima.message.help.usage= lima.misc.supportemail.description= lima.open=Open Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties =================================================================== --- trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-07-22 10:36:21 UTC (rev 2983) +++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-07-22 16:25:57 UTC (rev 2984) @@ -98,7 +98,19 @@ lima.financialstatement.subamount=Calculer un sous-total lima.fiscalperiod.addFiscalPeriod=Nouvel exercice lima.fiscalperiod.block=Cloturer un exercice +lima.identity=Identit\u00E9 +lima.identity.address=Adresse +lima.identity.address2=Adresse (suite) +lima.identity.businessNumber=SIRET +lima.identity.city=Ville +lima.identity.classificationCode=Code NAF lima.identity.contact=Contact +lima.identity.description=Description +lima.identity.email=Courriel +lima.identity.name=Nom +lima.identity.phoneNumber=n\u00B0 Tel +lima.identity.vatNumber=n\u00B0 TVA +lima.identity.zipCode=Code Postal lima.import=Import lima.import.account=Importer le PCG lima.import.all=Importer une nouvelle base (XML) @@ -134,6 +146,7 @@ lima.menu.help.i18n.fr=Fran\u00E7ais lima.menu.help.i18n.uk=Anglais lima.menu.help.site=Acc\u00E9der au site de Lima +lima.menu.window=Fen\u00EAtre lima.message.help.usage= lima.misc.supportemail.description= lima.open=Ouvert Modified: trunk/lima-swing/src/main/resources/icons/action-config.png =================================================================== (Binary files differ) Added: trunk/lima-swing/src/main/resources/icons/action-identity.png =================================================================== (Binary files differ) Property changes on: trunk/lima-swing/src/main/resources/icons/action-identity.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream
participants (1)
-
jpepin@users.chorem.org