mil.dod.th.ose.remote/src/mil/dod/th/ose/remote/util/RemotePropertyConverter.java
public List<ComplexTypesMapEntry> mapToComplexTypesMap(final Map<String, Object> props, 
            final RemoteTypesGen.LexiconFormat.Enum format) throws ObjectConverterException, MarshalException
    {
        final List<ComplexTypesMapEntry> entries = new ArrayList<ComplexTypesMapEntry>();
        for (String key : props.keySet())
        {
            final Object value = props.get(key);
            final ComplexTypesMapEntry.Builder entry = ComplexTypesMapEntry.newBuilder().setKey(key);

            if (SharedMessageUtils.isValueConvertableToMultitype(value))
            {
                entry.setMulti(SharedMessageUtils.convertObjectToMultitype(value));
            }
            else if (value instanceof Observation)
            {
                switch (format)
                {
                    case NATIVE:
                        entry.setObservationNative(
                                (ObservationGen.Observation)m_Converter.convertToProto(value));
                        break;
                        
                    case XML:
                        entry.setObservationXml(
                                ByteString.copyFrom(m_XmlMarshalService.createXmlByteArray(value, false)));
                        break;
                        
                    default:
                        throw new UnsupportedOperationException(
                                String.format("Lexicon format %s is not valid for observations", format)); 
                }
            }
            else if (value instanceof LinkStatus)
            {
                entry.setLinkLayerStatus(EnumConverter.convertJavaLinkStatusToProto((LinkStatus)value));
            }
            else if (value instanceof ProgramStatus)
            {
                entry.setProgramStatus(EnumConverter.convertProgramStatusToMissionStatus((ProgramStatus)value));
            }
            else if (value instanceof TestResult)
            {
                entry.setProgramTestResult(
                        EnumConverter.convertToMissionTestResult((TestResult)value));
            }
            else if (value instanceof SummaryStatusEnum)
            {
                entry.setSummaryStatus(SummaryStatusEnumConverter
                        .convertJavaEnumToProto((SummaryStatusEnum)value));
            }
            //asset command response type may be in event
            else if (value instanceof Response)
            {
                final ByteString commandBytes = m_Converter.convertToProto(value).toByteString();
                entry.setMulti(SharedMessageUtils.convertObjectToMultitype(commandBytes));
            }
            else
            {
                continue;
            }
            
            entries.add(entry.build());
        }

        //return list
        return entries;
    }
/**
     * Generate a list of map entries that are a protocol buffer equivalent of the original map. If a value is of a type
     * that cannot be converted the property will be ignored.
     * 
     * @param props
     *      properties to convert
     * @param format     
     *      format to use for lexicon based objects
     * @return
     *      properties converted into a list of map entries
     * @throws ObjectConverterException
     *      thrown in the event that a property cannot be converted
     * @throws MarshalException
     *      if unable to generated XML from JAXB object (applies when format is XML)
     */
Generate a list of map entries that are a protocol buffer equivalent of the original map. If a value is of a type
that cannot be converted the property will be ignored.


