Author: fdesbois Date: 2010-06-16 13:22:34 +0000 (Wed, 16 Jun 2010) New Revision: 538 Log: Refactor usage of Binder using WaoBinderHelper Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java 2010-06-16 13:19:44 UTC (rev 537) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java 2010-06-16 13:22:34 UTC (rev 538) @@ -27,6 +27,7 @@ import com.csvreader.CsvReader; import com.csvreader.CsvWriter; +import fr.ifremer.wao.WaoBinderHelper; import fr.ifremer.wao.WaoBusinessException; import fr.ifremer.wao.WaoBusinessException.Type; import fr.ifremer.wao.WaoContext; @@ -73,8 +74,6 @@ import org.nuiton.topia.framework.TopiaQuery.Op; import org.nuiton.util.DateUtils; import org.nuiton.util.PeriodDates; -import org.nuiton.util.beans.BinderBuilder; -import org.nuiton.util.beans.BinderProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -130,9 +129,9 @@ context.closeTransaction(transaction); } - public ServiceSamplingImpl() { - prepareBinderForProfession(); - } +// public ServiceSamplingImpl() { +// prepareBinderForProfession(); +// } @Override public void executeCreateUpdateSampleRow(TopiaContext transaction, @@ -584,8 +583,10 @@ Profession newProfession = new ProfessionImpl(); // Use of Binder previously initialized to copy the existing // profession in a new one - BinderProvider.getBinder(Profession.class). - copy(profession, newProfession); +// BinderProvider.getBinder(Profession.class). +// copy(profession, newProfession); + WaoBinderHelper.getSimpleTopiaBinder(Profession.class). + copy(profession, newProfession); return newProfession; } @@ -646,25 +647,25 @@ } } - /** - * Prepare the Binder for Profession copy. This method is called in - * service constructor. The copy from two Profession will be available - * anywhere using BinderProvider.get(Profession.class).copy(source, dest); - * - * @see org.nuiton.util.beans.Binder - * @see org.nuiton.util.beans.BinderProvider - */ - protected void prepareBinderForProfession() { - BinderBuilder builder = new BinderBuilder(); - builder.createBinderModel(Profession.class).addSimpleProperties( - Profession.CODE_DCF5, - Profession.LIBELLE, - Profession.MESH_SIZE, - Profession.OTHER, - Profession.SIZE, - Profession.SPECIES); - BinderProvider.registerBinder(builder); - } +// /** +// * Prepare the Binder for Profession copy. This method is called in +// * service constructor. The copy from two Profession will be available +// * anywhere using BinderProvider.get(Profession.class).copy(source, dest); +// * +// * @see org.nuiton.util.beans.Binder +// * @see org.nuiton.util.beans.BinderProvider +// */ +// protected void prepareBinderForProfession() { +// BinderBuilder builder = new BinderBuilder(); +// builder.createBinderModel(Profession.class).addSimpleProperties( +// Profession.CODE_DCF5, +// Profession.LIBELLE, +// Profession.MESH_SIZE, +// Profession.OTHER, +// Profession.SIZE, +// Profession.SPECIES); +// BinderProvider.registerBinder(builder); +// } @Override public InputStream executeExportSamplingPlanCsv(TopiaContext transaction,