mil.dod.th.ose.gui.webapp/src/mil/dod/th/ose/gui/webapp/asset/AssetCommandMgrImpl.java
private void handleSyncResponse(final int controllerId, final UUID assetUuid, 
            final CommandResponseEnum responseType, final byte[] responseMessage)
    {
        final AssetSyncableCommandModel model = m_AssetCommands.get(controllerId).get(assetUuid);
        final CommandTypeEnum commandSyncType = CommandTypeEnum.valueOf(responseType.toString().replace(
                RESPONSE_OBJECT_SUFFIX.toUpperCase(), COMMAND_OBJECT_SUFFIX.toUpperCase()));
        final CommandTypeEnum commandType = model.getCommandTypeBySyncType(commandSyncType);
        final Command command = model.getCommandByType(commandType);
        if (command == null)
        {
            m_GrowlUtil.createGlobalFacesMessage(FacesMessage.SEVERITY_ERROR, EXCEPTION_TITLE, 
                    String.format("Command %s could not be synced for asset with UUID: %s because the command " 
                            + "does not exist or the command isn't supported.", 
                            model.getCommandDisplayName(commandSyncType), assetUuid));
            return;
        }
        
        try
        {
            final Object jaxbResponse = m_CommandConverterService.getJavaResponseType(responseMessage, responseType);
            
            for (Field field : jaxbResponse.getClass().getDeclaredFields())
            {
                if (ReflectionsUtil.hasJaxbAnnotation(field))
                {
                    try
                    {
                        handleField(field, jaxbResponse, command);
                    }
                    catch (final ReflectionsUtilException exception)
                    {
                        final String exceptionMessage = "The response %s was unable to " 
                                + "be converted for use in syncing. " 
                                + "See server log for further details.";
                        
                        m_GrowlUtil.createGlobalFacesMessage(FacesMessage.SEVERITY_ERROR, EXCEPTION_TITLE, 
                                String.format(exceptionMessage, jaxbResponse.getClass().getSimpleName()), exception);
                        return;
                    }
                }
            }  
            
            m_EventAdmin.postEvent(new Event(TOPIC_COMMAND_SYNCED, new HashMap<String, Object>()));
            m_GrowlUtil.createGlobalFacesMessage(FacesMessage.SEVERITY_INFO, "Asset Command Synchronized:", 
                    String.format("%s for asset with UUID: %s synced.", model.getCommandDisplayName(commandType), 
                            assetUuid.toString()));
        }
        catch (final ObjectConverterException | InvalidProtocolBufferException exception)
        {
            m_GrowlUtil.createGlobalFacesMessage(FacesMessage.SEVERITY_ERROR, EXCEPTION_TITLE, 
                    String.format("Command %s could not be synced for asset with UUID: %s because the command" 
                            + " response could not be converted to an equivalent jaxb type.", 
                            model.getCommandDisplayName(commandSyncType), assetUuid));
        }
    }
/**
     * Method that handles converting a get command response message to its local JAXB equivalent.
     * 
     * @param controllerId
     *          ID of the controller where the get command message response originated.
     * @param assetUuid
     *          UUID of the asset the get command was executed for.
     * @param responseType
     *          The {@link CommandResponseEnum} associated with the response message.
     * @param responseMessage
     *          The byte array that represents the response message containing data on the get command executed.
     */
Method that handles converting a get command response message to its local JAXB equivalent.

