View Javadoc
1   /*******************************************************************************
2    *   Gisgraphy Project 
3    * 
4    *   This library is free software; you can redistribute it and/or
5    *   modify it under the terms of the GNU Lesser General Public
6    *   License as published by the Free Software Foundation; either
7    *   version 2.1 of the License, or (at your option) any later version.
8    * 
9    *   This library is distributed in the hope that it will be useful,
10   *   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12   *   Lesser General Public License for more details.
13   * 
14   *   You should have received a copy of the GNU Lesser General Public
15   *   License along with this library; if not, write to the Free Software
16   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
17   * 
18   *  Copyright 2008  Gisgraphy project 
19   *  David Masclet <davidmasclet@gisgraphy.com>
20   *  
21   *  
22   *******************************************************************************/
23  package com.gisgraphy.domain.geoloc.entity;
24  
25  import java.util.SortedSet;
26  
27  import javax.persistence.Entity;
28  import javax.persistence.Transient;
29  
30  import org.hibernate.annotations.Cache;
31  import org.hibernate.annotations.CacheConcurrencyStrategy;
32  
33  import com.gisgraphy.helper.IntrospectionIgnoredField;
34  import com.gisgraphy.street.StreetType;
35  
36  /**
37   * Represents a {@link Street}.
38   * 
39   * @author <a href="mailto:david.masclet@gisgraphy.com">David Masclet</a>
40   */
41  @Entity
42  @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
43  public class Street extends GisFeature {
44  
45      private boolean oneWay = false;
46      private StreetType streetType;
47      private Double length;
48      //private Long openstreetmapId;
49      //those fields are only used to sync the fulltext engine,
50      //there are not used to be stored in Datastore
51      
52      @IntrospectionIgnoredField
53      private String fullyQualifiedAddress;
54      private SortedSet<HouseNumber> houseNumbers;
55      
56      
57  
58  	/*public Long getOpenstreetmapId() {
59  	return openstreetmapId;
60      }
61  
62      public void setOpenstreetmapId(Long openstreetmapId) {
63  	this.openstreetmapId = openstreetmapId;
64      }*/
65  
66      /**
67       * Override the gisFeature value.<br>
68       * Default to true;<br>
69       * If this field is set to false, then the object won't be synchronized with
70       * the fullText search engine
71       */
72      @Override
73      @Transient
74      public boolean isFullTextSearchable() {
75  	return true;
76      }
77  
78      /**
79       * Constructor that populate the {@link Street} with the gisFeature fields<br>
80       * 
81       * @param gisFeature
82       *            The gisFeature from which we want to populate the
83       *            {@link Street}
84       */
85      public Street(GisFeature gisFeature) {
86  	super(gisFeature);
87      }
88  
89      /**
90       * Needed by CGLib
91       */
92      public Street() {
93  	super();
94      }
95  
96      public boolean isOneWay() {
97  	return oneWay;
98      }
99  
100     public void setOneWay(boolean oneWay) {
101 	this.oneWay = oneWay;
102     }
103 
104     public StreetType getStreetType() {
105 	return streetType;
106     }
107 
108     public void setStreetType(StreetType streetType) {
109 	this.streetType = streetType;
110     }
111 
112     public Double getLength() {
113 	return length;
114     }
115 
116     public void setLength(Double length) {
117 	this.length = length;
118     }
119 
120 
121 
122 	@Transient
123 	public String getFullyQualifiedAddress() {
124 		return fullyQualifiedAddress;
125 	}
126 
127 	public void setFullyQualifiedAddress(String fullyQualifiedAddress) {
128 		this.fullyQualifiedAddress = fullyQualifiedAddress;
129 	}
130 	
131 	@Transient
132     public SortedSet<HouseNumber> getHouseNumbers() {
133 		return houseNumbers;
134 	}
135 
136 	public void setHouseNumbers(SortedSet<HouseNumber> houseNumbers) {
137 		this.houseNumbers = houseNumbers;
138 	}
139 	
140 	
141 }