Interface ParaObject

All Superinterfaces:
Linkable, Serializable, Votable
All Known Implementing Classes:
Address, App, Linker, Sysprop, Tag, Translation, User, Vote, Webhook

public interface ParaObject extends Serializable, Linkable, Votable
The core domain interface. All Para objects implement it.
Author:
Alex Bogdanovski [[email protected]]
  • Method Details

    • getId

      String getId()
      The id of an object. Usually an autogenerated unique string of numbers.
      Returns:
      the id
    • setId

      void setId(String id)
      Sets a new id. Must not be null or empty.
      Parameters:
      id - the new id
    • getName

      @NotBlank @Size(min=1, max=255) @NotBlank @Size(min=1,max=255) String getName()
      The name of the object. Can be anything.
      Returns:
      the name. default: [type id]
    • setName

      void setName(String name)
      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

      void setAppid(String appid)
      Sets a new app name. Must not be null or empty.
      Parameters:
      appid - the new app id (name)
    • getParentid

      String getParentid()
      The id of the parent object.
      Returns:
      the id of the parent or null
    • setParentid

      void setParentid(String parentid)
      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 to Class.getSimpleName().toLowerCase()
      Returns:
      the simple name of the class
    • setType

      void setType(String type)
      Sets a new object type. Must not be null or empty.
      Parameters:
      type - a new type
    • getCreatorid

      String getCreatorid()
      The id of the user who created this. Should point to a User id.
      Returns:
      the id or null
    • setCreatorid

      void setCreatorid(String creatorid)
      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

      String getObjectURI()
      The URI of this object. For example: /users/123
      Returns:
      the URI
      See Also:
    • getTimestamp

      Long getTimestamp()
      The time when the object was created, in milliseconds.
      Returns:
      the timestamp of creation
    • setTimestamp

      void setTimestamp(Long timestamp)
      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

      void setUpdated(Long updated)
      Sets the last updated timestamp.
      Parameters:
      updated - a new timestamp
    • getTags

      List<String> getTags()
      The tags associated with this object. Tags must not be null or empty.
      Returns:
      a set of tags, or an empty set
      See Also:
    • setTags

      void setTags(List<String> tags)
      Merges the given tags with existing tags.
      Parameters:
      tags - the additional tags, or clears all tags if set to null
    • 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

      void setStored(Boolean isStored)
      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

      void setIndexed(Boolean isIndexed)
      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

      void setCached(Boolean isCached)
      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

      void setVersion(Long version)
      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

      void update()
      Updates the object permanently. Changes to Locked fields are ignored.
      See Also:
    • 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: