KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > bpel > xml > LocalizedProblem


1 package org.jbpm.bpel.xml;
2
3 import org.w3c.dom.Element JavaDoc;
4
5 import org.jbpm.jpdl.xml.Problem;
6
7 import com.ibm.wsdl.util.xml.XPathUtils;
8
9 public class LocalizedProblem extends Problem {
10   
11   public LocalizedProblem(int level, String JavaDoc description, Element JavaDoc locationElement) {
12     super(level, description);
13     setLocation(locationElement);
14   }
15   
16   private static final long serialVersionUID = 1L;
17   
18   private String JavaDoc location;
19   
20   /**
21    * Gets the error location.
22    * @return a location path
23    */

24   public String JavaDoc getLocation() {
25     return location;
26   }
27   
28   /**
29    * Sets the error location.
30    * @param location a location path, ideally an XPath; however, this is not validated
31    */

32   public void setLocation(String JavaDoc location) {
33     this.location = location;
34   }
35   
36   /**
37    * Calculates the XPath location path that identifies the given element,
38    * and then sets it as the error location.
39    * @param locationElem
40    */

41   public void setLocation(Element JavaDoc locationElem) {
42     location = XPathUtils.getXPathExprFromNode(locationElem);
43   }
44   
45   public String JavaDoc toString() {
46     return super.toString() + " [" + location + "]";
47   }
48 }
49
Popular Tags