// BEGIN EXTRA METHODS (C:/GitHub/rafidzal/OpenADK-java/adk-generator/../adk-generator/datadef/core/sif20/SIF_Status.txt.cs) public override string ToString() { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(SIF_Code); SIF_Data data = SIF_Data; if (data != null) { sb.Append(" ("); sb.Append(data.TextValue); sb.Append(")"); } return(sb.ToString()); }
/// <summary> Create a SIF_Ack for this message.</summary> /// <param name="code">The SIF_Status/SIF_Code value /// </param> /// <returns> A new SIF_Ack instance where the SIF_Status/SIF_Code value is /// set to the specified value and SIF_Ack header values are derived /// from this message's header values /// </returns> public virtual SIF_Ack ackStatus(int code) { SIF_Ack ack = new SIF_Ack(); SIF_Status status = new SIF_Status(code); ack.SIF_Status = status; ack.SIF_OriginalMsgId = MsgId; ack.SIF_OriginalSourceId = SourceId; SifVersion msgVersion = this.SifVersion; if (code == 8 /* Receiver is sleeping */ ) { if (msgVersion.Major == 1) { // SIF 1.x used SIF_Data for text SIF_Data d = new SIF_Data(); d.TextValue = "Receiver is sleeping"; status.SIF_Data = d; } else { status.SIF_Desc = "Receiver is sleeping"; } } ack.message = this; // Ack using the same version of SIF as this message ack.SifVersion = msgVersion; return ack; }
public void TestWriteXSINillMultiple() { SIF_Data data = new SIF_Data(); for (int a = 0; a < 3; a++) { StudentPersonal sp = new StudentPersonal(); sp.RefId = Adk.MakeGuid(); sp.StateProvinceId = "\u06DE55889"; sp.LocalId = "987987987987987"; Name name = new Name( NameType.LEGAL, "Johnson", "Steve" ); sp.Name = name; name.SetField( CommonDTD.NAME_TYPE, new SifString( null ) ); name.SetField( CommonDTD.NAME_MIDDLENAME, new SifString( null ) ); SIF_ExtendedElement see = new SIF_ExtendedElement( "FOO", null ); see.SetField( GlobalDTD.SIF_EXTENDEDELEMENT, new SifString( null ) ); see.XsiType = "Integer"; sp.SIFExtendedElementsContainer.Add( see ); sp.SetField( StudentDTD.STUDENTPERSONAL_LOCALID, new SifString( null ) ); data.AddChild( sp ); } SIF_Data data2 = (SIF_Data)AdkObjectParseHelper.WriteParseAndReturn(data, SifVersion.LATEST, null, true); foreach (SifElement child in data2.GetChildList()) { StudentPersonal copy = (StudentPersonal) child; Name name = copy.Name; Assert.IsNull( name.Type ); Assert.IsNull( name.MiddleName ); Assert.IsNotNull( name.FirstName ); Assert.IsNotNull( name.LastName ); // Attributes cannot be represented using xs nil SimpleField field = name.GetField( CommonDTD.NAME_TYPE ); Assert.IsNull( field ); field = name.GetField( CommonDTD.NAME_MIDDLENAME ); Assert.IsNotNull( field ); Assert.IsNull( field.Value ); SIF_ExtendedElement see = copy.GetSIFExtendedElement( "FOO" ); field = see.GetField( GlobalDTD.SIF_EXTENDEDELEMENT ); Assert.IsNotNull( field ); Assert.IsNull( field.Value ); field = copy.GetField( StudentDTD.STUDENTPERSONAL_LOCALID ); Assert.IsNotNull( field ); Assert.IsNull( field.Value ); } }