Learning
Documentation
Community
Open Exchange
Global Masters
Home / Class Reference / ENSLIB namespace / %Document.Object
Private  Storage   

%Document.Object


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

Inventory


Parameters Properties Methods Queries Indices ForeignKeys Triggers
38


Summary


Methods
%AddToSaveSet %AddToSyncSet %ClassIsLatestVersion %ClassName
%ConstructClone %Delete %DeleteId %DispatchClassMethod
%DispatchGetModified %DispatchMethod %DispatchSetModified %DispatchSetMultidimProperty
%Extends %GetParameter %GetSwizzleObject %IsA
%IsModified %IsNull %New %NormalizeObject
%ObjectIsNull %ObjectModified %OnBeforeAddToSync %OnDetermineClass
%Open %OpenId %OriginalNamespace %PackageName
%RemoveFromSaveSet %ResolveConcurrencyConflict %SerializeObject %SetModified
%SyncObjectIn %SyncTransport %ToJSONStream %ValidateObject
BuildValueArray CSON Clear Count
DocumentExists Find GetAt GetNext
GetPrevious Insert InsertAt InsertList
InsertOrdered IsDefined LogicalToOdbc Next
OdbcToLogical Previous RemoveAt SetAt
XML XMLDTD XMLExport XMLExportToStream
XMLExportToString XMLNew XMLSchema XMLSchemaNamespace
XMLSchemaType deswizzle loadResultSet loadXML
open save show swizzle


Methods


• method %ToJSONStream(ByRef pStream As %Stream.Object, pRewindStream As %Boolean = 0) as %Status
Write the document as JSON to a stream.
• method %ValidateObject(force As %Integer) as %Status
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.

Returns a %Status value indicating success or failure.

• classmethod BuildValueArray(serialized As %Binary, array As %Binary) as %Status
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
• method Clear() as %Status
Clears the contents of the array.

Returns a %Status value indicating success or failure.

• method Count() as %Integer
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
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
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
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
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
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 %CacheString) as %Status
Inserts an element with value element at the end of the list.

Returns a %Status value indicating success or failure.

• method InsertAt(element As %CacheString, key As %Integer) as %Status
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 %CacheString) as %Status
Inserts a list with value inslist at the end of the list.

Returns a %Status value indicating success or failure.

• method InsertOrdered(element As %CacheString) as %Status
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
Returns true (1) if a value is defined at location key, otherwise false (0).
• classmethod LogicalToOdbc(val As %String = "") as %String
Converts the serial state of this array object to a delimited string using the value of the ODBCDELIMITER parameter as a delimiter.
• final method Next(key As %String = "") as %String
• classmethod OdbcToLogical(val As %String = "") as %String
Converts the value of an incoming delimited string to a serialized state using the value of the ODBCDELIMITER parameter as a delimiter.
• final method Previous(key As %String = "") as %String
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 %CacheString
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 %CacheString, key As %Integer) as %Status
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
%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
deswizzle serializes a %Document object into CSON format.
• method loadResultSet(pResultSet As %SQL.IResultSet, pFieldName As %String(MAXLEN="")="results")
loadResult
• method loadXML(pXMLNode As %XML.Node)
• classmethod open(pWhere As %ZEN.Datatype.string, pDocumentID As %ZEN.Datatype.string, Output pStatus As %Status = "") as %Document.Object
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
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)
Display the current object and all nested objects.
• method swizzle(pObjectValue As %String(MAXLEN="")="")
swizzle converts a CSON object value into the current object.