Class Form
java.lang.Object
com.erudika.para.core.Form
- All Implemented Interfaces:
Linkable, ParaObject, Votable, Serializable
This class represents an HTML form. It is used for form submissions and settings.
- Author:
- Alex Bogdanovski [[email protected]]
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface Votable
Votable.VoteValue -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMax email recipients that will be notified by email after a form is submitted. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncountChildren(String type) Counts the number of children of a certain type.countLinks(String type2) Counts the number of links to other objects of a certain type.create()Persists the object to the database.voiddelete()Deletes the object from the database.voiddeleteChildren(String type) Deletes all children of a certain type.booleanReturns true if this object is equal to another.booleanexists()Returns true if the object exists in the database.<P extends ParaObject>
List<P> findChildren(String type, String query, Pager... pager) Finds children of a certain type that match a specific query.<P extends ParaObject>
List<P> findLinkedObjects(String type, String field, String query, Pager... pager) Finds linked objects of a certain type that match a specific field and query.getAppid()Returns the app identifier.Returns true if the object is cached.Captcha secret key.<P extends ParaObject>
List<P> getChildren(String type, Pager... pager) Returns a list of children of a certain type.<P extends ParaObject>
List<P> getChildren(String type, String field, String term, Pager... pager) Returns a list of children of a certain type that match a specific field and term.Returns the creator ID.The form URI.final StringgetId()Returns the object ID.Returns true if the object is indexed.<P extends ParaObject>
List<P> getLinkedObjects(String type, Pager... pager) Returns a list of linked objects of a certain type.Returns a list of links to other objects of a certain type.final StringgetName()Returns the object name.String[]Notify emails.Returns the object URI.Returns the parent ID.Returns the plural form of the object type.Redirect to.Returns true if the object is stored in the database.getTags()Returns the tags.Returns the timestamp.final StringgetType()Returns the object type.Returns the updated timestamp.Returns the version of the object.getVotes()Returns the number of votes.inthashCode()Returns the hash code for this object.booleanisLinked(ParaObject toObj) Returns true if the object is linked to another object.booleanReturns true if the object is linked to another object of a certain type and ID.booleanIs Markdown in message body enabled?.booleanShould we keep messages in DB?.booleanIs HTML allowed?.Links the object to another object of a certain type and ID.voidSets the app identifier.voidSets the cached flag.voidsetCaptchaSecretKey(String captchaSecretKey) Captcha secret key.voidsetCreatorid(String creatorid) Sets the creator ID.final voidSets the object ID.voidsetIndexed(Boolean indexed) Sets the indexed flag.voidsetMarkdownEnabled(boolean markdownEnabled) Is Markdown in message body enabled?.voidsetMessageStorageEnabled(boolean messageStorageEnabled) Should we keep messages in DB?.final voidSets the object name.voidsetNotifyEmails(String[] notifyEmails) Notify emails.voidsetParentid(String parentid) Sets the parent ID.voidsetPlaintextOnly(boolean plaintextOnly) Is HTML allowed?.voidsetRedirectTo(String redirectTo) Redirect to.voidSets the stored flag.voidSets the tags.voidsetTimestamp(Long timestamp) Sets the timestamp.final voidSets the object type.voidsetUpdated(Long updated) Sets the updated timestamp.voidsetVersion(Long version) Sets the version of the object.voidSets the number of votes.toString()Returns a JSON string representation of this object.voidUnlinks the object from another object of a certain type and ID.voidUnlinks the object from all other objects.voidupdate()Updates the object in the database.booleanVotes down for the object.booleanVotes up for the object.
-
Field Details
-
MAX_RECIPIENTS_PER_FORM
public static final int MAX_RECIPIENTS_PER_FORMMax email recipients that will be notified by email after a form is submitted. Consider making this configurable in the future.- See Also:
-
-
Constructor Details
-
Form
public Form()No-args constructor. Same asAddress(null) -
Form
-
-
Method Details
-
getFormActionURI
-
getCaptchaSecretKey
-
setCaptchaSecretKey
Captcha secret key.- Parameters:
captchaSecretKey- secret
-
getNotifyEmails
-
setNotifyEmails
-
isMessageStorageEnabled
public boolean isMessageStorageEnabled()Should we keep messages in DB?.- Returns:
- true if messages are kept in DB
-
setMessageStorageEnabled
public void setMessageStorageEnabled(boolean messageStorageEnabled) Should we keep messages in DB?.- Parameters:
messageStorageEnabled- true of false
-
isPlaintextOnly
public boolean isPlaintextOnly()Is HTML allowed?.- Returns:
- false if plaintext only
-
setPlaintextOnly
public void setPlaintextOnly(boolean plaintextOnly) Is HTML allowed?.- Parameters:
plaintextOnly- plaintext
-
isMarkdownEnabled
public boolean isMarkdownEnabled()Is Markdown in message body enabled?.- Returns:
- true if enabled
-
setMarkdownEnabled
public void setMarkdownEnabled(boolean markdownEnabled) Is Markdown in message body enabled?.- Parameters:
markdownEnabled- true if enabled
-
getRedirectTo
-
setRedirectTo
-
getId
Returns the object ID.- Specified by:
getIdin interfaceParaObject- Returns:
- the id
-
setId
Sets the object ID.- Specified by:
setIdin interfaceParaObject- Parameters:
id- the id
-
getType
Returns the object type.- Specified by:
getTypein interfaceParaObject- Returns:
- the type
-
setType
Sets the object type.- Specified by:
setTypein interfaceParaObject- Parameters:
type- the type
-
getAppid
Returns the app identifier.- Specified by:
getAppidin interfaceParaObject- Returns:
- the appid
-
setAppid
Sets the app identifier.- Specified by:
setAppidin interfaceParaObject- Parameters:
appid- the appid
-
getObjectURI
Returns the object URI.- Specified by:
getObjectURIin interfaceParaObject- Returns:
- the URI
- See Also:
-
getTags
Returns the tags.- Specified by:
getTagsin interfaceParaObject- Returns:
- the tags
- See Also:
-
getStored
Returns true if the object is stored in the database.- Specified by:
getStoredin interfaceParaObject- Returns:
- true if stored
-
setStored
Sets the stored flag.- Specified by:
setStoredin interfaceParaObject- Parameters:
stored- the stored flag
-
getIndexed
Returns true if the object is indexed.- Specified by:
getIndexedin interfaceParaObject- Returns:
- true if indexed
-
setIndexed
Sets the indexed flag.- Specified by:
setIndexedin interfaceParaObject- Parameters:
indexed- the indexed flag
-
getCached
Returns true if the object is cached.- Specified by:
getCachedin interfaceParaObject- Returns:
- true if cached
-
setCached
Sets the cached flag.- Specified by:
setCachedin interfaceParaObject- Parameters:
cached- the cached flag
-
setTags
Sets the tags.- Specified by:
setTagsin interfaceParaObject- Parameters:
tags- the tags
-
getTimestamp
Returns the timestamp.- Specified by:
getTimestampin interfaceParaObject- Returns:
- the timestamp
-
setTimestamp
Sets the timestamp.- Specified by:
setTimestampin interfaceParaObject- Parameters:
timestamp- the timestamp
-
getCreatorid
Returns the creator ID.- Specified by:
getCreatoridin interfaceParaObject- Returns:
- the creatorid
-
setCreatorid
Sets the creator ID.- Specified by:
setCreatoridin interfaceParaObject- Parameters:
creatorid- the creatorid
-
getName
Returns the object name.- Specified by:
getNamein interfaceParaObject- Returns:
- the name
-
setName
Sets the object name.- Specified by:
setNamein interfaceParaObject- Parameters:
name- the name
-
getPlural
Returns the plural form of the object type.- Specified by:
getPluralin interfaceParaObject- Returns:
- the plural name
-
getParentid
Returns the parent ID.- Specified by:
getParentidin interfaceParaObject- Returns:
- the parentid
-
setParentid
Sets the parent ID.- Specified by:
setParentidin interfaceParaObject- Parameters:
parentid- the parentid
-
getUpdated
Returns the updated timestamp.- Specified by:
getUpdatedin interfaceParaObject- Returns:
- the updated timestamp
-
setUpdated
Sets the updated timestamp.- Specified by:
setUpdatedin interfaceParaObject- Parameters:
updated- the updated timestamp
-
create
Persists the object to the database.- Specified by:
createin interfaceParaObject- Returns:
- the object ID
- See Also:
-
update
public void update()Updates the object in the database.- Specified by:
updatein interfaceParaObject- See Also:
-
delete
public void delete()Deletes the object from the database.- Specified by:
deletein interfaceParaObject- See Also:
-
exists
public boolean exists()Returns true if the object exists in the database.- Specified by:
existsin interfaceParaObject- Returns:
- true if exists
- See Also:
-
voteUp
-
voteDown
-
getVotes
-
setVotes
-
getVersion
Returns the version of the object.- Specified by:
getVersionin interfaceParaObject- Returns:
- the version
-
setVersion
Sets the version of the object.- Specified by:
setVersionin interfaceParaObject- Parameters:
version- the version
-
countLinks
Counts the number of links to other objects of a certain type.- Specified by:
countLinksin interfaceLinkable- Parameters:
type2- the other type- Returns:
- the number of links
-
getLinks
-
getLinkedObjects
Returns a list of linked objects of a certain type.- Specified by:
getLinkedObjectsin interfaceLinkable- Type Parameters:
P- the type of linked objects- Parameters:
type- the other typepager- a pager- Returns:
- a list of linked objects
-
findLinkedObjects
public <P extends ParaObject> List<P> findLinkedObjects(String type, String field, String query, Pager... pager) Finds linked objects of a certain type that match a specific field and query.- Specified by:
findLinkedObjectsin interfaceLinkable- Type Parameters:
P- the type of linked objects- Parameters:
type- the other typefield- the field to search inquery- the search querypager- a pager- Returns:
- a list of linked objects
-
isLinked
-
isLinked
Returns true if the object is linked to another object. -
link
-
unlink
-
unlinkAll
-
countChildren
Counts the number of children of a certain type.- Specified by:
countChildrenin interfaceLinkable- Parameters:
type- the child type- Returns:
- the number of children
-
getChildren
Returns a list of children of a certain type.- Specified by:
getChildrenin interfaceLinkable- Type Parameters:
P- the type of children- Parameters:
type- the child typepager- a pager- Returns:
- a list of children
-
getChildren
public <P extends ParaObject> List<P> getChildren(String type, String field, String term, Pager... pager) Returns a list of children of a certain type that match a specific field and term.- Specified by:
getChildrenin interfaceLinkable- Type Parameters:
P- the type of children- Parameters:
type- the child typefield- the field to search interm- the search termpager- a pager- Returns:
- a list of children
-
findChildren
Finds children of a certain type that match a specific query.- Specified by:
findChildrenin interfaceLinkable- Type Parameters:
P- the type of children- Parameters:
type- the child typequery- the search querypager- a pager- Returns:
- a list of children
-
deleteChildren
Deletes all children of a certain type.- Specified by:
deleteChildrenin interfaceLinkable- Parameters:
type- the child type
-
hashCode
-
equals
-
toString
-