Interface Linkable
- All Known Subinterfaces:
ParaObject
- All Known Implementing Classes:
Address, App, Linker, Sysprop, Tag, Translation, User, Vote, Webhook
public interface Linkable
Applied to all
ParaObjects by default. Allows an object to be linked to another object.
A link can be: 1-1, 1-* or *-*. One-to-one and one-to-many links are implemented using the parentid field.
Many-to-many links are implemented using Linker objects.- Author:
- Alex Bogdanovski [[email protected]]
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptioncountChildren(String type) Count the total number of child objects for this object.countLinks(String type2) Count the total number of links between this object and another type of object.voiddeleteChildren(String type) Deletes all child objects permanently.<P extends ParaObject>
List<P> findChildren(String type, String query, Pager... pager) Search through all child objects.<P extends ParaObject>
List<P> findLinkedObjects(String type, String field, String query, Pager... pager) Similar tofindChildren(java.lang.String, java.lang.String, com.erudika.para.core.utils.Pager...)but for many-to-many relationships.<P extends ParaObject>
List<P> getChildren(String type, Pager... pager) Returns all child objects linked to this object.<P extends ParaObject>
List<P> getChildren(String type, String field, String term, Pager... pager) Returns all child objects linked to this object.<P extends ParaObject>
List<P> getLinkedObjects(String type, Pager... pager) Similar togetChildren(java.lang.String, com.erudika.para.core.utils.Pager...)but for many-to-many relationships.Returns all links between this type object and another type of object.booleanisLinked(ParaObject toObj) Checks if a given object is linked to this one.booleanChecks if this object is linked to another.Links an object to this one in a many-to-many relationship.voidUnlinks an object from this one.voidUnlinks all objects that are linked to this one.
-
Method Details
-
countLinks
-
getLinks
-
getLinkedObjects
Similar togetChildren(java.lang.String, com.erudika.para.core.utils.Pager...)but for many-to-many relationships.- Type Parameters:
P- type of linked objects- Parameters:
type- type of linked objects to look forpager- aPager- Returns:
- a list of linked objects
-
findLinkedObjects
<P extends ParaObject> List<P> findLinkedObjects(String type, String field, String query, Pager... pager) Similar tofindChildren(java.lang.String, java.lang.String, com.erudika.para.core.utils.Pager...)but for many-to-many relationships. Searches through all linked objects connected to this via aLinkerobject.- Type Parameters:
P- type of linked objects- Parameters:
type- type of linked objects to look forfield- the name of the field to target (within a nested field "nstd")query- a query stringpager- aPager- Returns:
- a list of linked objects matching the search query
-
isLinked
-
isLinked
Checks if a given object is linked to this one.- Parameters:
toObj- the other object- Returns:
- true if linked
-
link
-
unlink
-
unlinkAll
void unlinkAll()Unlinks all objects that are linked to this one. Deletes allLinkerobjects. Only the links are deleted. Objects are left untouched. -
countChildren
-
getChildren
Returns all child objects linked to this object.- Type Parameters:
P- the type of children- Parameters:
type- the type of children to look forpager- aPager- Returns:
- a list of
ParaObjectin a one-to-many relationship with this object
-
findChildren
Search through all child objects. Only searches child objects directly connected to this parent via theparentidfield.- Type Parameters:
P- the type of children- Parameters:
type- the type of children to look forquery- a query stringpager- aPager- Returns:
- a list of
ParaObjectin a one-to-many relationship with this object
-
getChildren
Returns all child objects linked to this object.- Type Parameters:
P- the type of children- Parameters:
type- the type of children to look forfield- the field name to use as filterterm- the field value to use as filterpager- aPager- Returns:
- a list of
ParaObjectin a one-to-many relationship with this object
-
deleteChildren
Deletes all child objects permanently.- Parameters:
type- the children's type.
-