public class Vote extends Object implements ParaObject
Votable.VoteValue| Constructor and Description |
|---|
Vote()
No-args constructor.
|
Vote(String voterid,
String voteeid,
Votable.VoteValue value)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Long |
countChildren(String type)
Count the total number of child objects for this object.
|
Long |
countLinks(String type2)
Count the total number of links between this object and another type of object.
|
String |
create()
Stores this object in the data store.
|
void |
delete()
Deletes the object permanently by removing it from the data store.
|
void |
deleteChildren(String type)
Deletes all child objects permanently.
|
Vote |
down()
Set the vote negative.
|
boolean |
equals(Object obj) |
boolean |
exists()
Checks if an object is stored in the data store.
|
<P extends ParaObject> |
findChildren(String type,
String query,
Pager... pager)
Search through all child objects.
|
<P extends ParaObject> |
findLinkedObjects(String type,
String field,
String query,
Pager... pager)
Similar to
Linkable.findChildren(java.lang.String, java.lang.String, com.erudika.para.utils.Pager...)
but for many-to-many relationships. |
String |
getAppid()
The application name.
|
Boolean |
getCached()
Boolean flag which controls whether this object is cached.
|
<P extends ParaObject> |
getChildren(String type,
Pager... pager)
Returns all child objects linked to this object.
|
<P extends ParaObject> |
getChildren(String type,
String field,
String term,
Pager... pager)
Returns all child objects linked to this object.
|
String |
getCreatorid()
The id of the user who created this.
|
Long |
getExpiresAfter()
Returns the expiration period.
|
String |
getId()
The id of an object.
|
Boolean |
getIndexed()
Boolean flag which controls whether this object is indexed
by the search engine.
|
<P extends ParaObject> |
getLinkedObjects(String type,
Pager... pager)
Similar to
Linkable.getChildren(java.lang.String, com.erudika.para.utils.Pager...)
but for many-to-many relationships. |
List<Linker> |
getLinks(String type2,
Pager... pager)
Returns all links between this type object and another type of object.
|
String |
getName()
The name of the object.
|
String |
getObjectURI()
The URI of this object.
|
String |
getParentid()
The id of the parent object.
|
String |
getPlural()
The plural name of the object.
|
Boolean |
getStored()
Boolean flag which controls whether this object is stored
in the database or not.
|
List<String> |
getTags()
The tags associated with this object.
|
Long |
getTimestamp()
The time when the object was created, in milliseconds.
|
String |
getType()
The name of the object's class.
|
Long |
getUpdated()
The last time this object was updated.
|
String |
getValue()
Returns the value of the vote.
|
Long |
getVersion()
Returns the version number for this object.
|
Integer |
getVotes()
Returns the total sum of all votes for this object.
|
int |
hashCode() |
boolean |
isAmendable()
Checks if vote can still be amended.
|
boolean |
isDownvote() |
boolean |
isExpired()
Checks if expired.
|
boolean |
isLinked(ParaObject toObj)
Checks if a given object is linked to this one.
|
boolean |
isLinked(String type2,
String id2)
Checks if this object is linked to another.
|
boolean |
isUpvote() |
String |
link(String id2)
Links an object to this one in a many-to-many relationship.
|
void |
setAppid(String appid)
Sets a new app name.
|
void |
setCached(Boolean cached)
Sets the "isCached" flag.
|
void |
setCreatorid(String creatorid)
Sets a new creator id.
|
void |
setExpiresAfter(Long expiresAfter)
Sets the expiration period.
|
void |
setId(String id)
Sets a new id.
|
void |
setIndexed(Boolean indexed)
Sets the "isIndexed" flag.
|
void |
setName(String name)
Sets a new name.
|
void |
setParentid(String parentid)
Sets a new parent id.
|
void |
setStored(Boolean stored)
Sets the "isStored" flag.
|
void |
setTags(List<String> tags)
Merges the given tags with existing tags.
|
void |
setTimestamp(Long timestamp)
Sets the timestamp.
|
void |
setType(String type)
Sets a new object type.
|
void |
setUpdated(Long updated)
Sets the last updated timestamp.
|
void |
setValue(String value)
Sets the value of the vote.
|
void |
setVersion(Long version)
Sets the version of this object.
|
void |
setVotes(Integer votes)
Sets the total votes for this object.
|
String |
toString() |
void |
unlink(String type,
String id2)
Unlinks an object from this one.
|
void |
unlinkAll()
Unlinks all objects that are linked to this one.
|
Vote |
up()
Set the vote positive.
|
void |
update()
Updates the object permanently.
|
boolean |
voteDown(String userid)
Downvotes the object.
|
boolean |
voteUp(String userid)
Upvotes the object.
|
public Vote()
public Vote(String voterid, String voteeid, Votable.VoteValue value)
voterid - the user id of the votervoteeid - the id of the object that will receive the votevalue - up + or down -public final String getId()
ParaObjectgetId in interface ParaObjectpublic Vote up()
public Vote down()
public boolean isUpvote()
public boolean isDownvote()
public String getValue()
public void setValue(String value)
value - UP or DOWNpublic Long getExpiresAfter()
public void setExpiresAfter(Long expiresAfter)
expiresAfter - time in secondspublic boolean isExpired()
public boolean isAmendable()
public final void setId(String id)
ParaObjectsetId in interface ParaObjectid - the new idpublic final String getType()
ParaObjectClass.getSimpleName().toLowerCase()getType in interface ParaObjectpublic final void setType(String type)
ParaObjectsetType in interface ParaObjecttype - a new typepublic String getAppid()
ParaObjectgetAppid in interface ParaObjectpublic void setAppid(String appid)
ParaObjectsetAppid in interface ParaObjectappid - the new app id (name)public String getObjectURI()
ParaObjectgetObjectURI in interface ParaObjectUtils.getObjectURI(com.erudika.para.core.ParaObject, boolean, boolean)public List<String> getTags()
ParaObjectgetTags in interface ParaObjectTagpublic void setTags(List<String> tags)
ParaObjectsetTags in interface ParaObjecttags - the additional tags, or clears all tags if set to nullpublic Boolean getStored()
ParaObjectgetStored in interface ParaObjectpublic void setStored(Boolean stored)
ParaObjectsetStored in interface ParaObjectstored - when set to true, object is stored in DB.public Boolean getIndexed()
ParaObjectgetIndexed in interface ParaObjectpublic void setIndexed(Boolean indexed)
ParaObjectsetIndexed in interface ParaObjectindexed - when set to true, object is indexed.public Boolean getCached()
ParaObjectgetCached in interface ParaObjectpublic void setCached(Boolean cached)
ParaObjectsetCached in interface ParaObjectcached - when set to true, object is cached.public Long getTimestamp()
ParaObjectgetTimestamp in interface ParaObjectpublic void setTimestamp(Long timestamp)
ParaObjectsetTimestamp in interface ParaObjecttimestamp - a new timestamp in milliseconds.public String getCreatorid()
ParaObjectUser id.getCreatorid in interface ParaObjectpublic void setCreatorid(String creatorid)
ParaObjectsetCreatorid in interface ParaObjectcreatorid - a new idpublic final String getName()
ParaObjectgetName in interface ParaObjectpublic final void setName(String name)
ParaObjectsetName in interface ParaObjectname - the new namepublic String getPlural()
ParaObjectgetPlural in interface ParaObjectpublic String getParentid()
ParaObjectgetParentid in interface ParaObjectpublic void setParentid(String parentid)
ParaObjectsetParentid in interface ParaObjectparentid - a new idpublic Long getUpdated()
ParaObjectgetUpdated in interface ParaObjectpublic void setUpdated(Long updated)
ParaObjectsetUpdated in interface ParaObjectupdated - a new timestamppublic String create()
ParaObjectcreate in interface ParaObjectStored,
DAO.create(com.erudika.para.core.ParaObject)public void update()
ParaObjectLocked fields are ignored.update in interface ParaObjectLocked,
DAO.update(com.erudika.para.core.ParaObject)public void delete()
ParaObjectdelete in interface ParaObjectDAO.delete(com.erudika.para.core.ParaObject)public boolean exists()
ParaObjectexists in interface ParaObjectDAO.read(java.lang.String)public boolean voteUp(String userid)
Votablepublic boolean voteDown(String userid)
Votablepublic Integer getVotes()
Votablepublic void setVotes(Integer votes)
Votablepublic Long getVersion()
ParaObjectgetVersion in interface ParaObject0 if unused or -1, indicating a failed update.public void setVersion(Long version)
ParaObjectsetVersion in interface ParaObjectversion - a positive number, different than the current value of the version fieldpublic Long countLinks(String type2)
LinkablecountLinks in interface Linkabletype2 - the other type of objectpublic List<Linker> getLinks(String type2, Pager... pager)
Linkablepublic <P extends ParaObject> List<P> getLinkedObjects(String type, Pager... pager)
LinkableLinkable.getChildren(java.lang.String, com.erudika.para.utils.Pager...)
but for many-to-many relationships.getLinkedObjects in interface LinkableP - type of linked objectstype - type of linked objects to look forpager - a Pagerpublic <P extends ParaObject> List<P> findLinkedObjects(String type, String field, String query, Pager... pager)
LinkableLinkable.findChildren(java.lang.String, java.lang.String, com.erudika.para.utils.Pager...)
but for many-to-many relationships. Searches through all linked objects connected to this via
a Linker object.findLinkedObjects in interface LinkableP - type of linked objectstype - type of linked objects to look forfield - the name of the field to target (within a nested field "nstd")query - a query stringpager - a Pagerpublic boolean isLinked(String type2, String id2)
Linkablepublic boolean isLinked(ParaObject toObj)
Linkablepublic String link(String id2)
Linkablepublic void unlink(String type, String id2)
Linkablepublic void unlinkAll()
LinkableLinker objects. Only the links are deleted. Objects are left untouched.public Long countChildren(String type)
LinkablecountChildren in interface Linkabletype - the other type of objectpublic <P extends ParaObject> List<P> getChildren(String type, Pager... pager)
LinkablegetChildren in interface LinkableP - the type of childrentype - the type of children to look forpager - a PagerParaObject in a one-to-many relationship with this objectpublic <P extends ParaObject> List<P> getChildren(String type, String field, String term, Pager... pager)
LinkablegetChildren in interface LinkableP - the type of childrentype - the type of children to look forfield - the field name to use as filterterm - the field value to use as filterpager - a PagerParaObject in a one-to-many relationship with this objectpublic <P extends ParaObject> List<P> findChildren(String type, String query, Pager... pager)
Linkableparentid field.findChildren in interface LinkableP - the type of childrentype - the type of children to look forquery - a query stringpager - a PagerParaObject in a one-to-many relationship with this objectpublic void deleteChildren(String type)
LinkabledeleteChildren in interface Linkabletype - the children's type.Copyright © 2018 Erudika. All rights reserved.