Clover Coverage Report - KS Contract Documentation Generator 0.0.1-SNAPSHOT
Coverage timestamp: Wed Dec 31 1969 19:00:00 EST
../../../../../../img/srcFileCovDistChart0.png 0% of files have more coverage
36   94   4   9
0   58   0.11   4
4     1  
1    
 
  ServiceExceptionWriter       Line # 28 36 0% 4 40 0% 0.0
 
No Tests
 
1    /*
2    * Copyright 2009 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.osedu.org/licenses/ECL-2.0
9    *
10    * Unless required by applicable law or agreed to in writing, software
11    * distributed under the License is distributed on an "AS IS" BASIS,
12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    * See the License for the specific language governing permissions and
14    * limitations under the License.
15    */
16    package org.kuali.student.contract.writer.service;
17   
18    import org.kuali.student.contract.model.ServiceContractModel;
19    import org.kuali.student.contract.model.ServiceMethodError;
20    import org.kuali.student.contract.writer.JavaClassWriter;
21    import org.kuali.student.contract.writer.JavaEnumConstantCalculator;
22   
23    /**
24    *
25    * @author nwright
26    * @deprecated
27    */
 
28    public class ServiceExceptionWriter extends JavaClassWriter {
29   
30    private ServiceContractModel model;
31    private String directory;
32    private String rootPackage;
33    private ServiceMethodError error;
34   
 
35  0 toggle public ServiceExceptionWriter(ServiceContractModel model,
36    String directory,
37    String rootPackage,
38    ServiceMethodError error) {
39  0 super(directory, calcPackage(rootPackage), calcClassName(error.getType()));
40  0 this.model = model;
41  0 this.directory = directory;
42  0 this.rootPackage = rootPackage;
43  0 this.error = error;
44    }
45   
 
46  0 toggle public static String calcPackage(String rootPackage) {
47  0 return PureJavaInfcServiceWriter.calcPackage("exception", rootPackage);
48    }
49   
 
50  0 toggle public static String calcClassName(String type) {
51  0 return new JavaEnumConstantCalculator(type).reverse() + "Exception";
52    }
53   
54    /**
55    * Write out the entire file
56    * @param out
57    */
 
58  0 toggle public void write() {
59  0 String className = calcClassName(error.getType());
60  0 indentPrintln("public class " + className + " extends Exception");
61  0 openBrace();
62  0 indentPrintln("");
63  0 indentPrintln("private static final long serialVersionUID = 1L;");
64  0 indentPrintln("");
65  0 indentPrintln("public " + className + "()");
66  0 openBrace();
67  0 indentPrintln("super ();");
68  0 closeBrace();
69   
70  0 indentPrintln("");
71  0 indentPrintln("public " + className + "(String msg)");
72  0 openBrace();
73  0 indentPrintln("super (msg);");
74  0 closeBrace();
75   
76  0 indentPrintln("");
77  0 indentPrintln("public " + className + "(Throwable cause)");
78  0 openBrace();
79  0 indentPrintln("super (cause);");
80  0 closeBrace();
81   
82  0 indentPrintln("");
83  0 indentPrintln("public " + className + "(String msg, Throwable cause)");
84  0 openBrace();
85  0 indentPrintln("super (msg, cause);");
86  0 closeBrace();
87   
88  0 indentPrintln("");
89  0 closeBrace();
90   
91  0 this.writeJavaClassAndImportsOutToFile();
92  0 this.getOut().close();
93    }
94    }