|  1 |     | 
     | 
  |  2 |     | 
     | 
  |  3 |     | 
     | 
  |  4 |     | 
     | 
  |  5 |     | 
     | 
  |  6 |     | 
     | 
  |  7 |     | 
     | 
  |  8 |     | 
     | 
  |  9 |     | 
     | 
  |  10 |     | 
     | 
  |  11 |     | 
     | 
  |  12 |     | 
     | 
  |  13 |     | 
     | 
  |  14 |     | 
     | 
  |  15 |     | 
     | 
  |  16 |     | 
     | 
  |  17 |     | 
   package org.kuali.rice.kns.datadictionary;  | 
  |  18 |     | 
     | 
  |  19 |     | 
   import java.util.ArrayList;  | 
  |  20 |     | 
   import java.util.List;  | 
  |  21 |     | 
     | 
  |  22 |     | 
   import org.apache.commons.lang.StringUtils;  | 
  |  23 |     | 
   import org.kuali.rice.kns.inquiry.Inquirable;  | 
  |  24 |     | 
   import org.kuali.rice.kns.inquiry.InquiryAuthorizer;  | 
  |  25 |     | 
   import org.kuali.rice.kns.inquiry.InquiryPresentationController;  | 
  |  26 |     | 
     | 
  |  27 |     | 
     | 
  |  28 |     | 
     | 
  |  29 |     | 
     | 
  |  30 |     | 
     | 
  |  31 |     | 
     | 
  |  32 |     | 
     | 
  |  33 |     | 
     | 
  |  34 |     | 
     | 
  |  35 |     | 
     | 
  |  36 |     | 
   public class InquiryDefinition extends DataDictionaryDefinitionBase { | 
  |  37 |     | 
       private static final long serialVersionUID = -2506403061297774668L;  | 
  |  38 |     | 
         | 
  |  39 |     | 
           protected String title;  | 
  |  40 |    0 |        protected List<InquirySectionDefinition> inquirySections = new ArrayList<InquirySectionDefinition>();  | 
  |  41 |     | 
       protected Class<? extends Inquirable> inquirableClass;  | 
  |  42 |     | 
       protected Class<? extends InquiryPresentationController> presentationControllerClass;  | 
  |  43 |     | 
       protected Class<? extends InquiryAuthorizer> authorizerClass;  | 
  |  44 |     | 
         | 
  |  45 |    0 |        protected boolean translateCodes = true;  | 
  |  46 |     | 
     | 
  |  47 |    0 |        public InquiryDefinition() { | 
  |  48 |    0 |        }  | 
  |  49 |     | 
     | 
  |  50 |     | 
     | 
  |  51 |     | 
       public String getTitle() { | 
  |  52 |    0 |            return title;  | 
  |  53 |     | 
       }  | 
  |  54 |     | 
     | 
  |  55 |     | 
         | 
  |  56 |     | 
     | 
  |  57 |     | 
     | 
  |  58 |     | 
     | 
  |  59 |     | 
     | 
  |  60 |     | 
       public void setTitle(String title) { | 
  |  61 |    0 |            if (StringUtils.isBlank(title)) { | 
  |  62 |    0 |                throw new IllegalArgumentException("invalid (blank) title"); | 
  |  63 |     | 
           }  | 
  |  64 |     | 
     | 
  |  65 |    0 |            this.title = title;  | 
  |  66 |    0 |        }  | 
  |  67 |     | 
     | 
  |  68 |     | 
         | 
  |  69 |     | 
     | 
  |  70 |     | 
     | 
  |  71 |     | 
     | 
  |  72 |     | 
       public List<InquirySectionDefinition> getInquirySections() { | 
  |  73 |    0 |            return inquirySections;  | 
  |  74 |     | 
       }  | 
  |  75 |     | 
        | 
  |  76 |     | 
         | 
  |  77 |     | 
     | 
  |  78 |     | 
     | 
  |  79 |     | 
     | 
  |  80 |     | 
     | 
  |  81 |     | 
       public FieldDefinition getFieldDefinition(String fieldName) { | 
  |  82 |    0 |            for (InquirySectionDefinition section : inquirySections ) { | 
  |  83 |    0 |                for (FieldDefinition field : section.getInquiryFields() ) { | 
  |  84 |    0 |                    if (field.getAttributeName().equals(fieldName)) { | 
  |  85 |    0 |                        return field;  | 
  |  86 |     | 
                   }  | 
  |  87 |     | 
               }  | 
  |  88 |     | 
           }  | 
  |  89 |     | 
             | 
  |  90 |    0 |            return null;  | 
  |  91 |     | 
       }  | 
  |  92 |     | 
     | 
  |  93 |     | 
         | 
  |  94 |     | 
     | 
  |  95 |     | 
     | 
  |  96 |     | 
     | 
  |  97 |     | 
     | 
  |  98 |     | 
       public void completeValidation(Class rootBusinessObjectClass, Class otherBusinessObjectClass) { | 
  |  99 |    0 |            for ( InquirySectionDefinition inquirySection : inquirySections ) { | 
  |  100 |    0 |                inquirySection.completeValidation(rootBusinessObjectClass, null);  | 
  |  101 |     | 
           }  | 
  |  102 |    0 |        }  | 
  |  103 |     | 
     | 
  |  104 |     | 
       public InquirySectionDefinition getInquirySection( String sectionTitle ) { | 
  |  105 |    0 |            for ( InquirySectionDefinition inquirySection : inquirySections ) { | 
  |  106 |    0 |                if ( inquirySection.getTitle().equals(sectionTitle) ) { | 
  |  107 |    0 |                    return inquirySection;  | 
  |  108 |     | 
               }  | 
  |  109 |     | 
           }  | 
  |  110 |    0 |            return null;  | 
  |  111 |     | 
       }  | 
  |  112 |     | 
         | 
  |  113 |     | 
         | 
  |  114 |     | 
         | 
  |  115 |     | 
     | 
  |  116 |     | 
     | 
  |  117 |     | 
       public String toString() { | 
  |  118 |    0 |            return "InquiryDefinition '" + getTitle() + "'";  | 
  |  119 |     | 
       }  | 
  |  120 |     | 
     | 
  |  121 |     | 
     | 
  |  122 |     | 
       public Class<? extends Inquirable> getInquirableClass() { | 
  |  123 |    0 |            return inquirableClass;  | 
  |  124 |     | 
       }  | 
  |  125 |     | 
     | 
  |  126 |     | 
         | 
  |  127 |     | 
     | 
  |  128 |     | 
     | 
  |  129 |     | 
     | 
  |  130 |     | 
     | 
  |  131 |     | 
     | 
  |  132 |     | 
     | 
  |  133 |     | 
     | 
  |  134 |     | 
     | 
  |  135 |     | 
     | 
  |  136 |     | 
       public void setInquirableClass(Class<? extends Inquirable> inquirableClass) { | 
  |  137 |    0 |            this.inquirableClass = inquirableClass;  | 
  |  138 |    0 |        }  | 
  |  139 |     | 
     | 
  |  140 |     | 
         | 
  |  141 |     | 
     | 
  |  142 |     | 
     | 
  |  143 |     | 
     | 
  |  144 |     | 
       public void setInquirySections(List<InquirySectionDefinition> inquirySections) { | 
  |  145 |    0 |            this.inquirySections = inquirySections;  | 
  |  146 |    0 |        }  | 
  |  147 |     | 
     | 
  |  148 |     | 
     | 
  |  149 |     | 
           public Class<? extends InquiryPresentationController> getPresentationControllerClass() { | 
  |  150 |    0 |                    return this.presentationControllerClass;  | 
  |  151 |     | 
           }  | 
  |  152 |     | 
     | 
  |  153 |     | 
     | 
  |  154 |     | 
           public void setPresentationControllerClass(  | 
  |  155 |     | 
                           Class<? extends InquiryPresentationController> presentationControllerClass) { | 
  |  156 |    0 |                    this.presentationControllerClass = presentationControllerClass;  | 
  |  157 |    0 |            }  | 
  |  158 |     | 
     | 
  |  159 |     | 
     | 
  |  160 |     | 
           public Class<? extends InquiryAuthorizer> getAuthorizerClass() { | 
  |  161 |    0 |                    return this.authorizerClass;  | 
  |  162 |     | 
           }  | 
  |  163 |     | 
     | 
  |  164 |     | 
     | 
  |  165 |     | 
           public void setAuthorizerClass(  | 
  |  166 |     | 
                           Class<? extends InquiryAuthorizer> authorizerClass) { | 
  |  167 |    0 |                    this.authorizerClass = authorizerClass;  | 
  |  168 |    0 |            }  | 
  |  169 |     | 
     | 
  |  170 |     | 
     | 
  |  171 |     | 
           public boolean isTranslateCodes() { | 
  |  172 |    0 |                    return this.translateCodes;  | 
  |  173 |     | 
           }  | 
  |  174 |     | 
     | 
  |  175 |     | 
     | 
  |  176 |     | 
           public void setTranslateCodes(boolean translateCodes) { | 
  |  177 |    0 |                    this.translateCodes = translateCodes;  | 
  |  178 |    0 |            }  | 
  |  179 |     | 
             | 
  |  180 |     | 
   }  |