Coverage Report - org.kuali.rice.core.jpa.metadata.ManyToManyDescriptor
 
Classes in this File Line Coverage Branch Coverage Complexity
ManyToManyDescriptor
0%
0/46
0%
0/14
2.4
 
 1  
 /*
 2  
  * Copyright 2007-2008 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.opensource.org/licenses/ecl2.php
 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.rice.core.jpa.metadata;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.List;
 20  
 
 21  
 import javax.persistence.CascadeType;
 22  
 
 23  
 import org.apache.commons.lang.StringUtils;
 24  
 
 25  
 /**
 26  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 27  
  */
 28  0
 public class ManyToManyDescriptor extends CollectionDescriptor implements java.io.Serializable {
 29  
 
 30  
         private static final long serialVersionUID = 1170389265194138638L;
 31  
 
 32  
         private String joinTableName;
 33  0
         private java.util.List<JoinColumnDescriptor> joinColumnDescriptors = new ArrayList<JoinColumnDescriptor>();
 34  0
         private java.util.List<JoinColumnDescriptor> inverseJoinColumnDescriptors = new ArrayList<JoinColumnDescriptor>();
 35  
 
 36  
         public String getJoinTableName() {
 37  0
                 return this.joinTableName;
 38  
         }
 39  
 
 40  
         public void setJoinTableName(String joinTableName) {
 41  0
                 this.joinTableName = joinTableName;
 42  0
         }
 43  
 
 44  
         public void addJoinColumnDescriptor(JoinColumnDescriptor joinColumnDescriptor) {
 45  0
                 joinColumnDescriptors.add(joinColumnDescriptor);
 46  0
         }
 47  
 
 48  
         public void addInverseJoinColumnDescriptor(JoinColumnDescriptor joinColumnDescriptor) {
 49  0
                 inverseJoinColumnDescriptors.add(joinColumnDescriptor);
 50  0
         }
 51  
 
 52  
         public String toString() {
 53  0
                 StringBuffer sb = new StringBuffer();
 54  0
                 sb.append("ManyToManyDescriptor = [ ");
 55  0
                 sb.append("targetEntity:").append(targetEntity.getName()).append(", ");
 56  0
                 sb.append("cascade = { ");
 57  0
                 for (CascadeType ct : cascade) {
 58  0
                         sb.append(ct).append(" ");
 59  
                 }
 60  0
                 sb.append("}, ");
 61  0
                 sb.append("fetch:").append(fetch);
 62  0
                 if (!StringUtils.isBlank(mappedBy)) {
 63  0
                         sb.append(", mappedBy:").append(mappedBy);
 64  
                 }
 65  0
                 if (!StringUtils.isBlank(joinTableName)) {
 66  0
                         sb.append(", join table:").append(joinTableName);
 67  
                 }
 68  0
                 if (!joinColumnDescriptors.isEmpty()) {
 69  0
                         sb.append(", join columns = { ");
 70  0
                         for (JoinColumnDescriptor joinColumnDescriptor : joinColumnDescriptors) {                                
 71  0
                                 sb.append(" jc = { ");
 72  0
                                 sb.append("name:").append(joinColumnDescriptor.getName()).append(", ");
 73  0
                                 sb.append("insertable:").append(joinColumnDescriptor.isInsertable()).append(", ");
 74  0
                                 sb.append("nullable:").append(joinColumnDescriptor.isNullable()).append(", ");
 75  0
                                 sb.append("unique:").append(joinColumnDescriptor.isUnique()).append(", ");
 76  0
                                 sb.append("updateable:").append(joinColumnDescriptor.isUpdateable());
 77  0
                                 sb.append(" }");
 78  
                         }
 79  0
                         sb.append(" } ");
 80  
                 }
 81  0
                 if (!inverseJoinColumnDescriptors.isEmpty()) {
 82  0
                         sb.append(", inverse join columns = { ");
 83  0
                         for (JoinColumnDescriptor joinColumnDescriptor : inverseJoinColumnDescriptors) {                                
 84  0
                                 sb.append(" jc = { ");
 85  0
                                 sb.append("name:").append(joinColumnDescriptor.getName()).append(", ");
 86  0
                                 sb.append("insertable:").append(joinColumnDescriptor.isInsertable()).append(", ");
 87  0
                                 sb.append("nullable:").append(joinColumnDescriptor.isNullable()).append(", ");
 88  0
                                 sb.append("unique:").append(joinColumnDescriptor.isUnique()).append(", ");
 89  0
                                 sb.append("updateable:").append(joinColumnDescriptor.isUpdateable());
 90  0
                                 sb.append(" }");
 91  
                         }
 92  0
                         sb.append(" } ");
 93  
                 }
 94  0
                 sb.append(" ]");
 95  0
                 return sb.toString();
 96  
         }
 97  
         
 98  
 }