Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
KualiDatabase |
|
| 1.0;1 |
1 | package org.kuali.core.db.torque.pojo; | |
2 | ||
3 | /* | |
4 | * Licensed to the Apache Software Foundation (ASF) under one | |
5 | * or more contributor license agreements. See the NOTICE file | |
6 | * distributed with this work for additional information | |
7 | * regarding copyright ownership. The ASF licenses this file | |
8 | * to you under the Apache License, Version 2.0 (the | |
9 | * "License"); you may not use this file except in compliance | |
10 | * with the License. You may obtain a copy of the License at | |
11 | * | |
12 | * http://www.apache.org/licenses/LICENSE-2.0 | |
13 | * | |
14 | * Unless required by applicable law or agreed to in writing, | |
15 | * software distributed under the License is distributed on an | |
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
17 | * KIND, either express or implied. See the License for the | |
18 | * specific language governing permissions and limitations | |
19 | * under the License. | |
20 | */ | |
21 | ||
22 | import java.util.ArrayList; | |
23 | import java.util.List; | |
24 | ||
25 | import org.apache.torque.engine.database.model.Database; | |
26 | import org.xml.sax.Attributes; | |
27 | ||
28 | /** | |
29 | * Extends the Torque database class to handle sequences and views | |
30 | */ | |
31 | public class KualiDatabase extends Database { | |
32 | 0 | private List<View> views = new ArrayList<View>(); |
33 | 0 | private List<Sequence> sequences = new ArrayList<Sequence>(); |
34 | ||
35 | /** | |
36 | * Creates a new instance for the specified database type. | |
37 | * | |
38 | * @param databaseType | |
39 | * The default type for this database. | |
40 | */ | |
41 | public KualiDatabase(String databaseType) { | |
42 | 0 | super(databaseType); |
43 | 0 | } |
44 | ||
45 | public List<View> getViews() { | |
46 | 0 | return views; |
47 | } | |
48 | ||
49 | public List<Sequence> getSequences() { | |
50 | 0 | return sequences; |
51 | } | |
52 | ||
53 | public View addView(Attributes attrib) { | |
54 | 0 | View view = new View(); |
55 | 0 | view.setName(attrib.getValue("name")); |
56 | 0 | view.setDefinition(attrib.getValue("viewdefinition")); |
57 | 0 | views.add(view); |
58 | 0 | return view; |
59 | } | |
60 | ||
61 | public Sequence addSequence(Attributes attrib) { | |
62 | 0 | Sequence sequence = new Sequence(); |
63 | 0 | sequence.setName(attrib.getValue("name")); |
64 | 0 | sequence.setNextVal(attrib.getValue("nextval")); |
65 | ||
66 | 0 | sequences.add(sequence); |
67 | 0 | return sequence; |
68 | } | |
69 | } |