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
- 2352 discussions
r1676 - in trunk: . wao-persistence wao-persistence/src wao-persistence/src/main wao-persistence/src/main/java wao-persistence/src/main/java/fr wao-persistence/src/main/java/fr/ifremer wao-persistence/src/main/java/fr/ifremer/wao wao-persistence/src/main/java/fr/ifremer/wao/entity wao-persistence/src/main/resources wao-persistence/src/main/xmi wao-persistence/src/test
by bleny@users.forge.codelutin.com 24 Jan '14
by bleny@users.forge.codelutin.com 24 Jan '14
24 Jan '14
Author: bleny
Date: 2014-01-24 11:40:38 +0100 (Fri, 24 Jan 2014)
New Revision: 1676
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1676
Log:
introduce wao-persistence module
Added:
trunk/wao-persistence/
trunk/wao-persistence/LICENSE.txt
trunk/wao-persistence/README.txt
trunk/wao-persistence/pom.xml
trunk/wao-persistence/src/
trunk/wao-persistence/src/main/
trunk/wao-persistence/src/main/java/
trunk/wao-persistence/src/main/java/fr/
trunk/wao-persistence/src/main/java/fr/ifremer/
trunk/wao-persistence/src/main/java/fr/ifremer/wao/
trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoApplicationConfig.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoApplicationConfigOption.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoException.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoTechnicalException.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatGroupImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/CompanyImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactState.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactStateMotifImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/DCF5CodeImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/DataReliability.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/DistrictGeoPoint.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/FishingGearDCFImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/FishingZoneImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/FleetImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/GeoPoint.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/IndicatorImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/IndicatorLevelImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/LocationType.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/NewsImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObsDebCodeImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObsProgram.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObservationType.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObservedDataControl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleMonthImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowLogImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SamplingStrategy.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SeaboardGeoPoint.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SynthesisId.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TerrestrialDivisionImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TerrestrialLocationImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/UserProfileImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/UserRole.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/WaoUserImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/WaoUserTopiaDao.java
trunk/wao-persistence/src/main/resources/
trunk/wao-persistence/src/main/resources/wao.properties
trunk/wao-persistence/src/main/xmi/
trunk/wao-persistence/src/test/
trunk/wao-persistence/src/test/java/
trunk/wao-persistence/src/test/resources/
Modified:
trunk/wao-persistence/src/main/xmi/wao.zargo
Property changes on: trunk/wao-persistence
___________________________________________________________________
Added: svn:ignore
+ *.iml
.idea
.settings
target
.project
Copied: trunk/wao-persistence/LICENSE.txt (from rev 1675, tags/wao-3.4.1/wao-business/LICENSE.txt)
===================================================================
--- trunk/wao-persistence/LICENSE.txt (rev 0)
+++ trunk/wao-persistence/LICENSE.txt 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+ A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+ The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+ An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU Affero General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Remote Network Interaction; Use with the GNU General Public License.
+
+ Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software. This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source. For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code. There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+<http://www.gnu.org/licenses/>.
\ No newline at end of file
Property changes on: trunk/wao-persistence/LICENSE.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/LICENSE.txt:679-733
Copied: trunk/wao-persistence/README.txt (from rev 1675, tags/wao-3.4.1/wao-business/README.txt)
===================================================================
--- trunk/wao-persistence/README.txt (rev 0)
+++ trunk/wao-persistence/README.txt 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1 @@
+Look at README.txt in Wao-ui to launch the application
Property changes on: trunk/wao-persistence/README.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/README.txt:679-733
Added: trunk/wao-persistence/pom.xml
===================================================================
--- trunk/wao-persistence/pom.xml (rev 0)
+++ trunk/wao-persistence/pom.xml 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>fr.ifremer</groupId>
+ <artifactId>wao</artifactId>
+ <version>4.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>wao-persistence</artifactId>
+
+ <name>Wao :: Persistence</name>
+ <description>Wao persistence module</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.nuiton.topia</groupId>
+ <artifactId>topia-persistence</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-c3p0</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-config</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton.i18n</groupId>
+ <artifactId>nuiton-i18n</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-collections4</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jcl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton.eugene</groupId>
+ <artifactId>eugene-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-entities</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <inputs>zargo</inputs>
+ <!-- Corresponding to extracted package from zargo file -->
+ <fullPackagePath>fr.ifremer.wao</fullPackagePath>
+ <defaultPackage>fr.ifremer.wao</defaultPackage>
+ <templates>
+ org.nuiton.topia.templates.TopiaMetaTransformer
+ </templates>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.nuiton.i18n</groupId>
+ <artifactId>i18n-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>parseOthersAndGen</id>
+ <configuration>
+ <entries>
+ <entry>
+ <specificGoal>parserValidation</specificGoal>
+ <basedir>${maven.src.dir}/main/java/</basedir>
+ <includes>
+ <param>**/**-validation.xml</param>
+ </includes>
+ </entry>
+ <entry>
+ <basedir>${maven.gen.dir}/java/</basedir>
+ </entry>
+ </entries>
+ </configuration>
+ <goals>
+ <goal>parserJava</goal>
+ <goal>gen</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Property changes on: trunk/wao-persistence/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoApplicationConfig.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoApplicationConfig.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoApplicationConfig.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,94 @@
+package fr.ifremer.wao;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.config.ApplicationConfig;
+import org.nuiton.config.ArgumentsParserException;
+
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+public class WaoApplicationConfig {
+
+ private static final Log log = LogFactory.getLog(WaoApplicationConfig.class);
+
+ protected ApplicationConfig applicationConfig;
+
+ public WaoApplicationConfig() {
+ applicationConfig = new ApplicationConfig();
+ applicationConfig.loadDefaultOptions(WaoApplicationConfigOption.values());
+ applicationConfig.setConfigFileName("wao.properties");
+ try {
+ applicationConfig.parse();
+ } catch (ArgumentsParserException e) {
+ throw new WaoTechnicalException(e);
+ }
+ if (log.isInfoEnabled()) {
+ StringBuilder builder = new StringBuilder();
+ List<WaoApplicationConfigOption> options =
+ Lists.newArrayList(WaoApplicationConfigOption.values());
+ for (WaoApplicationConfigOption option : options) {
+ builder.append(String.format("\n%1$-40s = %2$s",
+ option.getKey(),
+ applicationConfig.getOption(option)));
+ }
+ log.info("wao " + builder.toString());
+ }
+ }
+
+ public boolean isDevMode() {
+ boolean isDevMode = applicationConfig.getOptionAsBoolean(WaoApplicationConfigOption.DEV_MODE.key);
+ return isDevMode;
+ }
+
+ public Map<String, String> getTopiaProperties() {
+ Map<String, String> jpaParameters = Maps.newHashMap();
+ Properties hibernateProperties = applicationConfig.getOptionStartsWith("hibernate");
+ jpaParameters.putAll((Map) hibernateProperties);
+ return jpaParameters;
+ }
+
+ /**
+ * @return Le nom d'hôte du serveur SMTP.
+ */
+ public String getSmtpHost() {
+ return applicationConfig.getOption(WaoApplicationConfigOption.SMTP_HOST.key);
+ }
+
+ /**
+ * @return Le port du serveur SMTP.
+ */
+ public int getSmtpPort() {
+ return applicationConfig.getOptionAsInt(WaoApplicationConfigOption.SMTP_PORT.key);
+ }
+
+ /**
+ * @return L'adresse d'expéditeur pour les mails de notifications
+ */
+ public String getSmtpFrom() {
+ return applicationConfig.getOption(WaoApplicationConfigOption.SMTP_FROM.key);
+ }
+
+ public String getInstanceUrl() {
+ return applicationConfig.getOption(WaoApplicationConfigOption.INSTANCE_URL.key);
+ }
+
+ public String getInstanceDisclaimer() {
+ return applicationConfig.getOption(WaoApplicationConfigOption.INSTANCE_DISCLAIMER.key);
+ }
+
+ public boolean isLogConfigurationProvided() {
+ boolean logConfigurationProvided =
+ StringUtils.isNotBlank(applicationConfig.getOption(WaoApplicationConfigOption.LOG_CONFIGURATION_FILE.key));
+ return logConfigurationProvided;
+ }
+
+ public File getLogConfigurationFile() {
+ return applicationConfig.getOptionAsFile(WaoApplicationConfigOption.LOG_CONFIGURATION_FILE.key);
+ }
+}
Added: trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoApplicationConfigOption.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoApplicationConfigOption.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoApplicationConfigOption.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,101 @@
+package fr.ifremer.wao;
+
+import org.nuiton.config.ConfigOptionDef;
+
+public enum WaoApplicationConfigOption implements ConfigOptionDef {
+
+ INSTANCE_URL(
+ "wao.instanceUrl",
+ "URL à laquelle on peut accéder à l'instance de l'extranet",
+ "http://localhost:8080/extranet-enc-ahi", String.class),
+
+ INSTANCE_DISCLAIMER(
+ "wao.instanceDisclaimer",
+ "Avertissement à afficher aux utilisateurs si l'instance est instable",
+ null, String.class),
+
+ SMTP_HOST(
+ "smtp.host",
+ "Nom d'hôte du serveur SMTP",
+ "", String.class),
+
+ SMTP_PORT(
+ "smtp.port",
+ "Le port du serveur SMTP",
+ "25", Integer.class),
+
+ SMTP_FROM(
+ "smtp.from",
+ "L'adresse d'expéditeur pour les mails de notifications",
+ "", String.class),
+
+ DEV_MODE(
+ "wao.devMode",
+ "Mode développement, court-circuite l'envoi de mail",
+ "true", Boolean.class),
+
+ LOG_CONFIGURATION_FILE(
+ "logConfigurationFile",
+ "Chemin vers le fichier de configuration des journaux",
+ null,
+ String.class);
+
+ protected final String key;
+ protected final String description;
+ protected final Class<?> type;
+ protected String defaultValue;
+
+ private WaoApplicationConfigOption(String key, String description,
+ String defaultValue, Class<?> type) {
+ this.key = key;
+ this.description = description;
+ this.defaultValue = defaultValue;
+ this.type = type;
+ }
+
+ @Override
+ public String getKey() {
+ return key;
+ }
+
+ @Override
+ public Class<?> getType() {
+ return type;
+ }
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ @Override
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ @Override
+ public boolean isTransient() {
+ return false;
+ }
+
+ @Override
+ public boolean isFinal() {
+ return false;
+ }
+
+ @Override
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ @Override
+ public void setTransient(boolean isTransient) {
+ // Nothing to do
+ }
+
+ @Override
+ public void setFinal(boolean isFinal) {
+ // Nothing to do
+ }
+
+}
\ No newline at end of file
Added: trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoException.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoException.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoException.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,19 @@
+package fr.ifremer.wao;
+
+public class WaoException extends Exception {
+
+ public WaoException() {
+ }
+
+ public WaoException(String message) {
+ super(message);
+ }
+
+ public WaoException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public WaoException(Throwable cause) {
+ super(cause);
+ }
+}
Added: trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoTechnicalException.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoTechnicalException.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoTechnicalException.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,19 @@
+package fr.ifremer.wao;
+
+public class WaoTechnicalException extends RuntimeException {
+
+ public WaoTechnicalException() {
+ }
+
+ public WaoTechnicalException(String message) {
+ super(message);
+ }
+
+ public WaoTechnicalException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public WaoTechnicalException(Throwable cause) {
+ super(cause);
+ }
+}
Added: trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,37 @@
+package fr.ifremer.wao;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class WaoUtils {
+
+ protected static final String MONTH_PATTERN = "MM/yyyy";
+
+ protected static final String DATE_PATTERN = "dd/MM/yyyy";
+
+ protected static final String DATE_TIME_PATTERN = "dd/MM/yyyy HH:mm";
+
+ protected static final String TIME_PATTERN = "HH:mm";
+
+ public static String formatMonth(Date date) {
+ return formatDate(date, MONTH_PATTERN);
+ }
+
+ public static String formatDate(Date date) {
+ return formatDate(date, DATE_PATTERN);
+ }
+
+ public static String formatDateTime(Date date) {
+ return formatDate(date, DATE_TIME_PATTERN);
+ }
+
+ public static String formatTime(Date date) {
+ return formatDate(date, TIME_PATTERN);
+ }
+
+ protected static String formatDate(Date date, String pattern) {
+ DateFormat dateFormat = new SimpleDateFormat(pattern);
+ return dateFormat.format(date);
+ }
+}
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatGroupImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/BoatGroupImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatGroupImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatGroupImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,38 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2011 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+public class BoatGroupImpl extends BoatGroupAbstract {
+
+ @Override
+ public String getDescription() {
+ return getCode() + " - " + getCommune() + " - " + getSector() + " - "
+ + getStaffSizeGroup() + " - " + getLengthGroup();
+ }
+
+ @Override
+ public String toString() {
+ return getDescription();
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatGroupImpl.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/BoatGroupImpl.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/BoatImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,64 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.wao.entity;
+
+/**
+ * BoatImpl
+ *
+ * Created: 26 nov. 2009
+ *
+ * @author fdesbois <fdesbois(a)codelutin.com>
+ */
+public class BoatImpl extends BoatAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String getDistrictCode() {
+ String districtCode = "";
+ if (getDistrict() != null) {
+ districtCode = getDistrict().getDistrictCode();
+ }
+ return districtCode;
+ }
+
+ @Override
+ public String getDescription() {
+ return getImmatriculation() + " - " + getName();
+ }
+
+ @Override
+ public String toString() {
+ return getName() + " (" + getImmatriculation() + ")";
+ }
+
+ @Override
+ public void setDistrict(TerrestrialLocation district) {
+ if ( ! district.isDistrict()) {
+ throw new IllegalArgumentException(district + " is not a district");
+ }
+ super.setDistrict(district);
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/BoatImpl.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/CompanyImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/CompanyImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/CompanyImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/CompanyImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,42 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.wao.entity;
+
+/**
+ * CompanyImpl
+ *
+ * Created: 27 nov. 2009
+ *
+ * @author fdesbois <fdesbois(a)codelutin.com>
+ */
+public class CompanyImpl extends CompanyAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String toString() {
+ return "CompanyImpl{name=" + getName() + "}";
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/CompanyImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/CompanyImpl.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/ContactImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,181 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.wao.entity;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * ContactImpl
+ *
+ * Created: 18 déc. 2009
+ *
+ * @author fdesbois <fdesbois(a)codelutin.com>
+ */
+public class ContactImpl extends ContactAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Get the reference date for the contact. It depends on existence of tideBeginDate.
+ *
+ * @return the tideBeginDate if exists or the topiaCreateDate if not
+ */
+ @Override
+ public Date getReferenceDate() {
+ Date referenceDate;
+ if (getObservationBeginDate() == null) {
+ referenceDate = getCreationDate();
+ } else {
+ referenceDate = getObservationBeginDate();
+ }
+ return referenceDate;
+ }
+
+ @Override
+ public void setState(int state) {
+ setContactState(ContactState.valueOf(state));
+ }
+
+ @Override
+ public ContactState getContactState() {
+ return ContactState.valueOf(getState());
+ }
+
+ @Override
+ public void setContactState(ContactState contactState) {
+ super.setState(contactState.ordinal());
+ }
+
+ @Override
+ public DataReliability getDataReliability() {
+ return DataReliability.valueOf(getDataReliabilityOrdinal());
+ }
+
+ @Override
+ public void setDataReliability(DataReliability dataReliability) {
+ setDataReliabilityOrdinal(dataReliability.ordinal());
+ }
+
+ @Override
+ public ObsProgram getObsProgram() {
+ return ObsProgram.valueOf(getObsProgramOrdinal());
+ }
+
+ @Override
+ public void setObsProgram(ObsProgram obsProgram) {
+ setObsProgramOrdinal(obsProgram.ordinal());
+ }
+
+ @Override
+ public SamplingStrategy getSamplingStrategy() {
+ return SamplingStrategy.valueOf(getSamplingStrategyOrdinal());
+ }
+
+ @Override
+ public void setSamplingStrategy(SamplingStrategy samplingStrategy) {
+ setSamplingStrategyOrdinal(samplingStrategy.ordinal());
+ }
+
+ @Override
+ public void setSampleRow(SampleRow sampleRow) {
+ super.setSampleRow(sampleRow);
+ setObsProgram(sampleRow.getObsProgram());
+ }
+
+ /** Value is still used but it's no longer written, it's now computed
+ * from the size of observers. */
+ protected void updateNbObservers() {
+ setNbObservants(getAllObservers().size());
+ }
+
+ @Override
+ public void addSecondaryObservers(WaoUser secondaryObservers) {
+ super.addSecondaryObservers(secondaryObservers);
+ updateNbObservers();
+ }
+
+ @Override
+ public void addAllSecondaryObservers(Collection<WaoUser> secondaryObservers) {
+ super.addAllSecondaryObservers(secondaryObservers);
+ updateNbObservers();
+ }
+
+ @Override
+ public void setSecondaryObservers(Collection<WaoUser> secondaryObservers) {
+ super.setSecondaryObservers(secondaryObservers);
+ updateNbObservers();
+ }
+
+ @Override
+ public void removeSecondaryObservers(WaoUser secondaryObservers) {
+ super.removeSecondaryObservers(secondaryObservers);
+ updateNbObservers();
+ }
+
+ @Override
+ public void clearSecondaryObservers() {
+ super.clearSecondaryObservers();
+ updateNbObservers();
+ }
+
+ @Override
+ public void setMainObserver(WaoUser mainObserver) {
+ super.setMainObserver(mainObserver);
+ updateNbObservers();
+ }
+
+ @Override
+ public ObservationType getObservationType() {
+ ObservationType observationType = null;
+ if (getObservationTypeOrdinal() != null) {
+ observationType = ObservationType.valueOf(getObservationTypeOrdinal());
+ }
+ return observationType;
+ }
+
+ @Override
+ public void setObservationType(ObservationType observationType) {
+ if (observationType == null) {
+ setObservationTypeOrdinal(null);
+ } else {
+ setObservationTypeOrdinal(observationType.ordinal());
+ }
+ }
+
+ @Override
+ public List<WaoUser> getAllObservers() {
+ List<WaoUser> allObservers = new LinkedList<WaoUser>();
+ if (getMainObserver() != null) {
+ allObservers.add(getMainObserver());
+ }
+ if (getSecondaryObservers() != null) {
+ allObservers.addAll(getSecondaryObservers());
+ }
+ return allObservers;
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/ContactImpl.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactState.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/bean/ContactState.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactState.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactState.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,158 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.wao.entity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * Enum for contact state. The ordinal enum is used to save the state in
+ * {@link fr.ifremer.wao.entity.Contact} entity. Don't change the enum values
+ * order.
+ *
+ * A {@link fr.ifremer.wao.entity.Contact} is always in a given state. Some
+ * states are final, meaning that there is change the state. Some others
+ * state are noted as unfinished, it means that this state (either final or
+ * not) imples that observers, for any reason, was not able to collect
+ * expected data.
+ *
+ * Some of the values of the enum may not be used by all
+ * {@link fr.ifremer.wao.entity.ObsProgram}. That's why method or provided
+ * to know which values are allowed for a given program.
+ * Created: 3 déc. 2009
+ *
+ * @author fdesbois <fdesbois(a)codelutin.com>
+ */
+public enum ContactState {
+
+ /** Usually, the first step, observer just contacted someone */
+ CONTACT_START(n_("ContactState.CONTACT_START"), false, false, false, true),
+
+ /** Observer has now someone to meet */
+ OBSERVATION_EXPECTED(n_("ContactState.OBSERVATION_EXPECTED"), false, false, true, true),
+
+ /** Observation was done, all data have been collected. Everything is fine */
+ OBSERVATION_DONE(n_("ContactState.OBSERVATION_DONE"), true, false, true, true),
+
+ /** Observer failed to collect data, weather or any other circumstances made data collection impossible */
+ OBSERVATION_CANCELLED(n_("ContactState.OBSERVATION_CANCELLED"), true, true, true, false),
+
+ /** After a contact start, people contacted refused the observation. Observer may try later. */
+ CONTACT_REFUSED(n_("ContactState.CONTACT_REFUSED"), true ,true, false, true),
+
+ /** After a contact refused, people contacted still refuse the observation. Observer may not try later. */
+ CONTACT_DEFINITELY_REFUSED(n_("ContactState.CONTACT_DEFINITELY_REFUSED"), true, true, false, true),
+
+ /** On the work field, observer choose not to get in touch with the people from the boat */
+ OBSERVATION_NOT_DONE(n_("ContactState.OBSERVATION_NOT_DONE"), true, false, false, true);
+
+ private String i18nKey;
+
+ /** if true, the state may not be changed. */
+ private boolean finalState;
+
+ /** if true, observation in this state has no collected data */
+ private boolean unfinishedState;
+
+ /** true if this value can be used for a contact of program {@link fr.ifremer.wao.entity.ObsProgram#OBSVENTE} */
+ protected boolean allowedForObsVente;
+
+ /** true if this value can be used for a contact of program {@link fr.ifremer.wao.entity.ObsProgram#OBSDEB} */
+ protected boolean allowedForObsDeb;
+
+ /** @deprecated I18N should be done properly by tapestry */
+ @Deprecated
+ ContactState(String i18nKey, boolean finalState, boolean unfinishedState,
+ boolean allowedForObsVente, boolean allowedForObsDeb) {
+ this.i18nKey = i18nKey;
+ this.finalState = finalState;
+ this.unfinishedState = unfinishedState;
+ this.allowedForObsVente = allowedForObsVente;
+ this.allowedForObsDeb = allowedForObsDeb;
+ }
+
+ public boolean isFinalState() {
+ return this.finalState;
+ }
+
+ public boolean isUnfinishedState() {
+ return this.unfinishedState;
+ }
+
+ /**
+ * Get the contactState corresponding to the {@code ordinal} value.
+ *
+ * @param ordinal reference for the ContactState
+ * @return ContactState
+ */
+ public static ContactState valueOf(int ordinal) {
+ for (ContactState curr : ContactState.values()) {
+ if (ordinal == curr.ordinal()) {
+ return curr;
+ }
+ }
+ return null;
+ }
+
+ public boolean isAllowed(ObsProgram obsProgram) {
+ boolean allowed;
+ if (obsProgram == ObsProgram.OBSMER) {
+ allowed = this != OBSERVATION_NOT_DONE;
+ } else if (obsProgram == ObsProgram.OBSVENTE) {
+ allowed = allowedForObsVente;
+ } else {
+ allowed = allowedForObsDeb;
+ }
+ return allowed;
+ }
+
+ public static List<ContactState> getAllowedStates(ObsProgram obsProgram) {
+ List<ContactState> allowedStates = new ArrayList<ContactState>();
+ for (ContactState contactState : values()) {
+ if (contactState.isAllowed(obsProgram)) {
+ allowedStates.add(contactState);
+ }
+ }
+ return allowedStates;
+ }
+
+ /**
+ * Different contact states may share the same set of possible motifs
+ * For example, CONTACT_DEFINITELY_REFUSED and CONTACT_REFUSED
+ * Here, we substitute one by another to use the same set of motifs
+ */
+ public static ContactState getSubstituteForMotif(ContactState contactState) {
+ ContactState substituteState;
+ if (contactState.equals(ContactState.CONTACT_DEFINITELY_REFUSED)) {
+ substituteState = ContactState.CONTACT_REFUSED;
+ } else {
+ substituteState = contactState;
+ }
+ return substituteState;
+ }
+
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactState.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/bean/ContactState.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactStateMotifImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/ContactStateMotifImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactStateMotifImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactStateMotifImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,64 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2011 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+public class ContactStateMotifImpl extends ContactStateMotifAbstract {
+
+ /** Do not use, needed by Hibernate */
+ public ContactStateMotifImpl() {}
+
+ public ContactStateMotifImpl(ContactState contactState) {
+ setContactState(contactState);
+ }
+
+ @Override
+ public void setContactStateOrdinal(int contactStateOrdinal) {
+ setContactState(ContactState.valueOf(contactStateOrdinal));
+ }
+
+ @Override
+ public void setContactState(ContactState contactState) {
+ ContactState substitute = ContactState.getSubstituteForMotif(contactState);
+ super.setContactStateOrdinal(substitute.ordinal());
+ }
+
+ @Override
+ public int getContactStateOrdinal() {
+ return getContactState().ordinal();
+ }
+
+ @Override
+ public ContactState getContactState() {
+ ContactState contactState = ContactState.valueOf(super.getContactStateOrdinal());
+ ContactState substitute = ContactState.getSubstituteForMotif(contactState);
+ return substitute;
+ }
+
+ @Override
+ public String toString() {
+ String name = getName();
+ return name;
+ }
+
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactStateMotifImpl.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/ContactStateMotifImpl.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/DCF5CodeImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/DCF5CodeImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/DCF5CodeImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/DCF5CodeImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,61 @@
+/*
+ * #%L
+ * Wao :: Business
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+public class DCF5CodeImpl extends DCF5CodeAbstract {
+
+ @Override
+ public String getFishingGearCode() {
+ return getFishingGearDCF().getCode();
+ }
+
+ @Override
+ public String getTargetSpeciesCode() {
+ String code = null;
+ if (getTargetSpeciesDCF() != null) {
+ code = getTargetSpeciesDCF().getCode();
+ }
+ return code;
+ }
+
+ @Override
+ public String getFishingGearDescription() {
+ return getFishingGearDCF().getDescription();
+ }
+
+ @Override
+ public String getTargetSpeciesDescription() {
+ String description = null;
+ if (getTargetSpeciesDCF() != null) {
+ description = getTargetSpeciesDCF().getDescription();
+ }
+ return description;
+ }
+
+ @Override
+ public String toString() {
+ String toString = getFishingGearCode();
+ if (getTargetSpeciesDCF() != null) {
+ toString += "_" + getTargetSpeciesCode();
+ }
+ return toString;
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/DCF5CodeImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/DCF5CodeImpl.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/DataReliability.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/bean/DataReliability.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/DataReliability.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/DataReliability.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,70 @@
+/*
+ * #%L
+ * Wao :: Business
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * This enumeration represents the different levels of trust that can accorded to
+ * a contact and to the data she provided.
+ *
+ * Order of the value puts the more used first, in order to make it first in
+ * combo-box for user convenience
+ *
+ * @author bleny
+ */
+public enum DataReliability {
+
+ /** Data are trustworthy (100% trust). */
+ RELIABLE(n_("DataReliability.RELIABLE")),
+
+ /** Data are doubtful (50% trust). */
+ DOUBTFUL(n_("DataReliability.DOUBTFUL")),
+
+ /** Data are not reliable (0% trust). */
+ NOT_RELIABLE(n_("DataReliability.NOT_RELIABLE")),
+
+ /** When Admin is waiting for a coordinator to correct data */
+ CORRECTION_ASKED(n_("DataReliability.CORRECTION_ASKED")),
+
+ /** Data reliability has not been evaluated yet (?% trust). */
+ UNKNOWN(n_("DataReliability.UNKNOWN")),
+
+ /** Information has not been provided */
+ NOT_PROVIDED(n_("DataReliability.NOT_PROVIDED"));
+
+ /** An i18n key to make enumeration printable in logs and UI. */
+ protected String i18nKey;
+
+ DataReliability(String i18nKey) {
+ this.i18nKey = i18nKey;
+ }
+
+ public static DataReliability valueOf(int ordinal) {
+ for (DataReliability dataReliability : DataReliability.values()) {
+ if (dataReliability.ordinal() == ordinal) {
+ return dataReliability;
+ }
+ }
+ return null;
+ }
+
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/DataReliability.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/bean/DataReliability.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/DistrictGeoPoint.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/DistrictGeoPoint.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/DistrictGeoPoint.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/DistrictGeoPoint.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,60 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+/**
+ * Adapteur pour avoir un GeoPoint correspondant à un quartier maritime.
+ */
+public class DistrictGeoPoint implements GeoPoint {
+
+ /** L'adapté. */
+ protected TerrestrialLocation district;
+
+ public DistrictGeoPoint(TerrestrialLocation district) {
+ if ( ! district.isDistrict()) {
+ throw new IllegalArgumentException();
+ }
+ this.district = district;
+ }
+
+ @Override
+ public Double getLatitude() {
+ return district.getDistrictLatitude();
+ }
+
+ @Override
+ public Double getLongitude() {
+ return district.getDistrictLongitude();
+ }
+
+ @Override
+ public String getCode() {
+ return district.getDistrictCode();
+ }
+
+ @Override
+ public String getName() {
+ return district.getDistrictName();
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/DistrictGeoPoint.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/DistrictGeoPoint.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/FishingGearDCFImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/FishingGearDCFImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/FishingGearDCFImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/FishingGearDCFImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,57 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+
+/**
+ * @author bleny
+ */
+public class FishingGearDCFImpl extends FishingGearDCFAbstract {
+
+ public FishingGearDCFImpl() {
+ super();
+ }
+
+ public FishingGearDCFImpl(String code) {
+ super();
+ setCode(code);
+ }
+
+ @Override
+ public String getDescription() {
+ // return WaoUtils._(FishingGearDCF.class.getName() + "." + getCode());
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String getFullDescription() {
+ return String.format("%s (%s)", getCode(), getDescription());
+ }
+
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this);
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/FishingGearDCFImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/FishingGearDCFImpl.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/FishingZoneImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/FishingZoneImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/FishingZoneImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/FishingZoneImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,52 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.wao.entity;
+
+/**
+ * FishingZoneImpl
+ *
+ * Created: 1 déc. 2009
+ *
+ * @author fdesbois <fdesbois(a)codelutin.com>
+ */
+public class FishingZoneImpl extends FishingZoneAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Le point décrit est celui où se trouve la façade maritime.
+ *
+ * @return le nom de le façade
+ */
+ @Override
+ public String getName() {
+ return getFacadeName();
+ }
+
+ @Override
+ public String getCode() {
+ return getFacadeName() + " - " + getSectorName() + " - " + getDistrictCode();
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/FishingZoneImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/FishingZoneImpl.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/FleetImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/FleetImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/FleetImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/FleetImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,36 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2011 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+public class FleetImpl extends FleetAbstract {
+
+ @Override
+ public String getDescription() {
+ String description = String.format("%s - %s - %s",
+ getFleetName(),
+ getSubFleetName(),
+ getSubSubFleetName());
+ return description;
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/FleetImpl.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/FleetImpl.java:679-733
Added: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/GeoPoint.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/GeoPoint.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/GeoPoint.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,18 @@
+package fr.ifremer.wao.entity;
+
+/**
+ * Représente un point qui correspond à une position géographique.
+ *
+ * @author bleny
+ */
+public interface GeoPoint {
+
+ Double getLatitude();
+
+ Double getLongitude();
+
+ String getCode();
+
+ String getName();
+
+}
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/IndicatorImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/IndicatorImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/IndicatorImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/IndicatorImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,52 @@
+/*
+ * #%L
+ * Wao :: Business
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+/**
+ *
+ */
+public class IndicatorImpl extends IndicatorAbstract {
+
+ @Override
+ public SynthesisId getSynthesisId() {
+ SynthesisId result = null;
+ if (getIndicatorId() != null) {
+ result = SynthesisId.valueOf(getIndicatorId());
+ }
+ return result;
+ }
+
+ @Override
+ public void setSynthesisId(SynthesisId synthesisId) {
+ setIndicatorId(synthesisId.ordinal());
+ }
+
+ /** return the level that contains given value between it's two bound */
+ @Override
+ public IndicatorLevel getLevelForValue(double value) {
+ for (IndicatorLevel level : getIndicatorLevel()) {
+ if (level.containsValue(value)) {
+ return level;
+ }
+ }
+ throw new IllegalStateException("no level found for value " + value);
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/IndicatorImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/IndicatorImpl.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/IndicatorLevelImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/IndicatorLevelImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/IndicatorLevelImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/IndicatorLevelImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,90 @@
+/*
+ * #%L
+ * Wao :: Business
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+public class IndicatorLevelImpl extends IndicatorLevelAbstract {
+
+ /** the upperBound of the lower level */
+ protected double lowerBound;
+
+ protected boolean upperBoundIncluded = false;
+
+ @Override
+ public double getLowerBound() {
+ return lowerBound;
+ }
+
+ @Override
+ public void setLowerBound(double lowerBound) {
+ this.lowerBound = lowerBound;
+ }
+
+ @Override
+ public boolean isLowerBoundPositiveInfinity() {
+ return lowerBound == Double.MAX_VALUE;
+ }
+
+ @Override
+ public void setLowerBoundToPositiveInfinity() {
+ lowerBound = Double.MAX_VALUE;
+ }
+
+ @Override
+ public boolean lowerEqualsUpperBounds() {
+ return getLowerBound() == getUpperBound();
+ }
+
+ /** if upperBound and lowerBound are equals, return true if value is equals
+ * if lowerBound and upperBound are different, return true if value is
+ * between bound.
+ *
+ * upperBound is always strict comparison, lowerBound non-strict comparison
+ */
+ @Override
+ public boolean containsValue(double value) {
+ boolean containsValue = false;
+
+ if (upperBoundIncluded && value == upperBound) {
+ containsValue = true;
+ } else if (lowerEqualsUpperBounds()) {
+ containsValue = value == getUpperBound();
+ } else {
+ if (getLowerBound() < getUpperBound()) {
+ containsValue = value >= getLowerBound()
+ && value < getUpperBound();
+ } else {
+ containsValue = value >= getUpperBound()
+ && value < getLowerBound();
+ }
+ }
+
+ return containsValue;
+ }
+
+ @Override
+ public boolean isUpperBoundIncluded() {
+ return upperBoundIncluded;
+ }
+
+ public void setUpperBoundIncluded(boolean upperBoundIncluded) {
+ this.upperBoundIncluded = upperBoundIncluded;
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/IndicatorLevelImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/IndicatorLevelImpl.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/LocationType.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/bean/LocationType.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/LocationType.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/LocationType.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,49 @@
+/*
+ * #%L
+ * Wao :: Business
+ * %%
+ * Copyright (C) 2009 - 2011 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+import static org.nuiton.i18n.I18n.n_;
+
+public enum LocationType {
+
+ PORT(n_("LocationType.PORT")),
+ AUCTION(n_("LocationType.AUCTION")),
+ DISTRICT(n_("LocationType.DISTRICT")),
+ REGION(n_("LocationType.REGION"));
+
+ protected String i18nKey;
+
+ LocationType(String i18nKey) {
+ this.i18nKey = i18nKey;
+ }
+
+ public static LocationType valueOf(Integer locationTypeOrdinal) {
+ if (locationTypeOrdinal != null) {
+ for (LocationType locationType : LocationType.values()) {
+ if (locationType.ordinal() == locationTypeOrdinal) {
+ return locationType;
+ }
+ }
+ }
+ return null;
+ }
+
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/LocationType.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/bean/LocationType.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/NewsImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/NewsImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/NewsImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/NewsImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,35 @@
+/*
+ * #%L
+ * Wao :: Business
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+/**
+ * Created: 15 juin 2010
+ *
+ * @author fdesbois <fdesbois(a)codelutin.com>
+ * @version $Id$
+ */
+public class NewsImpl extends NewsAbstract {
+
+ @Override
+ public boolean isFromAdmin() {
+ return company == null;
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/NewsImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/NewsImpl.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObsDebCodeImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/ObsDebCodeImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObsDebCodeImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObsDebCodeImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,60 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2011 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+
+public class ObsDebCodeImpl extends ObsDebCodeAbstract {
+
+ /** The label to be used when printing this code, it depends on the
+ * region, so setLabel must be called before using this field
+ */
+ protected String label;
+
+ @Override
+ public void setLabel(TerrestrialLocation region) {
+ ObsDebCodeDetails obsDebCodeDetailsForRegion = null;
+ for (ObsDebCodeDetails obsDebCodeDetails : getObsDebCodeDetails()) {
+ boolean match = obsDebCodeDetails.getRegion().getRegionIfremerCode()
+ .equals(region.getRegionIfremerCode());
+ if (match) {
+ obsDebCodeDetailsForRegion = obsDebCodeDetails;
+ }
+ }
+ if (obsDebCodeDetailsForRegion == null) {
+ label = null;
+ } else {
+ label = obsDebCodeDetailsForRegion.getLabel();
+ }
+ }
+
+ @Override
+ public String getDescription() {
+ return getCode() + (label == null ? "" : " - " + label);
+ }
+
+ @Override
+ public String toString() {
+ return getDescription();
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObsDebCodeImpl.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/ObsDebCodeImpl.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObsProgram.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/bean/ObsProgram.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObsProgram.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObsProgram.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,52 @@
+/*
+ * #%L
+ * Wao :: Business
+ * %%
+ * Copyright (C) 2009 - 2011 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+import static org.nuiton.i18n.I18n.n_;
+
+public enum ObsProgram {
+
+ OBSMER("M", n_("ObsProgram.OBSMER")),
+ OBSVENTE("V", n_("ObsProgram.OBSVENTE")),
+ OBSDEB("D", n_("ObsProgram.OBSDEB"));
+
+ protected String i18nKey;
+
+ protected String shortCode;
+
+ ObsProgram(String shortCode, String i18nKey) {
+ this.shortCode = shortCode;
+ this.i18nKey = i18nKey;
+ }
+
+ public static ObsProgram valueOf(int obsProgramOrdinal) {
+ for (ObsProgram obsProgram : values()) {
+ if (obsProgram.ordinal() == obsProgramOrdinal) {
+ return obsProgram;
+ }
+ }
+ return null;
+ }
+
+ public String getShortCode() {
+ return shortCode;
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObsProgram.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/bean/ObsProgram.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObservationType.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/bean/ObservationType.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObservationType.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObservationType.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,59 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2011 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * In ObsDeb, an observation done may be of different type, when
+ * the observer create a contact, he must provide the type of observation.
+ *
+ * @author bleny
+ */
+public enum ObservationType {
+
+ /** Information obtained by observation on the field work */
+ FIELD_WORK_OBSERVATION(n_("ObservationType.FIELD_WORK_OBSERVATION")),
+
+ /** Information obtained by asking someone on the field work */
+ FIELD_WORK_SURVEY(n_("ObservationType.FIELD_WORK_SURVEY")),
+
+ /** Information obtained by calling someone by phone */
+ PHONE_CALL(n_("ObservationType.PHONE_CALL"));
+
+ protected String i18nKey;
+
+ ObservationType(String i18nKey) {
+ this.i18nKey = i18nKey;
+ }
+
+ public static ObservationType valueOf(Integer observationTypeOrdinal) {
+ for (ObservationType observationType : values()) {
+ if (observationType.ordinal() == observationTypeOrdinal) {
+ return observationType;
+ }
+ }
+ throw new IllegalArgumentException("ordinal " + observationTypeOrdinal);
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObservationType.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/bean/ObservationType.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObservedDataControl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/ObservedDataControl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObservedDataControl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObservedDataControl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,44 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * Pour ObsMer indique si les données saisies dans Allegro sont valides.
+ */
+public enum ObservedDataControl {
+
+ CORRECTION_ASKED(n_("ObservedDataControl.CORRECTION_ASKED")),
+
+ ACCEPTED(n_("ObservedDataControl.ACCEPTED"));
+
+ /** An i18n key to make enumeration printable in logs and UI. */
+ protected String i18nKey;
+
+ ObservedDataControl(String i18nKey) {
+ this.i18nKey = i18nKey;
+ }
+
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObservedDataControl.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/ObservedDataControl.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleMonthImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/SampleMonthImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleMonthImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleMonthImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,38 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.wao.entity;
+
+/**
+ * SampleMonthImpl
+ *
+ * Created: 2 déc. 2009
+ *
+ * @author fdesbois <fdesbois(a)codelutin.com>
+ */
+public class SampleMonthImpl extends SampleMonthAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleMonthImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/SampleMonthImpl.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,263 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.wao.entity;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * SampleRowImpl
+ *
+ * Created: 30 nov. 2009
+ *
+ * @author fdesbois <fdesbois(a)codelutin.com>
+ */
+public class SampleRowImpl extends SampleRowAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public Integer getTotalTidesReal() {
+ int totalTidesReal = 0;
+ for (SampleMonth sampleMonth : getSampleMonth()) {
+ totalTidesReal += sampleMonth.getRealTidesValue();
+ }
+ return totalTidesReal;
+ }
+
+ @Override
+ public Integer getTotalTidesExpected() {
+ int totalTidesExpected = 0;
+ for (SampleMonth sampleMonth : getSampleMonth()) {
+ totalTidesExpected += sampleMonth.getExpectedTidesValue();
+ }
+ return totalTidesExpected;
+ }
+
+ /**
+ * Get the facade of the sampleRow. The row has normally only one facade in the FishingZone list.
+ *
+ * @return the facade name of the row
+ */
+ @Override
+ public String getFacade() {
+ if (getFishingZone().size() > 0) {
+ return getFishingZone().get(0).getFacadeName();
+ }
+ return null;
+ }
+
+ /**
+ * Get the sectors of the sampleRow. The sectors will be concat as a single String with "-" as separator.
+ *
+ * @return a String with all sectors linked to the sampleRow
+ */
+ @Override
+ public String getSectors() {
+ Set<String> sectorNames = new LinkedHashSet<String>();
+ for (FishingZone fishingZone : getFishingZone()) {
+ sectorNames.add(fishingZone.getSectorName());
+ }
+ String sectors = StringUtils.join(sectorNames, " - ");
+ return sectors;
+ }
+
+ /**
+ * Retrieve the elligibleBoat corresponding to the {@code boat}.
+ *
+ * @param boat Boat referenced by the ElligibleBoat
+ * @return the existing ElligibleBoat or null otherwise
+ */
+ @Override
+ public ElligibleBoat getElligibleBoatByBoat(Boat boat) {
+ for (ElligibleBoat elligible : getElligibleBoat()) {
+ if (elligible.getBoat().equals(boat)) {
+ return elligible;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Used to get a list of boat's immatriculations linked with the sampleRow.
+ *
+ * @return a simple String which contains immatriculations separate by
+ * a space
+ */
+ @Override
+ public String getMainElligibleBoatsAsString() {
+ String result = "";
+ for (ElligibleBoat elligible : getElligibleBoat()) {
+ if (elligible.isGlobalActive()) {
+ Boat boat = elligible.getBoat();
+ result += boat.getImmatriculation() + " ";
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Check if SampleMonth of the SampleRow has already realTidesValue set
+ * (different from 0). It means the SampleRow could'nt be deleted and
+ * have some modification constraints.
+ *
+ * @return true if a SampleMonth have realTidesValue, false otherwise
+ */
+ @Override
+ public boolean hasSampleMonthRealTideTime() {
+ for (SampleMonth month : getSampleMonth()) {
+ if (month.getRealTidesValue() != 0) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String getProfessionDescription() {
+ String code = StringUtils.join(getdCF5Code(), ", ");
+ code += getProfessionDescriptionWithoutDCF5();
+ return code;
+ }
+
+ @Override
+ public String getProfessionDescriptionWithoutDCF5() {
+ String code = "";
+ if (getProfession() != null) {
+ if (!StringUtils.isEmpty(getProfession().getMeshSize())) {
+ code += " " + getProfession().getMeshSize();
+ }
+ if (!StringUtils.isEmpty(getProfession().getSize())) {
+ code += " " + getProfession().getSize();
+ }
+ if (!StringUtils.isEmpty(getProfession().getOther())) {
+ code += " " + getProfession().getOther();
+ }
+ }
+ return code;
+ }
+
+ @Override
+ public void setDCF5Code(String codes, String separatorRegex) {
+ if (StringUtils.isBlank(codes)) {
+ setdCF5Code(null);
+ } else {
+ String[] splitCodes = codes.split(separatorRegex);
+ List<DCF5Code> dcfFives = new ArrayList<DCF5Code>(splitCodes.length);
+ for (String code : splitCodes) {
+ String[] codeParts = code.split("_");
+ DCF5Code dcfFive = new DCF5CodeImpl();
+
+ dcfFive.setFishingGearDCF(new FishingGearDCFImpl(codeParts[0]));
+ if (codeParts.length == 2) {
+ dcfFive.setTargetSpeciesDCF(new TargetSpeciesDCFImpl(codeParts[1]));
+ }
+
+ dcfFives.add(dcfFive);
+ }
+ setdCF5Code(dcfFives);
+ }
+ }
+
+ @Override
+ public ObsProgram getObsProgram() {
+ return ObsProgram.valueOf(getObsProgramOrdinal());
+ }
+
+ @Override
+ public void setObsProgram(ObsProgram obsProgram) {
+ setObsProgramOrdinal(obsProgram.ordinal());
+ }
+
+ @Override
+ public SamplingStrategy getSamplingStrategy() {
+ return SamplingStrategy.valueOf(getSamplingStrategyOrdinal());
+ }
+
+ @Override
+ public void setSamplingStrategy(SamplingStrategy samplingStrategy) {
+ setSamplingStrategyOrdinal(samplingStrategy.ordinal());
+ }
+
+ @Override
+ public void setObservationType(ObservationType observationType) {
+ if (observationType == null) {
+ setObservationTypeOrdinal(null);
+ } else {
+ setObservationTypeOrdinal(observationType.ordinal());
+ }
+ }
+
+ @Override
+ public ObservationType getObservationType() {
+ ObservationType observationType = null;
+ if (getObservationTypeOrdinal() != null) {
+ observationType = ObservationType.valueOf(getObservationTypeOrdinal());
+ }
+ return observationType;
+ }
+
+ @Override
+ public boolean isPhoneCall() {
+ return ObservationType.PHONE_CALL.equals(getObservationType());
+ }
+
+ @Override
+ public boolean isFieldWorkObservation() {
+ return ObservationType.FIELD_WORK_OBSERVATION.equals(getObservationType());
+ }
+
+ @Override
+ public void setTerrestrialLocation(TerrestrialLocation terrestrialLocation) {
+ clearTerrestrialLocations();
+ addTerrestrialLocations(terrestrialLocation);
+ }
+
+ @Override
+ public TerrestrialLocation getTerrestrialLocation() {
+ TerrestrialLocation terrestrialLocation = null;
+ if ( ! isTerrestrialLocationsEmpty()) {
+ terrestrialLocation = (TerrestrialLocation)
+ CollectionUtils.get(getTerrestrialLocations(), 0);
+ }
+ return terrestrialLocation;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer stringBuffer = new StringBuffer();
+ stringBuffer.append(getCode()).append(" (").append(getObsProgram());
+ if (getObservationType() != null) {
+ stringBuffer.append(", ").append(getObservationType().toString());
+ }
+ stringBuffer.append(")");
+ return stringBuffer.toString();
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowLogImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowLogImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowLogImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowLogImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,537 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.wao.entity;
+
+import com.google.common.collect.Maps;
+import fr.ifremer.wao.WaoUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.nuiton.topia.persistence.TopiaEntities;
+import org.nuiton.util.DateUtil;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * SampleRowLogImpl
+ *
+ * Created: 12 janv. 2010
+ *
+ * @author fdesbois <fdesbois(a)codelutin.com>
+ */
+public class SampleRowLogImpl extends SampleRowLogAbstract {
+
+ protected void addChange(String text) {
+ String log = getLogText();
+ if (!StringUtils.isEmpty(log)) {
+ log += "\n";
+ } else {
+ log = "";
+ }
+ log += text;
+ setLogText(log);
+ }
+
+ protected String nvl(String str) {
+ return str == null ? "" : str;
+ }
+
+ @Override
+ public Date getCreateDate() {
+ return getTopiaCreateDate();
+ }
+
+ protected SampleRow oldRow;
+
+ protected SampleRow newRow;
+
+ protected void compareNbObservers() {
+ // NbObservants
+ if (oldRow == null) {
+ addChange("Le nombre d'observateurs est de " + newRow.getNbObservants());
+ } else if (oldRow.getNbObservants() != newRow.getNbObservants()) {
+ addChange("Le nombre d'observateurs est passé de " + oldRow.getNbObservants()
+ + " à " + newRow.getNbObservants());
+ }
+ }
+
+ protected void compareAverageTidesTimes() {
+ // AverageTideTime
+ if (oldRow == null) {
+ addChange("Le durée moyenne d'une marée est de " + newRow.getAverageTideTime());
+ } else if (oldRow.getAverageTideTime() != newRow.getAverageTideTime()) {
+ addChange("La durée moyenne d'une marée est passé de " + oldRow.getAverageTideTime()
+ + " jours à " + newRow.getAverageTideTime());
+ }
+ }
+
+ protected void compareAverageObservationsCount() {
+ if (oldRow == null) {
+ addChange("Le nombre moyen d'observations par sortie est de " + newRow.getAverageTideTime());
+ } else if (oldRow.getAverageTideTime() != newRow.getAverageTideTime()) {
+ addChange("Le nombre moyen d'observations par sortie est passé de " + oldRow.getAverageTideTime()
+ + " à " + newRow.getAverageTideTime());
+ }
+ }
+
+ protected void compareTerrestrialLocations() {
+ Collection<TerrestrialLocation> oldTerrestrialLocations;
+ if (oldRow == null) {
+ oldTerrestrialLocations = Collections.emptyList();
+ } else {
+ oldTerrestrialLocations = oldRow.getTerrestrialLocations();
+ }
+ Collection<TerrestrialLocation> newTerrestrialLocations = newRow.getTerrestrialLocations();
+
+ // Lists for boats by status
+ List<String> removedTerrestrialLocations = new ArrayList<String>();
+ List<String> keptTerrestrialLocations = new ArrayList<String>();
+ List<String> addedTerrestrialLocations = new ArrayList<String>();
+
+ // filling the three lists
+ for (TerrestrialLocation oldTerrestrialLocation : oldTerrestrialLocations) {
+ if ( ! newTerrestrialLocations.contains(oldTerrestrialLocation)) {
+ removedTerrestrialLocations.add(oldTerrestrialLocation.getCode());
+ }
+ }
+ for (TerrestrialLocation newTerrestrialLocation : newTerrestrialLocations) {
+ if (oldTerrestrialLocations.contains(newTerrestrialLocation)) {
+ keptTerrestrialLocations.add(newTerrestrialLocation.getCode());
+ } else {
+ addedTerrestrialLocations.add(newTerrestrialLocation.getCode());
+ }
+ }
+
+ // using the three list to add info
+ if ( ! removedTerrestrialLocations.isEmpty()) {
+ addChange("Les lieux terrestres suivants ont été dissociés : " +
+ StringUtils.join(removedTerrestrialLocations, ", "));
+ }
+// if ( ! keptTerrestrialLocations.isEmpty()) {
+// addChange("Les lieux terrestres suivants sont toujours associées : " +
+// StringUtils.join(keptTerrestrialLocations, ", "));
+// }
+ if ( ! addedTerrestrialLocations.isEmpty()) {
+ addChange("Les lieux terrestres suivants ont été ajoutés : " +
+ StringUtils.join(addedTerrestrialLocations, ", "));
+ }
+ }
+
+ protected void compareTerrestrialDistricts() {
+ Collection<TerrestrialLocation> oldTerrestrialLocations;
+ if (oldRow == null) {
+ oldTerrestrialLocations = Collections.emptyList();
+ } else {
+ oldTerrestrialLocations = oldRow.getTerrestrialLocations();
+ }
+ Collection<TerrestrialLocation> newTerrestrialLocations = newRow.getTerrestrialLocations();
+
+ // Lists for boats by status
+ List<String> removedTerrestrialLocations = new ArrayList<String>();
+ List<String> keptTerrestrialLocations = new ArrayList<String>();
+ List<String> addedTerrestrialLocations = new ArrayList<String>();
+
+ // filling the three lists
+ for (TerrestrialLocation oldTerrestrialLocation : oldTerrestrialLocations) {
+ if ( ! newTerrestrialLocations.contains(oldTerrestrialLocation)) {
+ removedTerrestrialLocations.add(oldTerrestrialLocation.getDistrictCode());
+ }
+ }
+ for (TerrestrialLocation newTerrestrialLocation : newTerrestrialLocations) {
+ if (oldTerrestrialLocations.contains(newTerrestrialLocation)) {
+ keptTerrestrialLocations.add(newTerrestrialLocation.getDistrictCode());
+ } else {
+ addedTerrestrialLocations.add(newTerrestrialLocation.getDistrictCode());
+ }
+ }
+
+ // using the three list to add info
+ if ( ! removedTerrestrialLocations.isEmpty()) {
+ addChange("Les quartiers maritimes suivants ont été dissociées : " +
+ StringUtils.join(removedTerrestrialLocations, ", "));
+ }
+// if ( ! keptTerrestrialLocations.isEmpty()) {
+// addChange("Les quartiers maritimes suivants sont toujours associées : " +
+// StringUtils.join(keptTerrestrialLocations, ", "));
+// }
+ if ( ! addedTerrestrialLocations.isEmpty()) {
+ addChange("Les quartiers maritimes ont été ajoutées : " +
+ StringUtils.join(addedTerrestrialLocations, ", "));
+ }
+ }
+
+ protected void compareCompanies() {
+ Company oldCompany = oldRow == null ? null : oldRow.getCompany();
+ Company newCompany = newRow.getCompany();
+ if (oldCompany != null) {
+ String msg = "La ligne n'est plus associée à la société " + oldCompany.getName();
+ if (newCompany != null && !newCompany.equals(oldCompany)) {
+ addChange(msg + " mais à la société " + newCompany.getName());
+ } else if (newCompany == null) {
+ addChange(msg);
+ }
+ } else if (newCompany != null) {
+ addChange("La ligne est désormais associée à la société " + newCompany.getName());
+ }
+ }
+
+ protected void comparePrograms() {
+ String oldProgram = oldRow == null ? null : oldRow.getProgramName();
+ String newProgram = newRow.getProgramName();
+ if (!StringUtils.isEmpty(oldProgram)) {
+ if (!oldProgram.equals(newProgram)) {
+ addChange("La ligne n'est plus associée au programme " + oldProgram + " mais au programme " + newProgram);
+ }
+ } else if (!StringUtils.isEmpty(newProgram)) {
+ addChange("La ligne est désormais associée au programme " + newProgram);
+ }
+ }
+
+ protected void comparePeriods() {
+ DateFormat dateFormat = new SimpleDateFormat(DateUtil.MONTH_PATTERN);
+
+ String newPeriodBegin = dateFormat.format(newRow.getPeriodBegin());
+ String newPeriodEnd = dateFormat.format(newRow.getPeriodEnd());
+ if (oldRow == null) {
+ addChange("La ligne est sur la période du " + newPeriodBegin + " au " + newPeriodEnd);
+ } else {
+ String oldPeriodBegin = dateFormat.format(oldRow.getPeriodBegin());
+ if (!oldPeriodBegin.equals(newPeriodBegin)) {
+ addChange("La date de début est passée de " + oldPeriodBegin + " à " + newPeriodBegin);
+ }
+
+ String oldPeriodEnd = dateFormat.format(oldRow.getPeriodEnd());
+ if (!oldPeriodEnd.equals(newPeriodEnd)) {
+ addChange("La date de fin est passée de " + oldPeriodEnd + " à " + newPeriodEnd);
+ }
+ }
+ }
+
+ protected void compareProfession() {
+ Profession newProfession = newRow.getProfession();
+
+ if (oldRow == null) {
+ addChange("Le métier de la ligne est " + newRow.getProfessionDescription());
+ if (newProfession.getLibelle() != null) {
+ addChange("Le libelle du métier est " + newProfession.getLibelle());
+ }
+ if (newProfession.getSpecies() != null) {
+ addChange("Les espèces cibles du métier sont " + newProfession.getSpecies());
+ }
+ return;
+ }
+
+ if (!nvl(oldRow.getProfessionDescription()).equals(nvl(newRow.getProfessionDescription()))) {
+ addChange("Le métier de la ligne est passé de " + oldRow.getProfessionDescription()
+ + " à " + newRow.getProfessionDescription());
+ }
+
+ Profession oldProfession = oldRow.getProfession();
+ if (newProfession.getLibelle() != null && !nvl(oldProfession.getLibelle()).equals(nvl(newProfession.getLibelle()))) {
+ addChange("Le libellé du métier est passé de " + oldProfession.getLibelle() + " à " + newProfession.getLibelle());
+ }
+ if (newProfession.getSpecies() != null && !nvl(oldProfession.getSpecies()).equals(nvl(newProfession.getSpecies()))) {
+ addChange("Les espèces cibles du métier sont passées de " + oldProfession.getSpecies() + " à " + newProfession.getSpecies());
+ }
+ }
+
+ protected void compareSampleMonths() {
+ DateFormat dateFormat = new SimpleDateFormat(DateUtil.MONTH_PATTERN);
+
+// Map<String, SampleMonth> oldMonths = new HashMap<String, SampleMonth>();
+// for (SampleMonth month : oldRow.getSampleMonth()) {
+// oldMonths.put(month.getTopiaId(), month);
+// }
+
+ Map<String, SampleMonth> oldMonths;
+ if (oldRow == null) {
+ oldMonths = Collections.emptyMap();
+ } else {
+ oldMonths = Maps.uniqueIndex(oldRow.getSampleMonth(), TopiaEntities.getTopiaIdFunction());
+ }
+
+ List<SampleMonth> newMonths = newRow.getSampleMonth();
+ for (SampleMonth oldMonth : oldMonths.values()) {
+ if ( ! newMonths.contains(oldMonth)) {
+ String date = dateFormat.format(oldMonth.getPeriodDate());
+ addChange("Le mois " + date + " a été supprimé, " +
+ "l'ancienne valeur d'effort était " + oldMonth.getExpectedTidesValue());
+ }
+ }
+ for (SampleMonth month : newMonths) {
+ boolean monthCreated = ! oldMonths.containsKey(month.getTopiaId());
+ String date = dateFormat.format(month.getPeriodDate());
+ if (monthCreated) {
+ // log create month
+ addChange("Le mois " + date + " a été créé avec un nombre de marées de "
+ + month.getExpectedTidesValue());
+ } else {
+ SampleMonth oldMonth = oldMonths.get(month.getTopiaId());
+ if (oldMonth.getExpectedTidesValue() != month.getExpectedTidesValue()) {
+ // log change month value
+ addChange("Le nombre de marées du mois " + date + " est passé de " +
+ oldMonth.getExpectedTidesValue() + " à " + month.getExpectedTidesValue());
+ }
+ }
+ }
+ }
+
+ protected void compareEligibleBoats() {
+ List<ElligibleBoat> oldEligibleBoats;
+ if (oldRow == null) {
+ oldEligibleBoats = Collections.emptyList();
+ } else {
+ oldEligibleBoats = oldRow.getElligibleBoat();
+ }
+ List<ElligibleBoat> newEligibleBoats = newRow.getElligibleBoat();
+
+ // Lists for boats by status
+ List<Integer> noLongerEligibleBoats = new ArrayList<Integer>();
+ List<Integer> stillEligibleBoats = new ArrayList<Integer>();
+ List<Integer> newlyEligibleBoats = new ArrayList<Integer>();
+
+ // filling the three lists
+ for (ElligibleBoat oldEligibleBoat : oldEligibleBoats) {
+ if ( ! newEligibleBoats.contains(oldEligibleBoat)) {
+ Boat boat = oldEligibleBoat.getBoat();
+ int plateNumber = boat.getImmatriculation();
+ noLongerEligibleBoats.add(plateNumber);
+ }
+ }
+ for (ElligibleBoat newEligibleBoat : newEligibleBoats) {
+ if (oldEligibleBoats.contains(newEligibleBoat)) {
+ stillEligibleBoats.add(newEligibleBoat.getBoat().getImmatriculation());
+ } else {
+ newlyEligibleBoats.add(newEligibleBoat.getBoat().getImmatriculation());
+ }
+ }
+
+ // using the three list to add info
+ if ( ! noLongerEligibleBoats.isEmpty()) {
+ addChange("Les navires suivants ne sont plus éligibles : " +
+ StringUtils.join(noLongerEligibleBoats, ", "));
+ }
+// if ( ! stillEligibleBoats.isEmpty()) {
+// addChange("Les navires suivants sont toujours éligibles ; " +
+// StringUtils.join(stillEligibleBoats, ", "));
+// }
+ if ( ! newlyEligibleBoats.isEmpty()) {
+ addChange("Les navires suivants deviennent éligibles : " +
+ StringUtils.join(newlyEligibleBoats, ", "));
+ }
+ }
+
+ protected void compareFishingZones() {
+ List<FishingZone> oldFishingZones;
+ if (oldRow == null) {
+ oldFishingZones = Collections.emptyList();
+ } else {
+ oldFishingZones = oldRow.getFishingZone();
+ }
+ List<FishingZone> newFishingZones = newRow.getFishingZone();
+
+ // Lists for boats by status
+ List<String> removedZones = new ArrayList<String>();
+ List<String> keptZones = new ArrayList<String>();
+ List<String> addedZones = new ArrayList<String>();
+
+ // filling the three lists
+ for (FishingZone oldFishingZone : oldFishingZones) {
+ if ( ! newFishingZones.contains(oldFishingZone)) {
+ removedZones.add(oldFishingZone.getCode());
+ }
+ }
+ for (FishingZone newFishingZone : newFishingZones) {
+ if (oldFishingZones.contains(newFishingZone)) {
+ keptZones.add(newFishingZone.getCode());
+ } else {
+ addedZones.add(newFishingZone.getCode());
+ }
+ }
+
+ // using the three list to add info
+ if ( ! removedZones.isEmpty()) {
+ addChange("Les zones de pêches suivantes ont été dissociées : " +
+ StringUtils.join(removedZones, ", "));
+ }
+// if ( ! keptZones.isEmpty()) {
+// addChange("Les zones de pêches suivantes sont toujours associées : " +
+// StringUtils.join(keptZones, ", "));
+// }
+ if ( ! addedZones.isEmpty()) {
+ addChange("Les zones de pêches suivantes ont été ajoutées : " +
+ StringUtils.join(addedZones, ", "));
+ }
+ }
+
+ protected void compareDays() {
+ if (oldRow == null) {
+ addChange("Le jour est " + WaoUtils.formatDate(newRow.getExpectedDate()));
+ } else {
+ if (DateUtil.getDifferenceInDays(oldRow.getExpectedDate(), newRow.getExpectedDate()) >= 1) {
+ addChange("L'observation est déplacée du " + WaoUtils.formatDate(oldRow.getExpectedDate())
+ + " au " + WaoUtils.formatDate(newRow.getExpectedDate()));
+ }
+ }
+ }
+
+ protected void compareObservers() {
+ Collection<WaoUser> oldObservers;
+
+ if (oldRow == null) {
+ oldObservers = Collections.emptyList();
+ } else {
+ oldObservers = oldRow.getObservers();
+ }
+
+ Collection<WaoUser> newObservers = newRow.getObservers();
+ if (newObservers == null) {
+ newObservers = Collections.emptyList();
+ }
+
+ List<String> removedObservers = new LinkedList<String>();
+ List<String> addedObservers = new LinkedList<String>();
+
+ for (WaoUser oldObserver : oldObservers) {
+ if ( ! newObservers.contains(oldObserver)) {
+ removedObservers.add(oldObserver.getFullName());
+ }
+ }
+
+ for (WaoUser newObserver : newObservers) {
+ if ( ! oldObservers.contains(newObserver)) {
+ addedObservers.add(newObserver.getFullName());
+ }
+ }
+
+ if (oldRow == null) {
+ if ( ! newObservers.isEmpty()) {
+ addChange("Les observateurs sont " + StringUtils.join(newObservers, ", "));
+ }
+ } else {
+ if ( ! removedObservers.isEmpty()) {
+ addChange("Les observateurs dissociés de la ligne sont " + StringUtils.join(removedObservers, ", "));
+ }
+ if ( ! addedObservers.isEmpty()) {
+ addChange("Les observateurs associés à la ligne sont " + StringUtils.join(addedObservers, ", "));
+ }
+ }
+ }
+
+ protected void compareObservationUnits() {
+ if (oldRow == null || oldRow.getObservationUnit() == null) {
+ addChange("L'unité d'observation associée est " + newRow.getObservationUnit().getDescription());
+ } else if ( ! newRow.getObservationUnit().equals(oldRow.getObservationUnit())) {
+ addChange("L'unité d'observation passe de '" + oldRow.getObservationUnit().getDescription()
+ + " à " + newRow.getObservationUnit().getDescription());
+ }
+ }
+
+ protected void compareBoats() {
+ if (oldRow == null || oldRow.getBoat() == null) {
+ addChange("Le navire associé est " + newRow.getBoat().getDescription());
+ } else if ( ! newRow.getBoat().equals(oldRow.getBoat())) {
+ addChange("Le navire associé passe de " + oldRow.getBoat().getDescription()
+ + " à " + newRow.getBoat().getDescription());
+ }
+ }
+
+ protected void compareBlankRows() {
+ if (oldRow == null || oldRow.isBlankRow() != newRow.isBlankRow()) {
+ if (newRow.isBlankRow()) {
+ addChange("La ligne devient réalisée sans contacts");
+ } else {
+ addChange("La ligne devient n'est plus réalisée sans contacts");
+ }
+ }
+ }
+
+ /** Compare a sample row before and after its modifications and generate
+ * a differences summary and save it by setting log text.
+ */
+ public void setLogText(SampleRow oldRow, SampleRow newRow) {
+
+ if (newRow == null) {
+ throw new IllegalArgumentException("newRow is null");
+ }
+
+ if (oldRow != null) {
+ // it's a non-sense to compare two rows of two different programs
+ // or two rows distinct from a business PoV
+ boolean comparable = oldRow.getCode().equals(newRow.getCode())
+ && oldRow.getObsProgram().equals(newRow.getObsProgram());
+
+ if ( ! comparable) {
+ throw new IllegalArgumentException("given rows are not comparable");
+ }
+ }
+
+ this.oldRow = oldRow;
+ this.newRow = newRow;
+
+ ObsProgram obsProgram = newRow.getObsProgram();
+ if (ObsProgram.OBSMER.equals(obsProgram)) {
+ compareNbObservers();
+ compareAverageTidesTimes();
+ comparePrograms();
+ comparePeriods();
+ compareProfession();
+ compareSampleMonths();
+ compareEligibleBoats();
+ compareFishingZones();
+ }
+ if (ObsProgram.OBSVENTE.equals(obsProgram)) {
+ compareTerrestrialDistricts();
+ comparePrograms();
+ comparePeriods();
+ compareProfession();
+ compareSampleMonths();
+ compareEligibleBoats();
+ compareFishingZones();
+ compareAverageObservationsCount();
+ }
+ if (ObsProgram.OBSDEB.equals(obsProgram)) {
+ compareDays();
+ if (newRow.isPhoneCall()) {
+ compareBoats();
+ compareTerrestrialLocations();
+ } else {
+ compareObservationUnits();
+ }
+ compareObservers();
+ compareBlankRows();
+ }
+ compareCompanies();
+
+ this.oldRow = null;
+ this.newRow = null;
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowLogImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowLogImpl.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SamplingStrategy.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/bean/SamplingStrategy.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SamplingStrategy.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SamplingStrategy.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,52 @@
+/*
+ * #%L
+ * Wao :: Business
+ * %%
+ * Copyright (C) 2009 - 2011 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+import static org.nuiton.i18n.I18n.n_;
+
+public enum SamplingStrategy {
+
+ SIMULTANEOUS_G1_SPECIES(n_("SamplingStrategy.SIMULTANEOUS_G1_SPECIES")),
+ SIMULTANEOUS_G1_G2_SPECIES(n_("SamplingStrategy.SIMULTANEOUS_G1_G2_SPECIES")),
+ SIMULTANEOUS_ALL_SPECIES(n_("SamplingStrategy.SIMULTANEOUS_ALL_SPECIES")),
+ SPECIFIC_STOCK(n_("SamplingStrategy.SPECIFIC_STOCK"));
+
+ protected String i18nKey;
+
+ SamplingStrategy(String i18nKey) {
+ this.i18nKey = i18nKey;
+ }
+
+ public static SamplingStrategy valueOf(int samplingStrategyOrdinal) {
+ for (SamplingStrategy samplingStrategy : values()) {
+ if (samplingStrategy.ordinal() == samplingStrategyOrdinal) {
+ return samplingStrategy;
+ }
+ }
+ throw new IllegalArgumentException("ordinal " + samplingStrategyOrdinal);
+ }
+
+ @Override
+ public String toString() {
+ // return WaoUtils._(i18nKey);
+ throw new UnsupportedOperationException();
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SamplingStrategy.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/bean/SamplingStrategy.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SeaboardGeoPoint.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/SeaboardGeoPoint.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SeaboardGeoPoint.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SeaboardGeoPoint.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,91 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+import org.apache.commons.lang3.ObjectUtils;
+
+/**
+ * Adapteur pour avoir un GeoPoint correspondant à une façade maritime
+ */
+public class SeaboardGeoPoint implements GeoPoint {
+
+ /** L'adapté. */
+ protected TerrestrialLocation terrestrialLocation;
+
+ protected Double latitude;
+
+ protected Double longitude;
+
+ public SeaboardGeoPoint(TerrestrialLocation terrestrialLocation) {
+ this.terrestrialLocation = terrestrialLocation;
+ // Gestion de l'absence d'information, si on a pas les coordonnées
+ // de la façade maritime, on place le point sur le quartier maritime
+ // qui en fait parti (donc pas trop loin de la vérité)
+ if (terrestrialLocation.getSeaboardLatitude() == null || terrestrialLocation.getSeaboardLongitude() == null) {
+ latitude = terrestrialLocation.getDistrictLatitude();
+ longitude = terrestrialLocation.getDistrictLongitude();
+ } else {
+ latitude = terrestrialLocation.getSeaboardLatitude();
+ longitude = terrestrialLocation.getSeaboardLongitude();
+ }
+ }
+
+ public Double getLatitude() {
+ return latitude;
+ }
+
+ public Double getLongitude() {
+ return longitude;
+ }
+
+ @Override
+ public String getCode() {
+ return terrestrialLocation.getSeaboardCode();
+ }
+
+ @Override
+ public String getName() {
+ return terrestrialLocation.getSeaboardName();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return obj != null && obj instanceof SeaboardGeoPoint &&
+ ObjectUtils.equals(getCode(), ((SeaboardGeoPoint) obj).getCode());
+ }
+
+ @Override
+ public int hashCode() {
+ return getCode().hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return "SeaboardGeoPoint{" +
+ "code=" + getCode() +
+ "name=" + getName() +
+ "terrestrialLocation=" + terrestrialLocation +
+ '}';
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SeaboardGeoPoint.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/SeaboardGeoPoint.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SynthesisId.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/bean/SynthesisId.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SynthesisId.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SynthesisId.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,81 @@
+/*
+ * #%L
+ * Wao :: Web Interface
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * SynthesisID
+ *
+ * Created: 9 févr. 2010
+ *
+ * @author fdesbois <fdesbois(a)codelutin.com>
+ */
+public enum SynthesisId {
+
+ /** */
+ GRAPH_SAMPLING(n_("SynthesisId.GRAPH_SAMPLING")),
+
+ /** */
+ GRAPH_BOARDING(n_("SynthesisId.GRAPH_BOARDING")),
+
+ /** */
+ IND_COMPLIANCE_BOARDING(n_("SynthesisId.IND_COMPLIANCE_BOARDING")),
+
+ /** */
+ IND_CONTACT_STATE(n_("SynthesisId.IND_CONTACT_STATE")),
+
+ /** */
+ IND_ALLEGRO_REACTIVITY(n_("SynthesisId.IND_ALLEGRO_REACTIVITY")),
+
+ /** */
+ IND_DATA_RELIABILITY(n_("SynthesisId.IND_DATA_RELIABILITY")),
+
+ /** ObsDeb, number of observations per hour of the day */
+ OBSERVATION_HOUR(n_("SynthesisId.OBSERVATION_HOUR")),
+
+ /** ObsDeb, number of distinct boats observed by month */
+ DISTINCT_BOATS_COUNTS(n_("SynthesisId.DISTINCT_BOATS_COUNTS"));
+
+ /** An i18n key to make enumeration printable in logs and UI. */
+ protected String i18nKey;
+
+ SynthesisId(String i18nKey) {
+ this.i18nKey = i18nKey;
+ }
+
+ public static SynthesisId valueOf(int ordinal) {
+ for (SynthesisId synthesisId : SynthesisId.values()) {
+ if (synthesisId.ordinal() == ordinal) {
+ return synthesisId;
+ }
+ }
+ return null;
+ }
+
+ public String toString() {
+ // return WaoUtils._(i18nKey);
+ throw new UnsupportedOperationException();
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SynthesisId.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/bean/SynthesisId.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,57 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+
+/**
+ * @author bleny
+ */
+public class TargetSpeciesDCFImpl extends TargetSpeciesDCFAbstract {
+
+ public TargetSpeciesDCFImpl() {
+ super();
+ }
+
+ public TargetSpeciesDCFImpl(String code) {
+ super();
+ setCode(code);
+ }
+
+ @Override
+ public String getDescription() {
+ // return WaoUtils._(TargetSpeciesDCF.class.getName() + "." + getCode());
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String getFullDescription() {
+ return String.format("%s (%s)", getCode(), getDescription());
+ }
+
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this);
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TerrestrialDivisionImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/TerrestrialDivisionImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TerrestrialDivisionImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TerrestrialDivisionImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,50 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2011 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+public class TerrestrialDivisionImpl extends TerrestrialDivisionAbstract {
+
+ @Override
+ public boolean isObservationUnit() {
+ return getCode() == null && getPort() == null;
+ }
+
+ @Override
+ public String getDescription() {
+ String description;
+ if (isObservationUnit()) {
+ description = getRegionIfremer().getRegionIfremerCode() + "-" +
+ getObservationUnitCode() + " " + getObservationUnitName();
+ } else {
+ description = getPort().getPortName();
+ }
+ return description;
+ }
+
+ @Override
+ public String toString() {
+ return getDescription();
+ }
+
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TerrestrialDivisionImpl.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/TerrestrialDivisionImpl.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TerrestrialLocationImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/TerrestrialLocationImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TerrestrialLocationImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TerrestrialLocationImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,104 @@
+/*
+ * #%L
+ * Wao :: Business
+ * %%
+ * Copyright (C) 2009 - 2011 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+public class TerrestrialLocationImpl extends TerrestrialLocationAbstract {
+
+ @Override
+ public LocationType getLocationType() {
+ return LocationType.valueOf(getLocationTypeOrdinal());
+ }
+
+ @Override
+ public void setLocationType(LocationType locationType) {
+ if (locationType == null) {
+ setLocationTypeOrdinal(null);
+ } else {
+ setLocationTypeOrdinal(locationType.ordinal());
+ }
+ }
+
+ @Override
+ public String getDistrictName() {
+ String districtName = super.getDistrictName();
+ if (districtName == null) {
+ // districtName = WaoUtils._("wao.business.other");
+ throw new UnsupportedOperationException();
+ }
+ return districtName;
+ }
+
+ @Override
+ public boolean isDistrict() {
+ boolean isDistrict = getLocationType() == LocationType.DISTRICT;
+ return isDistrict;
+ }
+
+ @Override
+ public boolean isRegion() {
+ boolean isRegion = getLocationType() == LocationType.REGION;
+ return isRegion;
+ }
+
+ /**
+ * Get a description of the location like « Maracaibo (Port, Venezuela) »
+ */
+ public String getDescription() {
+ StringBuilder description = new StringBuilder();
+ if (isRegion()) {
+ description.append(getRegionIfremerName());
+ if (getCountryName() != null) {
+ description.append(" (").append(getCountryName()).append(")");
+ }
+ } else {
+ if (isDistrict()) {
+ description.append(getDistrictName()).append(" (")
+ .append(getDistrictCode()).append(", ");
+ } else { // it's a port or an auction
+ description.append(getName()).append(" (")
+ .append(getCode()).append(", ")
+ .append(getLocationType()).append(", ");
+ // add the port name only if it's different of the name
+ // because most of the time it's redundant
+ if (getPortName() != null && ! getPortName().equals(getName())) {
+ description.append(getPortName()).append(", ");
+ }
+ }
+
+ if (getRegionName() == null) {
+ description.append(getCountryName());
+ } else {
+ description.append(getRegionName());
+ }
+
+ description.append(")");
+ }
+ return description.toString();
+ }
+
+ @Override
+ public String toString() {
+ String toString = ToStringBuilder.reflectionToString(this);
+ return toString;
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TerrestrialLocationImpl.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/TerrestrialLocationImpl.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/UserProfileImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/UserProfileImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/UserProfileImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/UserProfileImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,140 @@
+/*
+ * #%L
+ * Wao :: Business
+ * %%
+ * Copyright (C) 2009 - 2011 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.entity;
+
+import java.util.UUID;
+
+public class UserProfileImpl extends UserProfileAbstract {
+
+ public UserProfileImpl() {
+ String newToken = UUID.randomUUID().toString();
+ setToken(newToken);
+ }
+
+ public UserProfileImpl(ObsProgram obsProgram, UserRole userRole, boolean canWrite) {
+ this();
+ setObsProgram(obsProgram);
+ setUserRole(userRole);
+ setCanWrite(canWrite);
+ }
+
+ @Override
+ public UserRole getUserRole() {
+ return UserRole.valueOf(getUserRoleOrdinal());
+ }
+
+ @Override
+ public void setUserRole(UserRole userRole) {
+ if (userRole == null) {
+ setUserRoleOrdinal(null);
+ } else {
+ setUserRoleOrdinal(userRole.ordinal());
+ }
+ }
+
+ @Override
+ public ObsProgram getObsProgram() {
+ return ObsProgram.valueOf(getObsProgramOrdinal());
+ }
+
+ @Override
+ public void setObsProgram(ObsProgram obsProgram) {
+ setObsProgramOrdinal(obsProgram.ordinal());
+ }
+
+ @Override
+ public boolean isAdmin() {
+ return getUserRole() == UserRole.ADMIN;
+ }
+
+ @Override
+ public boolean isCoordinator() {
+ return getUserRole() == UserRole.COORDINATOR;
+ }
+
+ @Override
+ public boolean isCoordinatorOrObserver() {
+ return isCoordinator() || isObserver();
+ }
+
+ @Override
+ public boolean isObserver() {
+ return getUserRole() == UserRole.OBSERVER;
+ }
+
+ @Override
+ public boolean isProfessional() {
+ return getUserRole() == UserRole.PROFESSIONAL;
+ }
+
+ @Override
+ public boolean isGuest() {
+ return getUserRole() == UserRole.GUEST;
+ }
+
+ @Override
+ public boolean isReadOnly() {
+ return ! getCanWrite();
+ }
+
+ @Override
+ public boolean isObsMer() {
+ return getObsProgram() == ObsProgram.OBSMER;
+ }
+
+ @Override
+ public boolean isObsVente() {
+ return getObsProgram() == ObsProgram.OBSVENTE;
+ }
+
+ @Override
+ public String getDescription() {
+ String role;
+ if (getUserRoleOrdinal() == null) {
+ role = "<no user role>";
+ } else {
+ role = getUserRole().getTranslation();
+ }
+ String program;
+ if (getObsProgramOrdinal() == null) {
+ program = "<no program>";
+ } else {
+ program = getObsProgram().toString();
+ }
+ String readOnly = "";
+ if (getCanWrite() == null) {
+ program = "<no write access specified>";
+ } else if (isReadOnly()) {
+ // readOnly = WaoUtils._("wao.business.readOnly");
+ throw new UnsupportedOperationException();
+ }
+
+// String result = WaoUtils._("wao.business.entity.UserProfile.description",
+// role, program, readOnly);
+ throw new UnsupportedOperationException();
+
+// return result;
+ }
+
+ public String toString() {
+ return getDescription() + " " + getTopiaId();
+ }
+}
\ No newline at end of file
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/UserProfileImpl.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/UserProfileImpl.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/UserRole.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/bean/UserRole.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/UserRole.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/UserRole.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,100 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.wao.entity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * Enumeration used as roles for {@link WaoUser}. Methods is available in WaoUser
+ * to use this enum like a property of the entity.
+ *
+ * Created: 24 mars 2010
+ *
+ * @author fdesbois <fdesbois(a)codelutin.com>
+ * @author tchemit <tchemit(a)codelutin.com>
+ * @version $Id$
+ */
+public enum UserRole {
+ /** Admin role **/
+ ADMIN(n_("UserRole.ADMIN")),
+ /** User/observer role **/
+ OBSERVER(n_("UserRole.OBSERVER")),
+ /** Coordinator role **/
+ COORDINATOR(n_("UserRole.COORDINATOR")),
+ /** Guest role **/
+ GUEST(n_("UserRole.GUEST")),
+ /** Professional role **/
+ PROFESSIONAL(n_("UserRole.PROFESSIONAL"));
+
+ protected String i18nKey;
+
+ UserRole(String i18nKey) {
+ this.i18nKey = i18nKey;
+ }
+
+ public static UserRole valueOf(int userRoleOrdinal) {
+ for (UserRole userRole : values()) {
+ if (userRole.ordinal() == userRoleOrdinal) {
+ return userRole;
+ }
+ }
+ throw new IllegalArgumentException("ordinal " + userRoleOrdinal);
+ }
+
+ // bleny 2011-01-26 calling this method toString make UI unstable.
+ // In Administration form, when choosing a role, changing the form value lead to
+ // an Enum.valueOf exception. It seems that Tapestry use toString()
+ // instead of name() to know witch value is chosen
+ public String getTranslation() {
+ throw new UnsupportedOperationException();
+ // return WaoUtils._(i18nKey);
+ }
+
+ /** for a given program, return the roles that can be assigned by someone
+ * who own the role <code>userRole</code>
+ * @param obsProgram available roles depends on the program
+ * @param userRole role of the user who want to grant rights
+ * @return roles that the user can affect
+ */
+ public static UserRole[] getAllowedRoles(ObsProgram obsProgram, UserRole userRole) {
+ List<UserRole> allowedRoles = new ArrayList<UserRole>();
+ allowedRoles.add(UserRole.COORDINATOR);
+ allowedRoles.add(UserRole.OBSERVER);
+ if (userRole.equals(UserRole.ADMIN)) {
+ allowedRoles.add(UserRole.ADMIN);
+ if ( ! obsProgram.equals(ObsProgram.OBSDEB)) {
+ allowedRoles.add(UserRole.GUEST);
+ }
+ if (obsProgram.equals(ObsProgram.OBSMER)) {
+ allowedRoles.add(UserRole.PROFESSIONAL);
+ }
+ }
+ UserRole[] result = allowedRoles.toArray(new UserRole[allowedRoles.size()]);
+ return result;
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/UserRole.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/bean/UserRole.java:679-733
Copied: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/WaoUserImpl.java (from rev 1675, tags/wao-3.4.1/wao-business/src/main/java/fr/ifremer/wao/entity/WaoUserImpl.java)
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/WaoUserImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/WaoUserImpl.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,93 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.wao.entity;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * UserImpl
+ *
+ * Created: 27 nov. 2009
+ *
+ * @author fdesbois <fdesbois(a)codelutin.com>
+ */
+public class WaoUserImpl extends WaoUserAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Return the fullName of the user, i.e. fisrtName + lastName.
+ * @return a String for the user fullName
+ */
+ @Override
+ public String getFullName() {
+ String name = getFirstName() != null ? getFirstName() : "";
+ name += getLastName() != null ? " " + getLastName() : "";
+ return name;
+ }
+
+ @Override
+ public boolean hasUserRole(UserRole userRole) {
+ // true if user has a profile with the role whatever the program
+ return hasUserRole(userRole, getUserProfile());
+ }
+
+ @Override
+ public boolean hasUserRole(UserRole userRole, ObsProgram obsProgram) {
+ return hasUserRole(userRole, getUserProfile(obsProgram));
+ }
+
+ protected boolean hasUserRole(UserRole userRole, Collection<UserProfile> userProfiles) {
+ for (UserProfile profile : userProfiles) {
+ if (profile.getUserRole() == userRole) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public List<UserProfile> getUserProfile(ObsProgram obsProgram) {
+ List<UserProfile> userProfiles = new ArrayList<UserProfile>();
+ if (getUserProfile() != null) {
+ for (UserProfile userProfile : getUserProfile()) {
+ if (userProfile.getObsProgram().equals(obsProgram)) {
+ userProfiles.add(userProfile);
+ }
+ }
+ }
+ return userProfiles;
+ }
+
+ @Override
+ public void clearUserProfile(ObsProgram obsProgram) {
+ List<UserProfile> userProfiles = getUserProfile(obsProgram);
+ for (UserProfile userProfile : userProfiles) {
+ removeUserProfile(userProfile);
+ }
+ }
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/WaoUserImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/entity/WaoUserImpl.java:679-733
Added: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/WaoUserTopiaDao.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/WaoUserTopiaDao.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/WaoUserTopiaDao.java 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,19 @@
+package fr.ifremer.wao.entity;
+
+import com.google.common.base.Optional;
+
+public class WaoUserTopiaDao extends AbstractWaoUserTopiaDao<WaoUser> {
+
+ public Optional<WaoUser> tryFindByEmailAndFetchCollections(String email) {
+ Optional<WaoUser> extranetUserOptional = forLoginEquals(email).tryFindUnique();
+ if (extranetUserOptional.isPresent()) {
+ WaoUser waoUser = extranetUserOptional.get();
+ // fetch the lazy collections to avoid lazy initialisation exception
+ waoUser.sizeAllegroWallet();
+ waoUser.sizeCanReadBoats();
+ waoUser.sizeUserProfile();
+ }
+ return extranetUserOptional;
+ }
+
+} //WaoUserTopiaDao
Property changes on: trunk/wao-persistence/src/main/resources
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/resources:679-733
Added: trunk/wao-persistence/src/main/resources/wao.properties
===================================================================
--- trunk/wao-persistence/src/main/resources/wao.properties (rev 0)
+++ trunk/wao-persistence/src/main/resources/wao.properties 2014-01-24 10:40:38 UTC (rev 1676)
@@ -0,0 +1,17 @@
+hibernate.connection.driver_class=org.h2.Driver
+hibernate.connection.url=jdbc:h2:file:/tmp/extranet-enc-ahi/h2data
+hibernate.connection.username=sa
+hibernate.connection.password=
+
+hibernate.dialect=org.hibernate.dialect.H2Dialect
+hibernate.hbm2ddl.auto=update
+hibernate.show_sql=false
+hibernate.format_sql=true
+hibernate.ejb.naming_strategy=org.hibernate.cfg.ImprovedNamingStrategy
+
+hibernate.c3p0.min_size=5
+hibernate.c3p0.max_size=20
+hibernate.c3p0.timeout=1800
+hibernate.c3p0.max_statements=50
+
+# hibernate.connection.provider_class=org.nuiton.topia.framework.TopiaConnectionProvider
Property changes on: trunk/wao-persistence/src/main/xmi
___________________________________________________________________
Added: svn:ignore
+ suiviobsmer.zargo#
Added: svn:mergeinfo
+ /branches/wao-1.5.x/wao-business/src/main/xmi:679-733
Modified: trunk/wao-persistence/src/main/xmi/wao.zargo
===================================================================
(Binary files differ)
1
0
Author: tchemit
Date: 2014-01-07 15:27:46 +0100 (Tue, 07 Jan 2014)
New Revision: 1675
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1675
Log:
create trunk
Added:
trunk/
1
0
Author: tchemit
Date: 2014-01-07 15:26:43 +0100 (Tue, 07 Jan 2014)
New Revision: 1674
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1674
Log:
remove trunk
Removed:
trunk/
1
0
07 Jun '13
Author: maven-release
Date: 2013-06-07 16:33:40 +0200 (Fri, 07 Jun 2013)
New Revision: 1673
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1673
Log:
[maven-release-plugin] prepare for next development iteration
Modified:
trunk/pom.xml
trunk/wao-business/pom.xml
trunk/wao-ui/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-06-07 14:33:32 UTC (rev 1672)
+++ trunk/pom.xml 2013-06-07 14:33:40 UTC (rev 1673)
@@ -15,7 +15,7 @@
<groupId>fr.ifremer</groupId>
<artifactId>wao</artifactId>
- <version>3.4.1</version>
+ <version>3.5-SNAPSHOT</version>
<modules>
<module>wao-business</module>
@@ -355,12 +355,12 @@
<scm>
<connection>
- scm:svn:http://svn.forge.codelutin.com/svn/wao/tags/wao-3.4.1
+ scm:svn:http://svn.forge.codelutin.com/svn/wao/trunk
</connection>
<developerConnection>
- scm:svn:http://svn.forge.codelutin.com/svn/wao/tags/wao-3.4.1
+ scm:svn:http://svn.forge.codelutin.com/svn/wao/trunk
</developerConnection>
- <url>http://forge.codelutin.com/repositories/browse/wao/tags/wao-3.4.1</url>
+ <url>http://forge.codelutin.com/repositories/browse/wao/trunk</url>
</scm>
<distributionManagement>
Modified: trunk/wao-business/pom.xml
===================================================================
--- trunk/wao-business/pom.xml 2013-06-07 14:33:32 UTC (rev 1672)
+++ trunk/wao-business/pom.xml 2013-06-07 14:33:40 UTC (rev 1673)
@@ -10,7 +10,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>wao</artifactId>
- <version>3.4.1</version>
+ <version>3.5-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.wao</groupId>
Modified: trunk/wao-ui/pom.xml
===================================================================
--- trunk/wao-ui/pom.xml 2013-06-07 14:33:32 UTC (rev 1672)
+++ trunk/wao-ui/pom.xml 2013-06-07 14:33:40 UTC (rev 1673)
@@ -10,7 +10,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>wao</artifactId>
- <version>3.4.1</version>
+ <version>3.5-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.wao</groupId>
1
0
Author: maven-release
Date: 2013-06-07 16:33:32 +0200 (Fri, 07 Jun 2013)
New Revision: 1672
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1672
Log:
[maven-release-plugin] copy for tag wao-3.4.1
Added:
tags/wao-3.4.1/
Property changes on: tags/wao-3.4.1
___________________________________________________________________
Added: svn:ignore
+ *.ipr
*.iws
*.iml
*.idea
target
nbactions.xml
Added: svn:mergeinfo
+ /branches/wao-1.5.x:679-733
1
0
07 Jun '13
Author: maven-release
Date: 2013-06-07 16:33:24 +0200 (Fri, 07 Jun 2013)
New Revision: 1671
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1671
Log:
[maven-release-plugin] prepare release wao-3.4.1
Modified:
trunk/pom.xml
trunk/wao-business/pom.xml
trunk/wao-ui/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-06-07 14:26:24 UTC (rev 1670)
+++ trunk/pom.xml 2013-06-07 14:33:24 UTC (rev 1671)
@@ -15,7 +15,7 @@
<groupId>fr.ifremer</groupId>
<artifactId>wao</artifactId>
- <version>3.4.1-SNAPSHOT</version>
+ <version>3.4.1</version>
<modules>
<module>wao-business</module>
@@ -355,12 +355,12 @@
<scm>
<connection>
- scm:svn:http://svn.forge.codelutin.com/svn/wao/trunk
+ scm:svn:http://svn.forge.codelutin.com/svn/wao/tags/wao-3.4.1
</connection>
<developerConnection>
- scm:svn:http://svn.forge.codelutin.com/svn/wao/trunk
+ scm:svn:http://svn.forge.codelutin.com/svn/wao/tags/wao-3.4.1
</developerConnection>
- <url>http://forge.codelutin.com/repositories/browse/wao/trunk</url>
+ <url>http://forge.codelutin.com/repositories/browse/wao/tags/wao-3.4.1</url>
</scm>
<distributionManagement>
Modified: trunk/wao-business/pom.xml
===================================================================
--- trunk/wao-business/pom.xml 2013-06-07 14:26:24 UTC (rev 1670)
+++ trunk/wao-business/pom.xml 2013-06-07 14:33:24 UTC (rev 1671)
@@ -10,7 +10,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>wao</artifactId>
- <version>3.4.1-SNAPSHOT</version>
+ <version>3.4.1</version>
</parent>
<groupId>fr.ifremer.wao</groupId>
Modified: trunk/wao-ui/pom.xml
===================================================================
--- trunk/wao-ui/pom.xml 2013-06-07 14:26:24 UTC (rev 1670)
+++ trunk/wao-ui/pom.xml 2013-06-07 14:33:24 UTC (rev 1671)
@@ -10,7 +10,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>wao</artifactId>
- <version>3.4.1-SNAPSHOT</version>
+ <version>3.4.1</version>
</parent>
<groupId>fr.ifremer.wao</groupId>
1
0
Author: bleny
Date: 2013-06-07 16:26:24 +0200 (Fri, 07 Jun 2013)
New Revision: 1670
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1670
Log:
pom versions to 3.4.1 according to roadmap
Modified:
trunk/pom.xml
trunk/wao-business/pom.xml
trunk/wao-ui/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-06-07 08:14:31 UTC (rev 1669)
+++ trunk/pom.xml 2013-06-07 14:26:24 UTC (rev 1670)
@@ -15,7 +15,7 @@
<groupId>fr.ifremer</groupId>
<artifactId>wao</artifactId>
- <version>3.5-SNAPSHOT</version>
+ <version>3.4.1-SNAPSHOT</version>
<modules>
<module>wao-business</module>
Modified: trunk/wao-business/pom.xml
===================================================================
--- trunk/wao-business/pom.xml 2013-06-07 08:14:31 UTC (rev 1669)
+++ trunk/wao-business/pom.xml 2013-06-07 14:26:24 UTC (rev 1670)
@@ -10,7 +10,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>wao</artifactId>
- <version>3.5-SNAPSHOT</version>
+ <version>3.4.1-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.wao</groupId>
Modified: trunk/wao-ui/pom.xml
===================================================================
--- trunk/wao-ui/pom.xml 2013-06-07 08:14:31 UTC (rev 1669)
+++ trunk/wao-ui/pom.xml 2013-06-07 14:26:24 UTC (rev 1670)
@@ -10,7 +10,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>wao</artifactId>
- <version>3.5-SNAPSHOT</version>
+ <version>3.4.1-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.wao</groupId>
1
0
r1669 - trunk/wao-business/src/main/java/fr/ifremer/wao/service
by bleny@users.forge.codelutin.com 07 Jun '13
by bleny@users.forge.codelutin.com 07 Jun '13
07 Jun '13
Author: bleny
Date: 2013-06-07 10:14:31 +0200 (Fri, 07 Jun 2013)
New Revision: 1669
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1669
Log:
fixes #2611
Modified:
trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java 2013-05-31 13:23:24 UTC (rev 1668)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java 2013-06-07 08:14:31 UTC (rev 1669)
@@ -1176,8 +1176,15 @@
throw new IllegalStateException(contactState + " should not lead to a mail sent");
}
- for (WaoUser observer : contactReloaded.getAllObservers()) {
+ // in obsvente, only the main observer
+ List<WaoUser> observers = new LinkedList<WaoUser>();
+ observers.add(contactReloaded.getMainObserver());
+ if (obsProgram == ObsProgram.OBSMER && contactReloaded.getSecondaryObservers() != null) {
+ observers.addAll(contactReloaded.getSecondaryObservers());
+ }
+ for (WaoUser observer : observers) {
+
boolean boatAlreadyInWallet = observer.getAllegroWalletByTopiaId(boatId) != null;
if (boatAlreadyInWallet) {
1
0
r1668 - trunk/wao-business/src/main/java/fr/ifremer/wao/service
by bleny@users.forge.codelutin.com 31 May '13
by bleny@users.forge.codelutin.com 31 May '13
31 May '13
Author: bleny
Date: 2013-05-31 15:23:24 +0200 (Fri, 31 May 2013)
New Revision: 1668
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1668
Log:
fixes #2512
Modified:
trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java 2013-05-26 06:58:33 UTC (rev 1667)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java 2013-05-31 13:23:24 UTC (rev 1668)
@@ -1206,7 +1206,7 @@
"Merci d'ajouter le navire \"%d\" au portefeuille ALLEGRO de l'observateur %s %s %s.\n\n" +
"%s.\n\n" +
"Cordialement,\n\n" +
- "L'équipe Obsmer",
+ "Wao",
boat.getImmatriculation(),
observer.getFullName(),
observer.getCompany().getName(),
1
0
Author: tchemit
Date: 2013-05-26 08:58:33 +0200 (Sun, 26 May 2013)
New Revision: 1667
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1667
Log:
updates mavenpom to 3.4.11
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-05-16 13:21:33 UTC (rev 1666)
+++ trunk/pom.xml 2013-05-26 06:58:33 UTC (rev 1667)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>3.4.9</version>
+ <version>3.4.11</version>
</parent>
<groupId>fr.ifremer</groupId>
1
0