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/5
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  0
                                                                 ((WorkflowEnhancedNavController)controller).getWfUtilities().doValidationCheck(new Callback<List<ValidationResultInfo>>(){
 206  
 
 207  
                                                                         @Override
 208  
                                                                         public void exec(
 209  
                                                                                         List<ValidationResultInfo> validationResult) {
 210  
                                                                                 //validationInfos = validationResult;
 211  0
                                                                                 tableSection.enableValidation(showingValidation);
 212  0
                                                                                 ErrorLevel isValid = tableSection.processValidationResults(validationResult, true);
 213  
 
 214  0
                                                                                 validationInfos = validationResult;
 215  0
                                                         if(isValid != ErrorLevel.ERROR){
 216  0
                                                                         infoContainer1.showWarningLayout(false);
 217  0
                                                                         infoContainer2.showWarningLayout(false);
 218  0
                                                                         ((WorkflowEnhancedNavController)controller).getWfUtilities().enableWorkflowActionsWidgets(true);
 219  
                                                         }
 220  
                                                         else{
 221  0
                                                                 infoContainer1.showWarningLayout(true);
 222  0
                                                                 infoContainer2.showWarningLayout(true);
 223  0
                                                                 ((WorkflowEnhancedNavController)controller).getWfUtilities().enableWorkflowActionsWidgets(false);
 224  
                                                         }
 225  0
                                                                                 onReadyCallback.exec(result);
 226  
 
 227  0
                                                                         }});
 228  
                                                         }
 229  
                                                         else{
 230  0
                                                                 onReadyCallback.exec(result);
 231  
                                                         }
 232  0
                                                 }});
 233  
 
 234  0
                         }
 235  
                 };
 236  
 
 237  0
                 verticalSection.addWidget(infoContainer1);
 238  0
                 verticalSection.addSection(tableSection);
 239  0
                 verticalSection.addWidget(infoContainer2);
 240  0
                 return verticalSection;
 241  
         }
 242  
         else{
 243  0
                 VerticalSectionView verticalSection = new VerticalSectionView(CourseSections.SUMMARY, getLabel(LUUIConstants.SUMMARY_LABEL_KEY), modelId);
 244  0
                 verticalSection.addSection(tableSection);
 245  0
                 GWT.log("CourseSummaryConfigurer - Summary table needs a workflow controller to provide submit/validation mechanism");
 246  0
                 return verticalSection;
 247  
         }
 248  
 
 249  
 
 250  
     }
 251  
 
 252  
     private SummaryTableFieldBlock generateProposalDocumentsSection() {
 253  0
             SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 254  0
         block.addEditingHandler(new EditHandler(CourseSections.DOCUMENTS));
 255  0
         block.setTitle(getLabel(LUUIConstants.TOOL_DOCUMENTS_LABEL_KEY));
 256  0
             block.addSummaryTableFieldRow(getFieldRow("proposal/id", generateMessageInfo(LUUIConstants.TOOL_DOCUMENTS_LABEL_KEY),
 257  
                          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));
 258  0
                 return block;
 259  
         }
 260  
 
 261  0
         private List<Anchor> validateLinks = new ArrayList<Anchor>();
 262  
     private WarnContainer generateWorkflowWidgetContainer(Widget w){
 263  0
             WarnContainer warnContainer = new WarnContainer();
 264  0
         warnContainer.add(w);
 265  0
         w.addStyleName("ks-button-spacing");
 266  0
         warnContainer.add(new KSButton("Return to Curriculum Management", ButtonStyle.DEFAULT_ANCHOR, new ClickHandler(){
 267  
 
 268  
                         @Override
 269  
                         public void onClick(ClickEvent event) {
 270  0
                                 Application.navigate(AppLocations.Locations.CURRICULUM_MANAGEMENT.getLocation());
 271  0
                         }
 272  
                 }));
 273  
         //TODO use messages here
 274  0
         KSLabel label = new KSLabel("This proposal has missing fields.  ");
 275  0
         final String showText = "Show what's missing.";
 276  0
         final String hideText = "Hide error highlighting.";
 277  0
         final Anchor link = new Anchor(showText);
 278  0
         validateLinks.add(link);
 279  0
         link.addClickHandler(new ClickHandler(){
 280  
 
 281  
                         @Override
 282  
                         public void onClick(ClickEvent event) {
 283  0
                                 if(!showingValidation){
 284  0
                                         for(int i=0; i< validateLinks.size(); i++){
 285  0
                                                 validateLinks.get(i).setText(hideText);
 286  
                                         }
 287  0
                                         showingValidation = true;
 288  0
                                         tableSection.enableValidation(showingValidation);
 289  0
                                         tableSection.processValidationResults(validationInfos, true);
 290  
                                 }
 291  
                                 else{
 292  0
                                         for(int i=0; i< validateLinks.size(); i++){
 293  0
                                                 validateLinks.get(i).setText(showText);
 294  
                                         }
 295  0
                                         showingValidation = false;
 296  0
                                         tableSection.enableValidation(showingValidation);
 297  0
                                         tableSection.removeValidationHighlighting();
 298  
                                 }
 299  0
                         }
 300  
                 });
 301  0
         warnContainer.addWarnWidget(label);
 302  0
         warnContainer.addWarnWidget(link);
 303  0
         return warnContainer;
 304  
     }
 305  
 
 306  
         public VerticalSectionView generateCourseSummarySection(){
 307  0
         tableSection.setEditable(false);
 308  0
         tableSection.addSummaryTableFieldBlock(generateCourseInformation());
 309  0
         tableSection.addSummaryTableFieldBlock(generateGovernanceSection());
 310  0
         tableSection.addSummaryTableFieldBlock(generateCourseLogisticsSection());
 311  0
         tableSection.addSummaryTableFieldBlock(generateLearningObjectivesSection());
 312  0
         tableSection.addSummaryTableFieldBlock(generateRequirementsSection());
 313  0
         tableSection.addSummaryTableFieldBlock(generateActiveDatesSection());
 314  0
         tableSection.addSummaryTableFieldBlock(generateFeesSection());
 315  
 
 316  0
         VerticalSectionView verticalSection = new VerticalSectionView(ViewCourseSections.DETAILED, getLabel(LUUIConstants.SUMMARY_LABEL_KEY), modelId, false);
 317  0
         verticalSection.addSection(tableSection);
 318  
 
 319  0
         return verticalSection;
 320  
     }
 321  
 
 322  
         @SuppressWarnings("unchecked")
 323  
         public SummaryTableFieldBlock generateCourseInformationForProposal(){
 324  0
         SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 325  0
         block.addEditingHandler(new EditHandler(CourseSections.COURSE_INFO));
 326  0
         block.setTitle(getLabel(LUUIConstants.INFORMATION_LABEL_KEY));
 327  0
         block.addSummaryTableFieldRow(getFieldRow(PROPOSAL_TITLE_PATH, generateMessageInfo(LUUIConstants.PROPOSAL_TITLE_LABEL_KEY)));
 328  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_TITLE, generateMessageInfo(LUUIConstants.COURSE_TITLE_LABEL_KEY)));
 329  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + TRANSCRIPT_TITLE, generateMessageInfo(LUUIConstants.SHORT_TITLE_LABEL_KEY)));
 330  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + SUBJECT_AREA, generateMessageInfo(LUUIConstants.SUBJECT_CODE_LABEL_KEY)));
 331  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_NUMBER_SUFFIX, generateMessageInfo(LUUIConstants.COURSE_NUMBER_LABEL_KEY)));
 332  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + INSTRUCTORS, generateMessageInfo(LUUIConstants.INSTRUCTORS_LABEL_KEY), null, null, null, new KeyListModelWigetBinding("personId"), false));
 333  
 
 334  0
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + CROSS_LISTINGS,
 335  
                         LUUIConstants.CROSS_LISTED_ITEM_LABEL_KEY,
 336  
                         Arrays.asList(
 337  
                                 Arrays.asList(SUBJECT_AREA, LUUIConstants.SUBJECT_CODE_LABEL_KEY),
 338  
                                 Arrays.asList(COURSE_NUMBER_SUFFIX, LUUIConstants.COURSE_NUMBER_LABEL_KEY))));
 339  0
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + JOINTS,
 340  
                         LUUIConstants.JOINT_OFFER_ITEM_LABEL_KEY,
 341  
                         Arrays.asList(
 342  
                                 Arrays.asList(CreditCourseJointsConstants.COURSE_ID, LUUIConstants.COURSE_NUMBER_OR_TITLE_LABEL_KEY))));
 343  0
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + VERSIONS,
 344  
                         LUUIConstants.VERSION_CODE_LABEL_KEY,
 345  
                         Arrays.asList(
 346  
                                 Arrays.asList("variationCode", LUUIConstants.VERSION_CODE_LABEL_KEY),
 347  
                                 Arrays.asList("variationTitle", LUUIConstants.TITLE_LABEL_KEY))));
 348  
 
 349  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + PROPOSAL_DESCRIPTION + "/" + RichTextInfoConstants.PLAIN, generateMessageInfo(LUUIConstants.DESCRIPTION_LABEL_KEY)));
 350  0
         block.addSummaryTableFieldRow(getFieldRow("proposal/rationale", generateMessageInfo(LUUIConstants.PROPOSAL_RATIONALE_LABEL_KEY)));
 351  
 
 352  
 
 353  0
         return block;
 354  
     }
 355  
 
 356  
     public SummaryTableFieldBlock generateCourseInformation(){
 357  0
         SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 358  0
         block.addEditingHandler(new EditHandler(CourseSections.COURSE_INFO));
 359  0
         block.setTitle(getLabel(LUUIConstants.INFORMATION_LABEL_KEY));
 360  
         //block.addSummaryTableFieldRow(getFieldRow(PROPOSAL_TITLE_PATH, generateMessageInfo(LUConstants.PROPOSAL_TITLE_LABEL_KEY)));
 361  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_TITLE, generateMessageInfo(LUUIConstants.COURSE_TITLE_LABEL_KEY)));
 362  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + TRANSCRIPT_TITLE, generateMessageInfo(LUUIConstants.SHORT_TITLE_LABEL_KEY)));
 363  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + SUBJECT_AREA, generateMessageInfo(LUUIConstants.SUBJECT_CODE_LABEL_KEY)));
 364  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_NUMBER_SUFFIX, generateMessageInfo(LUUIConstants.COURSE_NUMBER_LABEL_KEY)));
 365  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + INSTRUCTORS, generateMessageInfo(LUUIConstants.INSTRUCTORS_LABEL_KEY), null, null, null, new KeyListModelWigetBinding("personId"), false));
 366  
 
 367  0
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + CROSS_LISTINGS,
 368  
                         LUUIConstants.CROSS_LISTED_ITEM_LABEL_KEY,
 369  
                         Arrays.asList(
 370  
                                 Arrays.asList(SUBJECT_AREA, LUUIConstants.SUBJECT_CODE_LABEL_KEY),
 371  
                                 Arrays.asList(COURSE_NUMBER_SUFFIX, LUUIConstants.COURSE_NUMBER_LABEL_KEY))));
 372  0
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + JOINTS,
 373  
                         LUUIConstants.JOINT_OFFER_ITEM_LABEL_KEY,
 374  
                         Arrays.asList(
 375  
                                 Arrays.asList(CreditCourseJointsConstants.COURSE_ID, LUUIConstants.COURSE_NUMBER_OR_TITLE_LABEL_KEY))));
 376  0
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + VERSIONS,
 377  
                         LUUIConstants.VERSION_CODE_LABEL_KEY,
 378  
                         Arrays.asList(
 379  
                                 Arrays.asList("variationCode", LUUIConstants.VERSION_CODE_LABEL_KEY),
 380  
                                 Arrays.asList("variationTitle", LUUIConstants.TITLE_LABEL_KEY))));
 381  
 
 382  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + PROPOSAL_DESCRIPTION + "/" + RichTextInfoConstants.PLAIN, generateMessageInfo(LUUIConstants.DESCRIPTION_LABEL_KEY)));
 383  
 
 384  0
         return block;
 385  
     }
 386  
 
 387  
     public SummaryTableFieldBlock generateGovernanceSection(){
 388  0
             SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 389  0
             block.addEditingHandler(new EditHandler(CourseSections.GOVERNANCE));
 390  0
         block.setTitle(getLabel(LUUIConstants.GOVERNANCE_LABEL_KEY));
 391  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CAMPUS_LOCATIONS, generateMessageInfo(LUUIConstants.CAMPUS_LOCATION_LABEL_KEY)));
 392  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CURRICULUM_OVERSIGHT_ORGS_, generateMessageInfo(LUUIConstants.ACADEMIC_SUBJECT_ORGS_KEY)));
 393  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + ADMIN_ORGS, generateMessageInfo(LUUIConstants.ADMIN_ORG_LABEL_KEY)));
 394  0
         return block;
 395  
     }
 396  
 
 397  
     @SuppressWarnings("unchecked")
 398  
         public SummaryTableFieldBlock generateCourseLogisticsSection(){
 399  0
             SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 400  0
             block.addEditingHandler(new EditHandler(CourseSections.COURSE_LOGISTICS));
 401  0
         block.setTitle(getLabel(LUUIConstants.LOGISTICS_LABEL_KEY));
 402  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + TERMS_OFFERED, generateMessageInfo(LUUIConstants.TERMS_OFFERED_LABEL_KEY)));
 403  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + GRADING_OPTIONS, generateMessageInfo(LUUIConstants.LEARNING_RESULT_ASSESSMENT_SCALE_LABEL_KEY)));
 404  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CreditCourseConstants.DURATION + "/" + "atpDurationTypeKey", generateMessageInfo(LUUIConstants.DURATION_TYPE_LABEL_KEY)));
 405  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CreditCourseConstants.DURATION + "/" + "timeQuantity", generateMessageInfo(LUUIConstants.DURATION_QUANTITY_LABEL_KEY)));
 406  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + PASS_FAIL, generateMessageInfo(LUUIConstants.LEARNING_RESULT_PASS_FAIL_LABEL_KEY)));
 407  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + AUDIT, generateMessageInfo(LUUIConstants.LEARNING_RESULT_AUDIT_LABEL_KEY)));
 408  
 
 409  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CreditCourseConstants.FINAL_EXAM, generateMessageInfo(LUUIConstants.FINAL_EXAM_STATUS_LABEL_KEY)));
 410  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CreditCourseConstants.FINAL_EXAM_RATIONALE, generateMessageInfo(LUUIConstants.FINAL_EXAM_RATIONALE_LABEL_KEY), true));
 411  
 
 412  
         //Outcomes
 413  0
         Map<String, ModelWidgetBinding> customBindings = new HashMap<String, ModelWidgetBinding>();
 414  0
         ListToTextBinding resultValuesBinding = new ListToTextBinding();
 415  0
         customBindings.put("resultValues", resultValuesBinding);
 416  0
         String outcomesKey = COURSE + QueryPath.getPathSeparator() + CREDIT_OPTIONS;
 417  0
         MultiplicityConfiguration outcomesConfig = getMultiplicityConfig(outcomesKey,
 418  
                         LUUIConstants.LEARNING_RESULT_OUTCOME_LABEL_KEY,
 419  
                         Arrays.asList(
 420  
                                 Arrays.asList(CreditCourseConstants.TYPE, LUUIConstants.LEARNING_RESULT_OUTCOME_TYPE_LABEL_KEY),
 421  
                                 Arrays.asList(CREDIT_OPTION_FIXED_CREDITS, LUUIConstants.CONTACT_HOURS_LABEL_KEY, OPTIONAL),
 422  
                                 Arrays.asList(CREDIT_OPTION_MIN_CREDITS, LUUIConstants.CREDIT_OPTION_MIN_CREDITS_LABEL_KEY, OPTIONAL),
 423  
                                 Arrays.asList(CREDIT_OPTION_MAX_CREDITS, LUUIConstants.CREDIT_OPTION_MAX_CREDITS_LABEL_KEY, OPTIONAL),
 424  
                                 Arrays.asList("resultValues", LUUIConstants.CREDIT_OPTION_FIXED_CREDITS_LABEL_KEY, OPTIONAL)),
 425  
                                 customBindings);
 426  
 
 427  
         //Massive workaround for result values problem where we dont want to show them on certain selections,
 428  
         //in most cases you want to just use the optional flag and have it be based on empty/null data
 429  
         //but since this data is sometimes not empty/null when we dont want to show it, it requires a show
 430  
         //condition callback
 431  0
         tableSection.addShowRowCallback(new ShowRowConditionCallback(){
 432  
                         @Override
 433  
                         public void processShowConditions(SummaryTableFieldRow row,
 434  
                                         DataModel column1, DataModel column2) {
 435  0
                                 if(row.getFieldDescriptor1() != null &&
 436  
                                                 row.getFieldDescriptor1().getFieldKey().contains(CREDIT_OPTIONS) &&
 437  
                                                 row.getFieldDescriptor1().getFieldKey().contains("resultValues")){
 438  0
                                     String type = row.getFieldDescriptor1().getFieldKey().replace("resultValues", CreditCourseConstants.TYPE);
 439  0
                                     Object data1 = null;
 440  0
                                     Object data2 = null;
 441  0
                                     if(column1 != null){
 442  0
                                             data1 = column1.get(type);
 443  
                                     }
 444  0
                                     if(column2 != null){
 445  0
                                             data2 = column2.get(type);
 446  
                                     }
 447  
 
 448  0
                                     if(data1 != null && data1 instanceof String){
 449  0
                                             if(!((String)data1).equals("kuali.resultComponentType.credit.degree.multiple")){
 450  0
                                                     row.setShown(false);
 451  
                                             }
 452  
                                     }
 453  0
                                     else if(data2 != null && data2 instanceof String){
 454  0
                                             if(!((String)data2).equals("kuali.resultComponentType.credit.degree.multiple")){
 455  0
                                                     row.setShown(false);
 456  
                                             }
 457  
                                     }
 458  
                             }
 459  0
                         }
 460  
                 });
 461  
 
 462  0
         block.addSummaryMultiplicity(outcomesConfig);
 463  
 
 464  
         //Formats
 465  0
         MultiplicityConfiguration formatsConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FORMATS,
 466  
                         LUUIConstants.FORMAT_LABEL_KEY,
 467  
                         null);
 468  0
         MultiplicityConfiguration activitiesConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FORMATS + QueryPath.getPathSeparator()
 469  
                         + QueryPath.getWildCard() + QueryPath.getPathSeparator() + ACTIVITIES,
 470  
                         LUUIConstants.ACTIVITY_LITERAL_LABEL_KEY,
 471  
                         Arrays.asList(
 472  
                                 Arrays.asList(ACTIVITY_TYPE, LUUIConstants.ACTIVITY_TYPE_LABEL_KEY),
 473  
                                 Arrays.asList(CONTACT_HOURS + "/" + "unitQuantity", LUUIConstants.CONTACT_HOURS_LABEL_KEY),
 474  
                                 Arrays.asList(CONTACT_HOURS + "/" + "unitType", "per"),
 475  
                                 Arrays.asList(CreditCourseActivityConstants.DURATION + "/" + "atpDurationTypeKey", LUUIConstants.DURATION_TYPE_LABEL_KEY),
 476  
                                 Arrays.asList(CreditCourseActivityConstants.DURATION + "/" + "timeQuantity", LUUIConstants.DURATION_LITERAL_LABEL_KEY),
 477  
                                 Arrays.asList(DEFAULT_ENROLLMENT_ESTIMATE, LUUIConstants.CLASS_SIZE_LABEL_KEY)));
 478  0
         formatsConfig.setNestedConfig(activitiesConfig);
 479  0
         block.addSummaryMultiplicity(formatsConfig);
 480  
 
 481  0
         return block;
 482  
     }
 483  
 
 484  
     public SummaryTableFieldBlock generateLearningObjectivesSection(){
 485  0
             SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 486  0
             block.addEditingHandler(new EditHandler(CourseSections.LEARNING_OBJECTIVES));
 487  0
         block.setTitle(getLabel(LUUIConstants.LEARNING_OBJECTIVES_LABEL_KEY));
 488  0
         SummaryTableFieldRow loRow = getFieldRow(COURSE + "/" + CreditCourseConstants.COURSE_SPECIFIC_LOS, generateMessageInfo(LUUIConstants.LEARNING_OBJECTIVES_LABEL_KEY),
 489  
                         new KSListPanel(), new KSListPanel(), null, new TreeStringBinding(), false);
 490  0
         loRow.addContentCellStyleName("summaryTable-lo-cell");
 491  0
         block.addSummaryTableFieldRow(loRow);
 492  
 
 493  0
         return block;
 494  
     }
 495  
 
 496  
     public SummaryTableFieldBlock generateActiveDatesSection(){
 497  0
             SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 498  0
             block.addEditingHandler(new EditHandler(CourseSections.ACTIVE_DATES));
 499  0
         block.setTitle(getLabel(LUUIConstants.ACTIVE_DATES_LABEL_KEY));
 500  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + START_TERM, generateMessageInfo(LUUIConstants.START_TERM_LABEL_KEY)));
 501  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + END_TERM, generateMessageInfo(LUUIConstants.END_TERM_LABEL_KEY)));
 502  
         //Probably wrong - checkbox
 503  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + PILOT_COURSE, generateMessageInfo(LUUIConstants.PILOT_COURSE_LABEL_KEY)));
 504  0
         return block;
 505  
     }
 506  
 
 507  
     public SummaryTableFieldBlock generateFeesSection() {
 508  0
             SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 509  0
             block.addEditingHandler(new EditHandler(CourseSections.FINANCIALS));
 510  0
         block.setTitle(getLabel(LUUIConstants.FINANCIALS_LABEL_KEY));
 511  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + "feeJustification" + "/" + RichTextInfoConstants.PLAIN, generateMessageInfo(LUUIConstants.JUSTIFICATION_FEE)));
 512  
         //Fees
 513  0
         MultiplicityConfiguration feesConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FEES,
 514  
                         LUUIConstants.FEE,
 515  
                         Arrays.asList(
 516  
                                 Arrays.asList("rateType", "Rate Type"),
 517  
                                 Arrays.asList("feeType", "Fee Type")));
 518  
         //Note the use of empty string to remove the additional row from display in the summary table
 519  0
         MultiplicityConfiguration amountsConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FEES + QueryPath.getPathSeparator()
 520  
                         + QueryPath.getWildCard() + QueryPath.getPathSeparator() + "feeAmounts",
 521  
                         "",
 522  
                         Arrays.asList(
 523  
                                 Arrays.asList("currencyQuantity", "Amount")));
 524  0
                 feesConfig.setNestedConfig(amountsConfig);
 525  0
                 block.addSummaryMultiplicity(feesConfig);
 526  
 
 527  
                 //Revenue
 528  0
                 MultiplicityConfiguration revenueConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + "revenues",
 529  
                                 LUUIConstants.REVENUE,
 530  
                         Arrays.asList(
 531  
                                         Arrays.asList("affiliatedOrgs/0/orgId", "Organization"),
 532  
                                 Arrays.asList("affiliatedOrgs/0/percentage", "Percentage")));
 533  0
                 block.addSummaryMultiplicity(revenueConfig);
 534  
 
 535  
                 //Expenditure
 536  0
                 MultiplicityConfiguration expenditureConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + "expenditure"
 537  
                                 + QueryPath.getPathSeparator() + "affiliatedOrgs",
 538  
                                 LUUIConstants.EXPENDITURE,
 539  
                         Arrays.asList(
 540  
                                 Arrays.asList("orgId", "Organization"),
 541  
                                 Arrays.asList("percentage", "Percentage")));
 542  0
                 block.addSummaryMultiplicity(expenditureConfig);
 543  
 
 544  0
         return block;
 545  
         }
 546  
 
 547  
     public SummaryTableFieldBlock generateRequirementsSection(){
 548  
 
 549  0
             final SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 550  0
             block.addEditingHandler(new EditHandler(CourseSections.COURSE_REQUISITES));
 551  0
         block.setTitle(getLabel(LUUIConstants.REQUISITES_LABEL_KEY));
 552  
 
 553  
         //one row per requirement type
 554  0
         for (StatementTypeInfo stmtType : stmtTypes) {
 555  0
             SummaryTableFieldRow arow = new SummaryTableFieldRow(addRequisiteField(new FlowPanel(), stmtType), addRequisiteField(new FlowPanel(), stmtType));
 556  0
             block.addSummaryTableFieldRow(arow);
 557  0
         }
 558  
 
 559  0
         return block;
 560  
     }
 561  
 
 562  
     private FieldDescriptorReadOnly addRequisiteField(final FlowPanel panel, final StatementTypeInfo stmtType) {
 563  
 
 564  0
         final ModelWidgetBinding<FlowPanel> widgetBinding = new ModelWidgetBinding<FlowPanel>() {
 565  
 
 566  
             @Override
 567  
             public void setModelValue(FlowPanel panel, DataModel model, String path) {
 568  0
             }
 569  
 
 570  
             @Override
 571  
             public void setWidgetValue(final FlowPanel panel, DataModel model, String path) {
 572  0
                 String courseId = (model).getRoot().get("id");
 573  0
                 KSBlockingProgressIndicator.addTask(loadDataTask);
 574  
                 
 575  0
                 final CourseRequirementsDataModel reqDataModel = new CourseRequirementsDataModel(controller);
 576  0
                 reqDataModel.retrieveStatementTypes(courseId, new Callback<Boolean>() {
 577  
                     @Override
 578  
                     public void exec(Boolean result) {
 579  0
                         Iterator<StatementTreeViewInfo> iter = reqDataModel.getCourseReqInfo(stmtType.getId()).iterator();
 580  0
                         panel.clear();                        
 581  0
                         if (iter.hasNext()) {
 582  0
                             StatementTreeViewInfo rule = iter.next();
 583  0
                             SubrulePreviewWidget ruleWidget = new SubrulePreviewWidget(rule, true, CourseRequirementsSummaryView.getCluSetWidgetList(rule));
 584  0
                             panel.add(ruleWidget);
 585  
                         }
 586  0
                         KSBlockingProgressIndicator.removeTask(loadDataTask);                        
 587  0
                     }
 588  
                 });
 589  0
             }
 590  
         };
 591  
 
 592  0
         FieldDescriptorReadOnly requisiteField = new FieldDescriptorReadOnly(COURSE + "/" + CreditCourseConstants.ID, new MessageKeyInfo(stmtType.getName()), null, panel);
 593  0
         requisiteField.setWidgetBinding(widgetBinding);
 594  
 
 595  0
         return requisiteField;
 596  
     }
 597  
 
 598  
     private MultiplicityConfiguration getMultiplicityConfig(String path,
 599  
             String itemLabelMessageKey, List<List<String>> fieldKeysAndLabels){
 600  0
             return getMultiplicityConfig(path, itemLabelMessageKey, fieldKeysAndLabels, null);
 601  
     }
 602  
 
 603  
         private MultiplicityConfiguration getMultiplicityConfig(String path,
 604  
             String itemLabelMessageKey, List<List<String>> fieldKeysAndLabels, Map<String, ModelWidgetBinding> customBindings){
 605  0
             QueryPath parentPath = QueryPath.concat(path);
 606  0
         MultiplicityConfiguration config = new MultiplicityConfiguration(MultiplicityConfiguration.MultiplicityType.TABLE,
 607  
                 MultiplicityConfiguration.StyleType.TOP_LEVEL_GROUP, modelDefinition.getMetadata(parentPath));
 608  0
         config.setItemLabel(getLabel(itemLabelMessageKey));
 609  0
         config.setUpdateable(false);
 610  0
         config.setShowHeaders(true);
 611  
 
 612  0
         FieldDescriptorReadOnly parentFd = buildFieldDescriptor(path, getLabel(itemLabelMessageKey), null);
 613  0
         config.setParent(parentFd);
 614  
 
 615  0
         if (fieldKeysAndLabels != null) {
 616  0
             for (List<String> fieldKeyAndLabel : fieldKeysAndLabels) {
 617  0
                     MultiplicityFieldConfiguration fd = buildMultiplicityFD(fieldKeyAndLabel.get(0),
 618  
                         fieldKeyAndLabel.get(1), parentPath.toString());
 619  0
                     if(fieldKeyAndLabel.size() == 3 && fieldKeyAndLabel.get(2).equals(OPTIONAL)){
 620  0
                             fd.setOptional(true);
 621  
                     }
 622  0
                     if(customBindings != null && customBindings.containsKey(fieldKeyAndLabel.get(0))){
 623  0
                             fd.setModelWidgetBinding(customBindings.get(fieldKeyAndLabel.get(0)));
 624  
                     }
 625  0
                 config.addFieldConfiguration(fd);
 626  0
             }
 627  
         }
 628  
 
 629  0
         return config;
 630  
     }
 631  
 
 632  
 
 633  
     //TODO next 3 methods below should be moved into some kind of multiplicity helper class
 634  
     private MultiplicityFieldConfiguration buildMultiplicityFD(
 635  
             String fieldKey, String labelKey, String parentPath) {
 636  
 
 637  0
         QueryPath fieldPath = QueryPath.concat(parentPath, QueryPath.getWildCard(), fieldKey);
 638  0
         Metadata meta = modelDefinition.getMetadata(fieldPath);
 639  
 
 640  0
         MultiplicityFieldConfiguration fd = new MultiplicityFieldConfiguration(
 641  
                 fieldPath.toString(), generateMessageInfo(labelKey), meta, null);
 642  
 
 643  
 
 644  0
         return fd;
 645  
 
 646  
     }
 647  
 
 648  
     private FieldDescriptorReadOnly buildFieldDescriptor(String fieldKey, String messageKey,String parentPath) {
 649  0
         return buildFieldDescriptor(fieldKey, messageKey, parentPath, null, null);
 650  
     }
 651  
 
 652  
     private FieldDescriptorReadOnly buildFieldDescriptor(String fieldKey, String messageKey, String parentPath, Widget widget, ModelWidgetBinding<?> binding) {
 653  
 
 654  0
         QueryPath path = QueryPath.concat(parentPath, fieldKey);
 655  0
         Metadata meta = modelDefinition.getMetadata(path);
 656  
 
 657  0
         FieldDescriptorReadOnly fd = new FieldDescriptorReadOnly(path.toString(), generateMessageInfo(messageKey), meta);
 658  0
         if (widget != null) {
 659  0
             fd.setFieldWidget(widget);
 660  
         }
 661  0
         if (binding != null) {
 662  0
             fd.setWidgetBinding(binding);
 663  
         }
 664  0
         return fd;
 665  
     }
 666  
 
 667  
         public VerticalSectionView generateCourseBriefSection() {
 668  0
                 SummaryTableSection courseBriefSection = new SummaryTableSection(controller);
 669  0
                 courseBriefSection.setEditable(false);
 670  0
                 SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 671  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_TITLE, generateMessageInfo(LUUIConstants.COURSE_TITLE_LABEL_KEY)));
 672  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + "code", generateMessageInfo(LUUIConstants.COURSE_NUMBER_LABEL_KEY)));
 673  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + ADMIN_ORGS, generateMessageInfo(LUUIConstants.ADMIN_ORG_LABEL_KEY)));
 674  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + PROPOSAL_DESCRIPTION + "/" + RichTextInfoConstants.PLAIN, generateMessageInfo(LUUIConstants.DESCRIPTION_LABEL_KEY)));
 675  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CURRICULUM_OVERSIGHT_ORGS_, generateMessageInfo(LUUIConstants.ACADEMIC_SUBJECT_ORGS_KEY)));
 676  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CAMPUS_LOCATIONS, generateMessageInfo(LUUIConstants.CAMPUS_LOCATION_LABEL_KEY)));
 677  
 
 678  0
         Map<String, ModelWidgetBinding> customBindings = new HashMap<String, ModelWidgetBinding>();
 679  0
         ListToTextBinding resultValuesBinding = new ListToTextBinding();
 680  0
         customBindings.put("resultValues", resultValuesBinding);
 681  0
         String outcomesKey = COURSE + QueryPath.getPathSeparator() + CREDIT_OPTIONS;
 682  0
         MultiplicityConfiguration outcomesConfig = getMultiplicityConfig(outcomesKey,
 683  
                         LUUIConstants.LEARNING_RESULT_OUTCOME_LABEL_KEY,
 684  
                         Arrays.asList(
 685  
                                 Arrays.asList(CreditCourseConstants.TYPE, LUUIConstants.LEARNING_RESULT_OUTCOME_TYPE_LABEL_KEY),
 686  
                                 Arrays.asList(CREDIT_OPTION_FIXED_CREDITS, LUUIConstants.CONTACT_HOURS_LABEL_KEY, OPTIONAL),
 687  
                                 Arrays.asList(CREDIT_OPTION_MIN_CREDITS, LUUIConstants.CREDIT_OPTION_MIN_CREDITS_LABEL_KEY, OPTIONAL),
 688  
                                 Arrays.asList(CREDIT_OPTION_MAX_CREDITS, LUUIConstants.CREDIT_OPTION_MAX_CREDITS_LABEL_KEY, OPTIONAL),
 689  
                                 Arrays.asList("resultValues", LUUIConstants.CREDIT_OPTION_FIXED_CREDITS_LABEL_KEY, OPTIONAL)),
 690  
                                 customBindings);
 691  
 
 692  
         //Massive workaround for result values problem where we dont want to show them on certain selections,
 693  
         //in most cases you want to just use the optional flag and have it be based on empty/null data
 694  
         //but since this data is sometimes not empty/null when we dont want to show it, it requires a show
 695  
         //condition callback
 696  0
         courseBriefSection.addShowRowCallback(new ShowRowConditionCallback(){
 697  
                         @Override
 698  
                         public void processShowConditions(SummaryTableFieldRow row,
 699  
                                         DataModel column1, DataModel column2) {
 700  0
                                 if(row.getFieldDescriptor1() != null &&
 701  
                                                 row.getFieldDescriptor1().getFieldKey().contains(CREDIT_OPTIONS) &&
 702  
                                                 row.getFieldDescriptor1().getFieldKey().contains("resultValues")){
 703  0
                                     String type = row.getFieldDescriptor1().getFieldKey().replace("resultValues", CreditCourseConstants.TYPE);
 704  0
                                     Object data1 = null;
 705  0
                                     Object data2 = null;
 706  0
                                     if(column1 != null){
 707  0
                                             data1 = column1.get(type);
 708  
                                     }
 709  0
                                     if(column2 != null){
 710  0
                                             data2 = column2.get(type);
 711  
                                     }
 712  
 
 713  0
                                     if(data1 != null && data1 instanceof String){
 714  0
                                             if(!((String)data1).equals("kuali.resultComponentType.credit.degree.multiple")){
 715  0
                                                     row.setShown(false);
 716  
                                             }
 717  
                                     }
 718  0
                                     else if(data2 != null && data2 instanceof String){
 719  0
                                             if(!((String)data2).equals("kuali.resultComponentType.credit.degree.multiple")){
 720  0
                                                     row.setShown(false);
 721  
                                             }
 722  
                                     }
 723  
                             }
 724  0
                         }
 725  
                 });
 726  0
         block.addSummaryMultiplicity(outcomesConfig);
 727  
 
 728  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + TERMS_OFFERED, generateMessageInfo(LUUIConstants.TERMS_OFFERED_LABEL_KEY)));
 729  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + GRADING_OPTIONS, generateMessageInfo(LUUIConstants.LEARNING_RESULT_ASSESSMENT_SCALE_LABEL_KEY)));
 730  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + PASS_FAIL, generateMessageInfo(LUUIConstants.LEARNING_RESULT_PASS_FAIL_LABEL_KEY), true));
 731  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + AUDIT, generateMessageInfo(LUUIConstants.LEARNING_RESULT_AUDIT_LABEL_KEY), true));
 732  0
         MultiplicityConfiguration formatsConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FORMATS,
 733  
                         LUUIConstants.FORMAT_LABEL_KEY,
 734  
                         null);
 735  0
         MultiplicityConfiguration activitiesConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FORMATS + QueryPath.getPathSeparator()
 736  
                         + QueryPath.getWildCard() + QueryPath.getPathSeparator() + ACTIVITIES,
 737  
                         LUUIConstants.ACTIVITY_LITERAL_LABEL_KEY,
 738  
                         Arrays.asList(
 739  
                                 Arrays.asList(ACTIVITY_TYPE, LUUIConstants.ACTIVITY_TYPE_LABEL_KEY),
 740  
                                 Arrays.asList(CONTACT_HOURS + "/" + "unitQuantity", LUUIConstants.CONTACT_HOURS_LABEL_KEY),
 741  
                                 Arrays.asList(CONTACT_HOURS + "/" + "unitType", "per"),
 742  
                                 Arrays.asList(CreditCourseActivityConstants.DURATION + "/" + "atpDurationTypeKey", LUUIConstants.DURATION_TYPE_LABEL_KEY),
 743  
                                 Arrays.asList(CreditCourseActivityConstants.DURATION + "/" + "timeQuantity", LUUIConstants.DURATION_LITERAL_LABEL_KEY),
 744  
                                 Arrays.asList(DEFAULT_ENROLLMENT_ESTIMATE, LUUIConstants.CLASS_SIZE_LABEL_KEY)));
 745  0
         formatsConfig.setNestedConfig(activitiesConfig);
 746  0
         block.addSummaryMultiplicity(formatsConfig);
 747  
         //Fees
 748  0
         MultiplicityConfiguration feesConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FEES,
 749  
                         LUUIConstants.FEE,
 750  
                         Arrays.asList(
 751  
                                 Arrays.asList("rateType", "Rate Type"),
 752  
                                 Arrays.asList("feeType", "Fee Type")));
 753  
         //Note the use of empty string to remove the additional row from display in the summary table
 754  0
         MultiplicityConfiguration amountsConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FEES + QueryPath.getPathSeparator()
 755  
                         + QueryPath.getWildCard() + QueryPath.getPathSeparator() + "feeAmounts",
 756  
                         "",
 757  
                         Arrays.asList(
 758  
                                 Arrays.asList("currencyQuantity", "Amount")));
 759  0
                 feesConfig.setNestedConfig(amountsConfig);
 760  0
                 block.addSummaryMultiplicity(feesConfig);
 761  
 /*        block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + CROSS_LISTINGS,
 762  
                         LUConstants.CROSS_LISTED_ITEM_LABEL_KEY,
 763  
                         Arrays.asList(
 764  
                                 Arrays.asList(SUBJECT_AREA, LUConstants.SUBJECT_CODE_LABEL_KEY),
 765  
                                 Arrays.asList(COURSE_NUMBER_SUFFIX, LUConstants.COURSE_NUMBER_LABEL_KEY))));
 766  
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + JOINTS,
 767  
                         LUConstants.JOINT_OFFER_ITEM_LABEL_KEY,
 768  
                         Arrays.asList(
 769  
                                 Arrays.asList(CreditCourseJointsConstants.COURSE_ID, LUConstants.COURSE_NUMBER_OR_TITLE_LABEL_KEY))));
 770  
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + VERSIONS,
 771  
                         LUConstants.VERSION_CODE_LABEL_KEY,
 772  
                         Arrays.asList(
 773  
                                 Arrays.asList("variationCode", LUConstants.VERSION_CODE_LABEL_KEY),
 774  
                                 Arrays.asList("variationTitle", LUConstants.TITLE_LABEL_KEY))));*/
 775  0
                 courseBriefSection.addSummaryTableFieldBlock(block);
 776  0
         VerticalSectionView verticalSection = new VerticalSectionView(ViewCourseSections.BRIEF, "At a Glance", modelId, false);
 777  0
         verticalSection.addSection(courseBriefSection);
 778  
 
 779  0
         return verticalSection;
 780  
         }
 781  
 
 782  
         public VerticalSectionView generateCourseCatalogSection() {
 783  0
                 VerticalSectionView verticalSection = new VerticalSectionView(ViewCourseSections.CATALOG, "Catalog View", modelId, false);
 784  0
                 FieldDescriptorReadOnly catalogField = new FieldDescriptorReadOnly("", null, null, new HTML());
 785  0
                 catalogField.hideLabel();
 786  0
                 catalogField.setWidgetBinding(new ModelWidgetBinding<HTML>(){
 787  
 
 788  
                         @Override
 789  
                         public void setModelValue(HTML widget, DataModel model, String path) {
 790  
                                 // TODO Auto-generated method stub
 791  
 
 792  0
                         }
 793  
 
 794  
                         @Override
 795  
                         public void setWidgetValue(HTML widget, DataModel model, String path) {
 796  0
                                 String code = model.get("code");
 797  0
                                 String title = model.get(COURSE + "/" + COURSE_TITLE);
 798  0
                                 String credits = "";
 799  0
                                 String outcomesKey = COURSE + QueryPath.getPathSeparator() + CREDIT_OPTIONS;
 800  0
                                 Data outcomes = model.get(outcomesKey);
 801  0
                                 if(outcomes !=null){
 802  0
                                         Iterator<Property> iter = outcomes.realPropertyIterator();
 803  0
                                         String list = "";
 804  0
                                         ListToTextBinding binding = new ListToTextBinding();
 805  0
                                         while(iter.hasNext()){
 806  0
                                                 Property prop = iter.next();
 807  0
                                                 if (prop.getKey() instanceof Integer){
 808  0
                                         Integer number = (Integer)prop.getKey();
 809  0
                                         Object value = outcomes.get(number);
 810  0
                                         if(value instanceof Data){
 811  0
                                                 list = list + binding.getStringList(model, outcomesKey + "/" + number +"/" + "resultValues") + ", ";
 812  
                                         }
 813  
                                 }
 814  0
                                         }
 815  
 
 816  0
                                         if(!list.isEmpty()){
 817  0
                                                 list = list.trim();
 818  0
                                                 list = list.substring(0, list.length() - 1);
 819  0
                                     credits = "(" + list + ")";
 820  
                             }
 821  
                                 }
 822  
 
 823  0
                                 String description = model.get(COURSE + "/" + PROPOSAL_DESCRIPTION + "/" + RichTextInfoConstants.PLAIN);
 824  0
                                 String catalogText = "<b> " + code + " " + title + " " + credits + "</b> " + description + " ";
 825  0
                                 catalogText.replace(" null ", "");
 826  0
                                 catalogText.trim();
 827  0
                                 widget.setHTML(catalogText);
 828  
 
 829  0
                         }
 830  
                 });
 831  0
                 verticalSection.addField(catalogField);
 832  
 
 833  0
                 return verticalSection;
 834  
         }
 835  
 }