as3

Java code posted
created at 27 May 20:34

Edit | Back
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
51
52
53
54
55
56
57
58
59
60
61
package com.kcc.tempos.parsers {
  import mx.resources.ResourceManager;

  /**
   * Error de la query view data.
   * Este muchacho sabe ademas como parsear la informacion extra que arroja el QVD webservice.
   */
  public class QVDParserError extends WorkSheetError {
    public function QVDParserError(message:String = "", id:int = 0) {
      super(message, id);
    }

    /**
     * Parseo el error y obtengo los valores desde el XML.
     * Generalmente el objecto es de la forma:
     * 
     * <soap-env:Fault>
     *   <faultcode>soap-env:Client</faultcode>
     *   <faultstring xml:lang="en">NoApplicableData</faultstring>
     *   <detail>
     *     <n0:GetQueryViewData.Exception xmlns:n0="urn:sap-com:document:sap:soap:functions:mc-style">
     *     <Name>NoApplicableData</Name>
     *     <Text>Message not found (in main memory)</Text>
     *     <Message>
     *       <ID>BL</ID>
     *       <Number>209</Number>
     *     </Message>
     *     </n0:GetQueryViewData.Exception>
     *   </detail>
     * </soap-env:Fault>
     * 
     * @param obj
     */
    override public function fromXML(obj:Object):void {
      if (obj == null)
        return;
      this.obj = obj;
      var localName:String = (this.obj is XML) ? (this.obj as XML).localName().toString() : "";
      switch (localName) {
        case "Fault":
          this.sysubrc = 0;
          this.sylangu = "E";

          var details:XML = obj.*[2].*[0];
          if (details.Name.toString() == "NoApplicableData") {
            this.exception = "no_applicable_data";
            this.message = ResourceManager.getInstance().getString('error', 'error.' + this.exception) + " " + details.Text.toString();
          }
          else {
            this.message = details.Text.toString();
          }
          break;
      }

      if (message == "") {
        message = this.exception + this.sylangu;
      }
    }

  }
}
1.75 KB in 3 ms with coderay