Coverage Report - org.kuali.student.lum.lu.ui.course.client.configuration.CourseSummaryConfigurer
 
Classes in this File Line Coverage Branch Coverage Complexity
CourseSummaryConfigurer
0%
0/257
0%
0/28
2.19
CourseSummaryConfigurer$1
0%
0/6
0%
0/4
2.19
CourseSummaryConfigurer$2
0%
0/3
N/A
2.19
CourseSummaryConfigurer$2$1
0%
0/6
0%
0/2
2.19
CourseSummaryConfigurer$2$1$1
0%
0/13
0%
0/2
2.19
CourseSummaryConfigurer$3
0%
0/3
N/A
2.19
CourseSummaryConfigurer$4
0%
0/13
0%
0/6
2.19
CourseSummaryConfigurer$5
0%
0/16
0%
0/22
2.19
CourseSummaryConfigurer$6
0%
0/7
N/A
2.19
CourseSummaryConfigurer$6$1
0%
0/9
0%
0/2
2.19
CourseSummaryConfigurer$7
0%
0/16
0%
0/22
2.19
CourseSummaryConfigurer$8
0%
0/29
0%
0/10
2.19
CourseSummaryConfigurer$EditHandler
0%
0/5
N/A
2.19
 
 1  
 package org.kuali.student.lum.lu.ui.course.client.configuration;
 2  
 
 3  
 import java.util.*;
 4  
 
 5  
 import org.kuali.student.common.ui.client.application.Application;
 6  
 import org.kuali.student.common.ui.client.configurable.mvc.FieldDescriptorReadOnly;
 7  
 import org.kuali.student.common.ui.client.configurable.mvc.binding.ListToTextBinding;
 8  
 import org.kuali.student.common.ui.client.configurable.mvc.binding.ModelWidgetBinding;
 9  
 import org.kuali.student.common.ui.client.configurable.mvc.layouts.MenuSectionController;
 10  
 import org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityConfiguration;
 11  
 import org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityFieldConfiguration;
 12  
 import org.kuali.student.common.ui.client.configurable.mvc.sections.WarnContainer;
 13  
 import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView;
 14  
 import org.kuali.student.common.ui.client.mvc.*;
 15  
 import org.kuali.student.common.ui.client.widgets.KSButton;
 16  
 import org.kuali.student.common.ui.client.widgets.KSButtonAbstract.ButtonStyle;
 17  
 import org.kuali.student.common.ui.client.widgets.KSLabel;
 18  
 import org.kuali.student.common.ui.client.widgets.documenttool.DocumentList;
 19  
 import org.kuali.student.common.ui.client.widgets.documenttool.DocumentListBinding;
 20  
 import org.kuali.student.common.ui.client.widgets.field.layout.element.MessageKeyInfo;
 21  
 import org.kuali.student.common.ui.client.widgets.menus.KSListPanel;
 22  
 import org.kuali.student.common.ui.client.widgets.progress.BlockingTask;
 23  
 import org.kuali.student.common.ui.client.widgets.progress.KSBlockingProgressIndicator;
 24  
 import org.kuali.student.common.ui.client.widgets.rules.SubrulePreviewWidget;
 25  
 import org.kuali.student.common.ui.client.widgets.table.summary.ShowRowConditionCallback;
 26  
 import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableFieldBlock;
 27  
 import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableFieldRow;
 28  
 import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableSection;
 29  
 import org.kuali.student.core.assembly.data.Data;
 30  
 import org.kuali.student.core.assembly.data.Data.Property;
 31  
 import org.kuali.student.core.assembly.data.Metadata;
 32  
 import org.kuali.student.core.assembly.data.QueryPath;
 33  
 import org.kuali.student.core.statement.dto.StatementTreeViewInfo;
 34  
 import org.kuali.student.core.statement.dto.StatementTypeInfo;
 35  
 import org.kuali.student.core.validation.dto.ValidationResultInfo;
 36  
 import org.kuali.student.core.validation.dto.ValidationResultInfo.ErrorLevel;
 37  
 import org.kuali.student.core.workflow.ui.client.widgets.WorkflowEnhancedNavController;
 38  
 import org.kuali.student.lum.common.client.lo.TreeStringBinding;
 39  
 import org.kuali.student.lum.common.client.lu.LUUIConstants;
 40  
 import org.kuali.student.lum.common.client.widgets.AppLocations;
 41  
 import org.kuali.student.lum.lu.assembly.data.client.constants.base.AcademicSubjectOrgInfoConstants;
 42  
 import org.kuali.student.lum.lu.assembly.data.client.constants.base.MetaInfoConstants;
 43  
 import org.kuali.student.lum.lu.assembly.data.client.constants.base.RichTextInfoConstants;
 44  
 import org.kuali.student.lum.lu.assembly.data.client.constants.orch.*;
 45  
 import org.kuali.student.lum.lu.ui.course.client.configuration.CourseConfigurer.CourseSections;
 46  
 import org.kuali.student.lum.lu.ui.course.client.configuration.ViewCourseConfigurer.ViewCourseSections;
 47  
 import org.kuali.student.lum.lu.ui.course.client.requirements.CourseRequirementsDataModel;
 48  
 import org.kuali.student.lum.lu.ui.course.client.requirements.CourseRequirementsSummaryView;
 49  
 
 50  
 import com.google.gwt.core.client.GWT;
 51  
 import com.google.gwt.event.dom.client.ClickEvent;
 52  
 import com.google.gwt.event.dom.client.ClickHandler;
 53  
 import com.google.gwt.user.client.ui.Anchor;
 54  
 import com.google.gwt.user.client.ui.FlowPanel;
 55  
 import com.google.gwt.user.client.ui.HTML;
 56  
 import com.google.gwt.user.client.ui.Widget;
 57  
 
 58  0
 public class CourseSummaryConfigurer implements
 59  
         CreditCourseProposalConstants,
 60  
         CreditCourseProposalInfoConstants,
 61  
         CreditCourseConstants,
 62  
         CreditCourseFormatConstants,
 63  
         CreditCourseActivityConstants,
 64  
         MetaInfoConstants,
 65  
         CreditCourseDurationConstants,
 66  
         FeeInfoConstants,
 67  
         LearningObjectiveConstants,
 68  
         AcademicSubjectOrgInfoConstants,
 69  
         AffiliatedOrgInfoConstants,
 70  
         CreditCourseRevenueInfoConstants,
 71  
         CreditCourseExpenditureInfoConstants
 72  
 {
 73  
     //Override paths for course and proposal so they are root
 74  
     public static final String PROPOSAL = "";
 75  
     public static final String COURSE = "";
 76  
     public static final String PROPOSAL_TITLE_PATH = "proposal/name";
 77  0
     private List<ValidationResultInfo> validationInfos = new ArrayList<ValidationResultInfo>();
 78  0
     private boolean showingValidation = false;
 79  
     private static final String OPTIONAL = "o";
 80  
 
 81  0
     protected String type = "course";
 82  0
     protected String state = "draft";
 83  
     protected String groupName;
 84  
     protected DataModelDefinition modelDefinition;
 85  
     private List<StatementTypeInfo> stmtTypes;
 86  
 
 87  
     private Controller controller;
 88  
     private SummaryTableSection tableSection;
 89  
     private String modelId;
 90  
 
 91  0
         private BlockingTask loadDataTask = new BlockingTask("Retrieving Data");
 92  
     
 93  
     private class EditHandler implements ClickHandler{
 94  
 
 95  
             Enum<?> view;
 96  
 
 97  0
             public EditHandler(Enum<?> view){
 98  0
                     this.view = view;
 99  0
             }
 100  
 
 101  
                 @Override
 102  
                 public void onClick(ClickEvent event) {
 103  0
                         controller.showView(view);
 104  0
                 }
 105  
     }
 106  
 
 107  
     public CourseSummaryConfigurer(String type, String state,
 108  0
             String groupName, DataModelDefinition modelDefinition, List<StatementTypeInfo> stmtTypes, Controller controller, String modelId) {
 109  0
         this.type = type;
 110  0
         this.state = state;
 111  0
         this.groupName = groupName;
 112  0
         this.modelDefinition = modelDefinition;
 113  0
         this.stmtTypes = stmtTypes;
 114  0
         this.controller = controller;
 115  0
         this.modelId = modelId;
 116  0
         tableSection = new SummaryTableSection((Controller)controller);
 117  0
     }
 118  
 
 119  
     protected VerticalSectionView initSectionView (Enum<?> viewEnum, String labelKey) {
 120  0
         VerticalSectionView section = new VerticalSectionView(viewEnum, getLabel(labelKey), modelId);
 121  0
         section.addStyleName(LUUIConstants.STYLE_SECTION);
 122  0
         return section;
 123  
     }
 124  
     protected String getLabel(String labelKey) {
 125  0
         return Application.getApplicationContext().getUILabel(groupName, type, state, labelKey);
 126  
     }
 127  
     protected MessageKeyInfo generateMessageInfo(String labelKey) {
 128  0
         return new MessageKeyInfo(groupName, type, state, labelKey);
 129  
     }
 130  
     protected SummaryTableFieldRow getFieldRow(String fieldKey, MessageKeyInfo messageKey) {
 131  0
         return getFieldRow(fieldKey, messageKey, null, null, null, null, false);
 132  
     }
 133  
     protected SummaryTableFieldRow getFieldRow(String fieldKey, MessageKeyInfo messageKey, boolean optional) {
 134  0
         return getFieldRow(fieldKey, messageKey, null, null, null, null, optional);
 135  
     }
 136  
 
 137  
     protected SummaryTableFieldRow getFieldRow(String fieldKey, MessageKeyInfo messageKey, Widget widget, Widget widget2, String parentPath, ModelWidgetBinding<?> binding, boolean optional) {
 138  0
         QueryPath path = QueryPath.concat(parentPath, fieldKey);
 139  0
         Metadata meta = modelDefinition.getMetadata(path);
 140  
 
 141  0
         FieldDescriptorReadOnly fd = new FieldDescriptorReadOnly(path.toString(), messageKey, meta);
 142  0
         if (widget != null) {
 143  0
             fd.setFieldWidget(widget);
 144  
         }
 145  0
         if(binding != null){
 146  0
                 fd.setWidgetBinding(binding);
 147  
         }
 148  0
         fd.setOptional(optional);
 149  
 
 150  0
         FieldDescriptorReadOnly fd2 = new FieldDescriptorReadOnly(path.toString(), messageKey, meta);
 151  0
         if (widget2 != null) {
 152  0
             fd2.setFieldWidget(widget2);
 153  
         }
 154  0
         if(binding != null){
 155  0
                 fd2.setWidgetBinding(binding);
 156  
         }
 157  0
         fd2.setOptional(optional);
 158  
 
 159  0
         SummaryTableFieldRow fieldRow = new SummaryTableFieldRow(fd,fd2);
 160  
 
 161  0
         return fieldRow;
 162  
     }
 163  
 
 164  
         public VerticalSectionView generateProposalSummarySection(boolean canEditSections){
 165  0
         tableSection.setEditable(canEditSections);
 166  0
         tableSection.addSummaryTableFieldBlock(generateCourseInformationForProposal());
 167  0
         tableSection.addSummaryTableFieldBlock(generateGovernanceSection());
 168  0
         tableSection.addSummaryTableFieldBlock(generateCourseLogisticsSection());
 169  0
         tableSection.addSummaryTableFieldBlock(generateLearningObjectivesSection());
 170  0
         tableSection.addSummaryTableFieldBlock(generateRequirementsSection());
 171  0
         tableSection.addSummaryTableFieldBlock(generateActiveDatesSection());
 172  0
         tableSection.addSummaryTableFieldBlock(generateFeesSection());
 173  0
         tableSection.addSummaryTableFieldBlock(generateProposalDocumentsSection());
 174  
         
 175  0
         if(controller instanceof WorkflowEnhancedNavController){
 176  
                 final WarnContainer infoContainer1;
 177  
                 final WarnContainer infoContainer2;
 178  
 
 179  0
                 infoContainer1 = generateWorkflowWidgetContainer(((WorkflowEnhancedNavController)controller).getWfUtilities().getWorkflowActionsWidget());
 180  0
                 infoContainer2 = generateWorkflowWidgetContainer(((WorkflowEnhancedNavController)controller).getWfUtilities().getWorkflowActionsWidget());
 181  
 
 182  0
                 ((WorkflowEnhancedNavController)controller).getWfUtilities().addSubmitCallback(new Callback<Boolean>(){
 183  
 
 184  
                                 @Override
 185  
                                 public void exec(Boolean result) {
 186  0
                                         if(result){
 187  0
                                                 tableSection.setEditable(false);
 188  0
                                                 if(controller instanceof MenuSectionController){
 189  0
                                                         ((MenuSectionController) controller).removeMenuNavigation();
 190  
                                                 }
 191  
                                         }
 192  
 
 193  0
                                 }
 194  
                         });
 195  
                 //Override beforeShow for summary section here to allow for custom validation mechanism on the table
 196  0
                 VerticalSectionView verticalSection = new VerticalSectionView(CourseSections.SUMMARY, getLabel(LUUIConstants.SUMMARY_LABEL_KEY), modelId){
 197  
                         @Override
 198  
                         public void beforeShow(final Callback<Boolean> onReadyCallback) {
 199  
 
 200  0
                                 super.beforeShow(new Callback<Boolean>(){
 201  
 
 202  
                                                 @Override
 203  
                                                 public void exec(final Boolean result) {
 204  0
                                                         if(result){
 205  
                                                                 //Make sure workflow actions and status updated before showing.
 206  0
                                                                 ((WorkflowEnhancedNavController)controller).getWfUtilities().refresh();
 207  
                                                                 
 208  
                                                                 //Show validation error if they exist
 209  0
                                                                 ((WorkflowEnhancedNavController)controller).getWfUtilities().doValidationCheck(new Callback<List<ValidationResultInfo>>(){
 210  
 
 211  
                                                                         @Override
 212  
                                                                         public void exec(
 213  
                                                                                         List<ValidationResultInfo> validationResult) {
 214  
                                                                                 //validationInfos = validationResult;
 215  0
                                                                                 tableSection.enableValidation(showingValidation);
 216  0
                                                                                 ErrorLevel isValid = tableSection.processValidationResults(validationResult, true);
 217  
 
 218  0
                                                                                 validationInfos = validationResult;
 219  0
                                                         if(isValid != ErrorLevel.ERROR){
 220  0
                                                                         infoContainer1.showWarningLayout(false);
 221  0
                                                                         infoContainer2.showWarningLayout(false);
 222  0
                                                                         ((WorkflowEnhancedNavController)controller).getWfUtilities().enableWorkflowActionsWidgets(true);
 223  
                                                         }
 224  
                                                         else{
 225  0
                                                                 infoContainer1.showWarningLayout(true);
 226  0
                                                                 infoContainer2.showWarningLayout(true);
 227  0
                                                                 ((WorkflowEnhancedNavController)controller).getWfUtilities().enableWorkflowActionsWidgets(false);
 228  
                                                         }
 229  0
                                                                                 onReadyCallback.exec(result);
 230  
 
 231  0
                                                                         }});
 232  
                                                         }
 233  
                                                         else{
 234  0
                                                                 onReadyCallback.exec(result);
 235  
                                                         }
 236  0
                                                 }});
 237  
 
 238  0
                         }
 239  
                 };
 240  
 
 241  0
                 verticalSection.addWidget(infoContainer1);
 242  0
                 verticalSection.addSection(tableSection);
 243  0
                 verticalSection.addWidget(infoContainer2);
 244  0
                 return verticalSection;
 245  
         }
 246  
         else{
 247  0
                 VerticalSectionView verticalSection = new VerticalSectionView(CourseSections.SUMMARY, getLabel(LUUIConstants.SUMMARY_LABEL_KEY), modelId);
 248  0
                 verticalSection.addSection(tableSection);
 249  0
                 GWT.log("CourseSummaryConfigurer - Summary table needs a workflow controller to provide submit/validation mechanism");
 250  0
                 return verticalSection;
 251  
         }
 252  
 
 253  
 
 254  
     }
 255  
 
 256  
     private SummaryTableFieldBlock generateProposalDocumentsSection() {
 257  0
             SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 258  0
         block.addEditingHandler(new EditHandler(CourseSections.DOCUMENTS));
 259  0
         block.setTitle(getLabel(LUUIConstants.TOOL_DOCUMENTS_LABEL_KEY));
 260  0
             block.addSummaryTableFieldRow(getFieldRow("proposal/id", generateMessageInfo(LUUIConstants.TOOL_DOCUMENTS_LABEL_KEY),
 261  
                          new DocumentList(LUUIConstants.REF_DOC_RELATION_PROPOSAL_TYPE,false, false), new DocumentList(LUUIConstants.REF_DOC_RELATION_PROPOSAL_TYPE,false, false), null, new DocumentListBinding("proposal/id"), false));
 262  0
                 return block;
 263  
         }
 264  
 
 265  0
         private List<Anchor> validateLinks = new ArrayList<Anchor>();
 266  
     private WarnContainer generateWorkflowWidgetContainer(Widget w){
 267  0
             WarnContainer warnContainer = new WarnContainer();
 268  0
         warnContainer.add(w);
 269  0
         w.addStyleName("ks-button-spacing");
 270  0
         warnContainer.add(new KSButton("Return to Curriculum Management", ButtonStyle.DEFAULT_ANCHOR, new ClickHandler(){
 271  
 
 272  
                         @Override
 273  
                         public void onClick(ClickEvent event) {
 274  0
                                 Application.navigate(AppLocations.Locations.CURRICULUM_MANAGEMENT.getLocation());
 275  0
                         }
 276  
                 }));
 277  
         //TODO use messages here
 278  0
         KSLabel label = new KSLabel("This proposal has missing fields.  ");
 279  0
         final String showText = "Show what's missing.";
 280  0
         final String hideText = "Hide error highlighting.";
 281  0
         final Anchor link = new Anchor(showText);
 282  0
         validateLinks.add(link);
 283  0
         link.addClickHandler(new ClickHandler(){
 284  
 
 285  
                         @Override
 286  
                         public void onClick(ClickEvent event) {
 287  0
                                 if(!showingValidation){
 288  0
                                         for(int i=0; i< validateLinks.size(); i++){
 289  0
                                                 validateLinks.get(i).setText(hideText);
 290  
                                         }
 291  0
                                         showingValidation = true;
 292  0
                                         tableSection.enableValidation(showingValidation);
 293  0
                                         tableSection.processValidationResults(validationInfos, true);
 294  
                                 }
 295  
                                 else{
 296  0
                                         for(int i=0; i< validateLinks.size(); i++){
 297  0
                                                 validateLinks.get(i).setText(showText);
 298  
                                         }
 299  0
                                         showingValidation = false;
 300  0
                                         tableSection.enableValidation(showingValidation);
 301  0
                                         tableSection.removeValidationHighlighting();
 302  
                                 }
 303  0
                         }
 304  
                 });
 305  0
         warnContainer.addWarnWidget(label);
 306  0
         warnContainer.addWarnWidget(link);
 307  0
         return warnContainer;
 308  
     }
 309  
 
 310  
         public VerticalSectionView generateCourseSummarySection(){
 311  0
         tableSection.setEditable(false);
 312  0
         tableSection.addSummaryTableFieldBlock(generateCourseInformation());
 313  0
         tableSection.addSummaryTableFieldBlock(generateGovernanceSection());
 314  0
         tableSection.addSummaryTableFieldBlock(generateCourseLogisticsSection());
 315  0
         tableSection.addSummaryTableFieldBlock(generateLearningObjectivesSection());
 316  0
         tableSection.addSummaryTableFieldBlock(generateRequirementsSection());
 317  0
         tableSection.addSummaryTableFieldBlock(generateActiveDatesSection());
 318  0
         tableSection.addSummaryTableFieldBlock(generateFeesSection());
 319  
 
 320  0
         VerticalSectionView verticalSection = new VerticalSectionView(ViewCourseSections.DETAILED, getLabel(LUUIConstants.SUMMARY_LABEL_KEY), modelId, false);
 321  0
         verticalSection.addSection(tableSection);
 322  
 
 323  0
         return verticalSection;
 324  
     }
 325  
 
 326  
         @SuppressWarnings("unchecked")
 327  
         public SummaryTableFieldBlock generateCourseInformationForProposal(){
 328  0
         SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 329  0
         block.addEditingHandler(new EditHandler(CourseSections.COURSE_INFO));
 330  0
         block.setTitle(getLabel(LUUIConstants.INFORMATION_LABEL_KEY));
 331  0
         block.addSummaryTableFieldRow(getFieldRow(PROPOSAL_TITLE_PATH, generateMessageInfo(LUUIConstants.PROPOSAL_TITLE_LABEL_KEY)));
 332  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_TITLE, generateMessageInfo(LUUIConstants.COURSE_TITLE_LABEL_KEY)));
 333  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + TRANSCRIPT_TITLE, generateMessageInfo(LUUIConstants.SHORT_TITLE_LABEL_KEY)));
 334  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + SUBJECT_AREA, generateMessageInfo(LUUIConstants.SUBJECT_CODE_LABEL_KEY)));
 335  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_NUMBER_SUFFIX, generateMessageInfo(LUUIConstants.COURSE_NUMBER_LABEL_KEY)));
 336  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + INSTRUCTORS, generateMessageInfo(LUUIConstants.INSTRUCTORS_LABEL_KEY), null, null, null, new KeyListModelWigetBinding("personId"), false));
 337  
 
 338  0
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + CROSS_LISTINGS,
 339  
                         LUUIConstants.CROSS_LISTED_ITEM_LABEL_KEY,
 340  
                         Arrays.asList(
 341  
                                 Arrays.asList(SUBJECT_AREA, LUUIConstants.SUBJECT_CODE_LABEL_KEY),
 342  
                                 Arrays.asList(COURSE_NUMBER_SUFFIX, LUUIConstants.COURSE_NUMBER_LABEL_KEY))));
 343  0
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + JOINTS,
 344  
                         LUUIConstants.JOINT_OFFER_ITEM_LABEL_KEY,
 345  
                         Arrays.asList(
 346  
                                 Arrays.asList(CreditCourseJointsConstants.COURSE_ID, LUUIConstants.COURSE_NUMBER_OR_TITLE_LABEL_KEY))));
 347  0
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + VERSIONS,
 348  
                         LUUIConstants.VERSION_CODE_LABEL_KEY,
 349  
                         Arrays.asList(
 350  
                                 Arrays.asList("variationCode", LUUIConstants.VERSION_CODE_LABEL_KEY),
 351  
                                 Arrays.asList("variationTitle", LUUIConstants.TITLE_LABEL_KEY))));
 352  
 
 353  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + PROPOSAL_DESCRIPTION + "/" + RichTextInfoConstants.PLAIN, generateMessageInfo(LUUIConstants.DESCRIPTION_LABEL_KEY)));
 354  0
         block.addSummaryTableFieldRow(getFieldRow("proposal/rationale", generateMessageInfo(LUUIConstants.PROPOSAL_RATIONALE_LABEL_KEY)));
 355  
 
 356  
 
 357  0
         return block;
 358  
     }
 359  
 
 360  
     public SummaryTableFieldBlock generateCourseInformation(){
 361  0
         SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 362  0
         block.addEditingHandler(new EditHandler(CourseSections.COURSE_INFO));
 363  0
         block.setTitle(getLabel(LUUIConstants.INFORMATION_LABEL_KEY));
 364  
         //block.addSummaryTableFieldRow(getFieldRow(PROPOSAL_TITLE_PATH, generateMessageInfo(LUConstants.PROPOSAL_TITLE_LABEL_KEY)));
 365  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_TITLE, generateMessageInfo(LUUIConstants.COURSE_TITLE_LABEL_KEY)));
 366  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + TRANSCRIPT_TITLE, generateMessageInfo(LUUIConstants.SHORT_TITLE_LABEL_KEY)));
 367  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + SUBJECT_AREA, generateMessageInfo(LUUIConstants.SUBJECT_CODE_LABEL_KEY)));
 368  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_NUMBER_SUFFIX, generateMessageInfo(LUUIConstants.COURSE_NUMBER_LABEL_KEY)));
 369  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + INSTRUCTORS, generateMessageInfo(LUUIConstants.INSTRUCTORS_LABEL_KEY), null, null, null, new KeyListModelWigetBinding("personId"), false));
 370  
 
 371  0
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + CROSS_LISTINGS,
 372  
                         LUUIConstants.CROSS_LISTED_ITEM_LABEL_KEY,
 373  
                         Arrays.asList(
 374  
                                 Arrays.asList(SUBJECT_AREA, LUUIConstants.SUBJECT_CODE_LABEL_KEY),
 375  
                                 Arrays.asList(COURSE_NUMBER_SUFFIX, LUUIConstants.COURSE_NUMBER_LABEL_KEY))));
 376  0
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + JOINTS,
 377  
                         LUUIConstants.JOINT_OFFER_ITEM_LABEL_KEY,
 378  
                         Arrays.asList(
 379  
                                 Arrays.asList(CreditCourseJointsConstants.COURSE_ID, LUUIConstants.COURSE_NUMBER_OR_TITLE_LABEL_KEY))));
 380  0
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + VERSIONS,
 381  
                         LUUIConstants.VERSION_CODE_LABEL_KEY,
 382  
                         Arrays.asList(
 383  
                                 Arrays.asList("variationCode", LUUIConstants.VERSION_CODE_LABEL_KEY),
 384  
                                 Arrays.asList("variationTitle", LUUIConstants.TITLE_LABEL_KEY))));
 385  
 
 386  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + PROPOSAL_DESCRIPTION + "/" + RichTextInfoConstants.PLAIN, generateMessageInfo(LUUIConstants.DESCRIPTION_LABEL_KEY)));
 387  
 
 388  0
         return block;
 389  
     }
 390  
 
 391  
     public SummaryTableFieldBlock generateGovernanceSection(){
 392  0
             SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 393  0
             block.addEditingHandler(new EditHandler(CourseSections.GOVERNANCE));
 394  0
         block.setTitle(getLabel(LUUIConstants.GOVERNANCE_LABEL_KEY));
 395  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CAMPUS_LOCATIONS, generateMessageInfo(LUUIConstants.CAMPUS_LOCATION_LABEL_KEY)));
 396  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CURRICULUM_OVERSIGHT_ORGS_, generateMessageInfo(LUUIConstants.ACADEMIC_SUBJECT_ORGS_KEY)));
 397  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + ADMIN_ORGS, generateMessageInfo(LUUIConstants.ADMIN_ORG_LABEL_KEY)));
 398  0
         return block;
 399  
     }
 400  
 
 401  
     @SuppressWarnings("unchecked")
 402  
         public SummaryTableFieldBlock generateCourseLogisticsSection(){
 403  0
             SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 404  0
             block.addEditingHandler(new EditHandler(CourseSections.COURSE_LOGISTICS));
 405  0
         block.setTitle(getLabel(LUUIConstants.LOGISTICS_LABEL_KEY));
 406  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + TERMS_OFFERED, generateMessageInfo(LUUIConstants.TERMS_OFFERED_LABEL_KEY)));
 407  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + GRADING_OPTIONS, generateMessageInfo(LUUIConstants.LEARNING_RESULT_ASSESSMENT_SCALE_LABEL_KEY)));
 408  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CreditCourseConstants.DURATION + "/" + "atpDurationTypeKey", generateMessageInfo(LUUIConstants.DURATION_TYPE_LABEL_KEY)));
 409  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CreditCourseConstants.DURATION + "/" + "timeQuantity", generateMessageInfo(LUUIConstants.DURATION_QUANTITY_LABEL_KEY)));
 410  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + PASS_FAIL, generateMessageInfo(LUUIConstants.LEARNING_RESULT_PASS_FAIL_LABEL_KEY)));
 411  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + AUDIT, generateMessageInfo(LUUIConstants.LEARNING_RESULT_AUDIT_LABEL_KEY)));
 412  
 
 413  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CreditCourseConstants.FINAL_EXAM, generateMessageInfo(LUUIConstants.FINAL_EXAM_STATUS_LABEL_KEY)));
 414  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CreditCourseConstants.FINAL_EXAM_RATIONALE, generateMessageInfo(LUUIConstants.FINAL_EXAM_RATIONALE_LABEL_KEY), true));
 415  
 
 416  
         //Outcomes
 417  0
         Map<String, ModelWidgetBinding> customBindings = new HashMap<String, ModelWidgetBinding>();
 418  0
         ListToTextBinding resultValuesBinding = new ListToTextBinding();
 419  0
         customBindings.put("resultValues", resultValuesBinding);
 420  0
         String outcomesKey = COURSE + QueryPath.getPathSeparator() + CREDIT_OPTIONS;
 421  0
         MultiplicityConfiguration outcomesConfig = getMultiplicityConfig(outcomesKey,
 422  
                         LUUIConstants.LEARNING_RESULT_OUTCOME_LABEL_KEY,
 423  
                         Arrays.asList(
 424  
                                 Arrays.asList(CreditCourseConstants.TYPE, LUUIConstants.LEARNING_RESULT_OUTCOME_TYPE_LABEL_KEY),
 425  
                                 Arrays.asList(CREDIT_OPTION_FIXED_CREDITS, LUUIConstants.CONTACT_HOURS_LABEL_KEY, OPTIONAL),
 426  
                                 Arrays.asList(CREDIT_OPTION_MIN_CREDITS, LUUIConstants.CREDIT_OPTION_MIN_CREDITS_LABEL_KEY, OPTIONAL),
 427  
                                 Arrays.asList(CREDIT_OPTION_MAX_CREDITS, LUUIConstants.CREDIT_OPTION_MAX_CREDITS_LABEL_KEY, OPTIONAL),
 428  
                                 Arrays.asList("resultValues", LUUIConstants.CREDIT_OPTION_FIXED_CREDITS_LABEL_KEY, OPTIONAL)),
 429  
                                 customBindings);
 430  
 
 431  
         //Massive workaround for result values problem where we dont want to show them on certain selections,
 432  
         //in most cases you want to just use the optional flag and have it be based on empty/null data
 433  
         //but since this data is sometimes not empty/null when we dont want to show it, it requires a show
 434  
         //condition callback
 435  0
         tableSection.addShowRowCallback(new ShowRowConditionCallback(){
 436  
                         @Override
 437  
                         public void processShowConditions(SummaryTableFieldRow row,
 438  
                                         DataModel column1, DataModel column2) {
 439  0
                                 if(row.getFieldDescriptor1() != null &&
 440  
                                                 row.getFieldDescriptor1().getFieldKey().contains(CREDIT_OPTIONS) &&
 441  
                                                 row.getFieldDescriptor1().getFieldKey().contains("resultValues")){
 442  0
                                     String type = row.getFieldDescriptor1().getFieldKey().replace("resultValues", CreditCourseConstants.TYPE);
 443  0
                                     Object data1 = null;
 444  0
                                     Object data2 = null;
 445  0
                                     if(column1 != null){
 446  0
                                             data1 = column1.get(type);
 447  
                                     }
 448  0
                                     if(column2 != null){
 449  0
                                             data2 = column2.get(type);
 450  
                                     }
 451  
 
 452  0
                                     if(data1 != null && data1 instanceof String){
 453  0
                                             if(!((String)data1).equals("kuali.resultComponentType.credit.degree.multiple")){
 454  0
                                                     row.setShown(false);
 455  
                                             }
 456  
                                     }
 457  0
                                     else if(data2 != null && data2 instanceof String){
 458  0
                                             if(!((String)data2).equals("kuali.resultComponentType.credit.degree.multiple")){
 459  0
                                                     row.setShown(false);
 460  
                                             }
 461  
                                     }
 462  
                             }
 463  0
                         }
 464  
                 });
 465  
 
 466  0
         block.addSummaryMultiplicity(outcomesConfig);
 467  
 
 468  
         //Formats
 469  0
         MultiplicityConfiguration formatsConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FORMATS,
 470  
                         LUUIConstants.FORMAT_LABEL_KEY,
 471  
                         null);
 472  0
         MultiplicityConfiguration activitiesConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FORMATS + QueryPath.getPathSeparator()
 473  
                         + QueryPath.getWildCard() + QueryPath.getPathSeparator() + ACTIVITIES,
 474  
                         LUUIConstants.ACTIVITY_LITERAL_LABEL_KEY,
 475  
                         Arrays.asList(
 476  
                                 Arrays.asList(ACTIVITY_TYPE, LUUIConstants.ACTIVITY_TYPE_LABEL_KEY),
 477  
                                 Arrays.asList(CONTACT_HOURS + "/" + "unitQuantity", LUUIConstants.CONTACT_HOURS_LABEL_KEY),
 478  
                                 Arrays.asList(CONTACT_HOURS + "/" + "unitType", "per"),
 479  
                                 Arrays.asList(CreditCourseActivityConstants.DURATION + "/" + "atpDurationTypeKey", LUUIConstants.DURATION_TYPE_LABEL_KEY),
 480  
                                 Arrays.asList(CreditCourseActivityConstants.DURATION + "/" + "timeQuantity", LUUIConstants.DURATION_LITERAL_LABEL_KEY),
 481  
                                 Arrays.asList(DEFAULT_ENROLLMENT_ESTIMATE, LUUIConstants.CLASS_SIZE_LABEL_KEY)));
 482  0
         formatsConfig.setNestedConfig(activitiesConfig);
 483  0
         block.addSummaryMultiplicity(formatsConfig);
 484  
 
 485  0
         return block;
 486  
     }
 487  
 
 488  
     public SummaryTableFieldBlock generateLearningObjectivesSection(){
 489  0
             SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 490  0
             block.addEditingHandler(new EditHandler(CourseSections.LEARNING_OBJECTIVES));
 491  0
         block.setTitle(getLabel(LUUIConstants.LEARNING_OBJECTIVES_LABEL_KEY));
 492  0
         SummaryTableFieldRow loRow = getFieldRow(COURSE + "/" + CreditCourseConstants.COURSE_SPECIFIC_LOS, generateMessageInfo(LUUIConstants.LEARNING_OBJECTIVES_LABEL_KEY),
 493  
                         new KSListPanel(), new KSListPanel(), null, new TreeStringBinding(), false);
 494  0
         loRow.addContentCellStyleName("summaryTable-lo-cell");
 495  0
         block.addSummaryTableFieldRow(loRow);
 496  
 
 497  0
         return block;
 498  
     }
 499  
 
 500  
     public SummaryTableFieldBlock generateActiveDatesSection(){
 501  0
             SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 502  0
             block.addEditingHandler(new EditHandler(CourseSections.ACTIVE_DATES));
 503  0
         block.setTitle(getLabel(LUUIConstants.ACTIVE_DATES_LABEL_KEY));
 504  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + START_TERM, generateMessageInfo(LUUIConstants.START_TERM_LABEL_KEY)));
 505  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + END_TERM, generateMessageInfo(LUUIConstants.END_TERM_LABEL_KEY)));
 506  
         //Probably wrong - checkbox
 507  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + PILOT_COURSE, generateMessageInfo(LUUIConstants.PILOT_COURSE_LABEL_KEY)));
 508  0
         return block;
 509  
     }
 510  
 
 511  
     public SummaryTableFieldBlock generateFeesSection() {
 512  0
             SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 513  0
             block.addEditingHandler(new EditHandler(CourseSections.FINANCIALS));
 514  0
         block.setTitle(getLabel(LUUIConstants.FINANCIALS_LABEL_KEY));
 515  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + "feeJustification" + "/" + RichTextInfoConstants.PLAIN, generateMessageInfo(LUUIConstants.JUSTIFICATION_FEE)));
 516  
         //Fees
 517  0
         MultiplicityConfiguration feesConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FEES,
 518  
                         LUUIConstants.FEE,
 519  
                         Arrays.asList(
 520  
                                 Arrays.asList("rateType", "Rate Type"),
 521  
                                 Arrays.asList("feeType", "Fee Type")));
 522  
         //Note the use of empty string to remove the additional row from display in the summary table
 523  0
         MultiplicityConfiguration amountsConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FEES + QueryPath.getPathSeparator()
 524  
                         + QueryPath.getWildCard() + QueryPath.getPathSeparator() + "feeAmounts",
 525  
                         "",
 526  
                         Arrays.asList(
 527  
                                 Arrays.asList("currencyQuantity", "Amount")));
 528  0
                 feesConfig.setNestedConfig(amountsConfig);
 529  0
                 block.addSummaryMultiplicity(feesConfig);
 530  
 
 531  
                 //Revenue
 532  0
                 MultiplicityConfiguration revenueConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + "revenues",
 533  
                                 LUUIConstants.REVENUE,
 534  
                         Arrays.asList(
 535  
                                         Arrays.asList("affiliatedOrgs/0/orgId", "Organization"),
 536  
                                 Arrays.asList("affiliatedOrgs/0/percentage", "Percentage")));
 537  0
                 block.addSummaryMultiplicity(revenueConfig);
 538  
 
 539  
                 //Expenditure
 540  0
                 MultiplicityConfiguration expenditureConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + "expenditure"
 541  
                                 + QueryPath.getPathSeparator() + "affiliatedOrgs",
 542  
                                 LUUIConstants.EXPENDITURE,
 543  
                         Arrays.asList(
 544  
                                 Arrays.asList("orgId", "Organization"),
 545  
                                 Arrays.asList("percentage", "Percentage")));
 546  0
                 block.addSummaryMultiplicity(expenditureConfig);
 547  
 
 548  0
         return block;
 549  
         }
 550  
 
 551  
     public SummaryTableFieldBlock generateRequirementsSection(){
 552  
 
 553  0
             final SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 554  0
             block.addEditingHandler(new EditHandler(CourseSections.COURSE_REQUISITES));
 555  0
         block.setTitle(getLabel(LUUIConstants.REQUISITES_LABEL_KEY));
 556  
 
 557  
         //one row per requirement type
 558  0
         for (StatementTypeInfo stmtType : stmtTypes) {
 559  0
             SummaryTableFieldRow arow = new SummaryTableFieldRow(addRequisiteField(new FlowPanel(), stmtType), addRequisiteField(new FlowPanel(), stmtType));
 560  0
             block.addSummaryTableFieldRow(arow);
 561  0
         }
 562  
 
 563  0
         return block;
 564  
     }
 565  
 
 566  
     private FieldDescriptorReadOnly addRequisiteField(final FlowPanel panel, final StatementTypeInfo stmtType) {
 567  
 
 568  0
         final ModelWidgetBinding<FlowPanel> widgetBinding = new ModelWidgetBinding<FlowPanel>() {
 569  
 
 570  
             @Override
 571  
             public void setModelValue(FlowPanel panel, DataModel model, String path) {
 572  0
             }
 573  
 
 574  
             @Override
 575  
             public void setWidgetValue(final FlowPanel panel, DataModel model, String path) {
 576  0
                 String courseId = (model).getRoot().get("id");
 577  0
                 KSBlockingProgressIndicator.addTask(loadDataTask);
 578  
                 
 579  0
                 final CourseRequirementsDataModel reqDataModel = new CourseRequirementsDataModel(controller);
 580  0
                 reqDataModel.retrieveStatementTypes(courseId, new Callback<Boolean>() {
 581  
                     @Override
 582  
                     public void exec(Boolean result) {
 583  0
                         Iterator<StatementTreeViewInfo> iter = reqDataModel.getCourseReqInfo(stmtType.getId()).iterator();
 584  0
                         panel.clear();                        
 585  0
                         if (iter.hasNext()) {
 586  0
                             StatementTreeViewInfo rule = iter.next();
 587  0
                             SubrulePreviewWidget ruleWidget = new SubrulePreviewWidget(rule, true, CourseRequirementsSummaryView.getCluSetWidgetList(rule));
 588  0
                             panel.add(ruleWidget);
 589  
                         }
 590  0
                         KSBlockingProgressIndicator.removeTask(loadDataTask);                        
 591  0
                     }
 592  
                 });
 593  0
             }
 594  
         };
 595  
 
 596  0
         FieldDescriptorReadOnly requisiteField = new FieldDescriptorReadOnly(COURSE + "/" + CreditCourseConstants.ID, new MessageKeyInfo(stmtType.getName()), null, panel);
 597  0
         requisiteField.setWidgetBinding(widgetBinding);
 598  
 
 599  0
         return requisiteField;
 600  
     }
 601  
 
 602  
     private MultiplicityConfiguration getMultiplicityConfig(String path,
 603  
             String itemLabelMessageKey, List<List<String>> fieldKeysAndLabels){
 604  0
             return getMultiplicityConfig(path, itemLabelMessageKey, fieldKeysAndLabels, null);
 605  
     }
 606  
 
 607  
         private MultiplicityConfiguration getMultiplicityConfig(String path,
 608  
             String itemLabelMessageKey, List<List<String>> fieldKeysAndLabels, Map<String, ModelWidgetBinding> customBindings){
 609  0
             QueryPath parentPath = QueryPath.concat(path);
 610  0
         MultiplicityConfiguration config = new MultiplicityConfiguration(MultiplicityConfiguration.MultiplicityType.TABLE,
 611  
                 MultiplicityConfiguration.StyleType.TOP_LEVEL_GROUP, modelDefinition.getMetadata(parentPath));
 612  0
         config.setItemLabel(getLabel(itemLabelMessageKey));
 613  0
         config.setUpdateable(false);
 614  0
         config.setShowHeaders(true);
 615  
 
 616  0
         FieldDescriptorReadOnly parentFd = buildFieldDescriptor(path, getLabel(itemLabelMessageKey), null);
 617  0
         config.setParent(parentFd);
 618  
 
 619  0
         if (fieldKeysAndLabels != null) {
 620  0
             for (List<String> fieldKeyAndLabel : fieldKeysAndLabels) {
 621  0
                     MultiplicityFieldConfiguration fd = buildMultiplicityFD(fieldKeyAndLabel.get(0),
 622  
                         fieldKeyAndLabel.get(1), parentPath.toString());
 623  0
                     if(fieldKeyAndLabel.size() == 3 && fieldKeyAndLabel.get(2).equals(OPTIONAL)){
 624  0
                             fd.setOptional(true);
 625  
                     }
 626  0
                     if(customBindings != null && customBindings.containsKey(fieldKeyAndLabel.get(0))){
 627  0
                             fd.setModelWidgetBinding(customBindings.get(fieldKeyAndLabel.get(0)));
 628  
                     }
 629  0
                 config.addFieldConfiguration(fd);
 630  0
             }
 631  
         }
 632  
 
 633  0
         return config;
 634  
     }
 635  
 
 636  
 
 637  
     //TODO next 3 methods below should be moved into some kind of multiplicity helper class
 638  
     private MultiplicityFieldConfiguration buildMultiplicityFD(
 639  
             String fieldKey, String labelKey, String parentPath) {
 640  
 
 641  0
         QueryPath fieldPath = QueryPath.concat(parentPath, QueryPath.getWildCard(), fieldKey);
 642  0
         Metadata meta = modelDefinition.getMetadata(fieldPath);
 643  
 
 644  0
         MultiplicityFieldConfiguration fd = new MultiplicityFieldConfiguration(
 645  
                 fieldPath.toString(), generateMessageInfo(labelKey), meta, null);
 646  
 
 647  
 
 648  0
         return fd;
 649  
 
 650  
     }
 651  
 
 652  
     private FieldDescriptorReadOnly buildFieldDescriptor(String fieldKey, String messageKey,String parentPath) {
 653  0
         return buildFieldDescriptor(fieldKey, messageKey, parentPath, null, null);
 654  
     }
 655  
 
 656  
     private FieldDescriptorReadOnly buildFieldDescriptor(String fieldKey, String messageKey, String parentPath, Widget widget, ModelWidgetBinding<?> binding) {
 657  
 
 658  0
         QueryPath path = QueryPath.concat(parentPath, fieldKey);
 659  0
         Metadata meta = modelDefinition.getMetadata(path);
 660  
 
 661  0
         FieldDescriptorReadOnly fd = new FieldDescriptorReadOnly(path.toString(), generateMessageInfo(messageKey), meta);
 662  0
         if (widget != null) {
 663  0
             fd.setFieldWidget(widget);
 664  
         }
 665  0
         if (binding != null) {
 666  0
             fd.setWidgetBinding(binding);
 667  
         }
 668  0
         return fd;
 669  
     }
 670  
 
 671  
         public VerticalSectionView generateCourseBriefSection() {
 672  0
                 SummaryTableSection courseBriefSection = new SummaryTableSection(controller);
 673  0
                 courseBriefSection.setEditable(false);
 674  0
                 SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 675  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_TITLE, generateMessageInfo(LUUIConstants.COURSE_TITLE_LABEL_KEY)));
 676  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + "code", generateMessageInfo(LUUIConstants.COURSE_NUMBER_LABEL_KEY)));
 677  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + ADMIN_ORGS, generateMessageInfo(LUUIConstants.ADMIN_ORG_LABEL_KEY)));
 678  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + PROPOSAL_DESCRIPTION + "/" + RichTextInfoConstants.PLAIN, generateMessageInfo(LUUIConstants.DESCRIPTION_LABEL_KEY)));
 679  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CURRICULUM_OVERSIGHT_ORGS_, generateMessageInfo(LUUIConstants.ACADEMIC_SUBJECT_ORGS_KEY)));
 680  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CAMPUS_LOCATIONS, generateMessageInfo(LUUIConstants.CAMPUS_LOCATION_LABEL_KEY)));
 681  
 
 682  0
         Map<String, ModelWidgetBinding> customBindings = new HashMap<String, ModelWidgetBinding>();
 683  0
         ListToTextBinding resultValuesBinding = new ListToTextBinding();
 684  0
         customBindings.put("resultValues", resultValuesBinding);
 685  0
         String outcomesKey = COURSE + QueryPath.getPathSeparator() + CREDIT_OPTIONS;
 686  0
         MultiplicityConfiguration outcomesConfig = getMultiplicityConfig(outcomesKey,
 687  
                         LUUIConstants.LEARNING_RESULT_OUTCOME_LABEL_KEY,
 688  
                         Arrays.asList(
 689  
                                 Arrays.asList(CreditCourseConstants.TYPE, LUUIConstants.LEARNING_RESULT_OUTCOME_TYPE_LABEL_KEY),
 690  
                                 Arrays.asList(CREDIT_OPTION_FIXED_CREDITS, LUUIConstants.CONTACT_HOURS_LABEL_KEY, OPTIONAL),
 691  
                                 Arrays.asList(CREDIT_OPTION_MIN_CREDITS, LUUIConstants.CREDIT_OPTION_MIN_CREDITS_LABEL_KEY, OPTIONAL),
 692  
                                 Arrays.asList(CREDIT_OPTION_MAX_CREDITS, LUUIConstants.CREDIT_OPTION_MAX_CREDITS_LABEL_KEY, OPTIONAL),
 693  
                                 Arrays.asList("resultValues", LUUIConstants.CREDIT_OPTION_FIXED_CREDITS_LABEL_KEY, OPTIONAL)),
 694  
                                 customBindings);
 695  
 
 696  
         //Massive workaround for result values problem where we dont want to show them on certain selections,
 697  
         //in most cases you want to just use the optional flag and have it be based on empty/null data
 698  
         //but since this data is sometimes not empty/null when we dont want to show it, it requires a show
 699  
         //condition callback
 700  0
         courseBriefSection.addShowRowCallback(new ShowRowConditionCallback(){
 701  
                         @Override
 702  
                         public void processShowConditions(SummaryTableFieldRow row,
 703  
                                         DataModel column1, DataModel column2) {
 704  0
                                 if(row.getFieldDescriptor1() != null &&
 705  
                                                 row.getFieldDescriptor1().getFieldKey().contains(CREDIT_OPTIONS) &&
 706  
                                                 row.getFieldDescriptor1().getFieldKey().contains("resultValues")){
 707  0
                                     String type = row.getFieldDescriptor1().getFieldKey().replace("resultValues", CreditCourseConstants.TYPE);
 708  0
                                     Object data1 = null;
 709  0
                                     Object data2 = null;
 710  0
                                     if(column1 != null){
 711  0
                                             data1 = column1.get(type);
 712  
                                     }
 713  0
                                     if(column2 != null){
 714  0
                                             data2 = column2.get(type);
 715  
                                     }
 716  
 
 717  0
                                     if(data1 != null && data1 instanceof String){
 718  0
                                             if(!((String)data1).equals("kuali.resultComponentType.credit.degree.multiple")){
 719  0
                                                     row.setShown(false);
 720  
                                             }
 721  
                                     }
 722  0
                                     else if(data2 != null && data2 instanceof String){
 723  0
                                             if(!((String)data2).equals("kuali.resultComponentType.credit.degree.multiple")){
 724  0
                                                     row.setShown(false);
 725  
                                             }
 726  
                                     }
 727  
                             }
 728  0
                         }
 729  
                 });
 730  0
         block.addSummaryMultiplicity(outcomesConfig);
 731  
 
 732  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + TERMS_OFFERED, generateMessageInfo(LUUIConstants.TERMS_OFFERED_LABEL_KEY)));
 733  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + GRADING_OPTIONS, generateMessageInfo(LUUIConstants.LEARNING_RESULT_ASSESSMENT_SCALE_LABEL_KEY)));
 734  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + PASS_FAIL, generateMessageInfo(LUUIConstants.LEARNING_RESULT_PASS_FAIL_LABEL_KEY), true));
 735  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + AUDIT, generateMessageInfo(LUUIConstants.LEARNING_RESULT_AUDIT_LABEL_KEY), true));
 736  0
         MultiplicityConfiguration formatsConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FORMATS,
 737  
                         LUUIConstants.FORMAT_LABEL_KEY,
 738  
                         null);
 739  0
         MultiplicityConfiguration activitiesConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FORMATS + QueryPath.getPathSeparator()
 740  
                         + QueryPath.getWildCard() + QueryPath.getPathSeparator() + ACTIVITIES,
 741  
                         LUUIConstants.ACTIVITY_LITERAL_LABEL_KEY,
 742  
                         Arrays.asList(
 743  
                                 Arrays.asList(ACTIVITY_TYPE, LUUIConstants.ACTIVITY_TYPE_LABEL_KEY),
 744  
                                 Arrays.asList(CONTACT_HOURS + "/" + "unitQuantity", LUUIConstants.CONTACT_HOURS_LABEL_KEY),
 745  
                                 Arrays.asList(CONTACT_HOURS + "/" + "unitType", "per"),
 746  
                                 Arrays.asList(CreditCourseActivityConstants.DURATION + "/" + "atpDurationTypeKey", LUUIConstants.DURATION_TYPE_LABEL_KEY),
 747  
                                 Arrays.asList(CreditCourseActivityConstants.DURATION + "/" + "timeQuantity", LUUIConstants.DURATION_LITERAL_LABEL_KEY),
 748  
                                 Arrays.asList(DEFAULT_ENROLLMENT_ESTIMATE, LUUIConstants.CLASS_SIZE_LABEL_KEY)));
 749  0
         formatsConfig.setNestedConfig(activitiesConfig);
 750  0
         block.addSummaryMultiplicity(formatsConfig);
 751  
         //Fees
 752  0
         MultiplicityConfiguration feesConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FEES,
 753  
                         LUUIConstants.FEE,
 754  
                         Arrays.asList(
 755  
                                 Arrays.asList("rateType", "Rate Type"),
 756  
                                 Arrays.asList("feeType", "Fee Type")));
 757  
         //Note the use of empty string to remove the additional row from display in the summary table
 758  0
         MultiplicityConfiguration amountsConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FEES + QueryPath.getPathSeparator()
 759  
                         + QueryPath.getWildCard() + QueryPath.getPathSeparator() + "feeAmounts",
 760  
                         "",
 761  
                         Arrays.asList(
 762  
                                 Arrays.asList("currencyQuantity", "Amount")));
 763  0
                 feesConfig.setNestedConfig(amountsConfig);
 764  0
                 block.addSummaryMultiplicity(feesConfig);
 765  
 /*        block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + CROSS_LISTINGS,
 766  
                         LUConstants.CROSS_LISTED_ITEM_LABEL_KEY,
 767  
                         Arrays.asList(
 768  
                                 Arrays.asList(SUBJECT_AREA, LUConstants.SUBJECT_CODE_LABEL_KEY),
 769  
                                 Arrays.asList(COURSE_NUMBER_SUFFIX, LUConstants.COURSE_NUMBER_LABEL_KEY))));
 770  
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + JOINTS,
 771  
                         LUConstants.JOINT_OFFER_ITEM_LABEL_KEY,
 772  
                         Arrays.asList(
 773  
                                 Arrays.asList(CreditCourseJointsConstants.COURSE_ID, LUConstants.COURSE_NUMBER_OR_TITLE_LABEL_KEY))));
 774  
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + VERSIONS,
 775  
                         LUConstants.VERSION_CODE_LABEL_KEY,
 776  
                         Arrays.asList(
 777  
                                 Arrays.asList("variationCode", LUConstants.VERSION_CODE_LABEL_KEY),
 778  
                                 Arrays.asList("variationTitle", LUConstants.TITLE_LABEL_KEY))));*/
 779  0
                 courseBriefSection.addSummaryTableFieldBlock(block);
 780  0
         VerticalSectionView verticalSection = new VerticalSectionView(ViewCourseSections.BRIEF, "At a Glance", modelId, false);
 781  0
         verticalSection.addSection(courseBriefSection);
 782  
 
 783  0
         return verticalSection;
 784  
         }
 785  
 
 786  
         public VerticalSectionView generateCourseCatalogSection() {
 787  0
                 VerticalSectionView verticalSection = new VerticalSectionView(ViewCourseSections.CATALOG, "Catalog View", modelId, false);
 788  0
                 FieldDescriptorReadOnly catalogField = new FieldDescriptorReadOnly("", null, null, new HTML());
 789  0
                 catalogField.hideLabel();
 790  0
                 catalogField.setWidgetBinding(new ModelWidgetBinding<HTML>(){
 791  
 
 792  
                         @Override
 793  
                         public void setModelValue(HTML widget, DataModel model, String path) {
 794  
                                 // TODO Auto-generated method stub
 795  
 
 796  0
                         }
 797  
 
 798  
                         @Override
 799  
                         public void setWidgetValue(HTML widget, DataModel model, String path) {
 800  0
                                 String code = model.get("code");
 801  0
                                 String title = model.get(COURSE + "/" + COURSE_TITLE);
 802  0
                                 String credits = "";
 803  0
                                 String outcomesKey = COURSE + QueryPath.getPathSeparator() + CREDIT_OPTIONS;
 804  0
                                 Data outcomes = model.get(outcomesKey);
 805  0
                                 if(outcomes !=null){
 806  0
                                         Iterator<Property> iter = outcomes.realPropertyIterator();
 807  0
                                         String list = "";
 808  0
                                         ListToTextBinding binding = new ListToTextBinding();
 809  0
                                         while(iter.hasNext()){
 810  0
                                                 Property prop = iter.next();
 811  0
                                                 if (prop.getKey() instanceof Integer){
 812  0
                                         Integer number = (Integer)prop.getKey();
 813  0
                                         Object value = outcomes.get(number);
 814  0
                                         if(value instanceof Data){
 815  0
                                                 list = list + binding.getStringList(model, outcomesKey + "/" + number +"/" + "resultValues") + ", ";
 816  
                                         }
 817  
                                 }
 818  0
                                         }
 819  
 
 820  0
                                         if(!list.isEmpty()){
 821  0
                                                 list = list.trim();
 822  0
                                                 list = list.substring(0, list.length() - 1);
 823  0
                                     credits = "(" + list + ")";
 824  
                             }
 825  
                                 }
 826  
 
 827  0
                                 String description = model.get(COURSE + "/" + PROPOSAL_DESCRIPTION + "/" + RichTextInfoConstants.PLAIN);
 828  0
                                 String catalogText = "<b> " + code + " " + title + " " + credits + "</b> " + description + " ";
 829  0
                                 catalogText.replace(" null ", "");
 830  0
                                 catalogText.trim();
 831  0
                                 widget.setHTML(catalogText);
 832  
 
 833  0
                         }
 834  
                 });
 835  0
                 verticalSection.addField(catalogField);
 836  
 
 837  0
                 return verticalSection;
 838  
         }
 839  
 }