- All Implemented Interfaces:
InitializeListener
,Serializable
,Comparable<CoreUtils>
,Constable
,EventListener
Provides some the basic functionality for domain objects.
- Author:
- Alex Bogdanovski [[email protected]]
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds any number of tags to the set of tags.abstract Long
countChildren
(ParaObject obj, String type2) Count the total number of child objects for this object.abstract Long
countLinks
(ParaObject obj, String type2) Count the total number of links between this object and another type of object.abstract void
deleteChildren
(ParaObject obj, String type2) Deletes all child objects permanently.abstract <P extends ParaObject>
List<P> findChildren
(ParaObject obj, String type2, String query, Pager... pager) Searches through child objects in a one-to-many relationship.abstract <P extends ParaObject>
List<P> findLinkedObjects
(ParaObject obj, String type2, String field, String query, Pager... pager) Searches through all linked objects in many-to-many relationships.abstract Cache
getCache()
Returns the Cache object.abstract <P extends ParaObject>
List<P> getChildren
(ParaObject obj, String type2, Pager... pager) Returns all child objects linked to this object.abstract <P extends ParaObject>
List<P> getChildren
(ParaObject obj, String type2, String field, String term, Pager... pager) Returns all child objects linked to this object.abstract <P extends ParaObject>
PgetCreator
(ParaObject obj) The user object of the creator.abstract DAO
getDao()
Returns the DAO object.abstract FileStore
Returns the FileStore object.static CoreUtils
Provides a default instance using fake DAO, Search and Cache implementations.abstract <P extends ParaObject>
List<P> getLinkedObjects
(ParaObject obj, String type2, Pager... pager) Returns all objects linked to the given one.getLinks
(ParaObject obj, String type2, Pager... pager) Returns a list of all Linker objects for a given object.abstract String
Returns the default name property of an object.abstract String
getObjectURI
(ParaObject obj) Returns the relative path to the object, e.g.abstract <P extends ParaObject>
PgetParent
(ParaObject obj) The parent object.abstract Queue
getQueue()
Returns the Queue object.abstract Search
Returns the Search object.abstract boolean
isLinked
(ParaObject obj, ParaObject toObj) Checks if a given object is linked to this one.abstract boolean
isLinked
(ParaObject obj, String type2, String id2) Checks if this object is linked to another.abstract String
link
(ParaObject obj, String id2) Links two objects in a many-to-many relationship.abstract String
link
(ParaObject obj, String id2, String metadata) Links two objects in a many-to-many relationship.abstract String
overwrite
(ParaObject obj) Creates the object again (use with caution!).abstract String
overwrite
(String appid, ParaObject obj) Creates the object again (use with caution!).removeTags
(List<String> objectTags, String... tag) Removes a tag from the set of tags.abstract void
Sets the Cache object.abstract void
Sets the DAO object.abstract void
setFileStore
(FileStore fileStore) Sets the FileStore object.abstract void
Sets the Queue object.abstract void
Sets the Search object.abstract void
unlink
(ParaObject obj, String type2, String id2) Unlinks an object from this one.abstract void
unlinkAll
(ParaObject obj) Unlinks all objects that are linked to this one.static CoreUtils
Returns the enum constant of this class with the specified name.static CoreUtils[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.abstract boolean
vote
(ParaObject votable, String userid, Votable.VoteValue upDown) Casts a vote on a given object.abstract boolean
vote
(ParaObject votable, String userid, Votable.VoteValue upDown, Integer expiresAfter, Integer lockedAfter) Casts a vote on a given object.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
Methods inherited from interface com.erudika.para.core.listeners.InitializeListener
onInitialize
-
Enum Constant Details
-
INSTANCE
Singleton.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
getInstance
Provides a default instance using fake DAO, Search and Cache implementations.- Returns:
- an instance of this class
-
getDao
-
setDao
-
getSearch
-
setSearch
-
getCache
-
setCache
-
getQueue
-
setQueue
-
getFileStore
-
setFileStore
-
addTags
-
removeTags
-
countChildren
Count the total number of child objects for this object.- Parameters:
obj
- the object to execute this method ontype2
- the type of the other object- Returns:
- the number of links
-
countLinks
Count the total number of links between this object and another type of object.- Parameters:
obj
- the object to execute this method ontype2
- the other type of object- Returns:
- the number of links for the given object
-
deleteChildren
Deletes all child objects permanently.- Parameters:
obj
- the object to execute this method ontype2
- the children's type.
-
findChildren
public abstract <P extends ParaObject> List<P> findChildren(ParaObject obj, String type2, String query, Pager... pager) Searches through child objects in a one-to-many relationship.- Type Parameters:
P
- the type of children- Parameters:
obj
- the object to execute this method ontype2
- the type of children to look forquery
- a query stringpager
- aPager
- Returns:
- a list of
ParaObject
in a one-to-many relationship with this object
-
findLinkedObjects
public abstract <P extends ParaObject> List<P> findLinkedObjects(ParaObject obj, String type2, String field, String query, Pager... pager) Searches through all linked objects in many-to-many relationships.- Type Parameters:
P
- type of linked objects- Parameters:
obj
- the object to execute this method ontype2
- type of linked objects to search 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
-
getChildren
public abstract <P extends ParaObject> List<P> getChildren(ParaObject obj, String type2, Pager... pager) Returns all child objects linked to this object.- Type Parameters:
P
- the type of children- Parameters:
obj
- the object to execute this method ontype2
- the type of children to look forpager
- aPager
- Returns:
- a list of
ParaObject
in a one-to-many relationship with this object
-
getChildren
public abstract <P extends ParaObject> List<P> getChildren(ParaObject obj, String type2, String field, String term, Pager... pager) Returns all child objects linked to this object.- Type Parameters:
P
- the type of children- Parameters:
obj
- the object to execute this method ontype2
- 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
ParaObject
in a one-to-many relationship with this object
-
getCreator
The user object of the creator.- Type Parameters:
P
- type of linked objects- Parameters:
obj
- find the creator of this object- Returns:
- the user who created this or null if
obj.getCreatorid()
is null - See Also:
-
getLinkedObjects
public abstract <P extends ParaObject> List<P> getLinkedObjects(ParaObject obj, String type2, Pager... pager) Returns all objects linked to the given one. Only applicable to many-to-many relationships.- Type Parameters:
P
- type of linked objects- Parameters:
obj
- the object to execute this method ontype2
- type of linked objects to search forpager
- aPager
- Returns:
- a list of linked objects
-
getLinks
-
getName
-
getObjectURI
Returns the relative path to the object, e.g. /user/1234- Parameters:
obj
- an object- Returns:
- a relative path
-
getParent
The parent object.- Type Parameters:
P
- type of linked objects- Parameters:
obj
- find the parent of this object- Returns:
- the parent or null if
obj.getParentid()
is null
-
isLinked
Checks if this object is linked to another.- Parameters:
obj
- the object to execute this method ontype2
- the other typeid2
- the other id- Returns:
- true if the two are linked
-
isLinked
Checks if a given object is linked to this one.- Parameters:
obj
- the object to execute this method ontoObj
- the other object- Returns:
- true if linked
-
link
Links two objects in a many-to-many relationship. Only a link is created. Objects are left untouched. The type of the second object is automatically determined on read.- Parameters:
obj
- the object to execute this method onid2
- link to the object with this id- Returns:
- the id of the
Linker
object that is created
-
link
Links two objects in a many-to-many relationship. Only a link is created. Objects are left untouched. The type of the second object is automatically determined on read.- Parameters:
obj
- the object to execute this method onid2
- link to the object with this idmetadata
- some string of metadata to be attached to the link object- Returns:
- the id of the
Linker
object that is created
-
overwrite
Creates the object again (use with caution!). Same asDAO.create(com.erudika.para.core.ParaObject)
.- Parameters:
obj
- an object- Returns:
- the object id or null
-
overwrite
Creates the object again (use with caution!). Same asDAO.create(java.lang.String, com.erudika.para.core.ParaObject)
.- Parameters:
appid
- the app idobj
- an object- Returns:
- the object id or null
-
unlink
Unlinks an object from this one. Only a link is deleted. Objects are left untouched.- Parameters:
obj
- the object to execute this method ontype2
- the other typeid2
- the other id
-
unlinkAll
Unlinks all objects that are linked to this one. Deletes allLinker
objects. Only the links are deleted. Objects are left untouched.- Parameters:
obj
- the object to execute this method on
-
vote
Casts a vote on a given object.- Parameters:
votable
- the object to vote onuserid
- the voterupDown
- up or down- Returns:
- true if the vote was successful
-
vote
public abstract boolean vote(ParaObject votable, String userid, Votable.VoteValue upDown, Integer expiresAfter, Integer lockedAfter) Casts a vote on a given object.- Parameters:
votable
- the object to vote onuserid
- the voterupDown
- up or downexpiresAfter
- expires after secondslockedAfter
- locked after seconds- Returns:
- true if the vote was successful
-