Class Address
java.lang.Object
com.erudika.para.core.Address
- All Implemented Interfaces:
Linkable, ParaObject, Votable, Serializable
This class represents an address. It enables location based search queries.
It can be attached to any object by creating a
Linker between the two.- Author:
- Alex Bogdanovski [[email protected]]
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface Votable
Votable.VoteValue -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncountChildren(String type) Counts the number of children of a certain type.countLinks(String type2) Counts the number of links to other objects of a certain type.create()Persists the object to the database.voiddelete()Deletes the object from the database.voiddeleteChildren(String type) Deletes all children of a certain type.booleanReturns true if this object is equal to another.booleanexists()Returns true if the object exists in the database.<P extends ParaObject>
List<P> findChildren(String type, String query, Pager... pager) Finds children of a certain type that match a specific query.<P extends ParaObject>
List<P> findLinkedObjects(String type, String field, String query, Pager... pager) Finds linked objects of a certain type that match a specific field and query.The street address and other address info.getAppid()Returns the app identifier.Returns true if the object is cached.<P extends ParaObject>
List<P> getChildren(String type, Pager... pager) Returns a list of children of a certain type.<P extends ParaObject>
List<P> getChildren(String type, String field, String term, Pager... pager) Returns a list of children of a certain type that match a specific field and term.getCity()The name of the city.The country in which the address is located.Returns the creator ID.final StringgetId()Returns the address ID.Returns true if the object is indexed.The Latitude and Longitude points of this address.<P extends ParaObject>
List<P> getLinkedObjects(String type, Pager... pager) Returns a list of linked objects of a certain type.Returns a list of links to other objects of a certain type.final StringgetName()Returns the object name.Returns the object URI.Returns the parent ID.getPhone()The phone number.Returns the plural form of the object type.Returns true if the object is stored in the database.getTags()Returns the tags.Returns the timestamp.final StringgetType()Returns the object type.Returns the updated timestamp.Returns the version of the object.getVotes()Returns the number of votes.inthashCode()Returns the hash code for this object.booleanisLinked(ParaObject toObj) Returns true if the object is linked to another object.booleanReturns true if the object is linked to another object of a certain type and ID.Links the object to another object of a certain type and ID.voidsetAddress(String address) Sets new street address.voidSets the app identifier.voidSets the cached flag.voidSets the city.voidsetCountry(String country) Sets a new country name.voidsetCreatorid(String creatorid) Sets the creator ID.final voidSets the address ID.voidsetIndexed(Boolean indexed) Sets the indexed flag.voidSets the coordinates in the form "LAT,LNG".final voidSets the object name.voidsetParentid(String parentid) Sets the parent ID.voidSets a new phone number.voidSets the stored flag.voidSets the tags.voidsetTimestamp(Long timestamp) Sets the timestamp.final voidSets the object type.voidsetUpdated(Long updated) Sets the updated timestamp.voidsetVersion(Long version) Sets the version of the object.voidSets the number of votes.toString()Returns a JSON string representation of this object.voidUnlinks the object from another object of a certain type and ID.voidUnlinks the object from all other objects.voidupdate()Updates the object in the database.booleanVotes down for the object.booleanVotes up for the object.
-
Constructor Details
-
Address
public Address()No-args constructor. Same asAddress(null) -
Address
-
-
Method Details
-
getCity
-
setCity
-
getLatlng
The Latitude and Longitude points of this address. Must not be null or empty.- Returns:
- "lat,lng" as a string
-
setLatlng
Sets the coordinates in the form "LAT,LNG".- Parameters:
latlng- the coords
-
getPhone
The phone number. Multiple phones separated by comma are allowed.- Returns:
- the phone number
-
setPhone
Sets a new phone number.- Parameters:
phone- the number as a string
-
getCountry
The country in which the address is located. Must not be null or empty.- Returns:
- the full country name
-
setCountry
Sets a new country name.- Parameters:
country- the name of the country
-
getAddress
-
setAddress
Sets new street address. Must not be null or empty.- Parameters:
address- the address info
-
getId
Returns the address ID.- Specified by:
getIdin interfaceParaObject- Returns:
- the id
-
setId
Sets the address ID.- Specified by:
setIdin interfaceParaObject- Parameters:
id- the id
-
getType
Returns the object type.- Specified by:
getTypein interfaceParaObject- Returns:
- the type
-
setType
Sets the object type.- Specified by:
setTypein interfaceParaObject- Parameters:
type- the type
-
getAppid
Returns the app identifier.- Specified by:
getAppidin interfaceParaObject- Returns:
- the appid
-
setAppid
Sets the app identifier.- Specified by:
setAppidin interfaceParaObject- Parameters:
appid- the appid
-
getObjectURI
Returns the object URI.- Specified by:
getObjectURIin interfaceParaObject- Returns:
- the URI
- See Also:
-
getTags
Returns the tags.- Specified by:
getTagsin interfaceParaObject- Returns:
- the tags
- See Also:
-
getStored
Returns true if the object is stored in the database.- Specified by:
getStoredin interfaceParaObject- Returns:
- true if stored
-
setStored
Sets the stored flag.- Specified by:
setStoredin interfaceParaObject- Parameters:
stored- the stored flag
-
getIndexed
Returns true if the object is indexed.- Specified by:
getIndexedin interfaceParaObject- Returns:
- true if indexed
-
setIndexed
Sets the indexed flag.- Specified by:
setIndexedin interfaceParaObject- Parameters:
indexed- the indexed flag
-
getCached
Returns true if the object is cached.- Specified by:
getCachedin interfaceParaObject- Returns:
- true if cached
-
setCached
Sets the cached flag.- Specified by:
setCachedin interfaceParaObject- Parameters:
cached- the cached flag
-
setTags
Sets the tags.- Specified by:
setTagsin interfaceParaObject- Parameters:
tags- the tags
-
getTimestamp
Returns the timestamp.- Specified by:
getTimestampin interfaceParaObject- Returns:
- the timestamp
-
setTimestamp
Sets the timestamp.- Specified by:
setTimestampin interfaceParaObject- Parameters:
timestamp- the timestamp
-
getCreatorid
Returns the creator ID.- Specified by:
getCreatoridin interfaceParaObject- Returns:
- the creatorid
-
setCreatorid
Sets the creator ID.- Specified by:
setCreatoridin interfaceParaObject- Parameters:
creatorid- the creatorid
-
getName
Returns the object name.- Specified by:
getNamein interfaceParaObject- Returns:
- the name
-
setName
Sets the object name.- Specified by:
setNamein interfaceParaObject- Parameters:
name- the name
-
getPlural
Returns the plural form of the object type.- Specified by:
getPluralin interfaceParaObject- Returns:
- the plural name
-
getParentid
Returns the parent ID.- Specified by:
getParentidin interfaceParaObject- Returns:
- the parentid
-
setParentid
Sets the parent ID.- Specified by:
setParentidin interfaceParaObject- Parameters:
parentid- the parentid
-
getUpdated
Returns the updated timestamp.- Specified by:
getUpdatedin interfaceParaObject- Returns:
- the updated timestamp
-
setUpdated
Sets the updated timestamp.- Specified by:
setUpdatedin interfaceParaObject- Parameters:
updated- the updated timestamp
-
create
Persists the object to the database.- Specified by:
createin interfaceParaObject- Returns:
- the object ID
- See Also:
-
update
public void update()Updates the object in the database.- Specified by:
updatein interfaceParaObject- See Also:
-
delete
public void delete()Deletes the object from the database.- Specified by:
deletein interfaceParaObject- See Also:
-
exists
public boolean exists()Returns true if the object exists in the database.- Specified by:
existsin interfaceParaObject- Returns:
- true if exists
- See Also:
-
voteUp
-
voteDown
-
getVotes
-
setVotes
-
getVersion
Returns the version of the object.- Specified by:
getVersionin interfaceParaObject- Returns:
- the version
-
setVersion
Sets the version of the object.- Specified by:
setVersionin interfaceParaObject- Parameters:
version- the version
-
countLinks
Counts the number of links to other objects of a certain type.- Specified by:
countLinksin interfaceLinkable- Parameters:
type2- the other type- Returns:
- the number of links
-
getLinks
-
getLinkedObjects
Returns a list of linked objects of a certain type.- Specified by:
getLinkedObjectsin interfaceLinkable- Type Parameters:
P- the type of linked objects- Parameters:
type- the other typepager- a pager- Returns:
- a list of linked objects
-
findLinkedObjects
public <P extends ParaObject> List<P> findLinkedObjects(String type, String field, String query, Pager... pager) Finds linked objects of a certain type that match a specific field and query.- Specified by:
findLinkedObjectsin interfaceLinkable- Type Parameters:
P- the type of linked objects- Parameters:
type- the other typefield- the field to search inquery- the search querypager- a pager- Returns:
- a list of linked objects
-
isLinked
-
isLinked
Returns true if the object is linked to another object. -
link
-
unlink
-
unlinkAll
-
countChildren
Counts the number of children of a certain type.- Specified by:
countChildrenin interfaceLinkable- Parameters:
type- the child type- Returns:
- the number of children
-
getChildren
Returns a list of children of a certain type.- Specified by:
getChildrenin interfaceLinkable- Type Parameters:
P- the type of children- Parameters:
type- the child typepager- a pager- Returns:
- a list of children
-
getChildren
public <P extends ParaObject> List<P> getChildren(String type, String field, String term, Pager... pager) Returns a list of children of a certain type that match a specific field and term.- Specified by:
getChildrenin interfaceLinkable- Type Parameters:
P- the type of children- Parameters:
type- the child typefield- the field to search interm- the search termpager- a pager- Returns:
- a list of children
-
findChildren
Finds children of a certain type that match a specific query.- Specified by:
findChildrenin interfaceLinkable- Type Parameters:
P- the type of children- Parameters:
type- the child typequery- the search querypager- a pager- Returns:
- a list of children
-
deleteChildren
Deletes all children of a certain type.- Specified by:
deleteChildrenin interfaceLinkable- Parameters:
type- the child type
-
hashCode
-
equals
-
toString
-