mil.dod.th.ose.remote/src/mil/dod/th/ose/remote/observation/ObservationMessageService.java
private Message findObservation(final TerraHarvestMessage message, final ObservationStoreNamespace obsMessage,
        final RemoteChannel channel) throws InvalidProtocolBufferException 
    {
        final FindObservationByUUIDRequestData request = 
                FindObservationByUUIDRequestData.parseFrom(obsMessage.getData());
        if (request.getObservationFormat() != RemoteTypesGen.LexiconFormat.Enum.NATIVE)
        {
            throw new UnsupportedOperationException(
               String.format("Lexicon format %s is not valid for observation by UUID", request.getObservationFormat()));
        }

        //convert proto uuids to java uuid
        final List<java.util.UUID> javaUuids = new ArrayList<java.util.UUID>();
        for (UUID uuid : request.getUuidOfObservationList())
        {
            javaUuids.add(SharedMessageUtils.convertProtoUUIDtoUUID(uuid));
        }

        //get observations
        final List<Observation> observations = new ArrayList<Observation>(); 
        for (java.util.UUID uuid : javaUuids)
        {
            //fetch uuid
            final Observation obs = m_ObservationStore.find(uuid);

            //obs could be null if not found
            if (obs != null)
            {
                observations.add(obs);
            }
        }

        //convert the observations
        final List<ObservationGen.Observation> protoObservations = createProtoObservationList(observations);

        //response message
        final FindObservationByUUIDResponseData response = FindObservationByUUIDResponseData.newBuilder().
            addAllObservationNative(protoObservations).build();

        //send response
        m_MessageFactory.createObservationStoreResponseMessage(message, 
            ObservationStoreMessageType.FindObservationByUUIDResponse, response).queue(channel);

        //return request for event
        return request;
    }
/**
     * Handle the request to find observations by UUID.
     * @param message
     *     message that contains the request parameters to use to query the observation store
     * @param obsMessage
     *     message containing the observation store namespace message
     * @param channel
     *     the channel from which the message originated from
     * @return
     *     the parsed data message
     * @throws InvalidProtocolBufferException
     *     throw in the event that the namespace specific message could not be parsed. 
     */
Handle the request to find observations by UUID.
Handle the request to find observations by UUID .
private Message findObservation(final TerraHarvestMessage message, final ObservationStoreNamespace obsMessage,
        final RemoteChannel channel) throws InvalidProtocolBufferException 
    {
        final FindObservationByUUIDRequestData request = 
                FindObservationByUUIDRequestData.parseFrom(obsMessage.getData());
        if (request.getObservationFormat() != RemoteTypesGen.LexiconFormat.Enum.NATIVE)
        {
            throw new UnsupportedOperationException(
               String.format("Lexicon format %s is not valid for observation by UUID", request.getObservationFormat()));
        }
        final List<java.util.UUID> javaUuids = new ArrayList<java.util.UUID>();
        for (UUID uuid : request.getUuidOfObservationList())
        {
            javaUuids.add(SharedMessageUtils.convertProtoUUIDtoUUID(uuid));
        }
        final List<Observation> observations = new ArrayList<Observation>(); 
        for (java.util.UUID uuid : javaUuids)
        {
            final Observation obs = m_ObservationStore.find(uuid);
            if (obs != null)
            {
                observations.add(obs);
            }
        }
        final List<ObservationGen.Observation> protoObservations = createProtoObservationList(observations);
        final FindObservationByUUIDResponseData response = FindObservationByUUIDResponseData.newBuilder().
            addAllObservationNative(protoObservations).build();
        m_MessageFactory.createObservationStoreResponseMessage(message, 
            ObservationStoreMessageType.FindObservationByUUIDResponse, response).queue(channel);
        return request;
    }
private Message findObservation ( final TerraHarvestMessage message , final ObservationStoreNamespace obsMessage , final RemoteChannel channel ) throws InvalidProtocolBufferException { final FindObservationByUUIDRequestData request = FindObservationByUUIDRequestData . parseFrom ( obsMessage . getData ( ) ) ; if ( request . getObservationFormat ( ) != RemoteTypesGen . LexiconFormat . Enum . NATIVE ) { throw new UnsupportedOperationException ( String . format ( "Lexicon format %s is not valid for observation by UUID" , request . getObservationFormat ( ) ) ) ; } final List < java . util . UUID > javaUuids = new ArrayList < java . util . UUID > ( ) ; for ( UUID uuid : request . getUuidOfObservationList ( ) ) { javaUuids . add ( SharedMessageUtils . convertProtoUUIDtoUUID ( uuid ) ) ; } final List < Observation > observations = new ArrayList < Observation > ( ) ; for ( java . util . UUID uuid : javaUuids ) { final Observation obs = m_ObservationStore . find ( uuid ) ; if ( obs != null ) { observations . add ( obs ) ; } } final List < ObservationGen . Observation > protoObservations = createProtoObservationList ( observations ) ; final FindObservationByUUIDResponseData response = FindObservationByUUIDResponseData . newBuilder ( ) . addAllObservationNative ( protoObservations ) . build ( ) ; m_MessageFactory . createObservationStoreResponseMessage ( message , ObservationStoreMessageType . FindObservationByUUIDResponse , response ) . queue ( channel ) ; return request ; }
Handle the request to find observations by UUID.
Handle the request to find observations by UUID .
//convert proto uuids to java uuid //get observations //fetch uuid //obs could be null if not found //convert the observations //response message //send response //return request for event