Wao-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- 2357 discussions
[Suiviobsmer-commits] r146 - trunk/suiviobsmer-ui/src/main/webapp
by fdesbois@users.labs.libre-entreprise.org 22 Dec '09
by fdesbois@users.labs.libre-entreprise.org 22 Dec '09
22 Dec '09
Author: fdesbois
Date: 2009-12-22 09:52:22 +0000 (Tue, 22 Dec 2009)
New Revision: 146
Modified:
trunk/suiviobsmer-ui/src/main/webapp/SamplingPlan.tml
Log:
Evol #1952 : SampleRow can be deleted if no realTideTime is set (Resolve JavaScript issue on Confirm Mixin)
Modified: trunk/suiviobsmer-ui/src/main/webapp/SamplingPlan.tml
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/SamplingPlan.tml 2009-12-22 09:35:04 UTC (rev 145)
+++ trunk/suiviobsmer-ui/src/main/webapp/SamplingPlan.tml 2009-12-22 09:52:22 UTC (rev 146)
@@ -152,7 +152,7 @@
</a>
<t:unless t:test="row.hasSampleMonthRealTideTime()">
<a t:type="actionlink" t:id="deleteSampleRow" t:context="rowIndex" title="Supprimer la ligne d'échantillon"
- t:mixins="confirm" t:message="Etes-vous sûr de vouloir supprimer définitivement cette ligne du plan d'échantillonnage ?">
+ t:mixins="confirm" t:message="Etes-vous sûr de vouloir supprimer définitivement la ligne ${row.code} du plan d\'échantillonnage ?">
<img src="${asset:context:}/img/delete2.png" alt="Supprimer" title="Supprimer la ligne"/>
</a>
</t:unless>
1
0
[Suiviobsmer-commits] r145 - in trunk/suiviobsmer-business/src: main/java/fr/ifremer/suiviobsmer/impl test/java/fr/ifremer/suiviobsmer/impl
by fdesbois@users.labs.libre-entreprise.org 22 Dec '09
by fdesbois@users.labs.libre-entreprise.org 22 Dec '09
22 Dec '09
Author: fdesbois
Date: 2009-12-22 09:35:04 +0000 (Tue, 22 Dec 2009)
New Revision: 145
Modified:
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceSamplingImpl.java
trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceSamplingImplTest.java
Log:
Resolve Issue #1961 : Delete SampleRow problem
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceSamplingImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceSamplingImpl.java 2009-12-21 23:11:23 UTC (rev 144)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceSamplingImpl.java 2009-12-22 09:35:04 UTC (rev 145)
@@ -306,8 +306,10 @@
SampleRowDAO dao = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction);
- dao.delete(sampleRow);
+ SampleRow row = dao.findByTopiaId(sampleRow.getTopiaId());
+ dao.delete(row);
+
transaction.commitTransaction();
transaction.closeContext();
} catch (Exception eee) {
Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceSamplingImplTest.java
===================================================================
--- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceSamplingImplTest.java 2009-12-21 23:11:23 UTC (rev 144)
+++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceSamplingImplTest.java 2009-12-22 09:35:04 UTC (rev 145)
@@ -358,7 +358,7 @@
System.out.println("getSampleRow");
}
- //@Test
+ @Test
public void testDeleteSampleRow() throws Exception {
log.info("deleteSampleRow");
@@ -392,13 +392,15 @@
/** EXEC METHOD **/
service.deleteSampleRow(row);
+ transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction();
+ rowDAO = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction);
row = rowDAO.findByCode("2010_1");
assertNull(row);
- transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction();
ElligibleBoatDAO elligibleDAO = SuiviObsmerModelDAOHelper.getElligibleBoatDAO(transaction);
List<ElligibleBoat> elligibles = elligibleDAO.findAll();
assertEquals(0, elligibles.size());
+ transaction.closeContext();
}
@Test
1
0
[Suiviobsmer-commits] r144 - trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer
by fdesbois@users.labs.libre-entreprise.org 21 Dec '09
by fdesbois@users.labs.libre-entreprise.org 21 Dec '09
21 Dec '09
Author: fdesbois
Date: 2009-12-21 23:11:23 +0000 (Mon, 21 Dec 2009)
New Revision: 144
Modified:
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/TopiaQuery.java
Log:
Add javadoc
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/TopiaQuery.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/TopiaQuery.java 2009-12-21 22:47:09 UTC (rev 143)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/TopiaQuery.java 2009-12-21 23:11:23 UTC (rev 144)
@@ -25,31 +25,53 @@
private static final Logger log = LoggerFactory.getLogger(TopiaQuery.class);
+ /** Params for HQL query **/
protected List<Object> params;
+ /** Select part of the query **/
protected String select;
+ /** From part of the query **/
protected String from;
+ /** Where part of the query **/
protected String where;
+ /** Order By part of the query **/
protected String orderBy;
+ /** Group By part of the query **/
protected String groupBy;
+ /** Used to determine if parentheses are needed for Where input **/
protected boolean parentheses;
+ /**
+ * Enum to simmplify using operation in query
+ */
public static enum Op {
+ /** EQUALS **/
EQ("="),
+ /** GREATER THAN **/
GT(">"),
+ /** GREATER OR EQUALS **/
GE(">="),
+ /** LIKE for String manipulation **/
LIKE("LIKE"),
+ /** LESS THAN **/
LT("<"),
+ /** LESS OR EQUALS **/
LE("<="),
+ /** IS NOT NULL **/
NOT_NULL("IS NOT NULL");
protected String value;
+ /**
+ * Constructor of the Op Enum.
+ *
+ * @param value corresponding to the String for the query
+ */
Op(String value) {
this.value = value;
}
@@ -60,10 +82,20 @@
}
}
+ /**
+ * Constructor of TopiaQuery with entityClass initialization.
+ *
+ * @param entityClass Class for an entity Query
+ */
public TopiaQuery(Class<? extends TopiaEntity> entityClass) {
this(entityClass.getName());
}
+ /**
+ * Constructor of TopiaQuery with String form initialization.
+ *
+ * @param from From part for the Query
+ */
public TopiaQuery(String from) {
this.from = " FROM " + from;
parentheses = true;
@@ -74,6 +106,11 @@
return fullQuery();
}
+ /**
+ * Get the full query.
+ *
+ * @return a String corresponding to the full query.
+ */
public String fullQuery() {
String result = "";
if (select != null) {
@@ -92,6 +129,13 @@
return result.trim();
}
+ /**
+ * Add a HQL parameter to the Query.
+ *
+ * @param id identification of the param in the query
+ * @param e value of the param
+ * @return the TopiaQuery
+ */
public TopiaQuery addParam(String id, Object e) {
if (params == null) {
params = new ArrayList<Object>();
@@ -101,6 +145,13 @@
return this;
}
+ /**
+ * Add a where element to the Query. Could be anything.
+ * Parentheses are added automatically (even if there are not needed).
+ *
+ * @param where element to add
+ * @return the TopiaQuery
+ */
public TopiaQuery add(String where) {
if (this.where == null) {
this.where = " WHERE ";
@@ -118,6 +169,15 @@
return this;
}
+ /**
+ * Add an element to the query. The parameter will be automatically added.
+ * The constraint is needed to determine what type of operation it is.
+ *
+ * @param paramName the name of the parameter in the query (attribute of the entity)
+ * @param constraint the operation concerned
+ * @param paramValue the value of the parameter (an other entity, a String, ...)
+ * @return the TopiaQuery
+ */
public TopiaQuery add(String paramName, Op constraint, Object paramValue) {
int dot = paramName.lastIndexOf(".");
String valueName = paramName;
@@ -128,19 +188,47 @@
return add(paramName + " " + constraint + " :" + valueName).addParam(valueName, paramValue);
}
+ /**
+ * Add an element to the query with the constraint Not null.
+ *
+ * @param paramName name of the parameter in the query
+ * @return the TopiaQuery
+ */
public TopiaQuery addNotNull(String paramName) {
return add(paramName + " " + Op.NOT_NULL);
}
+ /**
+ * Add an element to the query. The parameter will be automatically added.
+ * The default constrainst operation is Op.EQ for EQUALS.
+ * Ex : add("boat", boat) means -> boat = :boat.
+ *
+ * @param paramName name of the parameter in the query
+ * @param paramValue value of the parameter
+ * @return the TopiaQuery
+ * @see #add(java.lang.String, fr.ifremer.suiviobsmer.TopiaQuery.Op, java.lang.Object)
+ */
public TopiaQuery add(String paramName, Object paramValue) {
return add(paramName, Op.EQ, paramValue);
}
+ /**
+ * Add an element to the from in the query. Used to add some other data in the query or for join.
+ *
+ * @param str the element to add
+ * @return the TopiaQuery
+ */
public TopiaQuery addFrom(String str) {
from += ", " + str;
return this;
}
+ /**
+ * Add an element to the select in the query. Used to add some parameters for the return of query.
+ *
+ * @param select element to add
+ * @return the TopiaQuery
+ */
public TopiaQuery addSelect(String select) {
if (this.select == null) {
this.select = "SELECT ";
@@ -151,6 +239,12 @@
return this;
}
+ /**
+ * Add an element to the order in the query. Used to add some parameters to order by.
+ *
+ * @param order element to add
+ * @return the TopiaQuery
+ */
public TopiaQuery addOrder(String order) {
if (orderBy == null) {
orderBy = " ORDER BY ";
@@ -161,6 +255,12 @@
return this;
}
+ /**
+ * Add an element to the group of the query. Used to add some paramters to group by.
+ *
+ * @param group element to add
+ * @return the TopiaQuery
+ */
public TopiaQuery addGroup(String group) {
if (groupBy == null) {
groupBy = " GROUP BY ";
@@ -171,6 +271,14 @@
return this;
}
+ /**
+ * Simple execution of the query. This method use directly the find method in TopiaContext interface.
+ *
+ * @param transaction the TopiaContext to use for execution
+ * @return a List of results
+ * @throws TopiaException
+ * @see org.nuiton.topia.TopiaContext#find(java.lang.String, java.lang.Object[])
+ */
public List execute(TopiaContext transaction) throws TopiaException {
if (log.isTraceEnabled()) {
log.trace("# QUERY : " + fullQuery());
@@ -184,6 +292,15 @@
return transaction.find(fullQuery(), params.toArray());
}
+ /**
+ * Execute the query and get a List of entity.
+ *
+ * @param <T> the type of TopiaEntity to return
+ * @param transaction the TopiaContext to use for execution
+ * @param entityClass the class of the TopiaEntity used for return type
+ * @return a List of TopiaEntity corresponding to the entityClass in argument
+ * @throws TopiaException
+ */
public <T extends TopiaEntity> List<T> executeToEntityList(TopiaContext transaction, Class<T> entityClass) throws TopiaException {
List res = execute(transaction);
List<T> results = new ArrayList<T>();
@@ -194,11 +311,29 @@
return results;
}
+ /**
+ * Execute the query and get the first result entity.
+ *
+ * @param <T> the type of TopiaEntity to return
+ * @param transaction the TopiaContext to use for execution
+ * @param entityClass the class of the TopiaEntity used for return type
+ * @return a TopiaEntity corresponding to the entityClass in argument
+ * @throws TopiaException
+ */
public <T extends TopiaEntity> T executeToEntity(TopiaContext transaction, Class<T> entityClass) throws TopiaException {
List<T> results = executeToEntityList(transaction, entityClass);
return !results.isEmpty() ? results.get(0) : null;
}
+ /**
+ * Execute the query and get an Integer for result. Used for query with COUNT or MAX, ...
+ * The select is overriden to get only the right value for return.
+ *
+ * @param transaction the TopiaContext to use for execution
+ * @param select the Select overriden (ex : MAX(myParam))
+ * @return an Integer
+ * @throws TopiaException
+ */
public int executeToInteger(TopiaContext transaction, String select) throws TopiaException {
String oldValue = this.select;
this.select = "SELECT " + select;
@@ -212,6 +347,13 @@
return result;
}
+ /**
+ * Execute a simple count on the query, i.e. the number of results get from the query.
+ *
+ * @param transaction the TopiaContext to use for execution
+ * @return an int corresponding to the number of result in the query
+ * @throws TopiaException
+ */
public int executeCount(TopiaContext transaction) throws TopiaException {
return executeToInteger(transaction, "COUNT(*)");
}
1
0
[Suiviobsmer-commits] r143 - in trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer: . entity impl
by fdesbois@users.labs.libre-entreprise.org 21 Dec '09
by fdesbois@users.labs.libre-entreprise.org 21 Dec '09
21 Dec '09
Author: fdesbois
Date: 2009-12-21 22:47:09 +0000 (Mon, 21 Dec 2009)
New Revision: 143
Added:
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/QueryBuilder.java
Modified:
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/TopiaQuery.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatImpl.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatInfosImpl.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImpl.java
Log:
- Suppress validation test for canCreateContact method
- Improve queries
Added: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/QueryBuilder.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/QueryBuilder.java (rev 0)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/QueryBuilder.java 2009-12-21 22:47:09 UTC (rev 143)
@@ -0,0 +1,71 @@
+
+package fr.ifremer.suiviobsmer;
+
+import fr.ifremer.suiviobsmer.TopiaQuery.Op;
+import fr.ifremer.suiviobsmer.bean.ContactState;
+import fr.ifremer.suiviobsmer.entity.Boat;
+import fr.ifremer.suiviobsmer.entity.Company;
+import fr.ifremer.suiviobsmer.entity.Contact;
+import java.util.Date;
+
+/**
+ * QueryBuilder
+ *
+ * Created: 21 déc. 2009
+ *
+ * @author fdesbois
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+public class QueryBuilder {
+
+ /**
+ * Create the query for the last contact of the boat and company.
+ *
+ * @param boat the boat concerned by the contact
+ * @param company the company concerned by the user who create the contact
+ * @return the TopiaQuery created
+ */
+ public static TopiaQuery createQueryLastContactForBoat(Boat boat, Company company) {
+ String contactClassName = Contact.class.getName();
+ TopiaQuery subquery = new TopiaQuery(contactClassName + " C2").
+ addSelect("MAX(C2.topiaCreateDate)").
+ add("C2.boat = C1.boat").
+ add("C2.user.company = :company");
+
+ TopiaQuery query = new TopiaQuery(contactClassName + " C1").
+ add("C1.boat", boat).
+ add("C1.user.company = :company").
+ addParam("company", company).
+ add("C1.topiaCreateDate = (" + subquery.fullQuery() + ")");
+
+ return query;
+ }
+
+ /**
+ * Create the query for contacts linked with a boat with BoardingDone state since the fromDate.
+ * This query is used to get all boarding dones with the boat for all companies.
+ * Only the validate contacts by company will be count. The param fromDate can be null,
+ * in this case, all contacts will be given (no matter which date then started).
+ *
+ * @param boat the boat concerned by the contact
+ * @param fromDate the date to start
+ * @return the TopiaQuery created
+ */
+ public static TopiaQuery createQueryDoneContactsFromDate(Boat boat, Date fromDate) {
+ TopiaQuery query = new TopiaQuery(Contact.class).
+ add("boat", boat).
+ add("state", ContactState.BOARDING_DONE.toString()).
+ add("validationCompany", Boolean.TRUE).
+ add("validationProgram IS NULL OR validationProgram = :booleanTrue").
+ addParam("booleanTrue", Boolean.TRUE);
+
+ if (fromDate != null) {
+ query.add("tideBeginDate", Op.GE, fromDate);
+ }
+ return query;
+ }
+
+}
Property changes on: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/QueryBuilder.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/TopiaQuery.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/TopiaQuery.java 2009-12-21 19:07:23 UTC (rev 142)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/TopiaQuery.java 2009-12-21 22:47:09 UTC (rev 143)
@@ -35,6 +35,8 @@
protected String orderBy;
+ protected String groupBy;
+
protected boolean parentheses;
public static enum Op {
@@ -81,6 +83,9 @@
if (where != null) {
result += where;
}
+ if (groupBy != null) {
+ result += groupBy;
+ }
if (orderBy != null) {
result += orderBy;
}
@@ -156,6 +161,16 @@
return this;
}
+ public TopiaQuery addGroup(String group) {
+ if (groupBy == null) {
+ groupBy = " GROUP BY ";
+ } else {
+ groupBy += ", ";
+ }
+ groupBy += group;
+ return this;
+ }
+
public List execute(TopiaContext transaction) throws TopiaException {
if (log.isTraceEnabled()) {
log.trace("# QUERY : " + fullQuery());
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatImpl.java 2009-12-21 19:07:23 UTC (rev 142)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatImpl.java 2009-12-21 22:47:09 UTC (rev 143)
@@ -21,14 +21,12 @@
package fr.ifremer.suiviobsmer.entity;
-import fr.ifremer.suiviobsmer.DataLoader;
+import fr.ifremer.suiviobsmer.QueryBuilder;
import fr.ifremer.suiviobsmer.SuiviObsmerException;
-import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper;
import fr.ifremer.suiviobsmer.SuiviObsmerContext;
+import fr.ifremer.suiviobsmer.TopiaQuery;
import fr.ifremer.suiviobsmer.bean.ContactState;
import java.io.Serializable;
-import java.util.List;
-import org.apache.commons.lang.BooleanUtils;
import org.nuiton.topia.TopiaContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -65,23 +63,24 @@
try {
transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction();
- String contactClassName = Contact.class.getName();
- // Return the last contact for this boat and company
- List results = transaction.find(
- "FROM " + contactClassName + " C1" +
- " WHERE C1.user.company = :company" +
- " AND C1.boat = :boat" +
- " AND C1.topiaCreateDate = " +
- " (SELECT MAX(C2.topiaCreateDate) FROM " + contactClassName + " C2" +
- " WHERE C2.user.company = :company AND C2.boat = C1.boat)",
- "company", company,
- "boat", this);
+// String contactClassName = Contact.class.getName();
+// // Return the last contact for this boat and company
+// List results = transaction.find(
+// "FROM " + contactClassName + " C1" +
+// " WHERE C1.user.company = :company" +
+// " AND C1.boat = :boat" +
+// " AND C1.topiaCreateDate = " +
+// " (SELECT MAX(C2.topiaCreateDate) FROM " + contactClassName + " C2" +
+// " WHERE C2.user.company = :company AND C2.boat = C1.boat)",
+// "company", company,
+// "boat", this);
- if (!results.isEmpty()) {
- Contact contact = (Contact)results.get(0);
- boolean validation = contact.getValidationProgram() != null || BooleanUtils.isFalse(contact.getValidationCompany());
+ TopiaQuery query = QueryBuilder.createQueryLastContactForBoat(this, company);
+ Contact contact = query.executeToEntity(transaction, Contact.class);
+ if (contact != null) {
+ //boolean validation = contact.getValidationProgram() != null || BooleanUtils.isFalse(contact.getValidationCompany());
ContactState state = ContactState.createContactStateEnum(contact.getState());
- result = validation/* && !state.equals(ContactState.BOAT_DEFINITIVE_REFUSED)*/;
+ result = state.isFinalState(); /*validation && !state.equals(ContactState.BOAT_DEFINITIVE_REFUSED)*/;
}
transaction.closeContext();
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatInfosImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatInfosImpl.java 2009-12-21 19:07:23 UTC (rev 142)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatInfosImpl.java 2009-12-21 22:47:09 UTC (rev 143)
@@ -21,16 +21,15 @@
package fr.ifremer.suiviobsmer.entity;
+import fr.ifremer.suiviobsmer.QueryBuilder;
import fr.ifremer.suiviobsmer.SuiviObsmerContext;
import fr.ifremer.suiviobsmer.SuiviObsmerException;
import fr.ifremer.suiviobsmer.TopiaQuery;
-import fr.ifremer.suiviobsmer.bean.ContactState;
import java.io.Serializable;
import org.nuiton.topia.TopiaContext;
import java.util.Date;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static fr.ifremer.suiviobsmer.TopiaQuery.Op;
/**
* BoatInfosImpl
@@ -67,7 +66,7 @@
try {
transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction();
- TopiaQuery query = createQueryDoneContactsFromDate(fromDate);
+ TopiaQuery query = QueryBuilder.createQueryDoneContactsFromDate(getBoat(), fromDate);
result = query.executeCount(transaction);
transaction.closeContext();
@@ -95,7 +94,7 @@
try {
transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction();
- TopiaQuery query = createQueryDoneContactsFromDate(fromDate);
+ TopiaQuery query = QueryBuilder.createQueryDoneContactsFromDate(getBoat(), fromDate);
query.add("user.company = :company").addParam("company", getCompany());
result = query.executeCount(transaction);
@@ -111,29 +110,6 @@
}
/**
- * Create the query for contacts with BoardingDone state since the fromDate.
- * This query is used to get all boarding dones on this boat for all companies.
- * Only the validate contacts by company will be count. The param fromDate can be null,
- * in this case, all contacts will be given (no matter which date then started).
- *
- * @param fromDate the date to start
- * @return the TopiaQuery created
- */
- protected TopiaQuery createQueryDoneContactsFromDate(Date fromDate) {
- TopiaQuery query = new TopiaQuery(Contact.class).
- add("boat", getBoat()).
- add("state", ContactState.BOARDING_DONE.toString()).
- add("validationCompany", Boolean.TRUE).
- add("validationProgram IS NULL OR validationProgram = :booleanTrue").
- addParam("booleanTrue", Boolean.TRUE);
-
- if (fromDate != null) {
- query.add("tideBeginDate", Op.GE, fromDate);
- }
- return query;
- }
-
- /**
* Execute the HQL query for counting contact with BoardingDone state since the fromDate.
* This query is used to get all boarding dones on this boat for all companies or only for the
* current one. Only the validate contacts by company will be count. The param fromDate can be null,
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImpl.java 2009-12-21 19:07:23 UTC (rev 142)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImpl.java 2009-12-21 22:47:09 UTC (rev 143)
@@ -23,6 +23,7 @@
import com.csvreader.CsvReader;
import fr.ifremer.suiviobsmer.DataLoader;
+import fr.ifremer.suiviobsmer.QueryBuilder;
import fr.ifremer.suiviobsmer.SuiviObsmerContext;
import fr.ifremer.suiviobsmer.SuiviObsmerException;
import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper;
@@ -410,16 +411,7 @@
}
// Last contact
- String contactClassName = Contact.class.getName();
- TopiaQuery query = new TopiaQuery(contactClassName + " C1");
- query.add("C1.user.company = :company").addParam("company", company);
- query.add("C1.boat", boat);
-
- TopiaQuery subquery = new TopiaQuery(contactClassName + " C2").addSelect("MAX(C2.topiaCreateDate)");
- subquery.add("C2.boat = C1.boat").add("C2.user.company = :company");
-
- query.add("C1.topiaCreateDate = (" + subquery.fullQuery() + ")");
-
+ TopiaQuery query = QueryBuilder.createQueryLastContactForBoat(boat, company);
Contact contact = query.executeToEntity(transaction, Contact.class);
if (contact != null) {
@@ -637,29 +629,29 @@
try {
transaction = rootContext.beginTransaction();
-// BoatDAO boatDAO = SuiviObsmerModelDAOHelper.getBoatDAO(transaction);
-// Boat boat = boatDAO.findByTopiaId(boatId);
-// if (boat == null) {
-// throw new IllegalArgumentException(
-// "Le navire avec l'identifiant '" + boatId + "' n'existe pas");
-// }
+// String activityCalendarClassName = ActivityCalendar.class.getName();
+// List results = transaction.find(
+// "FROM " + activityCalendarClassName + " A WHERE A.boat = :boat AND A.year = " +
+// "(SELECT MAX(B.year) FROM " + activityCalendarClassName + " B " +
+// " WHERE B.boat = A.boat GROUP BY B.boat)",
+// "boat", boat);
+//
+// result = (ActivityCalendar) results.get(0);
String activityCalendarClassName = ActivityCalendar.class.getName();
- List results = transaction.find(
- "FROM " + activityCalendarClassName + " A WHERE A.boat = :boat AND A.year = " +
- "(SELECT MAX(B.year) FROM " + activityCalendarClassName + " B " +
- " WHERE B.boat = A.boat GROUP BY B.boat)",
- "boat", boat);
+ TopiaQuery query = new TopiaQuery(activityCalendarClassName + " A").
+ add("A.boat", boat);
- result = (ActivityCalendar) results.get(0);
- DataLoader.loadActivityCalendar(result);
+ TopiaQuery subquery = new TopiaQuery(activityCalendarClassName + " B").
+ addSelect("MAX(B.year)").
+ add("B.boat = A.boat").
+ addGroup("B.boat");
-// ActivityCalendarDAO dao = SuiviObsmerModelDAOHelper.getActivityCalendarDAO(transaction);
-//
-// result = dao.findByProperties(
-// ActivityCalendar.BOAT, boat,
-// ActivityCalendar.YEAR, year);
+ query.add("A.year = (" + subquery.fullQuery() + ")");
+ result = query.executeToEntity(transaction, ActivityCalendar.class);
+ DataLoader.loadActivityCalendar(result);
+
transaction.closeContext();
} catch (Exception eee) {
SuiviObsmerContext.serviceException(transaction,
1
0
[Suiviobsmer-commits] r142 - in trunk: suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl suiviobsmer-business/src/main/xmi suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl suiviobsmer-ui/src/main/webapp
by fdesbois@users.labs.libre-entreprise.org 21 Dec '09
by fdesbois@users.labs.libre-entreprise.org 21 Dec '09
21 Dec '09
Author: fdesbois
Date: 2009-12-21 19:07:23 +0000 (Mon, 21 Dec 2009)
New Revision: 142
Added:
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/TopiaQuery.java
Modified:
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatInfosImpl.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ActivityCalendarImport.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImpl.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceSamplingImpl.java
trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.zargo
trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImplTest.java
trunk/suiviobsmer-ui/src/main/webapp/Boats.tml
Log:
- Add Query managment
- Improve query for Boat filters
Added: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/TopiaQuery.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/TopiaQuery.java (rev 0)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/TopiaQuery.java 2009-12-21 19:07:23 UTC (rev 142)
@@ -0,0 +1,204 @@
+
+package fr.ifremer.suiviobsmer;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.persistence.TopiaEntity;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * TopiaQuery
+ *
+ * Created: 21 déc. 2009
+ *
+ * @author fdesbois
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+public class TopiaQuery {
+
+ private static final Logger log = LoggerFactory.getLogger(TopiaQuery.class);
+
+ protected List<Object> params;
+
+ protected String select;
+
+ protected String from;
+
+ protected String where;
+
+ protected String orderBy;
+
+ protected boolean parentheses;
+
+ public static enum Op {
+ EQ("="),
+ GT(">"),
+ GE(">="),
+ LIKE("LIKE"),
+ LT("<"),
+ LE("<="),
+ NOT_NULL("IS NOT NULL");
+
+ protected String value;
+
+ Op(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return this.value;
+ }
+ }
+
+ public TopiaQuery(Class<? extends TopiaEntity> entityClass) {
+ this(entityClass.getName());
+ }
+
+ public TopiaQuery(String from) {
+ this.from = " FROM " + from;
+ parentheses = true;
+ }
+
+ @Override
+ public String toString() {
+ return fullQuery();
+ }
+
+ public String fullQuery() {
+ String result = "";
+ if (select != null) {
+ result = select;
+ }
+ result += from;
+ if (where != null) {
+ result += where;
+ }
+ if (orderBy != null) {
+ result += orderBy;
+ }
+ return result.trim();
+ }
+
+ public TopiaQuery addParam(String id, Object e) {
+ if (params == null) {
+ params = new ArrayList<Object>();
+ }
+ params.add(id);
+ params.add(e);
+ return this;
+ }
+
+ public TopiaQuery add(String where) {
+ if (this.where == null) {
+ this.where = " WHERE ";
+ } else {
+ this.where += " AND ";
+ }
+ if (parentheses) {
+ this.where += "(";
+ }
+ this.where += where;
+ if (parentheses) {
+ this.where += ")";
+ }
+ parentheses = true;
+ return this;
+ }
+
+ public TopiaQuery add(String paramName, Op constraint, Object paramValue) {
+ int dot = paramName.lastIndexOf(".");
+ String valueName = paramName;
+ if (dot != -1) {
+ valueName = paramName.substring(dot+1);
+ }
+ parentheses = false;
+ return add(paramName + " " + constraint + " :" + valueName).addParam(valueName, paramValue);
+ }
+
+ public TopiaQuery addNotNull(String paramName) {
+ return add(paramName + " " + Op.NOT_NULL);
+ }
+
+ public TopiaQuery add(String paramName, Object paramValue) {
+ return add(paramName, Op.EQ, paramValue);
+ }
+
+ public TopiaQuery addFrom(String str) {
+ from += ", " + str;
+ return this;
+ }
+
+ public TopiaQuery addSelect(String select) {
+ if (this.select == null) {
+ this.select = "SELECT ";
+ } else {
+ this.select += ", ";
+ }
+ this.select += select;
+ return this;
+ }
+
+ public TopiaQuery addOrder(String order) {
+ if (orderBy == null) {
+ orderBy = " ORDER BY ";
+ } else {
+ orderBy += ", ";
+ }
+ orderBy += order;
+ return this;
+ }
+
+ public List execute(TopiaContext transaction) throws TopiaException {
+ if (log.isTraceEnabled()) {
+ log.trace("# QUERY : " + fullQuery());
+ if (params != null) {
+ log.trace("# PARAMS : " + Arrays.toString(params.toArray()));
+ }
+ }
+ if (params == null) {
+ return transaction.find(fullQuery());
+ }
+ return transaction.find(fullQuery(), params.toArray());
+ }
+
+ public <T extends TopiaEntity> List<T> executeToEntityList(TopiaContext transaction, Class<T> entityClass) throws TopiaException {
+ List res = execute(transaction);
+ List<T> results = new ArrayList<T>();
+ for (Object o : res) {
+ T entity = (T)o;
+ results.add(entity);
+ }
+ return results;
+ }
+
+ public <T extends TopiaEntity> T executeToEntity(TopiaContext transaction, Class<T> entityClass) throws TopiaException {
+ List<T> results = executeToEntityList(transaction, entityClass);
+ return !results.isEmpty() ? results.get(0) : null;
+ }
+
+ public int executeToInteger(TopiaContext transaction, String select) throws TopiaException {
+ String oldValue = this.select;
+ this.select = "SELECT " + select;
+ int result = 0;
+ List results = execute(transaction);
+ if (!results.isEmpty()) {
+ Long tmp = (Long)results.get(0);
+ result = tmp.intValue();
+ }
+ this.select = oldValue;
+ return result;
+ }
+
+ public int executeCount(TopiaContext transaction) throws TopiaException {
+ return executeToInteger(transaction, "COUNT(*)");
+ }
+
+}
Property changes on: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/TopiaQuery.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatInfosImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatInfosImpl.java 2009-12-21 14:22:59 UTC (rev 141)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatInfosImpl.java 2009-12-21 19:07:23 UTC (rev 142)
@@ -23,15 +23,14 @@
import fr.ifremer.suiviobsmer.SuiviObsmerContext;
import fr.ifremer.suiviobsmer.SuiviObsmerException;
+import fr.ifremer.suiviobsmer.TopiaQuery;
import fr.ifremer.suiviobsmer.bean.ContactState;
import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import org.nuiton.topia.TopiaContext;
import java.util.Date;
-import java.util.List;
-import org.nuiton.topia.TopiaException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import static fr.ifremer.suiviobsmer.TopiaQuery.Op;
/**
* BoatInfosImpl
@@ -45,6 +44,8 @@
* par : $Author$
*/
public class BoatInfosImpl extends BoatInfosAbstract implements Serializable, BoatInfos {
+
+ private static final Logger log = LoggerFactory.getLogger(BoatInfosImpl.class);
private static final long serialVersionUID = 1L;
@@ -66,7 +67,8 @@
try {
transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction();
- result = countDoneContactsFromDate(transaction, fromDate, false);
+ TopiaQuery query = createQueryDoneContactsFromDate(fromDate);
+ result = query.executeCount(transaction);
transaction.closeContext();
} catch (Exception eee) {
@@ -93,8 +95,11 @@
try {
transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction();
- result = countDoneContactsFromDate(transaction, fromDate, true);
+ TopiaQuery query = createQueryDoneContactsFromDate(fromDate);
+ query.add("user.company = :company").addParam("company", getCompany());
+ result = query.executeCount(transaction);
+
transaction.closeContext();
} catch (Exception eee) {
SuiviObsmerContext.serviceException(transaction,
@@ -106,6 +111,29 @@
}
/**
+ * Create the query for contacts with BoardingDone state since the fromDate.
+ * This query is used to get all boarding dones on this boat for all companies.
+ * Only the validate contacts by company will be count. The param fromDate can be null,
+ * in this case, all contacts will be given (no matter which date then started).
+ *
+ * @param fromDate the date to start
+ * @return the TopiaQuery created
+ */
+ protected TopiaQuery createQueryDoneContactsFromDate(Date fromDate) {
+ TopiaQuery query = new TopiaQuery(Contact.class).
+ add("boat", getBoat()).
+ add("state", ContactState.BOARDING_DONE.toString()).
+ add("validationCompany", Boolean.TRUE).
+ add("validationProgram IS NULL OR validationProgram = :booleanTrue").
+ addParam("booleanTrue", Boolean.TRUE);
+
+ if (fromDate != null) {
+ query.add("tideBeginDate", Op.GE, fromDate);
+ }
+ return query;
+ }
+
+ /**
* Execute the HQL query for counting contact with BoardingDone state since the fromDate.
* This query is used to get all boarding dones on this boat for all companies or only for the
* current one. Only the validate contacts by company will be count. The param fromDate can be null,
@@ -117,40 +145,40 @@
* @return the number of boarding done since fromDate
* @throws TopiaException
*/
- protected int countDoneContactsFromDate(TopiaContext transaction, Date fromDate, boolean companyOnly) throws TopiaException {
- int result = 0;
-
- List<Object> params = new ArrayList<Object>();
- String contactClassName = Contact.class.getName();
- String query = "SELECT COUNT(*)" +
- " FROM " + contactClassName +
- " WHERE boat = :boat AND state = :boardingDone" +
- " AND validationCompany = :booleanTrue" +
- " AND (validationProgram IS NULL OR validationProgram = :booleanTrue)";
-
- params.add("boat"); params.add(getBoat());
- params.add("boardingDone"); params.add(ContactState.BOARDING_DONE.toString());
- params.add("booleanTrue"); params.add(Boolean.TRUE);
-
- if (fromDate != null) {
- query += " AND tideBeginDate >= :fromDate";
- params.add("fromDate");
- params.add(fromDate);
- }
-
- if (companyOnly) {
- query+= " AND user.company = :company";
- params.add("company");
- params.add(getCompany());
- }
-
- List results = transaction.find(query, params.toArray());
-
- if (!results.isEmpty()) {
- Long tmp = (Long) results.get(0);
- result += tmp.intValue();
- }
-
- return result;
- }
+// protected int countDoneContactsFromDate(TopiaContext transaction, Date fromDate, boolean companyOnly) throws TopiaException {
+// int result = 0;
+//
+// List<Object> params = new ArrayList<Object>();
+// String contactClassName = Contact.class.getName();
+// String query = "SELECT COUNT(*)" +
+// " FROM " + contactClassName +
+// " WHERE boat = :boat AND state = :boardingDone" +
+// " AND validationCompany = :booleanTrue" +
+// " AND (validationProgram IS NULL OR validationProgram = :booleanTrue)";
+//
+// params.add("boat"); params.add(getBoat());
+// params.add("boardingDone"); params.add(ContactState.BOARDING_DONE.toString());
+// params.add("booleanTrue"); params.add(Boolean.TRUE);
+//
+// if (fromDate != null) {
+// query += " AND tideBeginDate >= :fromDate";
+// params.add("fromDate");
+// params.add(fromDate);
+// }
+//
+// if (companyOnly) {
+// query+= " AND user.company = :company";
+// params.add("company");
+// params.add(getCompany());
+// }
+//
+// List results = transaction.find(query, params.toArray());
+//
+// if (!results.isEmpty()) {
+// Long tmp = (Long) results.get(0);
+// result += tmp.intValue();
+// }
+//
+// return result;
+// }
}
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ActivityCalendarImport.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ActivityCalendarImport.java 2009-12-21 14:22:59 UTC (rev 141)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ActivityCalendarImport.java 2009-12-21 19:07:23 UTC (rev 142)
@@ -252,10 +252,10 @@
if (result%500 == 0 && log.isInfoEnabled()) {
log.info("RUNNING... Import calendrier d'activité ligne " + currRow);
}
+
+ transaction.commitTransaction();
}
- transaction.commitTransaction();
-
long stopTime = System.currentTimeMillis();
String execTime = DurationFormatUtils.formatDurationHMS(stopTime - startTime);
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImpl.java 2009-12-21 14:22:59 UTC (rev 141)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImpl.java 2009-12-21 19:07:23 UTC (rev 142)
@@ -26,6 +26,8 @@
import fr.ifremer.suiviobsmer.SuiviObsmerContext;
import fr.ifremer.suiviobsmer.SuiviObsmerException;
import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper;
+import fr.ifremer.suiviobsmer.TopiaQuery;
+import fr.ifremer.suiviobsmer.TopiaQuery.Op;
import fr.ifremer.suiviobsmer.bean.BoatFilter;
import fr.ifremer.suiviobsmer.bean.CompanyBoatInfos;
import fr.ifremer.suiviobsmer.bean.CompanyBoatInfosImpl;
@@ -45,7 +47,6 @@
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import org.nuiton.topia.TopiaContext;
import org.slf4j.Logger;
@@ -79,137 +80,269 @@
try {
transaction = rootContext.beginTransaction();
- BoatDAO dao = SuiviObsmerModelDAOHelper.getBoatDAO(transaction);
+ TopiaQuery query = new TopiaQuery(Boat.class.getName() + " B").addSelect("B");
- boolean alreadyFiltered = false;
-
- /******************** FILTER ON BOATS *****************************/
-
- // IMMATRICULATION : full
+ // Immatriculation
if (filter.getBoatImmatriculation() != null) {
- if (log.isDebugEnabled()) {
- log.debug("Filter by immatriculation : " + filter.getBoatImmatriculation());
- }
- Boat boat = dao.findByImmatriculation(filter.getBoatImmatriculation());
- results.put(boat.getImmatriculation(), boat);
- return results;
+ query.add("B.immatriculation", filter.getBoatImmatriculation());
}
- // NAME : startWith
+
+ // Name
if (!StringUtils.isEmpty(filter.getBoatName())) {
- if (log.isDebugEnabled()) {
- log.debug("Filter by boatName : " + filter.getBoatName());
- }
- List list = transaction.find("FROM BoatImpl WHERE name LIKE :name",
- "name", filter.getBoatName() + "%");
- for (Object o : list) {
- Boat boat = (Boat)o;
- results.put(boat.getImmatriculation(), boat);
- }
- alreadyFiltered = true;
+ query.add("B.name", Op.LIKE, filter.getBoatName() + "%");
}
- // DISTRICT CODE : full
+
+ // DistrictCode
if (!StringUtils.isEmpty(filter.getBoatDistrictCode())) {
- if (log.isDebugEnabled()) {
- log.debug("Filter by boatDistrictCode : " + filter.getBoatDistrictCode());
- }
- // boats not filtered yet
- if (!alreadyFiltered) {
- List<Boat> boats = dao.findAllByDistrictCode(filter.getBoatDistrictCode());
- for (Boat boat : boats) {
- results.put(boat.getImmatriculation(), boat);
- }
- // results may exist with some boats from previous query (boatName)
- } else {
- for (Integer key : results.keySet()) {
- Boat boat = results.get(key);
- if (!boat.getDistrictCode().equals(filter.getBoatDistrictCode())) {
- results.remove(key);
- }
- }
- }
+ query.add("B.districtCode", filter.getBoatDistrictCode());
}
- /******************** FILTER ON SAMPLE ROWS ***********************/
-
- // COMPANY FILTERED ?
- boolean companyFiltered = filter.getCompany() != null;
+ boolean sampleRowCodeFiltered = !StringUtils.isEmpty(filter.getSampleRowCode());
boolean professionFiltered = filter.getProfession() != null;
boolean fishingZoneFiltered = filter.getFishingZone() != null;
+ boolean sampleRowFiltered = sampleRowCodeFiltered || professionFiltered || fishingZoneFiltered;
- SampleRowDAO rowDAO = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction);
+ // Add join for ElligibleBoat
+ if (sampleRowFiltered) {
+ String elligibleBoatClassName = ElligibleBoat.class.getName();
+ query.addFrom(elligibleBoatClassName + " E").add("E.boat = B");
+ }
+ // SampleRowCode
+ if (sampleRowCodeFiltered) {
+ query.add("E.sampleRow.code", filter.getSampleRowCode());
+ }
+ // Profession
+ if (professionFiltered) {
+ query.add("E.sampleRow.profession", filter.getProfession());
+ }
- // CODE
- Map<String, Object> properties = new HashMap<String, Object>();
- if (!StringUtils.isEmpty(filter.getSampleRowCode())) {
- if (log.isDebugEnabled()) {
- log.debug("Filter by rowCode : " + filter.getSampleRowCode());
- }
- properties.put(SampleRow.CODE, filter.getSampleRowCode());
- } else {
- // COMPANY : only if an other filter on SampleRow is set
- if (companyFiltered && (professionFiltered || fishingZoneFiltered)) {
- if (log.isDebugEnabled()) {
- log.debug("Filter by company : " + filter.getCompany().getName());
- }
- // TODO add filter for non closed sampleRow, i.e. sampleRow.program.periodEnd > currentTime
- properties.put(SampleRow.COMPANY, filter.getCompany());
- }
- // PROFESSION
- if (professionFiltered) {
- if (log.isDebugEnabled()) {
- log.debug("Filter by profession : " + filter.getProfession().getCode());
- }
- properties.put(SampleRow.PROFESSION, filter.getProfession());
- }
+ // TODO FishingZone
+
+ // Company : only if an other filter is set for the sampleRow
+ if (filter.getCompany() != null && sampleRowFiltered) {
+ query.add("E.sampleRow.company", filter.getCompany());
+ query.add("E.companyActive = :booleanTrue OR (E.companyActive IS NULL AND E.globalActive = :booleanTrue)").
+ addParam("booleanTrue", Boolean.TRUE);
}
- List<SampleRow> rows = new ArrayList<SampleRow>();
- if (!properties.isEmpty()) {
- rows = rowDAO.findAllByProperties(properties);
- alreadyFiltered = true;
- } else if (fishingZoneFiltered) {
- rows = rowDAO.findAllContainsFishingZone(filter.getFishingZone());
- alreadyFiltered = true;
+ List<Boat> boats = query.executeToEntityList(transaction, Boat.class);
+ for (Boat boat : boats) {
+ results.put(boat.getImmatriculation(), boat);
}
- /******************** CHECK ELLIGIBLE BOATS FOR EACH ROW **********/
+// String boatClassName = Boat.class.getName();
+// String queryHead = "SELECT B FROM " + boatClassName + " B";
+// String query = "";
+// boolean alreadyFiltered = false;
+// List<Object> params = new ArrayList<Object>();
+//
+// // Immatriculation
+// if (filter.getBoatImmatriculation() != null) {
+// query += " WHERE B.immatriculation = :immatriculation";
+// params.add("immatriculation");
+// params.add(filter.getBoatImmatriculation());
+// alreadyFiltered = true;
+// }
+// // Name
+// if (!StringUtils.isEmpty(filter.getBoatName())) {
+// query += alreadyFiltered ? " AND " : " WHERE ";
+// query += "B.name LIKE :name";
+// params.add("name");
+// params.add(filter.getBoatName() + "%");
+// alreadyFiltered = true;
+// }
+// // DistrictCode
+// if (!StringUtils.isEmpty(filter.getBoatDistrictCode())) {
+// query += alreadyFiltered ? " AND " : " WHERE ";
+// query += "B.districtCode = :districtCode";
+// params.add("districtCode");
+// params.add(filter.getBoatDistrictCode());
+// alreadyFiltered = true;
+// }
+//
+// boolean sampleRowCodeFiltered = !StringUtils.isEmpty(filter.getSampleRowCode());
+// boolean professionFiltered = filter.getProfession() != null;
+// boolean fishingZoneFiltered = filter.getFishingZone() != null;
+// boolean sampleRowFiltered = sampleRowCodeFiltered || professionFiltered || fishingZoneFiltered;
+//
+// // Add join for ElligibleBoat
+// if (sampleRowFiltered) {
+// String elligibleBoatClassName = ElligibleBoat.class.getName();
+// queryHead += ", " + elligibleBoatClassName + " E";
+// query += alreadyFiltered ? " AND " : " WHERE ";
+// query += "E.boat = B";
+// }
+// // SampleRowCode
+// if (sampleRowCodeFiltered) {
+// query += " AND E.sampleRow.code = :sampleRowCode";
+// params.add("sampleRowCode");
+// params.add(filter.getSampleRowCode());
+// }
+// // Profession
+// if (professionFiltered) {
+// query += " AND E.sampleRow.profession = :profession";
+// params.add("profession");
+// params.add(filter.getProfession());
+// }
+// // FishingZone
+//// if (fishingZoneFiltered) {
+//// String fishingZoneClassName = FishingZone.class.getName();
+//// queryHead += ", " + fishingZoneClassName + " F";
+//// query += " AND F.sampleRow = " +
+//// query += " AND E.sampleRow.fishingZone = :fishingZone";
+//// params.add("profession");
+//// params.add(filter.getFishingZone());
+//// }
+// // Company : only if an other filter is set for the sampleRow
+// if (filter.getCompany() != null && sampleRowFiltered) {
+// query += " AND E.sampleRow.company = :company";
+// query += " AND (E.companyActive = :booleanTrue ";
+// query += " OR (E.companyActive IS NULL AND E.globalActive = :booleanTrue))";
+// params.add("company");
+// params.add(filter.getCompany());
+// params.add("booleanTrue");
+// params.add(Boolean.TRUE);
+// }
+//
+// if (log.isDebugEnabled()) {
+// log.debug("QUERY : " + queryHead + query);
+// }
+//
+// List boats = transaction.find(queryHead + query, params.toArray());
+// for (Object o : boats) {
+// Boat boat = (Boat)o;
+// results.put(boat.getImmatriculation(), boat);
+// }
- for (SampleRow row : rows) {
- List<FishingZone> zones = row.getFishingZone();
- // FILTER BY FISHING ZONE
- if (fishingZoneFiltered && !zones.contains(filter.getFishingZone())) {
- break;
- }
- for (ElligibleBoat elligible : row.getElligibleBoat()) {
- int immatriculation = elligible.getBoat().getImmatriculation();
- // For company
- boolean condition1 = companyFiltered &&
- BooleanUtils.isNotFalse(elligible.getCompanyActive());
+ /******************** FILTER ON BOATS *****************************/
- // For admin
- boolean condition2 = !companyFiltered && elligible.getGlobalActive();
+// // IMMATRICULATION : full
+// if (filter.getBoatImmatriculation() != null) {
+// if (log.isDebugEnabled()) {
+// log.debug("Filter by immatriculation : " + filter.getBoatImmatriculation());
+// }
+// Boat boat = dao.findByImmatriculation(filter.getBoatImmatriculation());
+// results.put(boat.getImmatriculation(), boat);
+// return results;
+// }
+// // NAME : startWith
+// if (!StringUtils.isEmpty(filter.getBoatName())) {
+// if (log.isDebugEnabled()) {
+// log.debug("Filter by boatName : " + filter.getBoatName());
+// }
+// List list = transaction.find("FROM BoatImpl WHERE name LIKE :name",
+// "name", filter.getBoatName() + "%");
+// for (Object o : list) {
+// Boat boat = (Boat)o;
+// results.put(boat.getImmatriculation(), boat);
+// }
+// alreadyFiltered = true;
+// }
+// // DISTRICT CODE : full
+// if (!StringUtils.isEmpty(filter.getBoatDistrictCode())) {
+// if (log.isDebugEnabled()) {
+// log.debug("Filter by boatDistrictCode : " + filter.getBoatDistrictCode());
+// }
+// // boats not filtered yet
+// if (!alreadyFiltered) {
+// List<Boat> boats = dao.findAllByDistrictCode(filter.getBoatDistrictCode());
+// for (Boat boat : boats) {
+// results.put(boat.getImmatriculation(), boat);
+// }
+// // results may exist with some boats from previous query (boatName)
+// } else {
+// for (Integer key : results.keySet()) {
+// Boat boat = results.get(key);
+// if (!boat.getDistrictCode().equals(filter.getBoatDistrictCode())) {
+// results.remove(key);
+// }
+// }
+// }
+// }
+//
+// /******************** FILTER ON SAMPLE ROWS ***********************/
+//
+// // COMPANY FILTERED ?
+// boolean companyFiltered = filter.getCompany() != null;
+// boolean professionFiltered = filter.getProfession() != null;
+// boolean fishingZoneFiltered = filter.getFishingZone() != null;
+//
+// SampleRowDAO rowDAO = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction);
+//
+// // CODE
+// Map<String, Object> properties = new HashMap<String, Object>();
+// if (!StringUtils.isEmpty(filter.getSampleRowCode())) {
+// if (log.isDebugEnabled()) {
+// log.debug("Filter by rowCode : " + filter.getSampleRowCode());
+// }
+// properties.put(SampleRow.CODE, filter.getSampleRowCode());
+// } else {
+// // COMPANY : only if an other filter on SampleRow is set
+// if (companyFiltered && (professionFiltered || fishingZoneFiltered)) {
+// if (log.isDebugEnabled()) {
+// log.debug("Filter by company : " + filter.getCompany().getName());
+// }
+// // TODO add filter for non closed sampleRow, i.e. sampleRow.program.periodEnd > currentTime
+// properties.put(SampleRow.COMPANY, filter.getCompany());
+// }
+// // PROFESSION
+// if (professionFiltered) {
+// if (log.isDebugEnabled()) {
+// log.debug("Filter by profession : " + filter.getProfession().getCode());
+// }
+// properties.put(SampleRow.PROFESSION, filter.getProfession());
+// }
+// }
+//
+// List<SampleRow> rows = new ArrayList<SampleRow>();
+// if (!properties.isEmpty()) {
+// rows = rowDAO.findAllByProperties(properties);
+// alreadyFiltered = true;
+// } else if (fishingZoneFiltered) {
+// rows = rowDAO.findAllContainsFishingZone(filter.getFishingZone());
+// alreadyFiltered = true;
+// }
+//
+// /******************** CHECK ELLIGIBLE BOATS FOR EACH ROW **********/
+//
+// for (SampleRow row : rows) {
+// List<FishingZone> zones = row.getFishingZone();
+// // FILTER BY FISHING ZONE
+// if (fishingZoneFiltered && !zones.contains(filter.getFishingZone())) {
+// break;
+// }
+//
+// for (ElligibleBoat elligible : row.getElligibleBoat()) {
+// int immatriculation = elligible.getBoat().getImmatriculation();
+//
+// // For company
+// boolean condition1 = companyFiltered &&
+// BooleanUtils.isNotFalse(elligible.getCompanyActive());
+//
+// // For admin
+// boolean condition2 = !companyFiltered && elligible.getGlobalActive();
+//
+// if (condition1 || condition2) {
+// if (log.isDebugEnabled()) {
+// log.debug("Add elligible boat : " +
+// immatriculation + " - " +
+// elligible.getBoat().getName());
+// }
+// results.put(immatriculation, elligible.getBoat());
+// }
+//
+// }
+// }
+//
+// // No filter set
+// if (!alreadyFiltered) {
+// for (Boat boat : dao.findAll()) {
+// results.put(boat.getImmatriculation(), boat);
+// }
+// }
- if (condition1 || condition2) {
- if (log.isDebugEnabled()) {
- log.debug("Add elligible boat : " +
- immatriculation + " - " +
- elligible.getBoat().getName());
- }
- results.put(immatriculation, elligible.getBoat());
- }
-
- }
- }
-
- // No filter set
- if (!alreadyFiltered) {
- for (Boat boat : dao.findAll()) {
- results.put(boat.getImmatriculation(), boat);
- }
- }
-
transaction.closeContext();
} catch (Exception eee) {
SuiviObsmerContext.serviceException(transaction, "Impossible de filtrer la liste des navires", eee);
@@ -275,19 +408,21 @@
}
}
}
+
// Last contact
String contactClassName = Contact.class.getName();
- List results = transaction.find(
- "FROM " + contactClassName + " C1" +
- " WHERE C1.user.company = :company AND C1.boat = :boat " +
- " AND C1.topiaCreateDate = " +
- " (SELECT MAX(C2.topiaCreateDate) FROM " + contactClassName + " C2" +
- " WHERE C2.user.company = :company AND C2.boat = C1.boat)",
- "company", company,
- "boat", boat);
+ TopiaQuery query = new TopiaQuery(contactClassName + " C1");
+ query.add("C1.user.company = :company").addParam("company", company);
+ query.add("C1.boat", boat);
- if (!results.isEmpty()) {
- Contact contact = (Contact)results.get(0);
+ TopiaQuery subquery = new TopiaQuery(contactClassName + " C2").addSelect("MAX(C2.topiaCreateDate)");
+ subquery.add("C2.boat = C1.boat").add("C2.user.company = :company");
+
+ query.add("C1.topiaCreateDate = (" + subquery.fullQuery() + ")");
+
+ Contact contact = query.executeToEntity(transaction, Contact.class);
+
+ if (contact != null) {
DataLoader.loadContactForBoatInfos(contact);
result.setLastContact(contact);
}
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceSamplingImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceSamplingImpl.java 2009-12-21 14:22:59 UTC (rev 141)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceSamplingImpl.java 2009-12-21 19:07:23 UTC (rev 142)
@@ -25,6 +25,7 @@
import fr.ifremer.suiviobsmer.SuiviObsmerException;
import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper;
import fr.ifremer.suiviobsmer.SuiviObsmerContext;
+import fr.ifremer.suiviobsmer.TopiaQuery;
import fr.ifremer.suiviobsmer.dto.SamplingHistoricRow;
import fr.ifremer.suiviobsmer.entity.*;
import fr.ifremer.suiviobsmer.entity.SampleRow;
@@ -47,6 +48,7 @@
import org.apache.commons.lang.StringUtils;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
+import org.nuiton.util.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -179,33 +181,25 @@
FishingZone.FACADE_NAME,
FishingZone.SECTOR_NAME,
FishingZone.DISTRICT_CODE);
- /*List list;
- if (company != null) {
- list = transaction.find(
- "SELECT S FROM SampleRowImpl S, FishingZoneImpl F, FishingZoneToSampleRowImpl FS, ProgramImpl P" +
- " WHERE FS.fishingZone = F AND FS.sampleRow = S AND S.company = :company" +
- " AND (P.periodBegin <= :begin OR P.periodEnd >= :end)" +
- " ORDER BY facadeName, sectorName, districtCode",
- "company", company, "begin", periodBegin, "end", periodEnd);
- } else {
- list = transaction.find(
- "SELECT S FROM SampleRowImpl S, FishingZoneImpl F, FishingZoneToSampleRowImpl FS, ProgramImpl P" +
- " WHERE FS.fishingZone = F AND FS.sampleRow = S" +
- " AND (P.periodBegin <= :begin OR P.periodEnd >= :end)" +
- " ORDER BY facadeName, sectorName, districtCode",
- "begin", periodBegin, "end", periodEnd);
- }
- for (Object o : list) {
- SampleRow row = (SampleRow)o;
- // load data
- row.getProfession();
- row.getProgram();
- row.getCompany();
- row.getAllFishingZones();
- results.add(row);
- }*/
+// TopiaQuery query = new TopiaQuery(SampleRow.class.getName() + " S").addSelect("S");
+// query.addFrom(SampleRowZone.class.getName() + " Z").add("Z.sampleRow = S");
+// query.addFrom(FishingZone.class.getName() + " F").add("Z.fishingZone = F");
+//
+// if (company != null) {
+// query.add("S.company = :company").addParam("company", company);
+// }
+//
+// // Prepare period dates
+// periodBegin = DateUtils.setFirstDayOfMonth(periodBegin);
+// periodEnd = DateUtils.setLastDayOfMonth(periodEnd);
+// query.add("S.program.periodBegin < :end AND S.program.periodEnd > :begin").
+// addParam("begin", periodBegin).addParam("end", periodEnd);
+//
+// query.addOrder("facadeName, sectorName, districtCode");
+
+
for (FishingZone zone : list) {
if (log.isTraceEnabled()) {
log.trace("Zone : " + zone);
Modified: trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.zargo
===================================================================
(Binary files differ)
Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImplTest.java
===================================================================
--- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImplTest.java 2009-12-21 14:22:59 UTC (rev 141)
+++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImplTest.java 2009-12-21 19:07:23 UTC (rev 142)
@@ -111,13 +111,49 @@
InputStream input = getClass().getResourceAsStream("/import/navires.csv");
service.importBoatCsv(input);
+ ServiceUser serviceUser = new ServiceUserImpl();
+ Company company = new CompanyImpl();
+ company.setName("TARTANPION");
+ serviceUser.createUpdateCompany(company);
+ User user = new UserImpl();
+ user.setFirstName("Jean");
+ user.setLastName("Michmuche");
+ user.setCompany(company);
+ serviceUser.createUpdateUser(user, true);
+ List<SampleRow> rows = prepareSampleRows(company);
+
BoatFilter filter = new BoatFilterImpl();
+ // Exec with no filter
Map<Integer, Boat> boats = service.getBoatsByFilter(filter);
assertEquals(6, boats.size());
// first boat of the file
Boat boat = boats.get(273129);
assertNotNull(boat);
+
+ // Exec with filter on Immatriculation
+ filter.setBoatImmatriculation(273129);
+ boats = service.getBoatsByFilter(filter);
+ assertEquals(1, boats.size());
+
+ // Exec with filter on Name : start with "M"
+ filter = new BoatFilterImpl();
+ filter.setBoatName("M");
+ boats = service.getBoatsByFilter(filter);
+ assertEquals(2, boats.size());
+
+ // Exec with filter on DistrictCode
+ filter = new BoatFilterImpl();
+ filter.setBoatDistrictCode("UN");
+ boats = service.getBoatsByFilter(filter);
+ assertEquals(4, boats.size());
+
+ // Exec with filter on SampleRowCode and company
+ filter = new BoatFilterImpl();
+ filter.setSampleRowCode("2009_3");
+ filter.setCompany(company);
+ boats = service.getBoatsByFilter(filter);
+ assertEquals(2, boats.size());
}
@Test
Modified: trunk/suiviobsmer-ui/src/main/webapp/Boats.tml
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/Boats.tml 2009-12-21 14:22:59 UTC (rev 141)
+++ trunk/suiviobsmer-ui/src/main/webapp/Boats.tml 2009-12-21 19:07:23 UTC (rev 142)
@@ -125,47 +125,50 @@
<!-- BOATINFOS:: Informations du navire sélectionné -->
<t:if t:test="boatSelectedImmatriculation">
- <t:zone t:id="boatInfosZone" t:update="show" class="fleft" id="so-boats-boat-infos">
- <!-- HEADER For admin -->
- <t:if t:test="user.admin">
- <h2>Informations sur <!--${companyBoatInfos.boatInfos.boat.name}-->${boatName}</h2>
- <form t:type="form" t:id="companySelectForm" t:zone="so-boats-boat-infos">
- <t:label t:for="company" /> :
- <input t:type="select" t:id="company" t:model="companySelectModel" t:value="companyId" />
- <input t:type="submit" class="ico search" t:id="searchCompany" value="Search" />
- </form>
- </t:if>
- <!-- BODY - delegator -->
- <t:if t:test="canShowActiveBoatInfos()">
- <t:delegate to="activeBoatInfosBlock" />
- </t:if>
- <!-- BODY - activity calendar -->
- <fieldset id="so-boats-boat-infos-calendar">
- <legend>Calendrier d'activité</legend>
- <t:unless t:test="activityCalendarImportRun">
- <p>
- <t:if t:test="hasActivityCalendar()">
- <a t:type="actionlink" t:id="showLastActivityCalendar">
- <img src="${asset:context:}/img/calendar.png" title="Calendrier d'activité"/>
- </a>
- <p:else>
- <img src="${asset:context:}/img/calendar-unavailable.png" title="Calendrier d'activité indisponible"/>
- </p:else>
- </t:if>
- </p>
- <p:else>
- <div class="fb-info">
- Le chargement des calendriers d'activité dans l'application est actuellement en cours d'exécution...
- </div>
- </p:else>
+ <t:zone t:id="boatInfosZone" t:update="show" class="fleft" id="so-boats-boat-infos">
+ <t:unless t:test="activityCalendarImportRun">
+ <!-- HEADER For admin -->
+ <t:if t:test="user.admin">
+ <h2>Informations sur <!--${companyBoatInfos.boatInfos.boat.name}-->${boatName}</h2>
+ <form t:type="form" t:id="companySelectForm" t:zone="so-boats-boat-infos">
+ <t:label t:for="company" /> :
+ <input t:type="select" t:id="company" t:model="companySelectModel" t:value="companyId" />
+ <input t:type="submit" class="ico search" t:id="searchCompany" value="Search" />
+ </form>
+ </t:if>
+ <!-- BODY - delegator -->
+ <t:if t:test="canShowActiveBoatInfos()">
+ <t:delegate to="activeBoatInfosBlock" />
+ </t:if>
+ <!-- BODY - activity calendar -->
+ <fieldset id="so-boats-boat-infos-calendar">
+ <legend>Calendrier d'activité</legend>
+ <p>
+ <t:if t:test="hasActivityCalendar()">
+ <a t:type="actionlink" t:id="showLastActivityCalendar">
+ <img src="${asset:context:}/img/calendar.png" title="Calendrier d'activité"/>
+ </a>
+ <p:else>
+ <img src="${asset:context:}/img/calendar-unavailable.png" title="Calendrier d'activité indisponible"/>
+ </p:else>
+ </t:if>
+ </p>
+ </fieldset>
+ <!-- FOOTER For user -->
+ <t:unless t:test="user.admin">
+ <div id="so-boats-boat-infos-message">
+ Les informations saisies sont confidentielles et propriété de la société. <br />
+ Elles sont néanmoins consultables par un administrateur
+ </div>
</t:unless>
- </fieldset>
- <!-- FOOTER For user -->
- <t:unless t:test="user.admin">
- <div id="so-boats-boat-infos-message">
- Les informations saisies sont confidentielles et propriété de la société. <br />
- Elles sont néanmoins consultables par un administrateur
- </div>
+ <p:else>
+ <div class="fb-info">
+ Le chargement des calendriers d'activité est en cours. <br />
+ Vous ne pouvez pas accéder aux informations du navire pour l'instant. <br />
+ Veuillez réessayer ultérieurement.
+
+ </div>
+ </p:else>
</t:unless>
</t:zone>
1
0
[Suiviobsmer-commits] r141 - in trunk: suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity suiviobsmer-business/src/main/xmi suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages suiviobsmer-ui/src/main/webapp suiviobsmer-ui/src/main/webapp/img
by fdesbois@users.labs.libre-entreprise.org 21 Dec '09
by fdesbois@users.labs.libre-entreprise.org 21 Dec '09
21 Dec '09
Author: fdesbois
Date: 2009-12-21 14:22:59 +0000 (Mon, 21 Dec 2009)
New Revision: 141
Added:
trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatInfosImplTest.java
trunk/suiviobsmer-ui/src/main/webapp/img/calendar-unavailable.png
Modified:
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatImpl.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatInfosImpl.java
trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.zargo
trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatImplTest.java
trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImplTest.java
trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java
trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Boats.properties
trunk/suiviobsmer-ui/src/main/webapp/Boats.tml
Log:
- Show activityCalendar fieldset even if no calendar is set
- Add calcul on boarding for boatInfos
- Remove old methods in BoatImpl
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatImpl.java 2009-12-21 10:22:48 UTC (rev 140)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatImpl.java 2009-12-21 14:22:59 UTC (rev 141)
@@ -50,92 +50,11 @@
private static final long serialVersionUID = 1L;
- @Override
- @Deprecated
- public BoatInfos getBoatInfos(Company company) throws SuiviObsmerException {
- TopiaContext transaction = null;
- BoatInfos boatInfos = null;
- try {
- if (company == null) {
- throw new IllegalArgumentException("company parameter can't be null to getBoatsInfos " +
- "for boat '" + this.getName() + "'");
- }
- transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction();
-
- /*CompanyDAO companyDAO = SuiviObsmerModelDAOHelper.getCompanyDAO(transaction);
- Company companyFromDB = companyDAO.findByTopiaId(company.getTopiaId());*/
-
- BoatInfosDAO boatInfosDAO = SuiviObsmerModelDAOHelper.getBoatInfosDAO(transaction);
- boatInfos = boatInfosDAO.findByProperties(BoatInfos.BOAT, this, BoatInfos.COMPANY, company);
- if (boatInfos == null) {
- boatInfos = new BoatInfosImpl();
- boatInfos.setBoat(this);
- boatInfos.setCompany(company);
- } else {
- // load data
- boatInfos.getBoat();
- }
-
- if (log.isDebugEnabled()) {
- log.debug("Boat infos : " + boatInfos);
- log.debug("Boat infos boat : " + boatInfos.getBoat());
- }
-
- transaction.closeContext();
- } catch (Exception eee) {
- SuiviObsmerContext.serviceException(transaction,
- "Impossible de récupérer les informations privées du navire lié à la société " +
- "'" + company.getName() + "'",
- eee);
- }
- return boatInfos;
- }
-
/**
- * Get the last boat contact for the creator company.
- * No test on contact state is done here.
- * @param company which is the creator of the contact
- * @return the last boat contact (opened or not)
- * @throws SuiviObsmerException
- */
- @Override
- @Deprecated
- public Contact getLastContact(Company company) throws SuiviObsmerException {
- TopiaContext transaction = null;
- Contact contact = null;
- try {
- transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction();
-
- List results = transaction.find(
- "FROM ContactImpl C1" +
- " WHERE C1.user.company = :company AND C1.boat = :boat " +
- " AND C1.topiaCreateDate = " +
- " (SELECT MAX(C2.topiaCreateDate) FROM ContactImpl C2" +
- " WHERE C2.user.company = :company AND C2.boat = C1.boat)",
- "company", company,
- "boat", this);
-
- if (!results.isEmpty()) {
- contact = (Contact)results.get(0);
- DataLoader.loadContactForBoatInfos(contact);
- }
-
- transaction.closeContext();
- } catch (Exception eee) {
- SuiviObsmerContext.serviceException(transaction,
- "Impossible de récupérer le dernier contact du navire " + this.getImmatriculation() +
- " pour la société '" + company.getName() + "'",
- eee);
- }
- return contact;
- }
-
- /**
* Check if a contact for this boat, company and sampleRow can be created.
* The state is tested for the last created contact.
* A new contact can be created only if the last state is final and is not 'Refus définitif'.
* @param company which is the creator of the contact
- * @param row for the contact to be created
* @return true if the contact can be created, false either
* @throws SuiviObsmerException
*/
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatInfosImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatInfosImpl.java 2009-12-21 10:22:48 UTC (rev 140)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatInfosImpl.java 2009-12-21 14:22:59 UTC (rev 141)
@@ -21,12 +21,17 @@
package fr.ifremer.suiviobsmer.entity;
+import fr.ifremer.suiviobsmer.SuiviObsmerContext;
+import fr.ifremer.suiviobsmer.SuiviObsmerException;
+import fr.ifremer.suiviobsmer.bean.ContactState;
import java.io.Serializable;
import java.util.ArrayList;
-import java.util.Calendar;
+import java.util.Arrays;
+import java.util.Collections;
+import org.nuiton.topia.TopiaContext;
import java.util.Date;
-import java.util.GregorianCalendar;
import java.util.List;
+import org.nuiton.topia.TopiaException;
/**
* BoatInfosImpl
@@ -43,46 +48,109 @@
private static final long serialVersionUID = 1L;
- protected Date firstBoardingDate;
- protected List<String> professionLibelles;
protected int nbBoarding;
protected int nbBoardingForCompany;
-
- @Override
- public List<String> getProfessionLibelles() {
- List<String> professions = new ArrayList<String>();
- professions.add("PTM DEF - Chalutage pélagique en bœuf à bar");
- professions.add("OTB DEF80-90 - Chalutage de fond côtier");
- // TODO get professions libelles from sampleRows (change method name, get sampleRows code)
- return professions;
- }
/**
- * @return
+ * Calculate the number of boarding done on the boat since the date in argument.
+ * Only the validate contacts by company will be count.
+ *
+ * @param fromDate the date to start calcul
+ * @return a number of boarding done on the boat for all companies
+ * @throws SuiviObsmerException
*/
@Override
- public int getNbBoarding() {
- // TODO : calculate total nbBoarding from getFirstBoardingDate
- return 18;
+ public int getNbBoarding(Date fromDate) throws SuiviObsmerException {
+ TopiaContext transaction = null;
+ int result = 0;
+ try {
+ transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction();
+
+ result = countDoneContactsFromDate(transaction, fromDate, false);
+
+ transaction.closeContext();
+ } catch (Exception eee) {
+ SuiviObsmerContext.serviceException(transaction,
+ "Impossible de récupérer le nombre d'embarquements réels depuis le " +
+ "'" + fromDate + "'",
+ eee);
+ }
+ return result;
}
/**
- * @return
+ * Calculate the number of boarding done on the boat and the company since the date in argument.
+ * Only the validate contacts by company will be count.
+ *
+ * @param fromDate the date to start calcul
+ * @return a number of boarding done on the boat for the current company
+ * @throws SuiviObsmerException
*/
@Override
- public int getNbBoardingForCompany() {
- // TODO : calculate nbBoarding for Company
- //ContextUtil.getRootContext().beginTransaction();
- return 5;
+ public int getNbBoardingForCompany(Date fromDate) throws SuiviObsmerException {
+ TopiaContext transaction = null;
+ int result = 0;
+ try {
+ transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction();
+
+ result = countDoneContactsFromDate(transaction, fromDate, true);
+
+ transaction.closeContext();
+ } catch (Exception eee) {
+ SuiviObsmerContext.serviceException(transaction,
+ "Impossible de récupérer le nombre d'embarquements réels depuis le " +
+ "'" + fromDate + "' pour la société '" + getCompany().getName() + "'",
+ eee);
+ }
+ return result;
}
/**
- * @return
+ * Execute the HQL query for counting contact with BoardingDone state since the fromDate.
+ * This query is used to get all boarding dones on this boat for all companies or only for the
+ * current one. Only the validate contacts by company will be count. The param fromDate can be null,
+ * in this case, all contacts will be counted (not matter which date then started).
+ *
+ * @param transaction TopiaContext to execute the query
+ * @param fromDate the date to start calcul
+ * @param companyOnly boolean used to filter by the current company or not
+ * @return the number of boarding done since fromDate
+ * @throws TopiaException
*/
- @Override
- public Date getFirstBoardingDate() {
- Calendar calendar = new GregorianCalendar();
- calendar.add(Calendar.MONTH, 12);
- return calendar.getTime();
+ protected int countDoneContactsFromDate(TopiaContext transaction, Date fromDate, boolean companyOnly) throws TopiaException {
+ int result = 0;
+
+ List<Object> params = new ArrayList<Object>();
+ String contactClassName = Contact.class.getName();
+ String query = "SELECT COUNT(*)" +
+ " FROM " + contactClassName +
+ " WHERE boat = :boat AND state = :boardingDone" +
+ " AND validationCompany = :booleanTrue" +
+ " AND (validationProgram IS NULL OR validationProgram = :booleanTrue)";
+
+ params.add("boat"); params.add(getBoat());
+ params.add("boardingDone"); params.add(ContactState.BOARDING_DONE.toString());
+ params.add("booleanTrue"); params.add(Boolean.TRUE);
+
+ if (fromDate != null) {
+ query += " AND tideBeginDate >= :fromDate";
+ params.add("fromDate");
+ params.add(fromDate);
+ }
+
+ if (companyOnly) {
+ query+= " AND user.company = :company";
+ params.add("company");
+ params.add(getCompany());
+ }
+
+ List results = transaction.find(query, params.toArray());
+
+ if (!results.isEmpty()) {
+ Long tmp = (Long) results.get(0);
+ result += tmp.intValue();
+ }
+
+ return result;
}
}
Modified: trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.zargo
===================================================================
(Binary files differ)
Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatImplTest.java
===================================================================
--- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatImplTest.java 2009-12-21 10:22:48 UTC (rev 140)
+++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatImplTest.java 2009-12-21 14:22:59 UTC (rev 141)
@@ -28,7 +28,7 @@
import org.slf4j.LoggerFactory;
/**
- * BoatImpl
+ * BoatImplTest
*
* Created: 15 déc. 2009
*
@@ -67,71 +67,6 @@
}
/**
- * Test of getBoatInfos method, of class BoatImpl.
- */
- //@Test
- public void testGetBoatInfos() throws Exception {
- System.out.println("getBoatInfos");
- }
-
- /**
- * Test of getLastContact method, of class BoatImpl.
- */
- @Test
- public void testGetLastContact() throws Exception {
- log.info("getLastContact");
-
- /** PREPARE DATA **/
- ServiceUser serviceUser = new ServiceUserImpl();
- Company company = new CompanyImpl();
- company.setName("TARTANPION");
- serviceUser.createUpdateCompany(company);
- User user = new UserImpl();
- user.setFirstName("Jean");
- user.setLastName("Michmuche");
- user.setCompany(company);
- serviceUser.createUpdateUser(user, true);
-
- InputStream input = getClass().getResourceAsStream("/import/navires.csv");
- ServiceBoat serviceBoat = new ServiceBoatImpl();
- serviceBoat.importBoatCsv(input);
- List<Boat> boats = serviceBoat.getBoats("174258");
- Boat boat = boats.get(0);
-
- TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction();
-
- FishingZoneDAO zoneDAO = SuiviObsmerModelDAOHelper.getFishingZoneDAO(transaction);
- FishingZone zoneIId = zoneDAO.create(FishingZone.DISTRICT_CODE, "IId");
- FishingZone zoneIV = zoneDAO.create(FishingZone.DISTRICT_CODE, "IV");
- FishingZone zoneI = zoneDAO.create(FishingZone.DISTRICT_CODE, "I");
-
- transaction.commitTransaction();
-
- ServiceSampling serviceSampling = new ServiceSamplingImpl();
- input = getClass().getResourceAsStream("/import/echantillonnage.csv");
- serviceSampling.importSamplingPlanCsv(input);
-
- SampleRowDAO rowDAO = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction);
- SampleRow row = rowDAO.findByCode("2010_1");
- row.getCompany();
- row.getProgram();
- row.getProfession();
- transaction.closeContext();
-
- row.setCompany(company);
- serviceSampling.createUpdateSampleRow(row, boats);
-
- ServiceContact serviceContact = new ServiceContactImpl();
- Contact contact1 = serviceContact.getNewContact(user, row, boat);
- contact1.setState(ContactState.CONTACT_START.toString());
- serviceContact.saveContact(contact1, false);
-
- /** EXEC METHOD **/
- Contact result = boat.getLastContact(company);
- Assert.assertEquals(contact1.getTopiaId(), result.getTopiaId());
- }
-
- /**
* Test of canCreateContact method, of class BoatImpl.
*/
@Test
Added: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatInfosImplTest.java
===================================================================
--- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatInfosImplTest.java (rev 0)
+++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatInfosImplTest.java 2009-12-21 14:22:59 UTC (rev 141)
@@ -0,0 +1,170 @@
+
+package fr.ifremer.suiviobsmer.entity;
+
+import fr.ifremer.suiviobsmer.SuiviObsmerContext;
+import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper;
+import fr.ifremer.suiviobsmer.SuiviObsmerRunner;
+import fr.ifremer.suiviobsmer.bean.ContactState;
+import fr.ifremer.suiviobsmer.business.SuiviObsmerRunnerTest;
+import fr.ifremer.suiviobsmer.impl.ServiceBoatImpl;
+import fr.ifremer.suiviobsmer.impl.ServiceContactImpl;
+import fr.ifremer.suiviobsmer.services.ServiceBoat;
+import fr.ifremer.suiviobsmer.services.ServiceContact;
+import org.nuiton.topia.TopiaContext;
+import java.io.InputStream;
+import java.util.Date;
+import java.util.List;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.nuiton.util.DateUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * BoatInfosImplTest
+ *
+ * Created: 21 déc. 2009
+ *
+ * @author fdesbois
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+public class BoatInfosImplTest {
+
+ private static SuiviObsmerRunner runner;
+
+ private static final Logger log = LoggerFactory.getLogger(BoatInfosImplTest.class);
+
+ public BoatInfosImplTest() {
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ runner = new SuiviObsmerRunnerTest();
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ runner.start();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ runner.stop();
+ }
+
+ /**
+ * Test of getNbBoarding method, of class BoatInfosImpl.
+ */
+ @Test
+ public void testGetNbBoarding() throws Exception {
+ log.info("getNbBoarding");
+
+ /** PREPARE DATA **/
+ InputStream input = getClass().getResourceAsStream("/import/navires.csv");
+ ServiceBoat serviceBoat = new ServiceBoatImpl();
+ serviceBoat.importBoatCsv(input);
+ List<Boat> boats = serviceBoat.getBoats("174258");
+ Boat boat = boats.get(0);
+
+ TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction();
+
+ CompanyDAO companyDAO = SuiviObsmerModelDAOHelper.getCompanyDAO(transaction);
+ Company company = companyDAO.create(Company.NAME, "TARTANPION");
+ Company company2 = companyDAO.create(Company.NAME, "BIS");
+
+ UserDAO userDAO = SuiviObsmerModelDAOHelper.getUserDAO(transaction);
+ User user = userDAO.create(User.FIRST_NAME,"Jean", User.LAST_NAME, "Michmuche",
+ User.COMPANY, company);
+ company.addUser(user);
+ User user2 = userDAO.create(User.FIRST_NAME,"Bill", User.LAST_NAME, "Murray",
+ User.COMPANY, company2);
+ company2.addUser(user2);
+
+ BoatInfosDAO boatInfosDAO = SuiviObsmerModelDAOHelper.getBoatInfosDAO(transaction);
+ BoatInfos boatInfos = boatInfosDAO.create(BoatInfos.BOAT, boat, BoatInfos.COMPANY, company);
+
+ transaction.commitTransaction();
+ transaction.closeContext();
+
+ ServiceContact serviceContact = new ServiceContactImpl();
+ // First contact : OK
+ Contact contact1 = new ContactImpl();
+ contact1.setBoat(boat);
+ contact1.setUser(user);
+ contact1.setState(ContactState.BOARDING_DONE.toString());
+ Date begin = DateUtils.createDate(3, 3, 2009);
+ contact1.setTideBeginDate(begin);
+ contact1.setValidationCompany(Boolean.TRUE);
+ serviceContact.saveContact(contact1, false);
+
+ /** EXEC METHOD **/
+
+ Date fromDate = DateUtils.createDate(1, 1, 2009);
+ int result = boatInfos.getNbBoarding(fromDate);
+ Assert.assertEquals(1, result);
+
+ Contact contact2 = new ContactImpl();
+ // Second contact with ValidationProgram = FALSE
+ contact2.setBoat(boat);
+ contact2.setUser(user);
+ contact2.setState(ContactState.BOARDING_DONE.toString());
+ begin = DateUtils.createDate(3, 8, 2009);
+ contact2.setTideBeginDate(begin);
+ contact2.setValidationCompany(Boolean.TRUE);
+ contact2.setValidationProgram(Boolean.FALSE);
+ serviceContact.saveContact(contact2, false);
+
+ result = boatInfos.getNbBoarding(fromDate);
+ Assert.assertEquals(1, result);
+
+ Contact contact3 = new ContactImpl();
+ // Third contact with tideBeginDate < fromDate
+ contact3.setBoat(boat);
+ contact3.setUser(user);
+ contact3.setState(ContactState.BOARDING_DONE.toString());
+ begin = DateUtils.createDate(3, 8, 2008);
+ contact3.setTideBeginDate(begin);
+ contact3.setValidationCompany(Boolean.TRUE);
+ serviceContact.saveContact(contact3, false);
+
+ result = boatInfos.getNbBoarding(fromDate);
+ Assert.assertEquals(1, result);
+
+ Contact contact4 = new ContactImpl();
+ // Fourth contact : OK with an other company
+ contact4.setBoat(boat);
+ contact4.setUser(user2);
+ contact4.setState(ContactState.BOARDING_DONE.toString());
+ begin = DateUtils.createDate(3, 4, 2009);
+ contact4.setTideBeginDate(begin);
+ contact4.setValidationCompany(Boolean.TRUE);
+ serviceContact.saveContact(contact4, false);
+
+ result = boatInfos.getNbBoarding(fromDate);
+ Assert.assertEquals(2, result);
+
+ // Calcul with a fromDate null
+ result = boatInfos.getNbBoarding(null);
+ Assert.assertEquals(3, result);
+ }
+
+ /**
+ * Test of getNbBoardingForCompany method, of class BoatInfosImpl.
+ */
+ //@Test
+ public void testGetNbBoardingForCompany() {
+ System.out.println("getNbBoardingForCompany");
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatInfosImplTest.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImplTest.java
===================================================================
--- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImplTest.java 2009-12-21 10:22:48 UTC (rev 140)
+++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImplTest.java 2009-12-21 14:22:59 UTC (rev 141)
@@ -29,6 +29,7 @@
import fr.ifremer.suiviobsmer.business.SuiviObsmerRunnerTest;
import fr.ifremer.suiviobsmer.bean.BoatFilter;
import fr.ifremer.suiviobsmer.bean.CompanyBoatInfos;
+import fr.ifremer.suiviobsmer.bean.ContactState;
import fr.ifremer.suiviobsmer.entity.ActivityCalendar;
import fr.ifremer.suiviobsmer.entity.ActivityCalendarDAO;
import fr.ifremer.suiviobsmer.entity.Boat;
@@ -37,11 +38,16 @@
import fr.ifremer.suiviobsmer.entity.Company;
import fr.ifremer.suiviobsmer.entity.CompanyDAO;
import fr.ifremer.suiviobsmer.entity.CompanyImpl;
+import fr.ifremer.suiviobsmer.entity.Contact;
import fr.ifremer.suiviobsmer.entity.ElligibleBoat;
import fr.ifremer.suiviobsmer.entity.SampleRow;
import fr.ifremer.suiviobsmer.entity.SampleRowDAO;
+import fr.ifremer.suiviobsmer.entity.User;
+import fr.ifremer.suiviobsmer.entity.UserImpl;
+import fr.ifremer.suiviobsmer.services.ServiceContact;
import fr.ifremer.suiviobsmer.services.ServiceReferential;
import fr.ifremer.suiviobsmer.services.ServiceSampling;
+import fr.ifremer.suiviobsmer.services.ServiceUser;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
@@ -211,19 +217,37 @@
service.importBoatCsv(input);
List<Boat> boats = service.getBoats("174592");
+ Boat boat = boats.get(0);
// Two rows created : 2009_3 & 2010_4 and one Company : "TARTANPION"
+ ServiceUser serviceUser = new ServiceUserImpl();
Company company = new CompanyImpl();
company.setName("TARTANPION");
+ serviceUser.createUpdateCompany(company);
+ User user = new UserImpl();
+ user.setFirstName("Jean");
+ user.setLastName("Michmuche");
+ user.setCompany(company);
+ serviceUser.createUpdateUser(user, true);
List<SampleRow> rows = prepareSampleRows(company);
+
+ TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction();
+ SampleRowDAO rowDAO = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction);
+ SampleRow row = rowDAO.findByCode("2010_1");
+ row.getCompany();
+ row.getProgram();
+ row.getProfession();
+ transaction.closeContext();
- Boat boat = boats.get(0);
- // Return new BoatInfos
- BoatInfos boatInfos = boat.getBoatInfos(company);
+ ServiceContact serviceContact = new ServiceContactImpl();
+ Contact contact1 = serviceContact.getNewContact(user, row, boat);
+ contact1.setState(ContactState.CONTACT_START.toString());
+ serviceContact.saveContact(contact1, false);
CompanyBoatInfos companyBoatInfos = service.getCompanyBoatInfos(174592, company);
/** EXEC METHOD **/
+ BoatInfos boatInfos = companyBoatInfos.getBoatInfos();
boatInfos.setDup(2);
boatInfos.setContactFirstName("Jean-Paul");
@@ -266,7 +290,11 @@
assertNull(elligible.getCompanyActive());
assertTrue(elligible.getGlobalActive());
+ /** EXEC METHOD **/
+ Contact result = companyBoatInfos.getLastContact();
+ Assert.assertEquals(contact1.getTopiaId(), result.getTopiaId());
+
}
/**
Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java
===================================================================
--- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java 2009-12-21 10:22:48 UTC (rev 140)
+++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java 2009-12-21 14:22:59 UTC (rev 141)
@@ -29,7 +29,6 @@
import fr.ifremer.suiviobsmer.bean.CompanyBoatInfos;
import fr.ifremer.suiviobsmer.entity.BoatInfos;
import fr.ifremer.suiviobsmer.entity.Company;
-import fr.ifremer.suiviobsmer.entity.Contact;
import fr.ifremer.suiviobsmer.entity.ElligibleBoat;
import fr.ifremer.suiviobsmer.entity.FishingZone;
import fr.ifremer.suiviobsmer.entity.Profession;
@@ -49,6 +48,9 @@
import java.io.InputStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.BooleanUtils;
@@ -451,6 +453,12 @@
//boatInfos = null;
companyBoatInfos = null;
//companyId = null;
+
+ // Initialize from Date for boarding calcul in BoatInfos
+ Calendar calendar = new GregorianCalendar();
+ calendar.add(Calendar.MONTH, -12);
+ boardingFromDate = calendar.getTime();
+
return boatsZone.getBody();
}
@@ -484,6 +492,9 @@
@Property
private String companyId;
+ @Property
+ private Date boardingFromDate;
+
/*@Persist
private SuiviObsmerPropertyChangeListener propertyChange;*/
@@ -626,6 +637,10 @@
return boatInfosZone.getBody();
}
+ Block onSuccessFromCalculateBoardings() {
+ return boatInfosZone.getBody();
+ }
+
/**************************** Create new contact **************************/
@InjectPage
Modified: trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Boats.properties
===================================================================
--- trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Boats.properties 2009-12-21 10:22:48 UTC (rev 140)
+++ trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Boats.properties 2009-12-21 14:22:59 UTC (rev 141)
@@ -26,4 +26,5 @@
contactPhoneNumber-label: T\u00E9l\u00E9phone
contactEmail-label: E-mail
shipOwner-label: Armateur
+fromDate-label: Embarquements depuis le
dup-label: Capacit\u00E9 d'accueil du navire en personnels sp\u00E9cialis\u00E9s
\ No newline at end of file
Modified: trunk/suiviobsmer-ui/src/main/webapp/Boats.tml
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/Boats.tml 2009-12-21 10:22:48 UTC (rev 140)
+++ trunk/suiviobsmer-ui/src/main/webapp/Boats.tml 2009-12-21 14:22:59 UTC (rev 141)
@@ -125,52 +125,50 @@
<!-- BOATINFOS:: Informations du navire sélectionné -->
<t:if t:test="boatSelectedImmatriculation">
- <t:zone t:id="boatInfosZone" t:update="show" class="fleft" id="so-boats-boat-infos">
- <t:unless t:test="activityCalendarImportRun">
- <!-- HEADER For admin -->
- <t:if t:test="user.admin">
- <h2>Informations sur <!--${companyBoatInfos.boatInfos.boat.name}-->${boatName}</h2>
- <form t:type="form" t:id="companySelectForm" t:zone="so-boats-boat-infos">
- <t:label t:for="company" /> :
- <input t:type="select" t:id="company" t:model="companySelectModel" t:value="companyId" />
- <input t:type="submit" class="ico search" t:id="searchCompany" value="Search" />
- </form>
- </t:if>
- <!-- BODY - delegator -->
- <t:if t:test="canShowActiveBoatInfos()">
- <t:delegate to="activeBoatInfosBlock" />
- </t:if>
- <!-- BODY - activity calendar -->
- <t:if t:test="hasActivityCalendar()">
- <fieldset id="so-boats-boat-infos-calendar">
- <legend>Calendrier d'activité</legend>
- <p>
+ <t:zone t:id="boatInfosZone" t:update="show" class="fleft" id="so-boats-boat-infos">
+ <!-- HEADER For admin -->
+ <t:if t:test="user.admin">
+ <h2>Informations sur <!--${companyBoatInfos.boatInfos.boat.name}-->${boatName}</h2>
+ <form t:type="form" t:id="companySelectForm" t:zone="so-boats-boat-infos">
+ <t:label t:for="company" /> :
+ <input t:type="select" t:id="company" t:model="companySelectModel" t:value="companyId" />
+ <input t:type="submit" class="ico search" t:id="searchCompany" value="Search" />
+ </form>
+ </t:if>
+ <!-- BODY - delegator -->
+ <t:if t:test="canShowActiveBoatInfos()">
+ <t:delegate to="activeBoatInfosBlock" />
+ </t:if>
+ <!-- BODY - activity calendar -->
+ <fieldset id="so-boats-boat-infos-calendar">
+ <legend>Calendrier d'activité</legend>
+ <t:unless t:test="activityCalendarImportRun">
+ <p>
+ <t:if t:test="hasActivityCalendar()">
<a t:type="actionlink" t:id="showLastActivityCalendar">
<img src="${asset:context:}/img/calendar.png" title="Calendrier d'activité"/>
</a>
- </p>
- </fieldset>
- </t:if>
- <!-- FOOTER For user -->
- <t:unless t:test="user.admin">
- <div id="so-boats-boat-infos-message">
- Les informations saisies sont confidentielles et propriété de la société. <br />
- Elles sont néanmoins consultables par un administrateur
- </div>
+ <p:else>
+ <img src="${asset:context:}/img/calendar-unavailable.png" title="Calendrier d'activité indisponible"/>
+ </p:else>
+ </t:if>
+ </p>
+ <p:else>
+ <div class="fb-info">
+ Le chargement des calendriers d'activité dans l'application est actuellement en cours d'exécution...
+ </div>
+ </p:else>
</t:unless>
-
- <p:else>
- <div class="fb-info">
- Le chargement des calendriers d'activité est en cours. <br />
- Vous ne pouvez pas accéder aux informations du navire pour l'instant. <br />
- Veuillez réessayer ultérieurement.
- </div>
- </p:else>
+ </fieldset>
+ <!-- FOOTER For user -->
+ <t:unless t:test="user.admin">
+ <div id="so-boats-boat-infos-message">
+ Les informations saisies sont confidentielles et propriété de la société. <br />
+ Elles sont néanmoins consultables par un administrateur
+ </div>
</t:unless>
</t:zone>
-
-
<!-- BOATINFOS:: DISPLAY MODE -->
<t:block t:id="displayBoatInfos">
@@ -233,12 +231,17 @@
</t:if>
</p>
<p class="sep"> </p>
- <p><label>Embarquements :</label></p>
<p>
- <strong>${boatInfos.nbBoarding}</strong> embarquements
- dont <strong>${boatInfos.nbBoardingForCompany}</strong> pour votre société
- depuis le <strong><t:output value="boatInfos.firstBoardingDate" format="dateFormat" /></strong>
+ <form t:type="form" t:id="CalculateBoardings" t:zone="so-boats-boat-infos">
+ <t:label t:for="fromDate"/> :
+ <input t:type="datefield" t:id="fromDate" value="boardingFromDate" />
+ <input t:type="submit" class="ico refresh" t:id="refreshBoardings" value="Refresh" title="Recalculer les embarquements"/>
+ </form>
</p>
+ <p>
+ <strong>${boatInfos.getNbBoarding(boardingFromDate)}</strong> embarquements
+ dont <strong>${boatInfos.getNbBoardingForCompany(boardingFromDate)}</strong> dans votre société
+ </p>
<t:if t:test="companyBoatInfos.elligibleBoatsValues.size()">
<p class="sep"> </p>
<label>Ligne(s) du plan :</label>
@@ -306,11 +309,15 @@
<div>
<p><t:label t:for="dup"/> : <input t:type="textfield" t:id="dup" class="dup" value="boatInfos.dup" /></p>
<p class="sep"> </p>
+<!-- <p>
+ <t:label t:for="fromDate"/> :
+ <input t:type="datefield" t:id="fromDate" value="boardingFromDate" />
+ <input t:type="submit" class="ico refresh" t:id="refreshBoardings" value="Refresh" title="Recalculer les embarquements"/>
+ </p>
<p>
- <strong>${boatInfos.nbBoarding}</strong> embarquements
- dont <strong>${boatInfos.nbBoardingForCompany}</strong> dans votre société
- depuis le <strong><t:output value="boatInfos.firstBoardingDate" format="dateFormat" /></strong>
- </p>
+ <strong>${boatInfos.getNbBoarding(boardingFromDate)}</strong> embarquements
+ dont <strong>${boatInfos.getNbBoardingForCompany(boardingFromDate)}</strong> dans votre société
+ </p>-->
<p class="sep"> </p>
<label>Ligne(s) du plan :</label>
<ul>
Added: trunk/suiviobsmer-ui/src/main/webapp/img/calendar-unavailable.png
===================================================================
(Binary files differ)
Property changes on: trunk/suiviobsmer-ui/src/main/webapp/img/calendar-unavailable.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
1
0
[Suiviobsmer-commits] r140 - in trunk: . suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl suiviobsmer-business/src/main/xmi suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages suiviobsmer-ui/src/main/webapp/img
by fdesbois@users.labs.libre-entreprise.org 21 Dec '09
by fdesbois@users.labs.libre-entreprise.org 21 Dec '09
21 Dec '09
Author: fdesbois
Date: 2009-12-21 10:22:48 +0000 (Mon, 21 Dec 2009)
New Revision: 140
Added:
trunk/suiviobsmer-ui/src/main/webapp/img/logo_WAO.png
Modified:
trunk/changelog.txt
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatImpl.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImpl.java
trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.zargo
trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatImplTest.java
trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java
Log:
Correction canCreateContact condition
Modified: trunk/changelog.txt
===================================================================
--- trunk/changelog.txt 2009-12-20 19:50:20 UTC (rev 139)
+++ trunk/changelog.txt 2009-12-21 10:22:48 UTC (rev 140)
@@ -24,7 +24,7 @@
[15-12-2009] [fdesbois] EVO IHM #1941 (Boats / BoatActivityCalendar)
Ajout du champ d'import pour les calendriers d'activité + accès au fichier de log des imports
-[13-12-2009] [fdesbois] EVO METIER
+[13-12-2009] [fdesbois] EVO METIER #1941 (Boats / BoatActivityCalendar)
* Renommage classe SuiviObsmerUtils par SuiviObsmerContext plus approprié
* Ajout gestion import des calendriers d'activité (Lancé en arrière-plan)
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatImpl.java 2009-12-20 19:50:20 UTC (rev 139)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatImpl.java 2009-12-21 10:22:48 UTC (rev 140)
@@ -140,31 +140,29 @@
* @throws SuiviObsmerException
*/
@Override
- public boolean canCreateContact(Company company, SampleRow row) throws SuiviObsmerException {
+ public boolean canCreateContact(Company company) throws SuiviObsmerException {
TopiaContext transaction = null;
- // FIXME depends on condition over double creation on the same sampleRow for the same company.
- // Normally, the default value is true (if no contact exist for this boat, it's possible to create one)
- boolean result = false;
+ boolean result = true;
try {
transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction();
- // Return the last contact for this boat, sampleRow and company
+ String contactClassName = Contact.class.getName();
+ // Return the last contact for this boat and company
List results = transaction.find(
- "FROM ContactImpl C1" +
+ "FROM " + contactClassName + " C1" +
" WHERE C1.user.company = :company" +
- " AND C1.boat = :boat AND C1.sampleRow = :row" +
+ " AND C1.boat = :boat" +
" AND C1.topiaCreateDate = " +
- " (SELECT MAX(C2.topiaCreateDate) FROM ContactImpl C2" +
+ " (SELECT MAX(C2.topiaCreateDate) FROM " + contactClassName + " C2" +
" WHERE C2.user.company = :company AND C2.boat = C1.boat)",
"company", company,
- "boat", this,
- "row", row);
+ "boat", this);
if (!results.isEmpty()) {
Contact contact = (Contact)results.get(0);
boolean validation = contact.getValidationProgram() != null || BooleanUtils.isFalse(contact.getValidationCompany());
ContactState state = ContactState.createContactStateEnum(contact.getState());
- result = validation && !state.equals(ContactState.BOAT_DEFINITIVE_REFUSED);
+ result = validation/* && !state.equals(ContactState.BOAT_DEFINITIVE_REFUSED)*/;
}
transaction.closeContext();
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImpl.java 2009-12-20 19:50:20 UTC (rev 139)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImpl.java 2009-12-21 10:22:48 UTC (rev 140)
@@ -276,11 +276,12 @@
}
}
// Last contact
+ String contactClassName = Contact.class.getName();
List results = transaction.find(
- "FROM ContactImpl C1" +
+ "FROM " + contactClassName + " C1" +
" WHERE C1.user.company = :company AND C1.boat = :boat " +
" AND C1.topiaCreateDate = " +
- " (SELECT MAX(C2.topiaCreateDate) FROM ContactImpl C2" +
+ " (SELECT MAX(C2.topiaCreateDate) FROM " + contactClassName + " C2" +
" WHERE C2.user.company = :company AND C2.boat = C1.boat)",
"company", company,
"boat", boat);
@@ -508,9 +509,11 @@
// "Le navire avec l'identifiant '" + boatId + "' n'existe pas");
// }
+ String activityCalendarClassName = ActivityCalendar.class.getName();
List results = transaction.find(
- "FROM ActivityCalendarImpl A WHERE A.boat = :boat AND A.year = " +
- "(SELECT MAX(B.year) FROM ActivityCalendarImpl B WHERE B.boat = A.boat GROUP BY B.boat)",
+ "FROM " + activityCalendarClassName + " A WHERE A.boat = :boat AND A.year = " +
+ "(SELECT MAX(B.year) FROM " + activityCalendarClassName + " B " +
+ " WHERE B.boat = A.boat GROUP BY B.boat)",
"boat", boat);
result = (ActivityCalendar) results.get(0);
Modified: trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.zargo
===================================================================
(Binary files differ)
Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatImplTest.java
===================================================================
--- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatImplTest.java 2009-12-20 19:50:20 UTC (rev 139)
+++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatImplTest.java 2009-12-21 10:22:48 UTC (rev 140)
@@ -183,7 +183,7 @@
serviceContact.saveContact(contact1, false);
/** EXEC METHOD **/
- boolean result = boat.canCreateContact(company, row);
+ boolean result = boat.canCreateContact(company);
// contact still open
Assert.assertFalse(result);
@@ -191,28 +191,28 @@
contact1.setValidationProgram(Boolean.TRUE);
serviceContact.saveContact(contact1, false);
- result = boat.canCreateContact(company, row);
+ result = boat.canCreateContact(company);
// contact have a definitive refused for this boat
- Assert.assertFalse(result);
+ Assert.assertTrue(result);
contact1.setState(ContactState.BOARDING_DONE.toString());
serviceContact.saveContact(contact1, false);
- result = boat.canCreateContact(company, row);
+ result = boat.canCreateContact(company);
// contact is finished
Assert.assertTrue(result);
contact1.setState(ContactState.BOAT_UNAVAILABLE.toString());
serviceContact.saveContact(contact1, false);
- result = boat.canCreateContact(company, row);
+ result = boat.canCreateContact(company);
// contact is finished
Assert.assertTrue(result);
contact1.setState(ContactState.BOAT_REFUSED.toString());
serviceContact.saveContact(contact1, false);
- result = boat.canCreateContact(company, row);
+ result = boat.canCreateContact(company);
// contact is finished
Assert.assertTrue(result);
}
Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java
===================================================================
--- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java 2009-12-20 19:50:20 UTC (rev 139)
+++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java 2009-12-21 10:22:48 UTC (rev 140)
@@ -440,7 +440,7 @@
public boolean canCreateNewContactFromList() throws SuiviObsmerException {
if (!user.getAdmin() && isSampleRowExists()) {
- return boat.canCreateContact(user.getCompany(), getSampleRow());
+ return boat.canCreateContact(user.getCompany());
}
return false;
}
@@ -559,7 +559,8 @@
public boolean canCreateNewContactFromElligibleBoat() throws SuiviObsmerException {
if (!user.getAdmin() && !isElligibleBoatCompanyActiveFalse()) {
- return getBoatInfos().getBoat().canCreateContact(user.getCompany(), elligibleBoat.getSampleRow());
+ Boat boat = getBoatInfos().getBoat();
+ return boat.canCreateContact(user.getCompany());
}
return false;
}
Added: trunk/suiviobsmer-ui/src/main/webapp/img/logo_WAO.png
===================================================================
(Binary files differ)
Property changes on: trunk/suiviobsmer-ui/src/main/webapp/img/logo_WAO.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
1
0
Author: tchemit
Date: 2009-12-20 19:50:20 +0000 (Sun, 20 Dec 2009)
New Revision: 139
Modified:
trunk/pom.xml
Log:
use last stable version of ToPIA
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-12-20 19:03:08 UTC (rev 138)
+++ trunk/pom.xml 2009-12-20 19:50:20 UTC (rev 139)
@@ -239,7 +239,7 @@
<!-- libraries version -->
<nuitonutils.version>1.1.2-SNAPSHOT</nuitonutils.version>
- <topia.version>2.3.0-beta-2-SNAPSHOT</topia.version>
+ <topia.version>2.3.0-beta-2</topia.version>
<license.version>2.0.0</license.version>
<helper.version>1.1.0</helper.version>
<eugene.version>2.0.0-beta-2</eugene.version>
1
0
[Suiviobsmer-commits] r138 - in trunk: . suiviobsmer-business suiviobsmer-ui
by tchemit@users.labs.libre-entreprise.org 20 Dec '09
by tchemit@users.labs.libre-entreprise.org 20 Dec '09
20 Dec '09
Author: tchemit
Date: 2009-12-20 19:03:08 +0000 (Sun, 20 Dec 2009)
New Revision: 138
Modified:
trunk/
trunk/suiviobsmer-business/
trunk/suiviobsmer-ui/
Log:
svn ignore on idea files
Property changes on: trunk
___________________________________________________________________
Modified: svn:ignore
- target
+ target
*.iml
*.ipr
*.iws
Property changes on: trunk/suiviobsmer-business
___________________________________________________________________
Modified: svn:ignore
- target
+ target
*.iml
*.ipr
*.iws
Property changes on: trunk/suiviobsmer-ui
___________________________________________________________________
Modified: svn:ignore
- target
+ target
*.iml
*.ipr
*.iws
1
0
[Suiviobsmer-commits] r137 - in trunk: . suiviobsmer-business
by tchemit@users.labs.libre-entreprise.org 20 Dec '09
by tchemit@users.labs.libre-entreprise.org 20 Dec '09
20 Dec '09
Author: tchemit
Date: 2009-12-20 18:58:41 +0000 (Sun, 20 Dec 2009)
New Revision: 137
Modified:
trunk/pom.xml
trunk/suiviobsmer-business/pom.xml
Log:
use pluginManagements for eugene plugin + add as dependency topia-persistence + use last stable version of eugene
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-12-20 16:35:00 UTC (rev 136)
+++ trunk/pom.xml 2009-12-20 18:58:41 UTC (rev 137)
@@ -242,7 +242,7 @@
<topia.version>2.3.0-beta-2-SNAPSHOT</topia.version>
<license.version>2.0.0</license.version>
<helper.version>1.1.0</helper.version>
- <eugene.version>2.0.0-beta-2-SNAPSHOT</eugene.version>
+ <eugene.version>2.0.0-beta-2</eugene.version>
<tapestry.version>5.1.0.5</tapestry.version>
<!-- default license to use -->
@@ -470,6 +470,23 @@
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.nuiton.eugene</groupId>
+ <artifactId>maven-eugene-plugin</artifactId>
+ <version>${eugene.version}</version>
+ <configuration>
+ <inputs>zargo</inputs>
+ <resolver>org.nuiton.util.FasterCachedResourceResolver</resolver>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.nuiton.topia</groupId>
+ <artifactId>topia-persistence</artifactId>
+ <version>${topia.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+
</plugins>
</pluginManagement>
Modified: trunk/suiviobsmer-business/pom.xml
===================================================================
--- trunk/suiviobsmer-business/pom.xml 2009-12-20 16:35:00 UTC (rev 136)
+++ trunk/suiviobsmer-business/pom.xml 2009-12-20 18:58:41 UTC (rev 137)
@@ -93,13 +93,13 @@
<plugin>
<groupId>org.nuiton.eugene</groupId>
<artifactId>maven-eugene-plugin</artifactId>
- <version>${eugene.version}</version>
+ <!--<version>${eugene.version}</version>-->
<executions>
<execution>
<phase>generate-sources</phase>
<!-- By default, generation from ObjectModel -->
<configuration>
- <inputs>zargo</inputs>
+ <!--<inputs>zargo</inputs>-->
<!-- Corresponding to extracted package from zargo file -->
<fullPackagePath>fr.ifremer.suiviobsmer</fullPackagePath>
<!-- DefaultPackage used for DAOHelper generation -->
1
0