%Document.Object

serial class %Document.Object extends %Library.SerialObject, %XML.Adaptor

Method Inventory (Including Private)

Methods (Including Private)

private method %GetSerial(force As %Integer = 0) as %String [ Language = objectscript ]
private method %OnNew(pObjectValue As %String(MAXLEN="")="", pIsList As %Integer = 0) as %Status [ Language = objectscript ]
This callback method is invoked by the %New() method to provide notification that a new instance of an object is being created.

If this method returns an error then the object will not be created.

It is passed the arguments provided in the %New call. When customizing this method, override the arguments with whatever variables and types you expect to receive from %New(). For example, if you're going to call %New, passing 2 arguments, %OnNew's signature could be:

Method %OnNew(dob as %Date = "", name as %Name = "") as %Status If instead of returning a %Status code this returns an oref and this oref is a subclass of the current class then this oref will be the one returned to the caller of %New method.

private method %SetSerial(serialized As %String) as %Status [ Language = objectscript ]
method %ToJSONStream(ByRef pStream As %Stream.Object, pRewindStream As %Boolean = 0) as %Status [ Language = objectscript ]
Write the document as JSON to a stream.
method %ValidateObject(force As %Library.Integer, checkserial As %Library.Boolean = 1) as %Status [ Language = objectscript ]
Inherited description: This method validates an object. The %Save method of a persistent class calls it before filing any objects in the database. The %ValidateObject method of a referencing object can call it. You can also call it explicitly at any time.

%ValidateObject() does the following:

  1. It tests if any required property values are missing.
  2. If the PROPERTYVALIDATION class parameter is set to ValidateOnSave, it validates each non-null property value by calling the property method IsValid on each literal property and the object's %ValidateObject method for object-valued properties.
  3. If present, it will call a user-supplied %OnValidateObject() method.

If any of these tests fail, %ValidateObject() immediately returns an error value. It is up to the caller of %ValidateObject to process the error value.

unused is not used. checkserial will force the checking of any serial properties by calling their %ValidateObject methods after swizzling this property.

Returns a %Status value indicating success or failure.

classmethod BuildValueArray(serialized As %Binary, array As %Binary) as %Status [ Language = objectscript ]
Constructs array(key)=value for each element in the serialval value.

Returns a %Status value indicating success or failure.

classmethod CSON(pObjectValue As %String(MAXLEN="")) as %Document.Object [ Language = objectscript ]
method Clear() as %Status [ Language = objectscript ]
Clears the contents of the array.

Returns a %Status value indicating success or failure.

method Count() as %Integer [ Language = objectscript ]
Returns the number of elements contained in the array.
classmethod DocumentExists(pWhere As %ZEN.Datatype.string, pDocumentID As %ZEN.Datatype.string = "") as %ZEN.Datatype.boolean [ Language = objectscript ]
DocumentExists() returns a boolean value indicate whether or not the documentID exists in the global/local variable reference (GLVN).

Parameters
pWhere Input

Global or local variable reference where documents are stored.

pDocumentID Input

The document ID.

method Find(element As %String, key As %String) as %String [ Language = objectscript ]
Starting from, but not including, location key, finds the next element in the array with value equal to element.

If key is a null string (""), the search starts at the beginning of the array.

Find returns the key associated with the found element or null string ("") if no element is found.

final method GetAt(key As %String = "") as %String [ Language = objectscript ]
Finds and returns the value of the element at position key in the list.

GetAt returns the value of the element at location key or null string ("") if no element is found.

method GetNext(ByRef key As %String) as %String [ Language = objectscript ]
Finds and returns the value of the element at the location after key in the array. If key is a null string (""), it returns the value of the first element in the array.

The value of key, which is passed by reference, is updated to the key value of the returned element or null string ("") if key is at the end of the array.

method GetPrevious(ByRef key As %String) as %String [ Language = objectscript ]
Finds and returns the value of the element at the location before key in the array. If key is a null string (""), it returns the value of the last element in the array.

The value of key, which is passed by reference, is updated to the key value of the returned element or null string ("") if key is at the beginning of the array.

