Coverage Report - org.kuali.student.lum.program.client.AbstractProgramConfigurer
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractProgramConfigurer
0%
0/25
0%
0/10
1.833
 
 1  
 package org.kuali.student.lum.program.client;
 2  
 
 3  
 import java.util.ArrayList;
 4  
 
 5  
 import org.kuali.student.common.ui.client.configurable.mvc.Configurer;
 6  
 import org.kuali.student.common.ui.client.mvc.DataModel;
 7  
 import org.kuali.student.lum.common.client.configuration.AbstractControllerConfiguration;
 8  
 import org.kuali.student.lum.common.client.configuration.Configuration;
 9  
 import org.kuali.student.lum.common.client.configuration.ConfigurationManager;
 10  
 import org.kuali.student.lum.program.client.major.edit.MajorSummaryConfiguration;
 11  
 
 12  
 /**
 13  
  * @author Igor
 14  
  */
 15  0
 public abstract class AbstractProgramConfigurer extends Configurer {
 16  
 
 17  
     protected ProgramController programController;
 18  
 
 19  
     protected ConfigurationManager programSectionConfigManager;
 20  
 
 21  
     public static final String PROPOSAL_PATH = "proposal";
 22  
     
 23  
     {
 24  0
         groupName = ProgramMsgConstants.PROGRAM_MSG_GROUP;
 25  0
     }
 26  
     
 27  
     public void configure(ProgramController viewController) {
 28  0
         this.programController = viewController;
 29  0
         configureProgramSections();
 30  0
     }
 31  
  
 32  
     public String getProposalPath() {
 33  0
         return PROPOSAL_PATH;
 34  
     }
 35  
     /**
 36  
      * Configures menu for Program Sections
 37  
      */
 38  
     private void configureProgramSections() {
 39  0
         String programSectionLabel = getLabel(ProgramMsgConstants.PROGRAM_MENU_SECTIONS);
 40  0
         programController.addMenu(programSectionLabel);
 41  0
         ArrayList<Configuration> configurations = getProgramSectionConfigManager().getConfigurations();
 42  0
         for (Configuration configuration : configurations) {
 43  0
             if (configuration instanceof AbstractControllerConfiguration) {
 44  0
                 ((AbstractControllerConfiguration) configuration).setController(programController);
 45  
             }
 46  0
             if (configuration instanceof MajorSummaryConfiguration) {
 47  0
                 programController.addSpecialMenuItem(configuration.getView(), programSectionLabel);
 48  
             } else {
 49  0
                 programController.addMenuItem(programSectionLabel, configuration.getView());
 50  
             }
 51  
         }
 52  0
     }
 53  
 
 54  
     public ProgramController getProgramController() {
 55  0
         return programController;
 56  
     }
 57  
 
 58  
     public void applyPermissions() {
 59  0
         DataModel dataModel = programController.getProgramModel();
 60  0
         for (Configuration configuration : programSectionConfigManager.getConfigurations()) {
 61  0
             if (configuration.checkPermission(dataModel)) {
 62  0
                 configuration.applyRestrictions();
 63  
             }else{
 64  0
                 configuration.removeRestrictions();
 65  
             }
 66  
         }
 67  0
     }
 68  
 
 69  
     public ConfigurationManager getProgramSectionConfigManager() {
 70  0
         return programSectionConfigManager;
 71  
     }
 72  
 }