-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathGetGovernCodeRatesDelegate.as
50 lines (39 loc) · 1.33 KB
/
GetGovernCodeRatesDelegate.as
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package no.makingwaves.cust.dss.business
{
import com.adobe.cairngorm.business.ServiceLocator;
import mx.collections.ArrayCollection;
import mx.rpc.IResponder;
import mx.rpc.http.HTTPService;
import no.makingwaves.cust.dss.model.ModelLocator;
[Bindable]
public class GetGovernCodeRatesDelegate
{
//attributes =================================
private var responder : IResponder;
private var service : HTTPService;
public function GetGovernCodeRatesDelegate( responder : IResponder )
{
this.service = ServiceLocator.getInstance().getHTTPService( "coderates" );
this.responder = responder;
}
public function getGovernCodeRates():void {
this.service.url = this.getResourceUrl("rateRules");
var call:mx.rpc.AsyncToken = this.service.send();
call.addResponder(this.responder);
}
public function getGovernCodeRatesAbroad():void {
this.service.url = this.getResourceUrl("ratesInternational");
var call:mx.rpc.AsyncToken = this.service.send();
call.addResponder(this.responder);
}
private function getResourceUrl(id:String):String {
var resourceList:ArrayCollection = ModelLocator.getInstance().resourceList;
for (var i:Number = 0; i < resourceList.length; i++) {
if (resourceList.getItemAt(i).id == id) {
return resourceList.getItemAt(i).url;
}
}
return "";
}
}
}