cleanup
authorAndreas Müller <a.mueller@bgbm.org>
Tue, 30 Jan 2018 12:50:48 +0000 (13:50 +0100)
committerAndreas Müller <a.mueller@bgbm.org>
Tue, 30 Jan 2018 12:50:48 +0000 (13:50 +0100)
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/agent/Address.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/agent/Contact.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/LSID.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/location/Point.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/molecular/SequenceString.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/match/DefaultMatchStrategy.java

index 520206bd3ff848c97d6eb9cdbc43e3ce7ab4ca22..83bafe469ffa67460267e02b35744392dcc176e4 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -25,8 +25,8 @@ import org.apache.log4j.Logger;
 import org.hibernate.envers.Audited;
 
 import eu.etaxonomy.cdm.model.common.VersionableEntity;
-import eu.etaxonomy.cdm.model.location.Point;
 import eu.etaxonomy.cdm.model.location.Country;
+import eu.etaxonomy.cdm.model.location.Point;
 
 /**
  * This class represents atomized postal addresses.
@@ -36,9 +36,8 @@ import eu.etaxonomy.cdm.model.location.Country;
  * <li> Address according to the TCS
  * <li> Address according to the ABCD schema
  * </ul>
- * 
+ *
  * @author m.doering
- * @version 1.0
  * @created 08-Nov-2007 13:06:09
  */
 @XmlAccessorType(XmlAccessType.FIELD)
