%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
net.sf.infrared.aspects.jdbc.SqlPrepareContext |
|
|
1 | /* |
|
2 | * Copyright 2005 Tavant Technologies and Contributors |
|
3 | * |
|
4 | * Licensed under the Apache 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.apache.org/licenses/LICENSE-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 | * |
|
17 | * |
|
18 | * Original Author: binil.thomas (Tavant Technologies) |
|
19 | * Contributor(s): -; |
|
20 | * |
|
21 | */ |
|
22 | package net.sf.infrared.aspects.jdbc; |
|
23 | ||
24 | import java.util.Collections; |
|
25 | import java.util.List; |
|
26 | ||
27 | import net.sf.infrared.base.model.ExecutionContext; |
|
28 | ||
29 | /** |
|
30 | * |
|
31 | * @author binil.thomas |
|
32 | */ |
|
33 | public class SqlPrepareContext implements ExecutionContext { |
|
34 | private SqlContext parent; |
|
35 | ||
36 | 0 | public SqlPrepareContext(SqlContext parent) { |
37 | 0 | if (parent == null) { |
38 | 0 | throw new IllegalArgumentException("parent SqlContext cannot be null"); |
39 | } |
|
40 | 0 | this.parent = parent; |
41 | 0 | } |
42 | ||
43 | 0 | public SqlPrepareContext(String name, String layer){ |
44 | ||
45 | 0 | SqlContext parentContext = new SqlContext(name, layer); |
46 | 0 | this.parent = parentContext; |
47 | 0 | this.parent.addChild(class="keyword">this); |
48 | ||
49 | 0 | } |
50 | ||
51 | // The string returned is stored in the DB as the name. |
|
52 | public String getName() { |
|
53 | 0 | return (parent == null) ? class="keyword">null : parent.getName(); |
54 | } |
|
55 | ||
56 | ||
57 | public ExecutionContext getParent() { |
|
58 | 0 | return parent; |
59 | } |
|
60 | ||
61 | public String getLayer() { |
|
62 | 0 | return "SQL"; //@TODO make constant! |
63 | } |
|
64 | ||
65 | public List getChildren() { |
|
66 | 0 | return Collections.EMPTY_LIST; |
67 | } |
|
68 | ||
69 | public void addChild(ExecutionContext arg0) { |
|
70 | 0 | throw new UnsupportedOperationException(); //@TODO for now |
71 | } |
|
72 | ||
73 | public boolean equals(Object o) { |
|
74 | 0 | if (o == null) { |
75 | 0 | return false; |
76 | } |
|
77 | ||
78 | 0 | if (o == this) { |
79 | 0 | return true; |
80 | } |
|
81 | ||
82 | 0 | if (!(o instanceof SqlPrepareContext)) { |
83 | 0 | return false; |
84 | } |
|
85 | ||
86 | 0 | SqlPrepareContext other = (SqlPrepareContext) o; |
87 | 0 | return other.parent.equals(parent); |
88 | } |
|
89 | ||
90 | public int hashCode() { |
|
91 | 0 | return parent.hashCode(); |
92 | } |
|
93 | ||
94 | public String toString() { |
|
95 | //return "[JDBC] PREPARE (" + parent.getSql() + ")"; |
|
96 | 0 | return parent.getSql() + " [SQL] PREPARE"; |
97 | } |
|
98 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |