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