Generate a list of map entries that are a protocol buffer equivalent of the original map . If a value is of a type that cannot be converted the property will be ignored .
public List<ComplexTypesMapEntry> mapToComplexTypesMap(final Map<String, Object> props, 
            final RemoteTypesGen.LexiconFormat.Enum format) throws ObjectConverterException, MarshalException
    {
        final List<ComplexTypesMapEntry> entries = new ArrayList<ComplexTypesMapEntry>();
        for (String key : props.keySet())
        {
            final Object value = props.get(key);
            final ComplexTypesMapEntry.Builder entry = ComplexTypesMapEntry.newBuilder().setKey(key);
            if (SharedMessageUtils.isValueConvertableToMultitype(value))
            {
                entry.setMulti(SharedMessageUtils.convertObjectToMultitype(value));
            }
            else if (value instanceof Observation)
            {
                switch (format)
                {
                    case NATIVE:
                        entry.setObservationNative(
                                (ObservationGen.Observation)m_Converter.convertToProto(value));
                        break;
                    case XML:
                        entry.setObservationXml(
                                ByteString.copyFrom(m_XmlMarshalService.createXmlByteArray(value, false)));
                        break;
                    default:
                        throw new UnsupportedOperationException(
                                String.format("Lexicon format %s is not valid for observations", format)); 
                }
            }
            else if (value instanceof LinkStatus)
            {
                entry.setLinkLayerStatus(EnumConverter.convertJavaLinkStatusToProto((LinkStatus)value));
            }
            else if (value instanceof ProgramStatus)
            {
                entry.setProgramStatus(EnumConverter.convertProgramStatusToMissionStatus((ProgramStatus)value));
            }
            else if (value instanceof TestResult)
            {
                entry.setProgramTestResult(
                        EnumConverter.convertToMissionTestResult((TestResult)value));
            }
            else if (value instanceof SummaryStatusEnum)
            {
                entry.setSummaryStatus(SummaryStatusEnumConverter
                        .convertJavaEnumToProto((SummaryStatusEnum)value));
            }
            else if (value instanceof Response)
            {
                final ByteString commandBytes = m_Converter.convertToProto(value).toByteString();
                entry.setMulti(SharedMessageUtils.convertObjectToMultitype(commandBytes));
            }
            else
            {
                continue;
            }
            entries.add(entry.build());
        }
        return entries;
    }
public List < ComplexTypesMapEntry > mapToComplexTypesMap ( final Map < String , Object > props , final RemoteTypesGen . LexiconFormat . Enum format ) throws ObjectConverterException , MarshalException { final List < ComplexTypesMapEntry > entries = new ArrayList < ComplexTypesMapEntry > ( ) ; for ( String key : props . keySet ( ) ) { final Object value = props . get ( key ) ; final ComplexTypesMapEntry . Builder entry = ComplexTypesMapEntry . newBuilder ( ) . setKey ( key ) ; if ( SharedMessageUtils . isValueConvertableToMultitype ( value ) ) { entry . setMulti ( SharedMessageUtils . convertObjectToMultitype ( value ) ) ; } else if ( value instanceof Observation ) { switch ( format ) { case NATIVE : entry . setObservationNative ( ( ObservationGen . Observation ) m_Converter . convertToProto ( value ) ) ; break ; case XML : entry . setObservationXml ( ByteString . copyFrom ( m_XmlMarshalService . createXmlByteArray ( value , false ) ) ) ; break ; default : throw new UnsupportedOperationException ( String . format ( "Lexicon format %s is not valid for observations" , format ) ) ; } } else if ( value instanceof LinkStatus ) { entry . setLinkLayerStatus ( EnumConverter . convertJavaLinkStatusToProto ( ( LinkStatus ) value ) ) ; } else if ( value instanceof ProgramStatus ) { entry . setProgramStatus ( EnumConverter . convertProgramStatusToMissionStatus ( ( ProgramStatus ) value ) ) ; } else if ( value instanceof TestResult ) { entry . setProgramTestResult ( EnumConverter . convertToMissionTestResult ( ( TestResult ) value ) ) ; } else if ( value instanceof SummaryStatusEnum ) { entry . setSummaryStatus ( SummaryStatusEnumConverter . convertJavaEnumToProto ( ( SummaryStatusEnum ) value ) ) ; } else if ( value instanceof Response ) { final ByteString commandBytes = m_Converter . convertToProto ( value ) . toByteString ( ) ; entry . setMulti ( SharedMessageUtils . convertObjectToMultitype ( commandBytes ) ) ; } else { continue ; } entries . add ( entry . build ( ) ) ; } return entries ; }
Generate a list of map entries that are a protocol buffer equivalent of the original map.
Generate a list of map entries that are a protocol buffer equivalent of the original map .
//asset command response type may be in event //return list