BinaryData (TImportContext)
De Wiki1000
property BinaryData:TfwBinary;
Cette propriété de type binaire permet de définir les données à importer lorsque celle-ci sont contenues dans un objet binaire.
Exemple :
Importation des données contenues dans un message de file d'attente
unit TestSYFREWF; interface Type ProcessusImport = Class(TitObject) public Procedure doImport(aMsg:TdbmQueueMessage); Procedure Execute; end; Implementation {ProcessusImport} Procedure ProcessusImport.doImport(aMsg:TdbmQueueMessage); //procedure doImport(aMsg:TdbmQueueMessage); var instB:WFClasseB; inst:TImportContext; begin withP Transaction do begin instB := WFClasseB.Create; instB.unCode := 'B'+FormatDateTime('c',Now); instB.Caption := 'Session:'+instB.unCode; end; inst := TImportContext.Create; inst.ShareMode.Value := ISM_DEFAULT; inst.ImportMode := miInsert+miUpdate+miDisableEvents; inst.AdditionalValues.Values['uneChaine'] := 'uneChaineValue'; inst.AdditionalValues.Values['unEntier'] := 1; inst.AdditionalValues.Values['unEtat:AsVariant'] := WFCAState_Etat1; inst.AdditionalValues.Values['oidWFClasseBRef'] := instB.InstanceOID; // inst.BinaryData.CopyFrom(aMsg.binaryContent,bcmShare); // Result := inst.Execute('testimport-wfclassea.dip',''); end; Procedure ProcessusImport.Execute; //Procedure Execute; var aMsg:TdbmQueueMessage; aTopic:string; idx:Integer; begin if Assigned(UserContext.TaskContext) then begin UserContext.TaskContext.AddMessage('MyProcessus.Execute'); if Assigned(UserContext.TaskContext.EventContext.receivedMsg) then begin aMsg := UserContext.TaskContext.EventContext.receivedMsg; UserContext.TaskContext.AddMessage(Format('Message :%s',[aMsg.queueTopic]]); doImport(aMsg); end else begin UserContext.TaskContext.AddMessage('No message, process as a regular task'); end; end; end; end.
Voir aussi: