Coverage Report - org.apache.torque.engine.database.model.Unique
 
Classes in this File Line Coverage Branch Coverage Complexity
Unique
0%
0/9
0%
0/2
1.5
 
 1  
 package org.apache.torque.engine.database.model;
 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.List;
 17  
 
 18  
 /**
 19  
  * Information about unique columns of a table. This class assumes that in the underlying RDBMS, unique constraints and
 20  
  * unique indices are roughly equivalent. For example, adding a unique constraint to a column also creates an index on
 21  
  * that column (this is known to be true for MySQL and Oracle).
 22  
  * 
 23  
  * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
 24  
  * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
 25  
  * @version $Id: Unique.java,v 1.1 2007-10-21 07:57:27 abyrne Exp $
 26  
  */
 27  0
 public class Unique extends Index {
 28  
     /**
 29  
      * Returns <code>true</code>.
 30  
      * 
 31  
      * @return true
 32  
      */
 33  
     public final boolean isUnique() {
 34  0
         return true;
 35  
     }
 36  
 
 37  
     /**
 38  
      * String representation of the index. This is an xml representation.
 39  
      * 
 40  
      * @return string representation in xml
 41  
      */
 42  
     public String toString() {
 43  0
         StringBuffer result = new StringBuffer();
 44  0
         result.append(" <unique name=\"").append(getName()).append("\">\n");
 45  
 
 46  0
         List columns = getColumns();
 47  0
         for (int i = 0; i < columns.size(); i++) {
 48  0
             result.append("  <unique-column name=\"").append(columns.get(i)).append("\"/>\n");
 49  
         }
 50  0
         result.append(" </unique>\n");
 51  0
         return result.toString();
 52  
     }
 53  
 }