mil.dod.th.ose.remote/src/mil/dod/th/ose/remote/util/RemotePropertyConverter.java
public Map<String, Object> complexTypesMapToMap(final List<ComplexTypesMapEntry> entries) 
            throws ObjectConverterException, InvalidProtocolBufferException, UnmarshalException
    {
        final Map<String, Object> arguments = new HashMap<String, Object>();
        
        for (ComplexTypesMapEntry entry : entries)
        {
            final Object value;
            switch (entry.getValueCase())
            {
                case MULTI:
                    value = SharedMessageUtils.convertMultitypeToObject(entry.getMulti());
                    break;
                    
                case LINKLAYERSTATUS:
                    value = EnumConverter.convertProtoLinkStatusToJava(entry.getLinkLayerStatus());
                    break;
                    
                case PROGRAMSTATUS:
                    value = EnumConverter.convertMissionStatusToProgramStatus(entry.getProgramStatus());
                    break;
                    
                case PROGRAMTESTRESULT:
                    value = EnumConverter.convertToTestResult(entry.getProgramTestResult());
                    break;
                    
                case SUMMARYSTATUS:
                    value = SummaryStatusEnumConverter.convertProtoEnumToJava(entry.getSummaryStatus());
                    break;
                    
                case OBSERVATIONNATIVE:
                    value = m_Converter.convertToJaxb(entry.getObservationNative());
                    break;
                    
                case OBSERVATIONXML:
                    value = 
                        m_XmlUnmarshalService.getXmlObject(Observation.class, entry.getObservationXml().toByteArray());
                    break;
                    
                default:
                    throw new UnsupportedOperationException(
                            String.format("Maps with value case [%s] are not supported", entry.getValueCase())); 
                    
            }
            arguments.put(entry.getKey(), value);
        }
        //check if this event is a update command response
        if (arguments.containsKey(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE))
        {
            final String responseType = (String)arguments.get(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE_TYPE);
            final ByteString commandResponse = (ByteString)arguments.get(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE);
            if (responseType == null)
            {
                throw new IllegalStateException("Unable to convert event because the event has some data for an asset"
                        + " command response, but does not contain all needed data.");
            }
            final Response responseJava = m_CommandConverter.getJavaResponseType(commandResponse.toByteArray(), 
                    m_CommandConverter.getCommandResponseEnumFromClassName(responseType));
            arguments.put(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE, responseJava);
        }
        return arguments;
    }
/**
     * Create a map with all of the entries in the list.
     * 
     * @param entries
     *      list of entries
     * @return
     *      map containing all of the argument entries
     * @throws ObjectConverterException
     *      thrown in the event that a property cannot be properly converted
     * @throws InvalidProtocolBufferException
     *      thrown in the event that a property's message cannot be parsed
     * @throws UnmarshalException
     *      if unable to unmarshal XML data into a Java object (applies when format is XML)
     */
Create a map with all of the entries in the list.


