ModelController<K extends RenovationDocument> class abstract

An abstract controller containing methods and properties related to document CRUD operations.

Inheritance
Implementers

Constructors

ModelController(RenovationConfig config)

Properties

config RenovationConfig
finalinherited
hashCode int
The hash code for this object.
no setterinherited
locals Map<String, Map<String, dynamic>>
Cache object for the docs
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addChildDoc<T extends K>(T doc, dynamic field) Future<T>
Returns a child doc instance, already attached to parent doc
addTag({required String doctype, required String docName, required String tag}) Future<RequestResponse<String?>>
Adds a tag to document docName of a doctype.
addToLocals<T extends K>(T doc) → void
Adds the documents to a static local variable locals.
amendDoc<T extends K>(T doc) → T
Clones a doc, set amended_from property to the original doc.
assignDoc({required String assignTo, required String doctype, bool? myself, DateTime? dueDate, String? description, String? docName, List<String>? docNames, bool notify = false, Priority? priority, bool bulkAssign = false}) Future<RequestResponse<bool?>>
Assigns a doc or a list of docs to a particular user.
cancelDoc<T extends K>(T doc) Future<RequestResponse<T?>>
Returns the cancelled document T of a submitted document.
clearCache() → void
Clears the locals and newNameCount and reset to {}
override
completeDocAssignment({required String doctype, required String docName, required String assignedTo}) Future<RequestResponse>
Sets the assignment to Status.Cancelled which means that the task is assigned.
copyDoc<T extends K>(T doc) → T
Returns a cloned doc, with a new local name.
deleteDoc(String doctype, String docname) Future<RequestResponse<String?>>
Deletes the document from the backend, returning its name.
getCore() Renovation
Gets the reference to the Renovation instance
inherited
getDoc<T extends K>(T obj, String docname, {bool? forceFetch}) Future<RequestResponse<T?>>
Returns the document specified by its docname.
getDocFromCache<T extends K>(String? doctype, String docname) → T?
Returns the document from the local map.
getDocsAssignedToUser({required String assignedTo, String? doctype, Status? status}) Future<RequestResponse<List?>>
Returns the list of documents assigned to a user.
getHostUrl() String
Returns the configured host URL towards the backend
inherited
getList<T extends K>(T obj, {List<String>? fields, dynamic filters, String? orderBy, int? limitPageStart, int? limitPageLength, String? parent, Map<String, List<String>>? tableFields, List<String>? withLinkFields}) Future<RequestResponse<List<T?>?>>
Returns list of documents T of a doctype specified by obj.
getNewName(String doctype) String
Returns a new name for a doctype. For instance, New Renovation Review 1.
getReport({required String report, dynamic filters, String? user}) Future<RequestResponse>
Get report values.
getTaggedDocs({required String doctype, String? tag}) Future<RequestResponse<List<String>?>>
Gets all the names of all documents with the param-tag.
getTags({required String doctype, String? likeTag}) Future<RequestResponse<List<String?>?>>
Returns all tags of a doctype.
getUsersAssignedToDoc({required String doctype, required String docName}) Future<RequestResponse<List?>>
Returns the users assigned to a document of a certain doctype.
getValue(String doctype, String docname, String docfield) Future<RequestResponse<Map<String, dynamic>?>>
Returns a Map of docfield and its value from the backend.
handleError(String errorId, ErrorDetail error) → ErrorDetail
Returns the ErrorDetail after manipulating an existing one.
inherited
newDoc<T extends K>(T doc) → T
Returns a new instance of T document with a new name based on getNewName.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeTag({required String doctype, required String docName, required String tag}) Future<RequestResponse<String?>>
Adds a tag to document docName of a doctype.
saveDoc<T extends K>(T doc) Future<RequestResponse<T?>>
Returns the saved document T after saving in the backend.
saveSubmitDoc<T extends K>(T doc) Future<RequestResponse<T?>>
Saves the document first, then submit, in a single db transaction.
Returns a list of results after searching against fields.
setValue<T extends K>(T obj, String? docName, String docField, dynamic docValue) Future<RequestResponse<T?>>
Returns the modified document T after setting the docField with docValue.
submitDoc<T extends K>(T doc) Future<RequestResponse<T?>>
Submit a submittable document.
toString() String
A string representation of this object.
inherited
unAssignDoc({required String doctype, required String docName, required String unAssignFrom}) Future<RequestResponse<bool?>>
Un-assigns a user from the doctype and docName.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

newNameCount Map<String, int>
Holds the new name prefix number per doctype
final