4 * Copyright 2004-2007 MTBJ, Inc.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 package com
.dtrules
.infrastructure
;
21 import javax
.rules
.RuleException
;
23 public class RulesException
extends RuleException
{
27 String decisionTable
="";
28 String postfix
= null;
29 String filename
= null;
30 String section
= null;
33 public void setPostfix(String s
){
39 public String
getPostfix(){
44 * Get the DecisionTable under execution at the time the error
45 * occurred. Returns a null if unknown.
48 public String
getDecisionTable() {
53 * Set the decisionTable under execution when the error occurred.
54 * @param decisionTable
56 public void addDecisionTable(String decisionTable
, String filename
) {
57 if(filename
==null)filename
="";
58 if(this.decisionTable
.length()==0){
59 this.decisionTable
= decisionTable
+" \n";
61 this.decisionTable
= this.decisionTable
+" called by: "+decisionTable
+" \t("+filename
+")\n";
63 if(this.filename
== null) this.filename
= filename
;
66 public RulesException(String type
, String _location
, String _message
){
67 super("Location :"+_location
+" type: "+type
+" error: "+_message
);
73 static final long serialVersionUID
= 0;
76 * Provide my view of a Rules Exception;
78 public String
toString() {
81 (decisionTable
!="" ?
"\nDecision Table: "+decisionTable
:"\n") +
82 "File name: "+filename
+"\n"+
83 ((section
!= null) ?
("Section: "+section
+ " " + number
+"\n"):"")+
84 ((postfix
!= null) ?
("Postfix: "+postfix
+"\n"):"")+
85 "Location: '"+location
+"'\n" +
86 "Type: '"+errortype
+"'\n" +
87 "Error: '"+message
+"'\n" ;
93 public String
getSection() {
98 * @param section the section to set
100 public void setSection(String section
, int number
) {
101 if(this.section
== null){
102 this.section
= section
;
103 this.number
= number
;
110 public int getNumber() {