method Insert(element As %RawString) as %Status [ Language = objectscript ]
Inserts an element with value element at the end of the list.

Returns a %Status value indicating success or failure.

method InsertAt(element As %RawString, key As %Integer) as %Status [ Language = objectscript ]
Inserts an element with value element at position key.

To make room for the new element, the elements previously at or following position key are moved up by one position.

key must be in the following range:


 1 <= key <= Count() + 1
 
Returns a %Status value indicating success or failure.
method InsertList(inslist As %RawString) as %Status [ Language = objectscript ]
Inserts a list with value inslist at the end of the list.

Returns a %Status value indicating success or failure.

method InsertOrdered(element As %RawString) as %Status [ Language = objectscript ]
Inserts an element with value element into the list at the correct ordered position. The elements in the list are shifted to accommodate the new element as necessary.

Returns a %Status value indicating success or failure.

final method IsDefined(key As %String) as %Boolean [ Language = objectscript ]
Returns true (1) if a value is defined at location key, otherwise false (0).
classmethod LogicalToOdbc(val As %String = "") as %String [ Language = objectscript ]
Converts the serial state of this array object to a delimited string using the value of the ODBCDELIMITER parameter as a delimiter.
classmethod OdbcToLogical(val As %String = "") as %String [ Language = objectscript ]
Converts the value of an incoming delimited string to a serialized state using the value of the ODBCDELIMITER parameter as a delimiter.
Finds and returns the key value of the element at the location preceding key in the array. If key is a null string (""), then Next() returns the key value for the last element in the array.
method RemoveAt(key As %Integer) as %RawString [ Language = objectscript ]
Removes the element at position key in the list. The elements following position key are moved to fill in the resulting gap.

RemoveAt returns the value of the removed element or null string ("") if no element was removed.

method SetAt(element As %RawString, key As %Integer) as %Status [ Language = objectscript ]
Sets the value of the element at position key to element.

Returns a %Status value indicating success or failure.

classmethod XML(pXML As %Binary = "") as %Document.Object [ Language = objectscript ]
%Document.Object contructor that populates the document content from an XML source. pXML can either be a counted array of lines, a stream object, or...
method deswizzle() as %String [ Language = objectscript ]
deswizzle serializes a %Document object into CSON format.
method loadResultSet(pResultSet As %SQL.IResultSet, pFieldName As %String(MAXLEN="")="results") [ Language = objectscript ]
method loadXML(pXMLNode As %XML.Node) [ Language = objectscript ]
classmethod open(pWhere As %ZEN.Datatype.string, pDocumentID As %ZEN.Datatype.string, Output pStatus As %Status = "") as %Document.Object [ Language = objectscript ]
OpenDocument will retrieve a previously saved document from the specified global or local variable reference (GLVN) with the specified pDocumentID and return an oref referencing an instance of %ZEN.proxyObject. If a document with the specified ID does not exist in that GLVN then OpenDocument will return an error in the output pStatus parameter.

Parameters
pWhere Input

Global or local variable reference. This is the location where the proxyObject instance will be saved.

pDocumentID Input

The ID of the document to be opened.

pStatus Output

The returned %Status value, indicating success or failure.

method save(pWhere As %ZEN.Datatype.string, pDocumentID As %ZEN.Datatype.string = "", pUpdate As %Integer = 1) as %Status [ Language = objectscript ]
Save the Document to a global or local variable reference (GLVN) with the specified pDocumentID. If a document with the same ID already exists in that GLVN then an error %Status value is returned.

Parameters
pWhere Input

Global or local variable reference. This is the location where the %Document instance will be saved.

pDocumentID Input

The document ID. This value must be unique within the GLVN specified in pWhere.

method show(pLevel As %ZEN.Datatype.integer = 0) [ Language = objectscript ]
Display the current object and all nested objects.
method swizzle(pObjectValue As %String(MAXLEN="")="") [ Language = objectscript ]
swizzle converts a CSON object value into the current object.

Inherited Members

Inherited Methods (Including Private)

FeedbackOpens in a new window