Project

General

Profile

Revision f1ec80f5

IDf1ec80f5c0bab2af8d35de3c6268761cd63079a4
Parent 152082b2
Child fd48f996

Added by Andreas Müller almost 3 years ago

cleanup

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/agent/Address.java
1 1
/**
2 2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
25 25
import org.hibernate.envers.Audited;
26 26

  
27 27
import eu.etaxonomy.cdm.model.common.VersionableEntity;
28
import eu.etaxonomy.cdm.model.location.Point;
29 28
import eu.etaxonomy.cdm.model.location.Country;
29
import eu.etaxonomy.cdm.model.location.Point;
30 30

  
31 31
/**
32 32
 * This class represents atomized postal addresses.
......
36 36
 * <li> Address according to the TCS
37 37
 * <li> Address according to the ABCD schema
38 38
 * </ul>
39
 * 
39
 *
40 40
 * @author m.doering
41
 * @version 1.0
42 41
 * @created 08-Nov-2007 13:06:09
43 42
 */
44 43
@XmlAccessorType(XmlAccessType.FIELD)
......
58 57
	private static final long serialVersionUID = 682106303069088972L;
59 58
	@SuppressWarnings("unused")
60 59
	private static final Logger logger = Logger.getLogger(Address.class);
61
	
60

  
62 61
	public static Address NewInstance(){
63 62
		return new Address();
64 63
	}
65
	
64

  
66 65
    public static Address NewInstance(Country country,
67 66
			String locality, String pobox, String postcode,
68 67
			String region, String street, Point location) {
......
71 70
	}
72 71

  
73 72
    private Address(){
74
    	
73

  
75 74
    }
76
    