@param controllerId
ID of the controller where the get command message response originated.
@param assetUuid
UUID of the asset the get command was executed for.
@param responseType
The  CommandResponseEnum associated with the response message.
@param responseMessage
The byte array that represents the response message containing data on the get command executed.
Method that handles converting a get command response message to its local JAXB equivalent . @param controllerId ID of the controller where the get command message response originated . @param assetUuid UUID of the asset the get command was executed for . @param responseType The CommandResponseEnum associated with the response message . @param responseMessage The byte array that represents the response message containing data on the get command executed .
private void handleSyncResponse(final int controllerId, final UUID assetUuid, 
            final CommandResponseEnum responseType, final byte[] responseMessage)
    {
        final AssetSyncableCommandModel model = m_AssetCommands.get(controllerId).get(assetUuid);
        final CommandTypeEnum commandSyncType = CommandTypeEnum.valueOf(responseType.toString().replace(
                RESPONSE_OBJECT_SUFFIX.toUpperCase(), COMMAND_OBJECT_SUFFIX.toUpperCase()));
        final CommandTypeEnum commandType = model.getCommandTypeBySyncType(commandSyncType);
        final Command command = model.getCommandByType(commandType);
        if (command == null)
        {
            m_GrowlUtil.createGlobalFacesMessage(FacesMessage.SEVERITY_ERROR, EXCEPTION_TITLE, 
                    String.format("Command %s could not be synced for asset with UUID: %s because the command " 
                            + "does not exist or the command isn't supported.", 
                            model.getCommandDisplayName(commandSyncType), assetUuid));
            return;
        }
        try
        {
            final Object jaxbResponse = m_CommandConverterService.getJavaResponseType(responseMessage, responseType);
            for (Field field : jaxbResponse.getClass().getDeclaredFields())
            {
                if (ReflectionsUtil.hasJaxbAnnotation(field))
                {
                    try
                    {
                        handleField(field, jaxbResponse, command);
                    }
                    catch (final ReflectionsUtilException exception)
                    {
                        final String exceptionMessage = "The response %s was unable to " 
                                + "be converted for use in syncing. " 
                                + "See server log for further details.";
                        m_GrowlUtil.createGlobalFacesMessage(FacesMessage.SEVERITY_ERROR, EXCEPTION_TITLE, 
                                String.format(exceptionMessage, jaxbResponse.getClass().getSimpleName()), exception);
                        return;
                    }
                }
            }  
            m_EventAdmin.postEvent(new Event(TOPIC_COMMAND_SYNCED, new HashMap<String, Object>()));
            m_GrowlUtil.createGlobalFacesMessage(FacesMessage.SEVERITY_INFO, "Asset Command Synchronized:", 
                    String.format("%s for asset with UUID: %s synced.", model.getCommandDisplayName(commandType), 
                            assetUuid.toString()));
        }
        catch (final ObjectConverterException | InvalidProtocolBufferException exception)
        {
            m_GrowlUtil.createGlobalFacesMessage(FacesMessage.SEVERITY_ERROR, EXCEPTION_TITLE, 
                    String.format("Command %s could not be synced for asset with UUID: %s because the command" 
                            + " response could not be converted to an equivalent jaxb type.", 
                            model.getCommandDisplayName(commandSyncType), assetUuid));
        }
    }
private void handleSyncResponse ( final int controllerId , final UUID assetUuid , final CommandResponseEnum responseType , final byte [ ] responseMessage ) { final AssetSyncableCommandModel model = m_AssetCommands . get ( controllerId ) . get ( assetUuid ) ; final CommandTypeEnum commandSyncType = CommandTypeEnum . valueOf ( responseType . toString ( ) . replace ( RESPONSE_OBJECT_SUFFIX . toUpperCase ( ) , COMMAND_OBJECT_SUFFIX . toUpperCase ( ) ) ) ; final CommandTypeEnum commandType = model . getCommandTypeBySyncType ( commandSyncType ) ; final Command command = model . getCommandByType ( commandType ) ; if ( command == null ) { m_GrowlUtil . createGlobalFacesMessage ( FacesMessage . SEVERITY_ERROR , EXCEPTION_TITLE , String . format ( "Command %s could not be synced for asset with UUID: %s because the command " + "does not exist or the command isn't supported." , model . getCommandDisplayName ( commandSyncType ) , assetUuid ) ) ; return ; } try { final Object jaxbResponse = m_CommandConverterService . getJavaResponseType ( responseMessage , responseType ) ; for ( Field field : jaxbResponse . getClass ( ) . getDeclaredFields ( ) ) { if ( ReflectionsUtil . hasJaxbAnnotation ( field ) ) { try { handleField ( field , jaxbResponse , command ) ; } catch ( final ReflectionsUtilException exception ) { final String exceptionMessage = "The response %s was unable to " + "be converted for use in syncing. " + "See server log for further details." ; m_GrowlUtil . createGlobalFacesMessage ( FacesMessage . SEVERITY_ERROR , EXCEPTION_TITLE , String . format ( exceptionMessage , jaxbResponse . getClass ( ) . getSimpleName ( ) ) , exception ) ; return ; } } } m_EventAdmin . postEvent ( new Event ( TOPIC_COMMAND_SYNCED , new HashMap < String , Object > ( ) ) ) ; m_GrowlUtil . createGlobalFacesMessage ( FacesMessage . SEVERITY_INFO , "Asset Command Synchronized:" , String . format ( "%s for asset with UUID: %s synced." , model . getCommandDisplayName ( commandType ) , assetUuid . toString ( ) ) ) ; } catch ( final ObjectConverterException | InvalidProtocolBufferException exception ) { m_GrowlUtil . createGlobalFacesMessage ( FacesMessage . SEVERITY_ERROR , EXCEPTION_TITLE , String . format ( "Command %s could not be synced for asset with UUID: %s because the command" + " response could not be converted to an equivalent jaxb type." , model . getCommandDisplayName ( commandSyncType ) , assetUuid ) ) ; } }
Method that handles converting a get command response message to its local JAXB equivalent.
Method that handles converting a get command response message to its local JAXB equivalent .