@@ -58,11 +57,11 @@ public class Address extends VersionableEntity implements Cloneable{
        private static final long serialVersionUID = 682106303069088972L;
        @SuppressWarnings("unused")
        private static final Logger logger = Logger.getLogger(Address.class);
-       
+
        public static Address NewInstance(){
                return new Address();
        }
-       
+
     public static Address NewInstance(Country country,
                        String locality, String pobox, String postcode,
                        String region, String street, Point location) {
@@ -71,9 +70,9 @@ public class Address extends VersionableEntity implements Cloneable{
        }
 
     private Address(){
-       
+
     }
-    
+
        private Address(Country country, String locality, Point location,
                        String pobox, String postcode, String region, String street) {
                super();
@@ -88,32 +87,32 @@ public class Address extends VersionableEntity implements Cloneable{
 
        @XmlElement(name = "POBox")
        private String pobox;
-    
+
     @XmlElement(name = "Street")
        private String street;
-    
+
     @XmlElement(name = "Postcode")
        private String postcode;
-    
+
     @XmlElement(name = "Locality", required = true)
        private String locality;
-    
+
     @XmlElement(name = "Region")
        private String region;
-    
+
     @XmlElement(name = "Country")
     @XmlIDREF
     @XmlSchemaType(name = "IDREF")
     @ManyToOne(fetch = FetchType.LAZY)
        private Country country;
-    
+
     @XmlElement(name = "Location")
        private Point location;
-       
+
        /**
         * Returns the {@link Country country} involved in <i>this</i> postal address.
-        * 
-        * @return      the country 
+        *
+        * @return      the country
         */
        public Country getCountry(){
                return this.country;
@@ -129,7 +128,7 @@ public class Address extends VersionableEntity implements Cloneable{
        /**
         * Returns the geophysical {@link Point location} (coordinates) of <i>this</i> postal address.
         * The location can be useful for instance to visualize the address on a map.
-        * 
+        *
         * @return  the point corresponding to <i>this</i> address
         * @see         eu.etaxonomy.cdm.model.location.Point
         */
@@ -148,8 +147,8 @@ public class Address extends VersionableEntity implements Cloneable{
        /**
         * Returns a string corresponding to the post office box
         * involved in <i>this</i> postal address.
-        * 
-        * @return      the post office box string 
+        *
+        * @return      the post office box string
         */
        public String getPobox(){
                return this.pobox;
@@ -165,8 +164,8 @@ public class Address extends VersionableEntity implements Cloneable{
        /**
         * Returns the street name and number involved in <i>this</i> postal address.
         * Street numbers are part of the street string.
-        * 
-        * @return      the string composed of street name and number  
+        *
+        * @return      the string composed of street name and number
         */
        public String getStreet(){
                return this.street;
@@ -181,7 +180,7 @@ public class Address extends VersionableEntity implements Cloneable{
 
        /**
         * Returns the post code number involved in <i>this</i> postal address.
-        * 
+        *
         * @return      the post code number string
         */
        public String getPostcode(){
@@ -197,7 +196,7 @@ public class Address extends VersionableEntity implements Cloneable{
 
        /**
         * Returns the town (possibly with locality or suburb) involved in <i>this</i> postal address.
-        * 
+        *
         * @return  the string representing a town
         */
        public String getLocality(){
@@ -208,12 +207,12 @@ public class Address extends VersionableEntity implements Cloneable{
         * @see                 #getLocality()
         */
        public void setLocality(String locality){
-               this.locality = locality == "" ? null: locality;                
+               this.locality = locality == "" ? null: locality;
        }
 
        /**
         * Returns the region or state involved in <i>this</i> postal address.
-        * 
+        *
         * @return  the string representing a region or a state
         */
        public String getRegion(){
@@ -226,9 +225,9 @@ public class Address extends VersionableEntity implements Cloneable{
        public void setRegion(String region){
                this.region = region == "" ? null: region;
        }
-       
+
 //************************ CLONE ************************ //
-       /** 
+       /**
         * Clones this Address.
         * Set fields for nextVersion, previousVersion, updated, updatedBy and createdBy are set to <tt>null</tt>
         * The id is set to 0.
@@ -239,11 +238,11 @@ public class Address extends VersionableEntity implements Cloneable{
        @Override
        public Object clone() throws CloneNotSupportedException{
                Address result = (Address)super.clone();
-               
+
                //no changes to: -
                return result;
        }
 
-       
+
 
 }
index 5fb5c2bed6488c10a2e23e699e469baacc69637f..a27d8775bea861c7e5823319e2fa80c9e1c9016a 100644 (file)
@@ -73,33 +73,33 @@ public class Contact implements Serializable, Cloneable {
        @XmlElement(name = "EmailAddress")
        @ElementCollection(fetch = FetchType.LAZY)
        @Column(name = "contact_emailaddresses_element")
-       private List<String> emailAddresses;
+       private List<String> emailAddresses = new ArrayList<>();
 
        @XmlElementWrapper(name = "URLs", nillable = true)
        @XmlElement(name = "URL")
     @XmlSchemaType(name = "anyURI")
        @ElementCollection(fetch = FetchType.LAZY)
     @Column(name = "contact_urls_element" /*, length=330  */)  //length >255 does not work in InnoDB AUD tables for Key length of (REV, id, url) key
-       private final List<String> urls = new ArrayList<String>();
+       private final List<String> urls = new ArrayList<>();
 
        @XmlElementWrapper(name = "PhoneNumbers", nillable = true)
        @XmlElement(name = "PhoneNumber")
        @ElementCollection(fetch = FetchType.LAZY)
     @Column(name = "contact_phonenumbers_element")
        @Cascade({CascadeType.SAVE_UPDATE, CascadeType.MERGE, CascadeType.DELETE})
-       private List<String> phoneNumbers;
+       private List<String> phoneNumbers = new ArrayList<>();
 
        @XmlElementWrapper(name = "FaxNumbers", nillable = true)
        @XmlElement(name = "FaxNumber")
        @ElementCollection(fetch = FetchType.LAZY)
     @Column(name = "contact_faxnumbers_element")
-       private List<String> faxNumbers;
+       private List<String> faxNumbers = new ArrayList<>();
 
     @XmlElementWrapper(name = "Addresses", nillable = true)
     @XmlElement(name = "Address")
     @OneToMany(fetch = FetchType.LAZY, orphanRemoval=true)
        @Cascade({CascadeType.SAVE_UPDATE, CascadeType.MERGE})
-       protected Set<Address> addresses = new HashSet<Address>();
+       protected Set<Address> addresses = new HashSet<>();
 
        public static Contact NewInstance() {
                return new Contact();
@@ -168,13 +168,14 @@ public class Contact implements Serializable, Cloneable {
                return result;
        }
 
-
+// ************************ CONSTRUCTOR **************************/
        /**
         * Class constructor.
         */
        public Contact() {
        }
 
+// ************************ MERGE /MATCH ***************************/
 
        public void merge(Contact contact2) throws MergeException{
                if (contact2 != null){
@@ -185,7 +186,7 @@ public class Contact implements Serializable, Cloneable {
                        for (Address address : contact2.getAddresses()){
                                try {
                                        if (this.addresses == null){
-                                               this.addresses = new HashSet<Address>();
+                                               this.addresses = new HashSet<>();
                                        }
                                        this.addresses.add((Address)address.clone());
                                } catch (CloneNotSupportedException e) {
@@ -253,7 +254,7 @@ public class Contact implements Serializable, Cloneable {
         */
        public List<String> getEmailAddresses(){
                if(this.emailAddresses == null) {
-                       this.emailAddresses = new ArrayList<String>();
+                       this.emailAddresses = new ArrayList<>();
                }
                return this.emailAddresses;
        }
@@ -322,7 +323,7 @@ public class Contact implements Serializable, Cloneable {
         */
        public List<String> getPhoneNumbers(){
                if(this.phoneNumbers == null) {
-                       this.phoneNumbers = new ArrayList<String>();
+                       this.phoneNumbers = new ArrayList<>();
                }
                return this.phoneNumbers;
        }
@@ -350,7 +351,7 @@ public class Contact implements Serializable, Cloneable {
         */
        public List<String> getFaxNumbers(){
                if(this.faxNumbers == null) {
-                       this.faxNumbers = new ArrayList<String>();
+                       this.faxNumbers = new ArrayList<>();
                }
                return this.faxNumbers;
        }
@@ -385,7 +386,7 @@ public class Contact implements Serializable, Cloneable {
        public Object clone() {
                try{
                        Contact result = (Contact) super.clone();
-                       result.addresses = new HashSet<Address>();
+                       result.addresses = new HashSet<>();
                        for (Address adr : this.addresses){
                                result.addAddress((Address)adr.clone());
                        }
index 2824f5b9ddccd56f36be2116078426a3fff78739..d8d9e7d0038b381f3deb44770d501951337b3edc 100644 (file)
@@ -5,7 +5,7 @@
 *\r
 * The contents of this file are subject to the Mozilla Public License Version 1.1\r
 * See LICENSE.TXT at the top of this package for the full license terms.\r
-*/ \r
+*/\r
 \r
 package eu.etaxonomy.cdm.model.common;\r
 \r
@@ -14,14 +14,15 @@ import java.util.NoSuchElementException;
 import java.util.StringTokenizer;\r
 \r
 import javax.persistence.Embeddable;\r
+import javax.persistence.Transient;\r
 \r
 import com.ibm.lsid.MalformedLSIDException;\r
 \r
 /**\r
- * This class is copied from com.ibm.lsid.LSID, I needed to re-implement this since \r
+ * This class is copied from com.ibm.lsid.LSID, I needed to re-implement this since\r
  * the domain objects are required to be Serializable\r
- *  \r
- * \r
+ *\r
+ *\r
  * @author Ben Szekely (<a href="mailto:bhszekel@us.ibm.com">bhszekel@us.ibm.com</a>)\r
  * @author ben.clark\r
  * @see com.ibm.lsid.client.LSID\r
@@ -31,17 +32,17 @@ public class LSID implements Serializable {
        private static final long serialVersionUID = -3568951541851092269L;\r
 \r
        private String lsid;\r
-       \r
+\r
        private String authority;\r
-       \r
+\r
        private String namespace;\r
-       \r
+\r
        private String object;\r
-       \r
+\r
        private String revision;\r
-       \r
+\r
        private LSID() { }\r
-       \r
+\r
        /**\r
         * Construct a new LSID with the String representation.\r
         * @param String The lsid String respresentation\r
@@ -65,7 +66,7 @@ public class LSID implements Serializable {
 \r
                try {\r
                        authority = st.nextToken().toLowerCase();\r
-               } \r
+               }\r
                catch (NoSuchElementException e) {\r
                        throw new MalformedLSIDException(e, "authority not found: [" + lsid + "]");\r
                }\r
@@ -86,10 +87,10 @@ public class LSID implements Serializable {
                if (st.hasMoreTokens()) {\r
                        revision = st.nextToken();\r
                }\r
-               \r
+\r
                this.lsid = "urn:lsid:" + this.authority + ":" + this.namespace + ":" + this.object + (this.revision != null ? ":" + this.revision : "");\r
        }\r
-       \r
+\r
        /**\r
         * Construct a new LSID with the given components\r
         * @param String the authority\r
@@ -102,19 +103,21 @@ public class LSID implements Serializable {
                this.namespace = namespace;//.toLowerCase();\r
                this.object = object;//.toLowerCase();\r
                if (revision != null)\r
-                       this.revision = revision;//.toLowerCase();\r
+         {\r
+            this.revision = revision;//.toLowerCase();\r
+        }\r
                lsid = "urn:lsid:" + this.authority + ":" + this.namespace + ":" + this.object + (this.revision != null ? ":" + this.revision : "");\r
-       }       \r
-       \r
+       }\r
+\r
        /**\r
-        * Returns the lsid \r
+        * Returns the lsid\r
         * @return String The lsid String representation\r
         */\r
        public String getLsid() {\r
                return lsid;\r
        }\r
 \r
-       \r
+\r
 \r
        /**\r
         * Returns the authority component of the LSID\r
@@ -147,7 +150,7 @@ public class LSID implements Serializable {
        public String getRevision() {\r
                return revision;\r
        }\r
-       \r
+\r
        public static boolean isLsid(String strLsid){\r
                try {\r
                        //TODO use algorithm rather than exceptions\r
@@ -163,14 +166,16 @@ public class LSID implements Serializable {
         * return the string representation\r
         * @return String\r
         */\r
-       public String toString() {\r
+       @Override\r
+    public String toString() {\r
                return lsid;\r
        }\r
-       \r
+\r
        /**\r
         * Two LSIDs are equal their string representations are equal disregarding case.\r
         */\r
-       public boolean equals(Object lsid) {\r
+       @Override\r
+    public boolean equals(Object lsid) {\r
                if(this == lsid) {\r
                        return true;\r
                } else if (lsid != null && lsid instanceof LSID) {\r
index f472a5a276b0d9c680f0cb0fee89fba72c7aaa0b..cecd4f248d327e240c39d605cd34932d4d3ced9b 100644 (file)
@@ -47,7 +47,6 @@ import eu.etaxonomy.cdm.validation.Level2;
 
 /**
  * @author m.doering
- * @version 1.0
  * @created 08-Nov-2007 13:06:44
  */
 @XmlAccessorType(XmlAccessType.FIELD)
@@ -626,9 +625,6 @@ public class Point implements Cloneable, Serializable {
         return result;
     }
 
-    /* (non-Javadoc)
-     * @see java.lang.Object#toString()
-     */
     @Override
     public String toString(){
         String result = "";
index 0901572e4c415dbc9e88dcdb4a8db5ad0b401450..819f269b7064309b58657fc4f30dd713f29d2379 100644 (file)
@@ -70,7 +70,7 @@ public class SequenceString implements Cloneable, Serializable{
 \r
 // ********************* CONSTRUCTOR ********************/\r
 \r
-       private SequenceString(){};\r
+       private SequenceString(){}\r
 \r
 // ********************* GETTER / SETTER ********************/\r
 \r
index 2bf8573c1572e8794d65388cb7ae9baba18f46cc..6e1bce17fe7f5f7cfcf40a64cbeea86f7c68a01f 100644 (file)
@@ -50,7 +50,6 @@ public class DefaultMatchStrategy extends StrategyBase implements IMatchStrategy
                return new DefaultMatchStrategy(matchClazz);
        }
 
-//     protected Map<String, MatchMode> matchModeMap = new HashMap<String, MatchMode>();
        protected MatchMode defaultMatchMode = MatchMode.EQUAL;
        protected MatchMode defaultCollectionMatchMode = MatchMode.IGNORE;
        protected MatchMode defaultMatchMatchMode = MatchMode.MATCH;