- All Superinterfaces:
Linkable
,Serializable
,Votable
- All Known Implementing Classes:
Address
,App
,Linker
,Sysprop
,Tag
,Translation
,User
,Vote
,Webhook
The core domain interface. All Para objects implement it.
- Author:
- Alex Bogdanovski [[email protected]]
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.erudika.para.core.Votable
Votable.VoteValue
-
Method Summary
Modifier and TypeMethodDescriptioncreate()
Stores this object in the data store.void
delete()
Deletes the object permanently by removing it from the data store.boolean
exists()
Checks if an object is stored in the data store.getAppid()
The application name.Boolean flag which controls whether this object is cached.The id of the user who created this.getId()
The id of an object.Boolean flag which controls whether this object is indexed by the search engine.@NotBlank @Size(min=1,max=255) String
getName()
The name of the object.The URI of this object.The id of the parent object.The plural name of the object.Boolean flag which controls whether this object is stored in the database or not.getTags()
The tags associated with this object.The time when the object was created, in milliseconds.getType()
The name of the object's class.The last time this object was updated.Returns the version number for this object.void
Sets a new app name.void
Sets the "isCached" flag.void
setCreatorid
(String creatorid) Sets a new creator id.void
Sets a new id.void
setIndexed
(Boolean isIndexed) Sets the "isIndexed" flag.void
Sets a new name.void
setParentid
(String parentid) Sets a new parent id.void
Sets the "isStored" flag.void
Merges the given tags with existing tags.void
setTimestamp
(Long timestamp) Sets the timestamp.void
Sets a new object type.void
setUpdated
(Long updated) Sets the last updated timestamp.void
setVersion
(Long version) Sets the version of this object.void
update()
Updates the object permanently.Methods inherited from interface com.erudika.para.core.Linkable
countChildren, countLinks, deleteChildren, findChildren, findLinkedObjects, getChildren, getChildren, getLinkedObjects, getLinks, isLinked, isLinked, link, unlink, unlinkAll
-
Method Details
-
getId
String getId()The id of an object. Usually an autogenerated unique string of numbers.- Returns:
- the id
-
setId
-
getName
The name of the object. Can be anything.- Returns:
- the name. default: [type id]
-
setName
Sets a new name. Must not be null or empty.- Parameters:
name
- the new name
-
getAppid
String getAppid()The application name. Added to support multiple separate apps. Every object must belong to an app.- Returns:
- the app id (name). default: para
-
setAppid
Sets a new app name. Must not be null or empty.- Parameters:
appid
- the new app id (name)
-
getParentid
-
setParentid
Sets a new parent id. Must not be null or empty.- Parameters:
parentid
- a new id
-
getType
String getType()The name of the object's class. This is equivalent toClass.getSimpleName()
.toLowerCase()- Returns:
- the simple name of the class
-
setType
Sets a new object type. Must not be null or empty.- Parameters:
type
- a new type
-
getCreatorid
-
setCreatorid
Sets a new creator id. Must not be null or empty.- Parameters:
creatorid
- a new id
-
getPlural
String getPlural()The plural name of the object. For example: user - users- Returns:
- the plural name
-
getObjectURI
-
getTimestamp
Long getTimestamp()The time when the object was created, in milliseconds.- Returns:
- the timestamp of creation
-
setTimestamp
Sets the timestamp.- Parameters:
timestamp
- a new timestamp in milliseconds.
-
getUpdated
Long getUpdated()The last time this object was updated. Timestamp in ms.- Returns:
- timestamp in milliseconds
-
setUpdated
Sets the last updated timestamp.- Parameters:
updated
- a new timestamp
-
getTags
-
setTags
-
getStored
Boolean getStored()Boolean flag which controls whether this object is stored in the database or not. Default is true.- Returns:
- true if this object is stored in DB.
-
setStored
Sets the "isStored" flag.- Parameters:
isStored
- when set to true, object is stored in DB.
-
getIndexed
Boolean getIndexed()Boolean flag which controls whether this object is indexed by the search engine. Default is true.- Returns:
- true if this object is indexed
-
setIndexed
Sets the "isIndexed" flag.- Parameters:
isIndexed
- when set to true, object is indexed.
-
getCached
Boolean getCached()Boolean flag which controls whether this object is cached. Default is true.- Returns:
- true if this object is cached on update() and create().
-
setCached
Sets the "isCached" flag.- Parameters:
isCached
- when set to true, object is cached.
-
getVersion
Long getVersion()Returns the version number for this object. Used primarily for optimistic locking.- Returns:
- a positive number,
0
if unused or-1
, indicating a failed update.
-
setVersion
Sets the version of this object. This value should come from the database.- Parameters:
version
- a positive number, different than the current value of the version field
-
create
String create()Stores this object in the data store.- Returns:
- the id of the object (a new id if object is new)
- See Also:
-
update
-
delete
void delete()Deletes the object permanently by removing it from the data store.- See Also:
-
exists
boolean exists()Checks if an object is stored in the data store.- Returns:
- true if the object is persisted to the data store.
- See Also:
-