mil.dod.th.ose.gui.webapp/src/mil/dod/th/ose/gui/webapp/mp/MissionLoadSelected.java
public String loadMission() throws IllegalArgumentException, ObjectConverterException
    {
        if (!this.activeController.isActiveControllerSet()) 
        {
            //returning null will prevent navigation
            return null;
        }

        //get the current values from the mission manager
        final MissionModel model = this.missionSetUpMgr.getMission();
        final MissionProgramSchedule schedule = this.missionSetUpMgr.getSchedule();
        final int controllerId = this.activeController.getActiveController().getId();
        if (model.getLocation() == MissionTemplateLocation.LOCAL)
        {
            sendTemplateToActiveController(model.getName());
        }
        //transform arguments and send to controller
        //list to store arguments
        final List<MapEntry> parameters = new ArrayList<MapEntry>();
        //iterate over argument models to retrieve values for parameters list
        for (MissionArgumentModel argument : model.getArguments())
        {
            //make a map entry and fill with values from arguments
            final MapEntry entry = new MapEntry();
            entry.setKey(argument.getName());
            entry.setValue(argument.getCurrentValue());
            parameters.add(entry);
        }
        //transform mission arguments to mission program parameters, set schedule as active
        schedule.setActive(true);

        //check if a name was set for the created mission, if empty append a generated UUID to the template name
        String name = this.missionSetUpMgr.getProgramName();
        if (name == null || name.isEmpty())
        {
            name = this.missionSetUpMgr.getMission().getName().concat(UUID.randomUUID().toString());
            
            //post growl of assigned name
            m_GrowlUtil.createLocalFacesMessage(FacesMessage.SEVERITY_INFO, "Mission Program ",
                String.format("A mission program loaded for controller 0x%08x was not named, assigned name is %s", 
                    controllerId, name));
        }

        //construct params
        final MissionProgramParameters params = new MissionProgramParameters().withProgramName(name).
            withSchedule(schedule).withParameters(parameters).withTemplateName(model.getName());
        //send the parameters to the controller
        sendParametersToActiveController(params);
        
        //notify user of success
        m_GrowlUtil.createLocalFacesMessage(FacesMessage.SEVERITY_INFO, LOG_MESSAGE_DESCRIPTOR, 
            String.format("Mission %s using template %s was sent to 0x%08x", name, model.getName(), controllerId));
        
        this.missionSetUpMgr.setMission(null);
        return "";
    }
/**
     * Load the currently referenced mission from the {@link MissionSetUpMgr}.
     * @return
     *     string representing the next destination to be rendered to the browser
     * @throws ObjectConverterException
     *     throw in the event that the template or parameters cannot be converted to proto messages 
     * @throws IllegalArgumentException
     *     thrown in the event that the template selected to load does not exist 
     */
Load the currently referenced mission from the  MissionSetUpMgr.
@return
string representing the next destination to be rendered to the browser
@throws ObjectConverterException
throw in the event that the template or parameters cannot be converted to proto messages
@throws IllegalArgumentException
thrown in the event that the template selected to load does not exist
Load the currently referenced mission from the MissionSetUpMgr . @return string representing the next destination to be rendered to the browser @throws ObjectConverterException throw in the event that the template or parameters cannot be converted to proto messages @throws IllegalArgumentException thrown in the event that the template selected to load does not exist
public String loadMission() throws IllegalArgumentException, ObjectConverterException
    {
        if (!this.activeController.isActiveControllerSet()) 
        {
            return null;
        }
        final MissionModel model = this.missionSetUpMgr.getMission();
        final MissionProgramSchedule schedule = this.missionSetUpMgr.getSchedule();
        final int controllerId = this.activeController.getActiveController().getId();
        if (model.getLocation() == MissionTemplateLocation.LOCAL)
        {
            sendTemplateToActiveController(model.getName());
        }
        final List<MapEntry> parameters = new ArrayList<MapEntry>();
        for (MissionArgumentModel argument : model.getArguments())
        {
            final MapEntry entry = new MapEntry();
            entry.setKey(argument.getName());
            entry.setValue(argument.getCurrentValue());
            parameters.add(entry);
        }
        schedule.setActive(true);
        String name = this.missionSetUpMgr.getProgramName();
        if (name == null || name.isEmpty())
        {
            name = this.missionSetUpMgr.getMission().getName().concat(UUID.randomUUID().toString());
            m_GrowlUtil.createLocalFacesMessage(FacesMessage.SEVERITY_INFO, "Mission Program ",
                String.format("A mission program loaded for controller 0x%08x was not named, assigned name is %s", 
                    controllerId, name));
        }
        final MissionProgramParameters params = new MissionProgramParameters().withProgramName(name).
            withSchedule(schedule).withParameters(parameters).withTemplateName(model.getName());
        sendParametersToActiveController(params);
        m_GrowlUtil.createLocalFacesMessage(FacesMessage.SEVERITY_INFO, LOG_MESSAGE_DESCRIPTOR, 
            String.format("Mission %s using template %s was sent to 0x%08x", name, model.getName(), controllerId));
        this.missionSetUpMgr.setMission(null);
        return "";
    }
public String loadMission ( ) throws IllegalArgumentException , ObjectConverterException { if ( ! this . activeController . isActiveControllerSet ( ) ) { return null ; } final MissionModel model = this . missionSetUpMgr . getMission ( ) ; final MissionProgramSchedule schedule = this . missionSetUpMgr . getSchedule ( ) ; final int controllerId = this . activeController . getActiveController ( ) . getId ( ) ; if ( model . getLocation ( ) == MissionTemplateLocation . LOCAL ) { sendTemplateToActiveController ( model . getName ( ) ) ; } final List < MapEntry > parameters = new ArrayList < MapEntry > ( ) ; for ( MissionArgumentModel argument : model . getArguments ( ) ) { final MapEntry entry = new MapEntry ( ) ; entry . setKey ( argument . getName ( ) ) ; entry . setValue ( argument . getCurrentValue ( ) ) ; parameters . add ( entry ) ; } schedule . setActive ( true ) ; String name = this . missionSetUpMgr . getProgramName ( ) ; if ( name == null || name . isEmpty ( ) ) { name = this . missionSetUpMgr . getMission ( ) . getName ( ) . concat ( UUID . randomUUID ( ) . toString ( ) ) ; m_GrowlUtil . createLocalFacesMessage ( FacesMessage . SEVERITY_INFO , "Mission Program " , String . format ( "A mission program loaded for controller 0x%08x was not named, assigned name is %s" , controllerId , name ) ) ; } final MissionProgramParameters params = new MissionProgramParameters ( ) . withProgramName ( name ) . withSchedule ( schedule ) . withParameters ( parameters ) . withTemplateName ( model . getName ( ) ) ; sendParametersToActiveController ( params ) ; m_GrowlUtil . createLocalFacesMessage ( FacesMessage . SEVERITY_INFO , LOG_MESSAGE_DESCRIPTOR , String . format ( "Mission %s using template %s was sent to 0x%08x" , name , model . getName ( ) , controllerId ) ) ; this . missionSetUpMgr . setMission ( null ) ; return "" ; }
Load the currently referenced mission from the {@link MissionSetUpMgr}.
Load the currently referenced mission from the { @link MissionSetUpMgr } .
//returning null will prevent navigation //get the current values from the mission manager //transform arguments and send to controller //list to store arguments //iterate over argument models to retrieve values for parameters list //make a map entry and fill with values from arguments //transform mission arguments to mission program parameters, set schedule as active //check if a name was set for the created mission, if empty append a generated UUID to the template name //post growl of assigned name //construct params //send the parameters to the controller //notify user of success