Create a map with all of the entries in the list .
public Map<String, Object> complexTypesMapToMap(final List<ComplexTypesMapEntry> entries) 
            throws ObjectConverterException, InvalidProtocolBufferException, UnmarshalException
    {
        final Map<String, Object> arguments = new HashMap<String, Object>();
        for (ComplexTypesMapEntry entry : entries)
        {
            final Object value;
            switch (entry.getValueCase())
            {
                case MULTI:
                    value = SharedMessageUtils.convertMultitypeToObject(entry.getMulti());
                    break;
                case LINKLAYERSTATUS:
                    value = EnumConverter.convertProtoLinkStatusToJava(entry.getLinkLayerStatus());
                    break;
                case PROGRAMSTATUS:
                    value = EnumConverter.convertMissionStatusToProgramStatus(entry.getProgramStatus());
                    break;
                case PROGRAMTESTRESULT:
                    value = EnumConverter.convertToTestResult(entry.getProgramTestResult());
                    break;
                case SUMMARYSTATUS:
                    value = SummaryStatusEnumConverter.convertProtoEnumToJava(entry.getSummaryStatus());
                    break;
                case OBSERVATIONNATIVE:
                    value = m_Converter.convertToJaxb(entry.getObservationNative());
                    break;
                case OBSERVATIONXML:
                    value = 
                        m_XmlUnmarshalService.getXmlObject(Observation.class, entry.getObservationXml().toByteArray());
                    break;
                default:
                    throw new UnsupportedOperationException(
                            String.format("Maps with value case [%s] are not supported", entry.getValueCase())); 
            }
            arguments.put(entry.getKey(), value);
        }
        if (arguments.containsKey(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE))
        {
            final String responseType = (String)arguments.get(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE_TYPE);
            final ByteString commandResponse = (ByteString)arguments.get(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE);
            if (responseType == null)
            {
                throw new IllegalStateException("Unable to convert event because the event has some data for an asset"
                        + " command response, but does not contain all needed data.");
            }
            final Response responseJava = m_CommandConverter.getJavaResponseType(commandResponse.toByteArray(), 
                    m_CommandConverter.getCommandResponseEnumFromClassName(responseType));
            arguments.put(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE, responseJava);
        }
        return arguments;
    }
public Map < String , Object > complexTypesMapToMap ( final List < ComplexTypesMapEntry > entries ) throws ObjectConverterException , InvalidProtocolBufferException , UnmarshalException { final Map < String , Object > arguments = new HashMap < String , Object > ( ) ; for ( ComplexTypesMapEntry entry : entries ) { final Object value ; switch ( entry . getValueCase ( ) ) { case MULTI : value = SharedMessageUtils . convertMultitypeToObject ( entry . getMulti ( ) ) ; break ; case LINKLAYERSTATUS : value = EnumConverter . convertProtoLinkStatusToJava ( entry . getLinkLayerStatus ( ) ) ; break ; case PROGRAMSTATUS : value = EnumConverter . convertMissionStatusToProgramStatus ( entry . getProgramStatus ( ) ) ; break ; case PROGRAMTESTRESULT : value = EnumConverter . convertToTestResult ( entry . getProgramTestResult ( ) ) ; break ; case SUMMARYSTATUS : value = SummaryStatusEnumConverter . convertProtoEnumToJava ( entry . getSummaryStatus ( ) ) ; break ; case OBSERVATIONNATIVE : value = m_Converter . convertToJaxb ( entry . getObservationNative ( ) ) ; break ; case OBSERVATIONXML : value = m_XmlUnmarshalService . getXmlObject ( Observation . class , entry . getObservationXml ( ) . toByteArray ( ) ) ; break ; default : throw new UnsupportedOperationException ( String . format ( "Maps with value case [%s] are not supported" , entry . getValueCase ( ) ) ) ; } arguments . put ( entry . getKey ( ) , value ) ; } if ( arguments . containsKey ( Asset . EVENT_PROP_ASSET_COMMAND_RESPONSE ) ) { final String responseType = ( String ) arguments . get ( Asset . EVENT_PROP_ASSET_COMMAND_RESPONSE_TYPE ) ; final ByteString commandResponse = ( ByteString ) arguments . get ( Asset . EVENT_PROP_ASSET_COMMAND_RESPONSE ) ; if ( responseType == null ) { throw new IllegalStateException ( "Unable to convert event because the event has some data for an asset" + " command response, but does not contain all needed data." ) ; } final Response responseJava = m_CommandConverter . getJavaResponseType ( commandResponse . toByteArray ( ) , m_CommandConverter . getCommandResponseEnumFromClassName ( responseType ) ) ; arguments . put ( Asset . EVENT_PROP_ASSET_COMMAND_RESPONSE , responseJava ) ; } return arguments ; }
Create a map with all of the entries in the list.
Create a map with all of the entries in the list .
//check if this event is a update command response