Hello Alexander,
thank you for your response!
I have ran a similar test to you and identified that the problem isn't with the single %SerialObject property, but with the one that is a list of them.
Here's the code:
ClassMethod test()
{
set tKP = ..%New()
set tAddressSerial = ##class(HS.Message.AddUpdateHubRequest).%OpenId(21986071).Addresses.GetAt(1)
zw tAddressSerial
set tKP.IsSerial = 1set tKP.Serial = tAddressSerial
w tKP.%Save()
}
ClassMethod test2()
{
set tKP = ..%New()
set tIdentifierSerial = ##class(HS.Message.AddUpdateHubRequest).%OpenId(21986071).Identifiers
zw tIdentifierSerial
set tKP.IsSerial = 1set tKP.IsList = 1set tSerial = tIdentifierSerial.GetNext(.tKey)
for {
if tKey="" {quit}
do tKP.SerialList.Insert(tSerial)
set tSerial = tIdentifierSerial.GetNext(.tKey)
}
w tKP.%Save()
}The tXSerial variables are instances of classes that extend %SerialObject.
And here are the results:
HSROUTER>do##class(HS.Local.CZ.OR.ROUTER.Service.Data.KeyProperty).test()
tAddressSerial=5@HS.Types.Address ; <OREF>
+----------------- general information ---------------
| oref value: 5
| class name: HS.Types.Address
| %%OID: $lb($lb("Fake Street","24","","52","","","","Townville","CZE","12345","","","HP","","A",""),"HS.Types.Address")
| reference count: 2
+----------------- attribute values ------------------
| City = "Townville"
| Country = ""
| County = ""
| Description = ""
| POBox = ""
| PostalCode = 12345
| Precinct = ""
| PrimaryFlag = ""
| State = "CZE"
| Status = "A"
| StreetLine = "Fake Street"
| StreetName = "" <Get>
| StreetNumber = "24" <Get>
| StreetType = 52 <Get>
| UnitNumber = ""
| Use = "HP"
+-----------------------------------------------------
1
HSROUTER>do##class(HS.Local.CZ.OR.ROUTER.Service.Data.KeyProperty).test2()
tIdentifierSerial=2@%Collection.ListOfObj; <OREF>
+----------------- general information ---------------
| oref value: 2
| class name: %Collection.ListOfObj
| reference count: 3
+----------------- attribute values ------------------
| ElementClassType = "serial"
| ElementType = "HS.Types.Identifier"
| LiteralBehavior = 0
| (oidData) = ""
| (oidData(1)) = $lb($lb("DS4","496228107","","PN","A",""))
| (oidData(2)) = $lb($lb("111","496228107","","MB","A",""))
| (orefData) = "2@%Collection.ListOfObj"
| OrefStorage = 16393
| Owner = 2
| ReadOnly = ""
| Storage = 16388
| StreamLocation = ""
+--------------- calculated references ---------------
| Size <Get>
+-----------------------------------------------------
02x<METHOD DOES NOT EXIST>zSerialNewObject+1^HS.Local.CZ.OR.ROUTER.Service.Data.KeyProperty.1 *%New,%Library.SerialObject«
HSROUTERJ$^zSerialNewObject+1^HS.Local.CZ.OR.ROUTER.Service.Data.KeyProperty.1 +1L$^zSerialGetSwizzled+2^HS.Local.CZ.OR.ROUTER.Service.Data.KeyProperty.1 +3G$^%AddToSaveSet+5^HS.Local.CZ.OR.ROUTER.Service.Data.KeyProperty.1 +16$^%BuildObjectGraph+1^%Library.RegisteredObject.1 +1?$^%Save+5^HS.Local.CZ.OR.ROUTER.Service.Data.KeyProperty.1 +1AD^ztest2+12^HS.Local.CZ.OR.ROUTER.Service.Data.KeyProperty.1 +X^@ +1The whole purpose of the KeyProperty class is to be part of another class which is meant to replicate Ens.Request instances into memory and regenerate them later. We need this because even though the Ens.Request class is persistent, it is deleted during management data purges and there are some requests we need to keep/remake even after purge schedule. I have figured out saving literal and persistent properties, so now I need to figure out a way to do so with serial ones as well. This was the first and simplest impulse but there might be another obvious way to save any sort of serial object and retrieve it later.
- Log in to post comments