Package com.ibm.cloud.cloudant.v1.model
Class DesignDocument
java.lang.Object
com.ibm.cloud.sdk.core.service.model.DynamicModel<Object>
com.ibm.cloud.cloudant.v1.model.DesignDocument
- All Implemented Interfaces:
com.ibm.cloud.sdk.core.service.model.ObjectModel
Schema for a design document.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the attachments.Gets the conflicts.Gets the deletedConflicts.Gets the filters.getId()
Gets the id.Gets the indexes.Gets the language.Gets the localSeq.Gets the options.getRev()
Gets the rev.Gets the revisions.Gets the revsInfo.Gets the validateDocUpdate.getViews()
Gets the views.Gets the autoupdate.Gets the deleted.New builder.void
setAttachments
(Map<String, Attachment> attachments) Sets the attachments.void
setAutoupdate
(Boolean autoupdate) Sets the autoupdate.void
setConflicts
(List<String> conflicts) Sets the conflicts.void
setDeleted
(Boolean deleted) Sets the deleted.void
setDeletedConflicts
(List<String> deletedConflicts) Sets the deletedConflicts.void
setFilters
(Map<String, String> filters) Sets the filters.void
Sets the id.void
setIndexes
(Map<String, SearchIndexDefinition> indexes) Sets the indexes.void
setLanguage
(String language) Sets the language.void
setLocalSeq
(String localSeq) Sets the localSeq.void
setOptions
(DesignDocumentOptions options) Sets the options.void
Sets the rev.void
setRevisions
(Revisions revisions) Sets the revisions.void
setRevsInfo
(List<DocumentRevisionStatus> revsInfo) Sets the revsInfo.void
setValidateDocUpdate
(String validateDocUpdate) Sets the validateDocUpdate.void
Sets the views.Methods inherited from class com.ibm.cloud.sdk.core.service.model.DynamicModel
equals, get, getAdditionalPropertyTypeToken, getProperties, getPropertyNames, hashCode, put, removeProperties, removeProperty, setProperties, toString
-
Constructor Details
-
DesignDocument
public DesignDocument()
-
-
Method Details
-
newBuilder
New builder.- Returns:
- a DesignDocument builder
-
getAttachments
Gets the attachments. Schema for a map of attachment name to attachment metadata.- Returns:
- the attachments
-
setAttachments
Sets the attachments.- Parameters:
attachments
- the new attachments
-
getConflicts
Gets the conflicts. Schema for a list of document revision identifiers.- Returns:
- the conflicts
-
setConflicts
Sets the conflicts.- Parameters:
conflicts
- the new conflicts
-
isDeleted
Gets the deleted. Deletion flag. Available if document was removed.- Returns:
- the deleted
-
setDeleted
Sets the deleted.- Parameters:
deleted
- the new deleted
-
getDeletedConflicts
Gets the deletedConflicts. Schema for a list of document revision identifiers.- Returns:
- the deletedConflicts
-
setDeletedConflicts
Sets the deletedConflicts.- Parameters:
deletedConflicts
- the new deletedConflicts
-
getId
Gets the id. Schema for a design document ID.- Returns:
- the id
-
setId
Sets the id.- Parameters:
id
- the new id
-
getLocalSeq
Gets the localSeq. Document's update sequence in current database. Available if requested with local_seq=true query parameter.- Returns:
- the localSeq
-
setLocalSeq
Sets the localSeq.- Parameters:
localSeq
- the new localSeq
-
getRev
Gets the rev. Schema for a document revision identifier.- Returns:
- the rev
-
setRev
Sets the rev.- Parameters:
rev
- the new rev
-
getRevisions
Gets the revisions. Schema for list of revision information.- Returns:
- the revisions
-
setRevisions
Sets the revisions.- Parameters:
revisions
- the new revisions
-
getRevsInfo
Gets the revsInfo. Schema for a list of objects with information about local revisions and their status.- Returns:
- the revsInfo
-
setRevsInfo
Sets the revsInfo.- Parameters:
revsInfo
- the new revsInfo
-
isAutoupdate
Gets the autoupdate. Indicates whether to automatically build indexes defined in this design document.- Returns:
- the autoupdate
-
setAutoupdate
Sets the autoupdate.- Parameters:
autoupdate
- the new autoupdate
-
getFilters
Gets the filters. Schema for filter functions definition. This schema is a map where keys are the names of the filter functions and values are the function definition in string format. Filter function formats, or filters the changes feed that pass filter rules. The function takes 2 parameters: * `doc`: The document that is being processed. * `req`: A Request JavaScript object with these properties: * `body` - string, Request body data as string. If the request method is GET this field contains the value `"undefined"`. If the method is DELETE or HEAD the value is `""` (empty string). * `cookie` - Cookies object. * `form` - Form Data object, contains the decoded body as key-value pairs if the Content-Type header was application/x-www-form-urlencoded. * `headers` - Request Headers object. * `id` - string, requested document id if it was specified or null otherwise. * `info` - Database Information object, see `DatabaseInformation`. * `method` - string or an array of chars, request method. String value is a method as one of: HEAD, GET, POST, PUT, DELETE, OPTIONS, TRACE, COPY. For not supported methods it will be represented as an array of char codes e.g. for VIEW it will be 86,73,69,87. * `path` - array of strings, requested path sections. * `peer` - string, request source IP address. * `query` - string, URL query parameters object. Note that multiple keys are not supported and the last key value suppresses others. * `requested_path` - array of strings, actual requested path section. * `raw_path` - string, raw requested path. * `userCtx`: User Context Object, containing information about the user writing the document (if present), see the `UserContext`. * `secObj`: Security Object, with lists of database security roles, see the `SecurityObject`. * `uuid` - string, generated UUID by a specified algorithm in the config file. Filter functions must return true if a document passed all the rules.- Returns:
- the filters
-
setFilters
Sets the filters.- Parameters:
filters
- the new filters
-
getIndexes
Gets the indexes. Search (text) index function definitions.- Returns:
- the indexes
-
setIndexes
Sets the indexes.- Parameters:
indexes
- the new indexes
-
getLanguage
Gets the language. Defines Query Server key to process design document functions.- Returns:
- the language
-
setLanguage
Sets the language.- Parameters:
language
- the new language
-
getOptions
Gets the options. Schema for design document options.- Returns:
- the options
-
setOptions
Sets the options.- Parameters:
options
- the new options
-
getValidateDocUpdate
Gets the validateDocUpdate. Validate document update function can be used to prevent invalid or unauthorized document update requests from being stored. Validation functions typically examine the structure of the new document to ensure that required fields are present and to verify that the requesting user should be allowed to make changes to the document properties. When a write request is received for a given database, the validation function in each design document in that database is called in an unspecified order. If any of the validation functions throw an error, the write will not succeed. The validation function can abort the pending document write by throwing one of two error objects: ``` // user is not authorized to make the change but may re-authenticate throw({ unauthorized: 'Error message here.' }); // change is not allowed throw({ forbidden: 'Error message here.' }); ``` The function takes 4 parameters: * `newDoc` - New version of document that will be stored from the update request. * `oldDoc` - Previous version of document that is already stored. * `userCtx` - User Context Object, containing information about the user writing the document (if present), see the `UserContext`. * `secObj` - Security Object, with lists of database security roles, see the `SecurityObject`.- Returns:
- the validateDocUpdate
-
setValidateDocUpdate
Sets the validateDocUpdate.- Parameters:
validateDocUpdate
- the new validateDocUpdate
-
getViews
Gets the views. Schema for design document views.- Returns:
- the views
-
setViews
Sets the views.- Parameters:
views
- the new views
-