Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for first-class place model #79

Merged
merged 11 commits into from
Nov 12, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions gedcomx-model/src/main/java/org/gedcomx/conclusion/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class Event extends Conclusion implements HasDateAndPlace, Attributable {

private URI type;
private Date date;
private Place place;
private PlaceReference place;
private List<EventRole> roles;

/**
Expand All @@ -64,7 +64,7 @@ public Event(EventType EventType) {
* @param date The date of applicability of this event.
* @param place The place of applicability of this event.
*/
public Event(EventType EventType, Date date, Place place) {
public Event(EventType EventType, Date date, PlaceReference place) {
setKnownType(EventType);
setDate(date);
setPlace(place);
Expand Down Expand Up @@ -136,7 +136,7 @@ public void setDate(Date date) {
* @return The place of this event.
*/
@Override
public Place getPlace() {
public PlaceReference getPlace() {
return place;
}

Expand All @@ -146,7 +146,7 @@ public Place getPlace() {
* @param place The place of this event.
*/
@Override
public void setPlace(Place place) {
public void setPlace(PlaceReference place) {
this.place = place;
}

Expand Down
8 changes: 4 additions & 4 deletions gedcomx-model/src/main/java/org/gedcomx/conclusion/Fact.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class Fact extends Conclusion implements HasDateAndPlace {

private URI type;
private Date date;
private Place place;
private PlaceReference place;
private String value;

/**
Expand Down Expand Up @@ -63,7 +63,7 @@ public Fact(FactType factType, String value) {
* @param place The place of applicability of this fact.
* @param value The value as supplied by the user.
*/
public Fact(FactType factType, Date date, Place place, String value) {
public Fact(FactType factType, Date date, PlaceReference place, String value) {
setKnownType(factType);
setDate(date);
setPlace(place);
Expand Down Expand Up @@ -133,7 +133,7 @@ public void setDate(Date date) {
*
* @return The place of applicability of this fact.
*/
public Place getPlace() {
public PlaceReference getPlace() {
return place;
}

Expand All @@ -142,7 +142,7 @@ public Place getPlace() {
*
* @param place The place of applicability of this fact.
*/
public void setPlace(Place place) {
public void setPlace(PlaceReference place) {
this.place = place;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ public interface HasDateAndPlace {
*
* @return The place.
*/
Place getPlace();
PlaceReference getPlace();

/**
* The place.
*
* @param place The place.
*/
void setPlace(Place place);
void setPlace(PlaceReference place);
}
122 changes: 85 additions & 37 deletions gedcomx-model/src/main/java/org/gedcomx/conclusion/Place.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,79 +15,127 @@
*/
package org.gedcomx.conclusion;

import org.gedcomx.common.URI;
import org.codehaus.enunciate.json.JsonName;
import org.codehaus.jackson.annotate.JsonProperty;
import org.gedcomx.common.Attribution;
import org.gedcomx.common.TextValue;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import java.util.List;


/**
* A concluded genealogical place.
*
* @author Ryan Heaton
* An abstraction of place independent of its potential jurisdictional hierarchies.
*/
@XmlType ( name = "Place", propOrder = { "original", "normalized" } )
public class Place {
@XmlType ( name = "Place", propOrder = { "names", "latitude", "longitude", "identifiers", "attribution" } )
public class Place extends Conclusion {

private List<TextValue> names;
private double latitude;
private double longitude;
private List<Identifier> identifiers;
private Attribution attribution;

/**
* A list of standardized (or normalized) names associated with this place.
*
* It is RECOMMENDED that instances provide at least one name.
*
* @return A list of standardized (or normalized) names associated with this place.
*/
@XmlElement (name = "name")
@JsonName ("names")
@JsonProperty ("names")
public List<TextValue> getNames() {
return names;
}

/**
* A list of standardized (or normalized) names associated with this place.
*
* It is RECOMMENDED that instances provide at least one name.
*
* @param names A list of standardized (or normalized) names associated with this place.
*/
@JsonProperty ("names")
public void setNames(List<TextValue> names) {
this.names = names;
}

private URI resource;
private String original;
private String normalized;
/**
* Degrees north or south of the Equator (0 degrees). Values range from −90 degrees (south) to 90 degrees (north).
*
* @return Degrees north or south of the Equator.
*/
public double getLatitude() {
return latitude;
}

/**
* The standardized and/or normalized resource value.
* Degrees north or south of the Equator (0 degrees). Values range from −90 degrees (south) to 90 degrees (north).
*
* @return The resource value.
* @param latitude Degrees north or south of the Equator.
*/
@XmlAttribute
public URI getResource() {
return resource;
public void setLatitude(double latitude) {
this.latitude = latitude;
}

/**
* The standardized and/or normalized resource value.
* Angular distance in degrees, relative to the Prime Meridian. Values west of the Meridian range from −180 to 0 degrees. Values east of the Meridian range from 0 to 180 degrees.
*
* @param resource The resource value.
* @return Angular distance in degrees, relative to the Prime Meridian.
*/
public void setResource(URI resource) {
this.resource = resource;
public double getLongitude() {
return longitude;
}

/**
* The original text as supplied by the user.
* Angular distance in degrees, relative to the Prime Meridian. Values west of the Meridian range from −180 to 0 degrees. Values east of the Meridian range from 0 to 180 degrees.
*
* @return The original text as supplied by the user.
* @param longitude Angular distance in degrees, relative to the Prime Meridian.
*/
public String getOriginal() {
return original;
public void setLongitude(double longitude) {
this.longitude = longitude;
}

/**
* The original value as supplied by the user.
* A list of known identifiers for this place (e.g., place authority identifiers).
*
* @param original The original value as supplied by the user.
* @return A list of known identifiers for this place.
*/
public void setOriginal(String original) {
this.original = original;
@XmlElement (name = "identifier")
@JsonName ("identifiers")
@JsonProperty ("identifiers")
public List<Identifier> getIdentifiers() {
return identifiers;
}

/**
* The normalized value of the place
* A list of known identifiers for this place (e.g., place authority identifiers).
*
* @return the normalized value
* @param identifiers A list of known identifiers for this place.
*/
public String getNormalized() {
return normalized;
@JsonProperty ("identifiers")
public void setIdentifiers(List<Identifier> identifiers) {
this.identifiers = identifiers;
}

/**
* The normalized value of the place
* Attribution metadata for this place.
*
* @param normalized the normalized value
* @return Attribution metadata for this place.
*/
public void setNormalized(String normalized) {
this.normalized = normalized;
public Attribution getAttribution() {
return attribution;
}

public String toString() {
return "Place{" + "original='" + original + '\'' + "normal='" + normalized + '\'' + ", resource=" + resource + '}';
/**
* Attribution metadata for this place.
*
* @param attribution Attribution metadata for this place.
*/
public void setAttribution(Attribution attribution) {
this.attribution = attribution;
}
}
Loading