1 | /* LoadConfigurationCommand.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.LoadConfigurationDelegate;
|
---|
9 | import gov.va.med.edp.command.AbstractResponderCommand;
|
---|
10 | import gov.va.med.edp.control.config.ConfigurationEvent;
|
---|
11 | import gov.va.med.edp.factory.SessionFactory;
|
---|
12 | import gov.va.med.edp.factory.TrackingFactory;
|
---|
13 | import gov.va.med.edp.model.TrackingModelLocator;
|
---|
14 | import gov.va.med.edp.util.BoardTools;
|
---|
15 | import gov.va.med.edp.vo.ColorMapVO;
|
---|
16 | import gov.va.med.edp.vo.ColorMatchVO;
|
---|
17 | import gov.va.med.edp.vo.DisplaySizeVO;
|
---|
18 |
|
---|
19 | import mx.collections.ArrayCollection;
|
---|
20 | import mx.rpc.IResponder;
|
---|
21 | import mx.rpc.events.FaultEvent;
|
---|
22 | import mx.rpc.events.ResultEvent;
|
---|
23 |
|
---|
24 | public class LoadConfigurationCommand extends AbstractResponderCommand implements ICommand, IResponder
|
---|
25 | {
|
---|
26 | private var model:TrackingModelLocator = TrackingModelLocator.getInstance();
|
---|
27 |
|
---|
28 | public function execute(event:CairngormEvent):void
|
---|
29 | {
|
---|
30 | model.config.colorLoaded = false;
|
---|
31 | model.config.bedLoaded = false;
|
---|
32 | model.config.paramLoaded = false;
|
---|
33 | var delegate: LoadConfigurationDelegate = new LoadConfigurationDelegate(this);
|
---|
34 | var loadEvent: ConfigurationEvent = ConfigurationEvent(event);
|
---|
35 | delegate.loadConfiguration(model.logArea);
|
---|
36 | }
|
---|
37 |
|
---|
38 | public override function result(data:Object):void
|
---|
39 | {
|
---|
40 | var xml:XML = ResultEvent(data).result as XML;
|
---|
41 |
|
---|
42 | // load color info first so it can be referenced by columns
|
---|
43 | // load color info - default maps
|
---|
44 | model.config.colorMaps =
|
---|
45 | TrackingFactory.buildColorMapListFromXML(xml.colorMaps.colors);
|
---|
46 |
|
---|
47 | // load color info - maps for current spec
|
---|
48 | BoardTools.applyColorSpec(xml.colorSpec.colors, model.config.colorMaps);
|
---|
49 | model.config.colorToken = xml.colorToken;
|
---|
50 | model.config.colorLoaded = true;
|
---|
51 |
|
---|
52 | // load available columns
|
---|
53 | model.config.availableColumns =
|
---|
54 | TrackingFactory.buildColumnSpecListFromXML(xml.columnList.col, model.config.colorMaps);
|
---|
55 |
|
---|
56 | //load screen sizes
|
---|
57 | model.config.displaySizes = TrackingFactory.buildScreenSizesFromXML(xml.screenSizes.size);
|
---|
58 |
|
---|
59 | // load room/bed info
|
---|
60 | model.config.beds =
|
---|
61 | TrackingFactory.buildRoomBedListFromXML(xml.beds.bed);
|
---|
62 | model.config.whenList =
|
---|
63 | SessionFactory.buildLookupListFromXML(xml.displayWhen.when);
|
---|
64 | model.config.statusList =
|
---|
65 | SessionFactory.buildLookupListFromXML(xml.statusList.status);
|
---|
66 | model.config.roomCategoryList =
|
---|
67 | SessionFactory.buildLookupListFromXML(xml.roomCategories.item);
|
---|
68 | model.config.bedToken = xml.bedToken;
|
---|
69 | model.config.bedLoaded = true;
|
---|
70 |
|
---|
71 | // load parameter info
|
---|
72 | model.config.params = TrackingFactory.buildLogEditParamsFromXML(xml.params[0]);
|
---|
73 | model.config.defaultRoomList = SessionFactory.buildLookupListFromXML(xml.defaultRoomList.item);
|
---|
74 | model.config.paramToken = xml.paramToken;
|
---|
75 | model.config.paramLoaded = true;
|
---|
76 | }
|
---|
77 |
|
---|
78 | protected override function getFaultMessage(faultEvent:FaultEvent):String {
|
---|
79 | return "Error loading configuration for display board: " + super.getFaultMessage(faultEvent);
|
---|
80 | }
|
---|
81 | }
|
---|
82 | }
|
---|