public final class Linker extends Object implements ParaObject, Serializable
Votable.VoteValue| Constructor and Description |
|---|
Linker()
No-args constructor.
|
Linker(String type1,
String type2,
String id1,
String id2)
A link.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNestedObject(ParaObject obj)
Add an object to nest inside the linker object.
|
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.
|
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.
|
String |
getId()
The id of an object.
|
String |
getId1()
Returns the id of the first object in the link.
|
String |
getId2()
Returns the id of the second object in the link.
|
String |
getIdFieldNameFor(String type)
Returns "id1" or "id2" depending on the alphabetical order of type.
|
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 |
getMetadata()
Returns the additional information about the link.
|
String |
getName()
The name of the object.
|
List<Map<String,Object>> |
getNstd()
Get the nested objects that are linked by this link.
|
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.
|
String |
getType1()
Returns the type of the first object in the link.
|
String |
getType2()
Returns the type of the second object in the link.
|
Long |
getUpdated()
The last time this object was updated.
|
Long |
getVersion()
Returns the version number for this object.
|
Integer |
getVotes()
Returns the total sum of all votes for this object.
|
int |
hashCode() |
boolean |
isFirst(String type2)
Checks if the position of a given object is first or second.
|
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.
|
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 |
setId(String id)
Sets a new id.
|
void |
setId1(String id1)
Sets the id of the first object in the link.
|
void |
setId2(String id2)
Sets the id of the second object in the link.
|
void |
setIndexed(Boolean indexed)
Sets the "isIndexed" flag.
|
void |
setMetadata(String metadata)
Sets additional information about the link.
|
void |
setName(String name)
Sets a new name.
|
void |
setNstd(List<Map<String,Object>> nstd)
Sets the nested array of objects that are linked by this link.
|
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 |
setType1(String type1)
Sets the type of the first object in the link.
|
void |
setType2(String type2)
Sets the type of the second object in the link.
|
void |
setUpdated(Long updated)
Sets the last updated timestamp.
|
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.
|
void |
update()
Updates the object permanently.
|
boolean |
voteDown(String userid)
Downvotes the object.
|
boolean |
voteUp(String userid)
Upvotes the object.
|
public String getId2()
public void setId2(String id2)
id2 - a new idpublic String getId1()
public void setId1(String id1)
id1 - a new idpublic String getType1()
public void setType1(String type1)
type1 - the typepublic String getType2()
public void setType2(String type2)
type2 - second typepublic String getMetadata()
public void setMetadata(String metadata)
metadata - some infopublic boolean isFirst(String type2)
type2 - the given class of objectgetType1()public String getIdFieldNameFor(String type)
type - the typepublic List<Map<String,Object>> getNstd()
public void setNstd(List<Map<String,Object>> nstd)
nstd - an array of 2 objects onlypublic void addNestedObject(ParaObject obj)
obj - objectpublic String getId()
ParaObjectgetId in interface ParaObjectpublic void setId(String id)
ParaObjectsetId in interface ParaObjectid - the new idpublic String getType()
ParaObjectClass.getSimpleName().toLowerCase()getType in interface ParaObjectpublic 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 String getName()
ParaObjectgetName in interface ParaObjectpublic 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.