75

  
77 76
	private Address(Country country, String locality, Point location,
78 77
			String pobox, String postcode, String region, String street) {
79 78
		super();
......
88 87

  
89 88
	@XmlElement(name = "POBox")
90 89
	private String pobox;
91
    
90

  
92 91
    @XmlElement(name = "Street")
93 92
	private String street;
94
    
93

  
95 94
    @XmlElement(name = "Postcode")
96 95
	private String postcode;
97
    
96

  
98 97
    @XmlElement(name = "Locality", required = true)
99 98
	private String locality;
100
    
99

  
101 100
    @XmlElement(name = "Region")
102 101
	private String region;
103
    
102

  
104 103
    @XmlElement(name = "Country")
105 104
    @XmlIDREF
106 105
    @XmlSchemaType(name = "IDREF")
107 106
    @ManyToOne(fetch = FetchType.LAZY)
108 107
	private Country country;
109
    
108

  
110 109
    @XmlElement(name = "Location")
111 110
	private Point location;
112
	
111

  
113 112
	/**
114 113
	 * Returns the {@link Country country} involved in <i>this</i> postal address.
115
	 * 
116
	 * @return	the country 
114
	 *
115
	 * @return	the country
117 116
	 */
118 117
	public Country getCountry(){
119 118
		return this.country;
......
129 128
	/**
130 129
	 * Returns the geophysical {@link Point location} (coordinates) of <i>this</i> postal address.
131 130
	 * The location can be useful for instance to visualize the address on a map.
132
	 * 
131
	 *
133 132
	 * @return  the point corresponding to <i>this</i> address
134 133
	 * @see		eu.etaxonomy.cdm.model.location.Point
135 134
	 */
......
148 147
	/**
149 148
	 * Returns a string corresponding to the post office box
150 149
	 * involved in <i>this</i> postal address.
151
	 * 
152
	 * @return	the post office box string 
150
	 *
151
	 * @return	the post office box string
153 152
	 */
154 153
	public String getPobox(){
155 154
		return this.pobox;
......
165 164
	/**
166 165
	 * Returns the street name and number involved in <i>this</i> postal address.
167 166
	 * Street numbers are part of the street string.
168
	 * 
169
	 * @return	the string composed of street name and number  
167
	 *
168
	 * @return	the string composed of street name and number
170 169
	 */
171 170
	public String getStreet(){
172 171
		return this.street;
......
181 180

  
182 181
	/**
183 182
	 * Returns the post code number involved in <i>this</i> postal address.
184
	 * 
183
	 *
185 184
	 * @return	the post code number string
186 185
	 */
187 186
	public String getPostcode(){
......
197 196

  
198 197
	/**
199 198
	 * Returns the town (possibly with locality or suburb) involved in <i>this</i> postal address.
200
	 * 
199
	 *
201 200
	 * @return  the string representing a town
202 201
	 */
203 202
	public String getLocality(){
......
208 207
	 * @see			#getLocality()
209 208
	 */
210 209
	public void setLocality(String locality){
211
		this.locality = locality == "" ? null: locality;		
210
		this.locality = locality == "" ? null: locality;
212 211
	}
213 212

  
214 213
	/**
215 214
	 * Returns the region or state involved in <i>this</i> postal address.
216
	 * 
215
	 *
217 216
	 * @return  the string representing a region or a state
218 217
	 */
219 218
	public String getRegion(){
......
226 225
	public void setRegion(String region){
227 226
		this.region = region == "" ? null: region;
228 227
	}
229
	
228

  
230 229
//************************ CLONE ************************ //
231
	/** 
230
	/**
232 231
	 * Clones this Address.
233 232
	 * Set fields for nextVersion, previousVersion, updated, updatedBy and createdBy are set to <tt>null</tt>
234 233
	 * The id is set to 0.
......
239 238
	@Override
240 239
	public Object clone() throws CloneNotSupportedException{
241 240
		Address result = (Address)super.clone();
242
		
241

  
243 242
		//no changes to: -
244 243
		return result;
245 244
	}
246 245

  
247
	
246

  
248 247

  
249 248
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/agent/Contact.java
73 73
	@XmlElement(name = "EmailAddress")
74 74
	@ElementCollection(fetch = FetchType.LAZY)
75 75
	@Column(name = "contact_emailaddresses_element")
76
	private List<String> emailAddresses;
76
	private List<String> emailAddresses = new ArrayList<>();
77 77

  
78 78
	@XmlElementWrapper(name = "URLs", nillable = true)
79 79
	@XmlElement(name = "URL")
80 80
    @XmlSchemaType(name = "anyURI")
81 81
	@ElementCollection(fetch = FetchType.LAZY)
82 82
    @Column(name = "contact_urls_element" /*, length=330  */)  //length >255 does not work in InnoDB AUD tables for Key length of (REV, id, url) key
83
	private final List<String> urls = new ArrayList<String>();
83
	private final List<String> urls = new ArrayList<>();
84 84

  
85 85
	@XmlElementWrapper(name = "PhoneNumbers", nillable = true)
86 86
	@XmlElement(name = "PhoneNumber")
87 87
	@ElementCollection(fetch = FetchType.LAZY)
88 88
    @Column(name = "contact_phonenumbers_element")
89 89
	@Cascade({CascadeType.SAVE_UPDATE, CascadeType.MERGE, CascadeType.DELETE})
90
	private List<String> phoneNumbers;
90
	private List<String> phoneNumbers = new ArrayList<>();
91 91

  
92 92
	@XmlElementWrapper(name = "FaxNumbers", nillable = true)
93 93
	@XmlElement(name = "FaxNumber")
94 94
	@ElementCollection(fetch = FetchType.LAZY)
95 95
    @Column(name = "contact_faxnumbers_element")
96
	private List<String> faxNumbers;
96
	private List<String> faxNumbers = new ArrayList<>();
97 97

  
98 98
    @XmlElementWrapper(name = "Addresses", nillable = true)
99 99
    @XmlElement(name = "Address")
100 100
    @OneToMany(fetch = FetchType.LAZY, orphanRemoval=true)
101 101
	@Cascade({CascadeType.SAVE_UPDATE, CascadeType.MERGE})
102
	protected Set<Address> addresses = new HashSet<Address>();
102
	protected Set<Address> addresses = new HashSet<>();
103 103

  
104 104
	public static Contact NewInstance() {
105 105
		return new Contact();
......
168 168
		return result;
169 169
	}
170 170

  
171

  
171
// ************************ CONSTRUCTOR **************************/
172 172
	/**
173 173
	 * Class constructor.
174 174
	 */
175 175
	public Contact() {
176 176
	}
177 177

  
178
// ************************ MERGE /MATCH ***************************/
178 179

  
179 180
	public void merge(Contact contact2) throws MergeException{
180 181
		if (contact2 != null){
......
185 186
			for (Address address : contact2.getAddresses()){
186 187
				try {
187 188
					if (this.addresses == null){
188
						this.addresses = new HashSet<Address>();
189
						this.addresses = new HashSet<>();
189 190
					}
190 191
					this.addresses.add((Address)address.clone());
191 192
				} catch (CloneNotSupportedException e) {
......
253 254
	 */
254 255
	public List<String> getEmailAddresses(){
255 256
		if(this.emailAddresses == null) {
256
			this.emailAddresses = new ArrayList<String>();
257
			this.emailAddresses = new ArrayList<>();
257 258
		}
258 259
		return this.emailAddresses;
259 260
	}
......
322 323
	 */
323 324
	public List<String> getPhoneNumbers(){
324 325
		if(this.phoneNumbers == null) {
325
			this.phoneNumbers = new ArrayList<String>();
326
			this.phoneNumbers = new ArrayList<>();
326 327
		}
327 328
		return this.phoneNumbers;
328 329
	}
......
350 351
	 */
351 352
	public List<String> getFaxNumbers(){
352 353
		if(this.faxNumbers == null) {
353
			this.faxNumbers = new ArrayList<String>();
354
			this.faxNumbers = new ArrayList<>();
354 355
		}
355 356
		return this.faxNumbers;
356 357
	}
......
385 386
	public Object clone() {
386 387
		try{
387 388
			Contact result = (Contact) super.clone();
388
			result.addresses = new HashSet<Address>();
389
			result.addresses = new HashSet<>();
389 390
			for (Address adr : this.addresses){
390 391
				result.addAddress((Address)adr.clone());
391 392
			}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/LSID.java
5 5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/ 
8
*/
9 9

  
10 10
package eu.etaxonomy.cdm.model.common;
11 11

  
......
14 14
import java.util.StringTokenizer;
15 15

  
16 16
import javax.persistence.Embeddable;
17
import javax.persistence.Transient;
17 18

  
18 19
import com.ibm.lsid.MalformedLSIDException;
19 20

  
20 21
/**
21
 * This class is copied from com.ibm.lsid.LSID, I needed to re-implement this since 
22
 * This class is copied from com.ibm.lsid.LSID, I needed to re-implement this since
22 23
 * the domain objects are required to be Serializable
23
 *  
24
 * 
24
 *
25
 *
25 26
 * @author Ben Szekely (<a href="mailto:bhszekel@us.ibm.com">bhszekel@us.ibm.com</a>)
26 27
 * @author ben.clark
27 28
 * @see com.ibm.lsid.client.LSID
......
31 32
	private static final long serialVersionUID = -3568951541851092269L;
32 33

  
33 34
	private String lsid;
34
	
35

  
35 36
	private String authority;
36
	
37

  
37 38
	private String namespace;
38
	
39

  
39 40
	private String object;
40
	
41

  
41 42
	private String revision;
42
	
43

  
43 44
	private LSID() { }
44
	
45

  
45 46
	/**
46 47
	 * Construct a new LSID with the String representation.
47 48
	 * @param String The lsid String respresentation
......
65 66

  
66 67
		try {
67 68
			authority = st.nextToken().toLowerCase();
68
		} 
69
		}
69 70
		catch (NoSuchElementException e) {
70 71
			throw new MalformedLSIDException(e, "authority not found: [" + lsid + "]");
71 72
		}
......
86 87
		if (st.hasMoreTokens()) {
87 88
			revision = st.nextToken();
88 89
		}
89
		
90

  
90 91
		this.lsid = "urn:lsid:" + this.authority + ":" + this.namespace + ":" + this.object + (this.revision != null ? ":" + this.revision : "");
91 92
	}
92
	
93

  
93 94
	/**
94 95
	 * Construct a new LSID with the given components
95 96
	 * @param String the authority
......
102 103
		this.namespace = namespace;//.toLowerCase();
103 104
		this.object = object;//.toLowerCase();
104 105
		if (revision != null)
105
			this.revision = revision;//.toLowerCase();
106
         {
107
            this.revision = revision;//.toLowerCase();
108
        }
106 109
		lsid = "urn:lsid:" + this.authority + ":" + this.namespace + ":" + this.object + (this.revision != null ? ":" + this.revision : "");
107
	}	
108
	
110
	}
111

  
109 112
	/**
110
	 * Returns the lsid 
113
	 * Returns the lsid
111 114
	 * @return String The lsid String representation
112 115
	 */
113 116
	public String getLsid() {
114 117
		return lsid;
115 118
	}
116 119

  
117
	
120

  
118 121

  
119 122
	/**
120 123
	 * Returns the authority component of the LSID
......
147 150
	public String getRevision() {
148 151
		return revision;
149 152
	}
150
	
153

  
151 154
	public static boolean isLsid(String strLsid){
152 155
		try {
153 156
			//TODO use algorithm rather than exceptions
......
163 166
	 * return the string representation
164 167
	 * @return String
165 168
	 */
166
	public String toString() {
169
	@Override
170
    public String toString() {
167 171
		return lsid;
168 172
	}
169
	
173

  
170 174
	/**
171 175
	 * Two LSIDs are equal their string representations are equal disregarding case.
172 176
	 */
173
	public boolean equals(Object lsid) {
177
	@Override
178
    public boolean equals(Object lsid) {
174 179
		if(this == lsid) {
175 180
			return true;
176 181
		} else if (lsid != null && lsid instanceof LSID) {
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/location/Point.java
47 47

  
48 48
/**
49 49
 * @author m.doering
50
 * @version 1.0
51 50
 * @created 08-Nov-2007 13:06:44
52 51
 */
53 52
@XmlAccessorType(XmlAccessType.FIELD)
......
626 625
        return result;
627 626
    }
628 627

  
629
    /* (non-Javadoc)
630
     * @see java.lang.Object#toString()
631
     */
632 628
    @Override
633 629
    public String toString(){
634 630
        String result = "";
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/molecular/SequenceString.java
70 70

  
71 71
// ********************* CONSTRUCTOR ********************/
72 72

  
73
	private SequenceString(){};
73
	private SequenceString(){}
74 74

  
75 75
// ********************* GETTER / SETTER ********************/
76 76

  
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/match/DefaultMatchStrategy.java
50 50
		return new DefaultMatchStrategy(matchClazz);
51 51
	}
52 52

  
53
//	protected Map<String, MatchMode> matchModeMap = new HashMap<String, MatchMode>();
54 53
	protected MatchMode defaultMatchMode = MatchMode.EQUAL;
55 54
	protected MatchMode defaultCollectionMatchMode = MatchMode.IGNORE;
56 55
	protected MatchMode defaultMatchMatchMode = MatchMode.MATCH;

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)