[1227] | 1 | /* MatchPersonCommand.as */
|
---|
| 2 |
|
---|
| 3 | package gov.va.med.edp.command.config
|
---|
| 4 | {
|
---|
| 5 | import com.adobe.cairngorm.commands.ICommand;
|
---|
| 6 | import com.adobe.cairngorm.control.CairngormEvent;
|
---|
| 7 |
|
---|
| 8 | import gov.va.med.edp.business.config.MatchPersonDelegate;
|
---|
| 9 | import gov.va.med.edp.command.AbstractResponderCommand;
|
---|
| 10 | import gov.va.med.edp.control.config.MatchPersonEvent;
|
---|
| 11 | import gov.va.med.edp.factory.TrackingFactory;
|
---|
| 12 | import gov.va.med.edp.model.TrackingModelLocator;
|
---|
| 13 |
|
---|
| 14 | import mx.rpc.IResponder;
|
---|
| 15 | import mx.rpc.events.FaultEvent;
|
---|
| 16 | import mx.rpc.events.ResultEvent;
|
---|
| 17 |
|
---|
| 18 | public class MatchPersonCommand extends AbstractResponderCommand implements ICommand, IResponder
|
---|
| 19 | {
|
---|
| 20 | private var model:TrackingModelLocator = TrackingModelLocator.getInstance();
|
---|
| 21 |
|
---|
| 22 | public function execute(event:CairngormEvent):void
|
---|
| 23 | {
|
---|
| 24 | var e: MatchPersonEvent = MatchPersonEvent(event);
|
---|
| 25 |
|
---|
| 26 | model.config.srcStaffReady = false;
|
---|
| 27 | model.config.srcStaff = null;
|
---|
| 28 |
|
---|
| 29 | var delegate: MatchPersonDelegate = new MatchPersonDelegate(this);
|
---|
| 30 | delegate.matchPersons(e.partial, e.personType);
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | public override function result(data:Object):void
|
---|
| 34 | {
|
---|
| 35 | var xml:XML = ResultEvent(data).result as XML;
|
---|
| 36 | model.config.srcStaff = TrackingFactory.buildStaffListFromXML(xml.staff);
|
---|
| 37 | model.config.srcStaffReady = true;
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | protected override function getFaultMessage(faultEvent:FaultEvent):String {
|
---|
| 41 | return "Error matching persons: " + super.getFaultMessage(faultEvent);
|
---|
| 42 | }
|
---|
| 43 | }
|
---|
| 44 | }
|
---|