[Suiviobsmer-commits] r400 - in trunk: . wao-business wao-business/src/main/java/fr/ifremer/wao wao-business/src/main/java/fr/ifremer/wao/service wao-business/src/main/resources/oldmappings/WaoModel/1.1/fr/ifremer/wao/entity wao-business/src/main/xmi wao-business/src/test/java/fr/ifremer/wao wao-business/src/test/java/fr/ifremer/wao/entity wao-business/src/test/java/fr/ifremer/wao/service wao-ui wao-ui/src/main/java/fr/ifremer/wao/ui/pages
Author: fdesbois Date: 2010-03-31 19:25:21 +0000 (Wed, 31 Mar 2010) New Revision: 400 Modified: trunk/pom.xml trunk/wao-business/pom.xml trunk/wao-business/src/main/java/fr/ifremer/wao/WaoGlobal.java trunk/wao-business/src/main/java/fr/ifremer/wao/WaoMigrationCallBack.java trunk/wao-business/src/main/java/fr/ifremer/wao/WaoRunnerImpl.java trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceBoatImpl.java trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceNewsImpl.java trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceReferentialImpl.java trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceUserImpl.java trunk/wao-business/src/main/resources/oldmappings/WaoModel/1.1/fr/ifremer/wao/entity/CompanyImpl.hbm.xml trunk/wao-business/src/main/resources/oldmappings/WaoModel/1.1/fr/ifremer/wao/entity/SampleRowImpl.hbm.xml trunk/wao-business/src/main/xmi/wao.properties trunk/wao-business/src/main/xmi/wao.zargo trunk/wao-business/src/test/java/fr/ifremer/wao/WaoGlobalTest.java trunk/wao-business/src/test/java/fr/ifremer/wao/entity/BoatImplTest.java trunk/wao-business/src/test/java/fr/ifremer/wao/entity/SampleRowImplTest.java trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceBoatImplTest.java trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceSamplingImplTest.java trunk/wao-ui/pom.xml trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Administration.java Log: - Add debug time (temp) - Remove lazy=false on unecessary relations (optimize page loading on sampleRows) Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/pom.xml 2010-03-31 19:25:21 UTC (rev 400) @@ -15,7 +15,7 @@ <groupId>fr.ifremer</groupId> <artifactId>wao</artifactId> - <version>1.0.4-SNAPSHOT</version> + <version>1.1-SNAPSHOT</version> <modules> <module>wao-ui</module> Modified: trunk/wao-business/pom.xml =================================================================== --- trunk/wao-business/pom.xml 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-business/pom.xml 2010-03-31 19:25:21 UTC (rev 400) @@ -10,7 +10,7 @@ <parent> <groupId>fr.ifremer</groupId> <artifactId>wao</artifactId> - <version>1.0.4-SNAPSHOT</version> + <version>1.1-SNAPSHOT</version> </parent> <groupId>fr.ifremer.wao</groupId> Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/WaoGlobal.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/WaoGlobal.java 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/WaoGlobal.java 2010-03-31 19:25:21 UTC (rev 400) @@ -82,7 +82,6 @@ WaoUser.PASSWORD, password, WaoUser.FIRST_NAME, "Super", WaoUser.LAST_NAME, "Admin"); - company.addWaoUser(user); user.setCompany(company); transaction.commitTransaction(); Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/WaoMigrationCallBack.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/WaoMigrationCallBack.java 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/WaoMigrationCallBack.java 2010-03-31 19:25:21 UTC (rev 400) @@ -47,10 +47,10 @@ List<String> queries = new ArrayList<String>(); -// createUserRoleColumn_1_1(queries); -// -// changeContactStateColumn_1_1(queries); + createUserRoleColumn_1_1(queries); + changeContactStateColumn_1_1(queries); + changeSampleRowLogAdminColumn_1_1(queries); String[] strings = queries.toArray(new String[queries.size()]); Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/WaoRunnerImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/WaoRunnerImpl.java 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/WaoRunnerImpl.java 2010-03-31 19:25:21 UTC (rev 400) @@ -56,6 +56,7 @@ public void start() throws WaoException { try { configuration = new ApplicationConfig(); + configuration.setAppName("wao"); configuration.setConfigFileName("Wao.properties"); configuration.parse(new String[]{}); configuration.setOption("topia.persistence.classes", Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceBoatImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceBoatImpl.java 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceBoatImpl.java 2010-03-31 19:25:21 UTC (rev 400) @@ -84,6 +84,11 @@ TopiaContext transaction = null; Map<Integer, Boat> results = new HashMap<Integer, Boat>(); try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } + transaction = rootContext.beginTransaction(); BoatDAO dao = WaoModelDAOHelper.getBoatDAO(transaction); @@ -102,6 +107,13 @@ } results = dao.findAllMappedByQuery(query, Boat.IMMATRICULATION, Integer.class); + + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getBoatsByFilter ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } } catch (Exception eee) { WaoContext.serviceException(transaction, "Impossible de filtrer la liste des navires", eee); @@ -116,6 +128,11 @@ TopiaContext transaction = null; int result = 0; try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } + transaction = rootContext.beginTransaction(); BoatDAO dao = WaoModelDAOHelper.getBoatDAO(transaction); @@ -124,6 +141,13 @@ query = createQueryForBoatFilter(query, filter); result = query.executeCount(); + + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getNbBoatsByFilter ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } } catch (Exception eee) { WaoContext.serviceException(transaction, "Impossible de filtrer la liste des navires", eee); @@ -186,6 +210,11 @@ TopiaContext transaction = null; try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } + transaction = rootContext.beginTransaction(); BoatDAO dao = WaoModelDAOHelper.getBoatDAO(transaction); @@ -233,6 +262,13 @@ if (contact != null) { result.setLastContact(contact); } + + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getCompanyBoatInfos ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } // transaction.closeContext(); } catch (Exception eee) { @@ -251,6 +287,10 @@ throws WaoException { TopiaContext transaction = null; try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); BoatInfosDAO dao = WaoModelDAOHelper.getBoatInfosDAO(transaction); @@ -272,6 +312,13 @@ } transaction.commitTransaction(); + + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ createUpdateCompanyBoatInfos ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } //transaction.closeContext(); } catch (Exception eee) { Boat boat = companyBoatInfos.getBoatInfos().getBoat(); @@ -292,6 +339,10 @@ return boats; } try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); BoatDAO dao = WaoModelDAOHelper.getBoatDAO(transaction); @@ -308,6 +359,13 @@ } boats.add(boat); } + + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getBoatsByImmatriculations ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } //transaction.closeContext(); } catch (Exception eee) { @@ -324,12 +382,23 @@ TopiaContext transaction = null; Boat result = null; try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); BoatDAO dao = WaoModelDAOHelper.getBoatDAO(transaction); result = dao.findByTopiaId(boatId); + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getBoat ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } + //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, "Impossible de charger le navire", eee); @@ -344,6 +413,10 @@ TopiaContext transaction = null; List<String> results = new ArrayList<String>(); try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); input = StringUtils.upperCase(input); @@ -353,6 +426,13 @@ results = dao.createQuery().addDistinct().setSelect(Boat.NAME). add(Boat.NAME, Op.LIKE, input + "%").execute(); + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getBoatNamesStartWith ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } + //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, @@ -591,6 +671,10 @@ TopiaContext transaction = null; ActivityCalendar result = null; try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); ActivityCalendarDAO dao = WaoModelDAOHelper.getActivityCalendarDAO(transaction); @@ -628,6 +712,13 @@ company.getName()); } + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getLastActivityCalendar ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } + //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java 2010-03-31 19:25:21 UTC (rev 400) @@ -62,7 +62,6 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; -import java.nio.charset.Charset; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -73,6 +72,7 @@ import java.util.Map; import org.apache.commons.lang.BooleanUtils; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.time.DurationFormatUtils; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.persistence.TopiaEntity; import org.slf4j.Logger; @@ -104,6 +104,10 @@ Map<String, Contact> results = new HashMap<String, Contact>(); TopiaContext transaction = null; try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); ContactDAO dao = WaoModelDAOHelper.getContactDAO(transaction); @@ -118,8 +122,16 @@ log.debug("Query : " + query); } + query.addLoad(Contact.SAMPLE_ROW + "." + SampleRow.SAMPLE_MONTH); results = dao.findAllMappedByQuery(query); + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getContacts ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } + //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, @@ -135,6 +147,10 @@ TopiaContext transaction = null; int result = 0; try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); ContactDAO dao = WaoModelDAOHelper.getContactDAO(transaction); @@ -143,6 +159,13 @@ result = query.executeCount(); + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getNbContacts ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } + //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, @@ -167,6 +190,10 @@ public void saveContact(Contact contact, boolean delete) throws WaoException { TopiaContext transaction = null; try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); ContactDAO dao = WaoModelDAOHelper.getContactDAO(transaction); @@ -183,6 +210,13 @@ } transaction.commitTransaction(); + + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ saveContact ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, @@ -369,7 +403,8 @@ // For an admin, get the company from database if (user.isAdmin()) { // FIXME-FD20100104 findContains not optimized in TopiaDAOImpl - company = companyDAO.findContainsWaoUser(observer); + //company = companyDAO.findContainsWaoUser(observer); + company = observer.getCompany(); // For a user, check if the observer as the same company as the current user } else if (!observer.getCompany().equals(company)) { throw new WaoBusinessException(Type.IMPORT_ERROR, this.getClass(), Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceNewsImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceNewsImpl.java 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceNewsImpl.java 2010-03-31 19:25:21 UTC (rev 400) @@ -26,9 +26,9 @@ import fr.ifremer.wao.WaoModelDAOHelper; import fr.ifremer.wao.entity.News; import fr.ifremer.wao.entity.NewsDAO; -import fr.ifremer.wao.service.ServiceNews; import java.util.ArrayList; import java.util.List; +import org.apache.commons.lang.time.DurationFormatUtils; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.persistence.TopiaEntity; import org.slf4j.Logger; @@ -60,12 +60,23 @@ TopiaContext transaction = null; List<News> results = new ArrayList<News>(); try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); NewsDAO dao = WaoModelDAOHelper.getNewsDAO(transaction); results = dao.findAllWithOrder(TopiaEntity.TOPIA_CREATE_DATE + " DESC"); + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getNews ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } + //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, @@ -80,6 +91,10 @@ public void saveNews(News news, boolean delete) throws WaoException { TopiaContext transaction = null; try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); NewsDAO dao = WaoModelDAOHelper.getNewsDAO(transaction); @@ -92,6 +107,13 @@ } transaction.commitTransaction(); + + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ saveNews ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceReferentialImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceReferentialImpl.java 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceReferentialImpl.java 2010-03-31 19:25:21 UTC (rev 400) @@ -34,11 +34,11 @@ import fr.ifremer.wao.io.ImportHelper; import fr.ifremer.wao.io.WaoCsvHeader.FISHING_ZONE; import java.io.InputStream; -import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.time.DurationFormatUtils; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaException; import org.nuiton.topia.framework.TopiaQuery; @@ -71,6 +71,10 @@ TopiaContext transaction = null; List<String> results = new ArrayList<String>(); try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); FishingZoneDAO dao = WaoModelDAOHelper.getFishingZoneDAO(transaction); @@ -80,6 +84,13 @@ results = (List<String>)query.setSelect("DISTINCT F." + FishingZone.FACADE_NAME).execute(); + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getFacades ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } + //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, "Impossible de charger la liste des facades", eee); @@ -94,6 +105,10 @@ TopiaContext transaction = null; List<String> results = new ArrayList<String>(); try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); FishingZoneDAO dao = WaoModelDAOHelper.getFishingZoneDAO(transaction); @@ -107,6 +122,13 @@ results = (List<String>)query.setSelect("DISTINCT F." + FishingZone.SECTOR_NAME).execute(); + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getSectors ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } + //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, "Impossible de charger la liste des secteurs de pêche", eee); @@ -138,12 +160,23 @@ TopiaContext transaction = null; List<Profession> results = new ArrayList<Profession>(); try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); ProfessionDAO dao = WaoModelDAOHelper.getProfessionDAO(transaction); results = dao.findAll(); + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getProfessions ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } + //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, @@ -159,12 +192,23 @@ TopiaContext transaction = null; List<FishingZone> results = new ArrayList<FishingZone>(); try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); FishingZoneDAO dao = WaoModelDAOHelper.getFishingZoneDAO(transaction); results = dao.findAll(); + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getFishingZones ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } + //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java 2010-03-31 19:25:21 UTC (rev 400) @@ -43,7 +43,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.nio.charset.Charset; import java.text.DateFormat; import java.text.NumberFormat; import java.text.ParseException; @@ -56,7 +55,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.logging.Level; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.time.DurationFormatUtils; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaException; import org.nuiton.topia.framework.TopiaQuery; @@ -93,7 +94,12 @@ @Override public void createUpdateSampleRow(SampleRow row, List<Boat> boats, SampleRowLog rowLog) throws WaoException { TopiaContext transaction = null; + TopiaContext transaction2 = null; try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); SampleRowLogDAO logDAO = WaoModelDAOHelper.getSampleRowLogDAO(transaction); @@ -115,10 +121,10 @@ Company oldCompany = null; Map<String, SampleMonth> oldMonths = new HashMap<String, SampleMonth>(); List<FishingZone> oldZones = new ArrayList<FishingZone>(); + transaction2 = rootContext.beginTransaction(); // UPDATE if (!newRow) { // Prepare data for logging or deleting oldMonths - TopiaContext transaction2 = rootContext.beginTransaction(); SampleRowDAO oldDAO = WaoModelDAOHelper.getSampleRowDAO(transaction2); oldRow = oldDAO.findByTopiaId(row.getTopiaId()); oldCompany = oldRow.getCompany(); @@ -127,7 +133,6 @@ oldMonths.put(month.getTopiaId(), month); } oldZones = oldRow.getFishingZone(); - transaction2.closeContext(); // NbObservants if (oldRow.getNbObservants() != row.getNbObservants()) { @@ -233,7 +238,7 @@ if (log.isDebugEnabled()) { log.debug("update row : " + row); } - row.addSampleRowLog(rowLog); + rowLog.setSampleRow(row); rowDAO.update(row); if (log.isDebugEnabled()) { @@ -241,11 +246,23 @@ log.debug("commit transaction !"); } transaction.commitTransaction(); + + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ createUpdateSampleRow ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, "Impossible de sauvegarder la ligne d'échantillon", eee); } finally { + try { + transaction2.closeContext(); + } catch (TopiaException eee) { + log.error("Error closing transaction", eee); + } WaoContext.closeTransaction(transaction); } } @@ -286,6 +303,10 @@ TopiaContext transaction = null; FacadeRow result = new FacadeRowImpl(); try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } if (period.getFromDate() == null || period.getThruDate() == null) { throw new IllegalArgumentException("PeriodBegin date and/or PeriodEnd date can't be null !"); } @@ -311,11 +332,20 @@ query.addOrder(zoneOrder).addOrder("S." + SampleRow.CODE).addSelect(zoneOrder); // Load data //query.addLoad(SampleRow.PROFESSION, SampleRow.COMPANY); + + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ before query getSampleRowsOrderedByFishingZone ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + startTime = System.currentTimeMillis(); + } if (log.isDebugEnabled()) { log.debug("Query : " + query); } + query.addLoad(SampleRow.SAMPLE_MONTH); List<SampleRow> results = dao.findAllByQuery(query); for (SampleRow row : results) { @@ -323,6 +353,13 @@ result.addRow(row); } + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getSampleRowsOrderedByFishingZone exec query ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } + //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, @@ -338,6 +375,10 @@ TopiaContext transaction = null; List<String> results = new ArrayList<String>(); try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); SampleRowDAO dao = WaoModelDAOHelper.getSampleRowDAO(transaction); @@ -349,6 +390,13 @@ results = (List<String>)query.setSelect("DISTINCT " + SampleRow.PROGRAM_NAME).execute(); + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getPrograms ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } + //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, @@ -364,6 +412,10 @@ TopiaContext transaction = null; List<SampleRow> results = new ArrayList<SampleRow>(); try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); SampleRowDAO dao = WaoModelDAOHelper.getSampleRowDAO(transaction); @@ -373,21 +425,27 @@ query = filter.prepareQueryForSampling(query, "S"); if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ after prepareQueryForSampling ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + startTime = System.currentTimeMillis(); + } + + if (log.isDebugEnabled()) { log.debug("Query : " + query); } -// if (finished) { -// // Only rows which are not finished will be kept -// Date current = WaoContext.getCurrentDate(); -// query.add(SampleRow.PERIOD_END, Op.GE, current); -// } + results = dao.findAllByQuery(query); -// if (filter.getCompany() != null) { -// query.add("S." + SampleRow.COMPANY, filter.getCompany()); -// } + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getSampleRowsByFilter exec query ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + startTime = System.currentTimeMillis(); + } - results = dao.findAllByQuery(query); - //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, @@ -403,12 +461,26 @@ TopiaContext transaction = null; SampleRow result = null; try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); SampleRowDAO dao = WaoModelDAOHelper.getSampleRowDAO(transaction); result = dao.findByTopiaId(sampleRowId); + result.sizeSampleMonth(); + result.sizeElligibleBoat(); + + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getSampleRow ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } + //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, @@ -427,6 +499,10 @@ TopiaContext transaction = null; SampleRow result = null; try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } if (log.isInfoEnabled()) { log.info("W:[ getSampleRowByCode ] : " + "sampleRowCode = " + sampleRowCode); @@ -442,6 +518,7 @@ query.add(SampleRow.COMPANY, user.getCompany()); } + query.addLoad(SampleRow.SAMPLE_ROW_LOG); result = dao.findByQuery(query); if (result == null) { @@ -449,6 +526,13 @@ ServiceSampling.class, "La ligne du plan avec " + "pour code " + sampleRowCode + " est introuvable !"); } + + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getSampleRowByCode ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } } catch (Exception eee) { WaoContext.serviceException(transaction, @@ -465,6 +549,10 @@ public void deleteSampleRow(SampleRow sampleRow) throws WaoException { TopiaContext transaction = null; try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); SampleRowDAO dao = WaoModelDAOHelper.getSampleRowDAO(transaction); @@ -474,6 +562,13 @@ dao.delete(row); transaction.commitTransaction(); + + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ deleteSampleRow ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, @@ -492,6 +587,10 @@ return result; } try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); Calendar begin = new GregorianCalendar(); @@ -515,6 +614,13 @@ String str = StringUtils.leftPad("" + num, 4, "0"); result = year + "_" + str; + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getNewSampleRowCode ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } + //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSynthesisImpl.java 2010-03-31 19:25:21 UTC (rev 400) @@ -51,6 +51,7 @@ import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; +import org.apache.commons.lang.time.DurationFormatUtils; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.framework.TopiaQuery; import org.nuiton.topia.framework.TopiaQuery.Op; @@ -86,6 +87,10 @@ TopiaContext transaction = null; List<SortedMap<Date, Integer>> results = new ArrayList<SortedMap<Date, Integer>>(); try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); PeriodDates period = filter.getPeriod(); @@ -137,6 +142,13 @@ } } + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getDataSampling ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } + //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, @@ -169,6 +181,10 @@ BoardingResult result = new BoardingResultImpl(); result.setData(map); try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); // Initialiaze max boardings and its max key value @@ -239,6 +255,13 @@ result.setMaxBoardingValue(maxValue.intValue()); } + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getBoardingBoats ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } + //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, @@ -257,6 +280,10 @@ // only if there is no unfinished sampleRow or no contact done Map<String, Double> results = new HashMap<String, Double>(); try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); ContactDAO dao = WaoModelDAOHelper.getContactDAO(transaction); @@ -325,6 +352,13 @@ } } + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getNonComplianceBoardingIndicator ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } + //transaction.closeContext(); } catch (Exception eee) { String msgEnd = ""; @@ -345,6 +379,10 @@ TopiaContext transaction = null; Map<String, ContactStateStatistics> results = new HashMap<String, ContactStateStatistics>(); try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); ContactDAO dao = WaoModelDAOHelper.getContactDAO(transaction); @@ -406,7 +444,13 @@ stats.addResult(state, rowCount.intValue()); } - //transaction.closeContext(); + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getContactStateStatistics ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } + } catch (Exception eee) { String msgEnd = ""; if (company != null) { @@ -429,6 +473,10 @@ Map<String, ContactAverageReactivity> results = new HashMap<String, ContactAverageReactivity>(); try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); ContactDAO dao = WaoModelDAOHelper.getContactDAO(transaction); @@ -454,18 +502,6 @@ } String dataInput = contact + "." + Contact.DATA_INPUT_DATE; - //query.addNotNull(dataInput); - - // FIXME-FD20100212 Hack for H2 which not managed day for date diff -// TopiaContextImplementor context = (TopiaContextImplementor)transaction; -// String dialect = context.getHibernateConfiguration().getProperty("hibernate.dialect"); - -// String avg = "AVG(day(" + dataInput + " - " + tideBegin + "))"; -// if (dialect.contains("H2Dialect")) { -// avg = "AVG(" + dataInput + " - " + tideBegin + ")"; -// } - - //query.setSelect(companyName, avg).addGroup(companyName); query.setSelect(companyName, dataInput, tideBegin); if (log.isDebugEnabled()) { @@ -496,28 +532,15 @@ } avg.addValue(nbDays); + } - - -// String rowCompanyName = (String)row[0]; -// Object rowAverage = row[1]; -// if (log.isDebugEnabled()) { -// log.debug("Company : " + rowCompanyName); -// log.debug("Res : " + rowAverage.getClass().getName()); -// log.debug("Res : " + rowAverage); -// log.debug("tideBegin : " + (Date)row[3]); -// log.debug("dataInput : " + (Date)row[2]); -// } -//// Double d = new Double((double)rowAverage.intValue()); -//// if (rowAverage < 0) { -//// rowAverage = 0.; -//// } -// results.put(rowCompanyName, 0.); + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getContactDataInputDateReactivity ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); } - - - } catch (Exception eee) { String msgEnd = ""; if (company != null) { Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceUserImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceUserImpl.java 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceUserImpl.java 2010-03-31 19:25:21 UTC (rev 400) @@ -38,6 +38,7 @@ import java.util.ArrayList; import java.util.List; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.time.DurationFormatUtils; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.framework.TopiaQuery; import org.slf4j.Logger; @@ -69,6 +70,10 @@ TopiaContext transaction = null; WaoUser user = null; try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); WaoUserDAO dao = WaoModelDAOHelper.getWaoUserDAO(transaction); @@ -87,6 +92,13 @@ "Identifiant ou mot de passe incorrects, veuillez réessayer."); } + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ connect ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } + //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, "Une erreur est survenue lors de la demande de connexion", eee); @@ -100,6 +112,10 @@ public void forgetPassword(String login) throws WaoException { TopiaContext transaction = null; try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } if (!login.contains("@")) { throw new WaoBusinessException(Type.SYNTAX, this.getClass(), "Votre identifiant n'est pas un email valide, " + "veuillez contacter un administrateur pour qu'il puisse changer votre mot de passe."); @@ -134,6 +150,13 @@ } transaction.commitTransaction(); + + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ forgetPassword ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, "Impossible de créer ou de mettre à jour l'utilisateur", eee); @@ -146,6 +169,10 @@ public void createUpdateUser(WaoUser user, boolean generatePassword) throws WaoException { TopiaContext transaction = null; try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } if (user == null) { throw new IllegalArgumentException("user parameter can't be null"); } @@ -215,6 +242,13 @@ } transaction.commitTransaction(); + + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ createUpdateUser ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, "Impossible de créer ou de mettre à jour l'utilisateur", eee); @@ -227,6 +261,10 @@ public void deleteUser(WaoUser user) throws WaoException { TopiaContext transaction = null; try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); String userType = StringUtils.lowerCase( @@ -276,6 +314,13 @@ dao.delete(user); transaction.commitTransaction(); + + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ deleteUser ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, "Impossible de créer ou" + @@ -289,6 +334,10 @@ public void createUpdateCompany(Company company) throws WaoException { TopiaContext transaction = null; try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } if (company == null) { throw new IllegalArgumentException("company parameter can't be null"); } @@ -301,6 +350,13 @@ dao.update(company); transaction.commitTransaction(); + + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ createUpdateCompany ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } //transaction.closeContext(); } catch (Exception eee) { WaoContext.serviceException(transaction, "Impossible de créer ou de mettre à jour la société", eee); @@ -314,6 +370,10 @@ TopiaContext transaction = null; List<Company> results = new ArrayList<Company>(); try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); CompanyDAO dao = WaoModelDAOHelper.getCompanyDAO(transaction); @@ -324,7 +384,12 @@ results = dao.findAll(); } - //transaction.closeContext(); + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getCompanies ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } } catch (Exception eee) { WaoContext.serviceException(transaction, "Impossible de récupérer la liste des sociétés", eee); } finally { @@ -334,10 +399,50 @@ } @Override + public List<WaoUser> getUsersByCompany(Company company) throws WaoException { + TopiaContext transaction = null; + List<WaoUser> results = new ArrayList<WaoUser>(); + try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } + transaction = rootContext.beginTransaction(); + + WaoUserDAO dao = WaoModelDAOHelper.getWaoUserDAO(transaction); + + + TopiaQuery query = dao.createQuery(). + add(WaoUser.COMPANY, company). + addOrder(WaoUser.FIRST_NAME, WaoUser.LAST_NAME); + + results = dao.findAllByQuery(query); + + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getUsersByCompany ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } + } catch (Exception eee) { + WaoContext.serviceException(transaction, "Impossible de récupérer " + + "la liste des utilisateurs de la société " + + company.getName(), eee); + } finally { + WaoContext.closeTransaction(transaction); + } + return results; + } + + @Override public List<WaoUser> getObservers(boolean activeOnly) throws WaoException { TopiaContext transaction = null; List<WaoUser> results = new ArrayList<WaoUser>(); try { + long startTime = 0; + if (log.isDebugEnabled()) { + startTime = System.currentTimeMillis(); + } transaction = rootContext.beginTransaction(); WaoUserDAO dao = WaoModelDAOHelper.getWaoUserDAO(transaction); @@ -351,7 +456,12 @@ results = dao.findAllByQuery(query); - //transaction.closeContext(); + if (log.isDebugEnabled()) { + long stopTime = System.currentTimeMillis(); + log.debug("W:[ getObservers ] Time = " + + DurationFormatUtils.formatDurationHMS( + stopTime - startTime)); + } } catch (Exception eee) { WaoContext.serviceException(transaction, "Impossible de récupérer la liste des observateurs", eee); } finally { Modified: trunk/wao-business/src/main/resources/oldmappings/WaoModel/1.1/fr/ifremer/wao/entity/CompanyImpl.hbm.xml =================================================================== --- trunk/wao-business/src/main/resources/oldmappings/WaoModel/1.1/fr/ifremer/wao/entity/CompanyImpl.hbm.xml 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-business/src/main/resources/oldmappings/WaoModel/1.1/fr/ifremer/wao/entity/CompanyImpl.hbm.xml 2010-03-31 19:25:21 UTC (rev 400) @@ -13,7 +13,7 @@ <property name="email" type="text" access="field" column="email" node="email"/> <property name="city" type="text" access="field" column="city" node="city"/> <property name="postalCode" type="int" access="field" column="postalCode" node="postalCode"/> - <bag name="waoUser" inverse="true" order-by="firstName,lastName" lazy="false" cascade="all,delete-orphan" node="waoUser" embed-xml="false"> + <bag name="waoUser" inverse="true" lazy="true" cascade="all,delete-orphan" node="waoUser" embed-xml="false"> <key column="company"/> <one-to-many class="fr.ifremer.wao.entity.WaoUserImpl" node="topiaId" embed-xml="false"/> </bag> Modified: trunk/wao-business/src/main/resources/oldmappings/WaoModel/1.1/fr/ifremer/wao/entity/SampleRowImpl.hbm.xml =================================================================== --- trunk/wao-business/src/main/resources/oldmappings/WaoModel/1.1/fr/ifremer/wao/entity/SampleRowImpl.hbm.xml 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-business/src/main/resources/oldmappings/WaoModel/1.1/fr/ifremer/wao/entity/SampleRowImpl.hbm.xml 2010-03-31 19:25:21 UTC (rev 400) @@ -14,16 +14,16 @@ <property name="periodBegin" type="java.util.Date" access="field" column="periodBegin" node="periodBegin"/> <property name="periodEnd" type="java.util.Date" access="field" column="periodEnd" node="periodEnd"/> <many-to-one name="profession" class="fr.ifremer.wao.entity.ProfessionImpl" column="profession" lazy="false" node="profession/@topiaId" embed-xml="false"/> - <bag name="sampleMonth" inverse="true" order-by="periodDate" lazy="false" cascade="all,delete-orphan" node="sampleMonth" embed-xml="false"> + <bag name="sampleMonth" inverse="true" order-by="periodDate" lazy="true" cascade="all,delete-orphan" node="sampleMonth" embed-xml="false"> <key column="sampleRow"/> <one-to-many class="fr.ifremer.wao.entity.SampleMonthImpl" node="topiaId" embed-xml="false"/> </bag> <many-to-one name="company" class="fr.ifremer.wao.entity.CompanyImpl" column="company" lazy="false" node="company/@topiaId" embed-xml="false"/> - <bag name="sampleRowLog" inverse="true" order-by="topiaCreateDate desc" lazy="false" cascade="all,delete-orphan" node="sampleRowLog" embed-xml="false"> + <bag name="sampleRowLog" inverse="true" order-by="topiaCreateDate desc" lazy="true" cascade="all,delete-orphan" node="sampleRowLog" embed-xml="false"> <key column="sampleRow"/> <one-to-many class="fr.ifremer.wao.entity.SampleRowLogImpl" node="topiaId" embed-xml="false"/> </bag> - <bag name="elligibleBoat" inverse="true" order-by="companyActive" lazy="false" cascade="all,delete-orphan" node="elligibleBoat" embed-xml="false"> + <bag name="elligibleBoat" inverse="true" order-by="companyActive" lazy="true" cascade="all,delete-orphan" node="elligibleBoat" embed-xml="false"> <key column="sampleRow"/> <one-to-many class="fr.ifremer.wao.entity.ElligibleBoatImpl" node="topiaId" embed-xml="false"/> </bag> Modified: trunk/wao-business/src/main/xmi/wao.properties =================================================================== --- trunk/wao-business/src/main/xmi/wao.properties 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-business/src/main/xmi/wao.properties 2010-03-31 19:25:21 UTC (rev 400) @@ -1,19 +1,19 @@ model.tagvalue.copyright=/* *##%\n Copyright (C) 2009 Wao\n *##%*/ model.tagvalue.java.lang.String=text -fr.ifremer.wao.entity.Company.attribute.waoUser.tagvalue.lazy=false -fr.ifremer.wao.entity.Company.attribute.waoUser.tagvalue.orderBy=firstName,lastName +#fr.ifremer.wao.entity.Company.attribute.waoUser.tagvalue.lazy=false +#fr.ifremer.wao.entity.Company.attribute.waoUser.tagvalue.orderBy=firstName,lastName -fr.ifremer.wao.entity.SampleRow.attribute.sampleMonth.tagvalue.lazy=false +#fr.ifremer.wao.entity.SampleRow.attribute.sampleMonth.tagvalue.lazy=false fr.ifremer.wao.entity.SampleRow.attribute.sampleMonth.tagvalue.orderBy=periodDate fr.ifremer.wao.entity.SampleRow.attribute.fishingZone.tagvalue.lazy=false fr.ifremer.wao.entity.SampleRow.attribute.fishingZone.tagvalue.orderBy=facadeName,sectorName,districtCode fr.ifremer.wao.entity.SampleRow.attribute.profession.tagvalue.lazy=false fr.ifremer.wao.entity.SampleRow.attribute.company.tagvalue.lazy=false -#fr.ifremer.wao.entity.SampleRow.attribute.pogram.tagvalue.lazy=false -fr.ifremer.wao.entity.SampleRow.attribute.elligibleBoat.tagvalue.lazy=false +#fr.ifremer.wao.entity.SampleRow.attribute.elligibleBoat.tagvalue.lazy=false fr.ifremer.wao.entity.SampleRow.attribute.elligibleBoat.tagvalue.orderBy=companyActive -fr.ifremer.wao.entity.SampleRow.attribute.sampleRowLog.tagvalue.lazy=false +#fr.ifremer.wao.entity.SampleRow.attribute.sampleRowLog.tagvalue.lazy=false fr.ifremer.wao.entity.SampleRow.attribute.sampleRowLog.tagvalue.orderBy=topiaCreateDate desc + fr.ifremer.wao.entity.SampleRowLog.attribute.author.tagvalue.lazy=false fr.ifremer.wao.entity.FishingZone.attribute.sampleRow.tagvalue.orderBy=code @@ -24,10 +24,4 @@ fr.ifremer.wao.entity.ElligibleBoat.attribute.boat.tagvalue.lazy=false fr.ifremer.wao.entity.Contact.attribute.sampleRow.tagvalue.lazy=false -fr.ifremer.wao.entity.Contact.attribute.boat.tagvalue.lazy=false - -#fr.ifremer.wao.entity.Boat.attribute.elligibleBoat.tagvalue.lazy=false -#fr.ifremer.wao.entity.ElligibleBoat.attribute.sampleRow.tagvalue.lazy=false -#fr.ifremer.wao.entity.ElligibleBoat.attribute.company.tagvalue.lazy=false -#fr.ifremer.wao.entity.SampleRow.attribute.program.tagvalue.lazy=false -#fr.ifremer.wao.entity.SampleRow.attribute.company.tagvalue.lazy=false \ No newline at end of file +fr.ifremer.wao.entity.Contact.attribute.boat.tagvalue.lazy=false \ No newline at end of file Modified: trunk/wao-business/src/main/xmi/wao.zargo =================================================================== (Binary files differ) Modified: trunk/wao-business/src/test/java/fr/ifremer/wao/WaoGlobalTest.java =================================================================== --- trunk/wao-business/src/test/java/fr/ifremer/wao/WaoGlobalTest.java 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-business/src/test/java/fr/ifremer/wao/WaoGlobalTest.java 2010-03-31 19:25:21 UTC (rev 400) @@ -93,7 +93,7 @@ Company company = companies.get(0); assertEquals("ADMIN", company.getName()); - List<WaoUser> users = company.getWaoUser(); + List<WaoUser> users = serviceUser.getUsersByCompany(company); assertEquals(1, users.size()); WaoUser user = users.get(0); Modified: trunk/wao-business/src/test/java/fr/ifremer/wao/entity/BoatImplTest.java =================================================================== --- trunk/wao-business/src/test/java/fr/ifremer/wao/entity/BoatImplTest.java 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-business/src/test/java/fr/ifremer/wao/entity/BoatImplTest.java 2010-03-31 19:25:21 UTC (rev 400) @@ -132,6 +132,8 @@ SampleRow row = rowDAO.findByCode("2010_0001"); row.getCompany(); row.getProfession(); + row.sizeElligibleBoat(); + row.sizeSampleMonth(); transaction.closeContext(); row.setCompany(company); Modified: trunk/wao-business/src/test/java/fr/ifremer/wao/entity/SampleRowImplTest.java =================================================================== --- trunk/wao-business/src/test/java/fr/ifremer/wao/entity/SampleRowImplTest.java 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-business/src/test/java/fr/ifremer/wao/entity/SampleRowImplTest.java 2010-03-31 19:25:21 UTC (rev 400) @@ -97,6 +97,8 @@ transaction.commitTransaction(); SampleRow myRow = dao.findByCode("2010_1"); + myRow.sizeElligibleBoat(); + myRow.sizeSampleMonth(); transaction.closeContext(); return myRow; } @@ -105,6 +107,8 @@ TopiaContext transaction = WaoContext.getTopiaRootContext().beginTransaction(); SampleRowDAO dao = WaoModelDAOHelper.getSampleRowDAO(transaction); SampleRow resultRow = dao.findByCode("2010_1"); + resultRow.sizeElligibleBoat(); + resultRow.sizeSampleMonth(); transaction.closeContext(); return resultRow; } Modified: trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceBoatImplTest.java =================================================================== --- trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceBoatImplTest.java 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceBoatImplTest.java 2010-03-31 19:25:21 UTC (rev 400) @@ -226,8 +226,12 @@ SampleRowDAO rowDAO = WaoModelDAOHelper.getSampleRowDAO(transaction); SampleRow row1 = rowDAO.findByCode("2009_0003"); row1.getProfession(); + row1.sizeElligibleBoat(); + row1.sizeSampleMonth(); SampleRow row2 = rowDAO.findByCode("2010_0004"); row2.getProfession(); + row2.sizeElligibleBoat(); + row2.sizeSampleMonth(); transaction.commitTransaction(); Modified: trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceSamplingImplTest.java =================================================================== --- trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceSamplingImplTest.java 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceSamplingImplTest.java 2010-03-31 19:25:21 UTC (rev 400) @@ -433,6 +433,8 @@ SampleRow row = rowDAO.findByCode("2010_0001"); row.getProfession(); row.getCompany(); + row.sizeSampleMonth(); + row.sizeElligibleBoat(); transaction.closeContext(); input = getClass().getResourceAsStream("/import/navires.csv"); Modified: trunk/wao-ui/pom.xml =================================================================== --- trunk/wao-ui/pom.xml 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-ui/pom.xml 2010-03-31 19:25:21 UTC (rev 400) @@ -10,7 +10,7 @@ <parent> <groupId>fr.ifremer</groupId> <artifactId>wao</artifactId> - <version>1.0.4-SNAPSHOT</version> + <version>1.1-SNAPSHOT</version> </parent> <groupId>fr.ifremer.wao</groupId> Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Administration.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Administration.java 2010-03-31 10:10:28 UTC (rev 399) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Administration.java 2010-03-31 19:25:21 UTC (rev 400) @@ -215,7 +215,7 @@ @Log public GenericSelectModel<WaoUser> getUsersSelectModel() throws WaoException { if (usersSelectModel == null) { - List<WaoUser> users = getCompany().getWaoUser(); + List<WaoUser> users = serviceUser.getUsersByCompany(getCompany()); if (log.isDebugEnabled()) { log.debug("Nb users : " + users.size()); }
participants (1)
-
fdesbois@users.labs.libre-entreprise.org