1 | /* MatchClosedVisitsCommand.as */
|
---|
2 |
|
---|
3 | package gov.va.med.edp.command
|
---|
4 | {
|
---|
5 | import com.adobe.cairngorm.commands.ICommand;
|
---|
6 | import com.adobe.cairngorm.control.CairngormEvent;
|
---|
7 |
|
---|
8 | import gov.va.med.edp.business.MatchClosedVisitsDelegate;
|
---|
9 | import gov.va.med.edp.control.MatchItemsEvent;
|
---|
10 | import gov.va.med.edp.factory.TrackingFactory;
|
---|
11 | import gov.va.med.edp.model.TrackingModelLocator;
|
---|
12 |
|
---|
13 | import mx.rpc.IResponder;
|
---|
14 | import mx.rpc.events.FaultEvent;
|
---|
15 | import mx.rpc.events.ResultEvent;
|
---|
16 |
|
---|
17 | public class MatchClosedVisitsCommand extends AbstractResponderCommand implements ICommand, IResponder
|
---|
18 | {
|
---|
19 | private var model:TrackingModelLocator = TrackingModelLocator.getInstance();
|
---|
20 |
|
---|
21 | public function execute(event:CairngormEvent):void
|
---|
22 | {
|
---|
23 | var matchEvent: MatchItemsEvent = MatchItemsEvent(event);
|
---|
24 | if ((matchEvent.partial == null) || (matchEvent.partial.length == 0)) {
|
---|
25 | model.matchingClosedVisits = null;
|
---|
26 | return;
|
---|
27 | }
|
---|
28 |
|
---|
29 | var delegate:MatchClosedVisitsDelegate = new MatchClosedVisitsDelegate(this);
|
---|
30 | delegate.matchClosedVisits(model.logArea, matchEvent.partial);
|
---|
31 | }
|
---|
32 |
|
---|
33 | public override function result(data:Object):void
|
---|
34 | {
|
---|
35 | var xml:XML = ResultEvent(data).result as XML;
|
---|
36 | model.matchingClosedVisits =
|
---|
37 | TrackingFactory.buildVisitListFromXML(xml.visit);
|
---|
38 | model.logEdit.resetEntry();
|
---|
39 | model.setEditState();
|
---|
40 | model.matchingClosedVisitsIndex = -1;
|
---|
41 | }
|
---|
42 |
|
---|
43 | protected override function getFaultMessage(faultEvent:FaultEvent):String {
|
---|
44 | return "Retrieve closed visits failed: " + super.getFaultMessage(faultEvent);
|
---|
45 | }
|
---|
46 | }
|
---|
47 | }
|
---|