mil.dod.th.ose.remote/src/mil/dod/th/ose/remote/observation/ObservationMessageService.java
private ObservationQuery createObservationQuery(final Query queryRequest) throws IllegalArgumentException, // NOCHECKSTYLE: This logic is required until refactoring can be done
            IllegalStateException
    {
        final ObservationQuery obsQuery = m_ObservationStore.newQuery();
        
        if (queryRequest.hasMaxNumberOfObs())
        {
            obsQuery.withMaxObservations(queryRequest.getMaxNumberOfObs());
        }
        
        if (queryRequest.hasAssetUuid())
        {
            obsQuery.withAssetUuid(SharedMessageUtils.convertProtoUUIDtoUUID(queryRequest.getAssetUuid()));
        }
        
        if (queryRequest.hasAssetType())
        {
            obsQuery.withAssetType(queryRequest.getAssetType());
        }
        
        for (ObservationSubType.Enum subTypeProto : queryRequest.getObservationSubTypeList())
        {
            final ObservationSubTypeEnum subType = ObservationSubTypeEnumConverter.convertProtoEnumToJava(subTypeProto);
            
            obsQuery.withSubType(subType);
        }
        
        if (queryRequest.hasCreatedTimeRange())
        {
            final TimeConstraintData times = queryRequest.getCreatedTimeRange();
            obsQuery.withTimeCreatedRange(new Date(times.getStartTime()), new Date(times.getStopTime()));
        }
        
        if (queryRequest.hasObservedTimeRange())
        {
            final TimeConstraintData times = queryRequest.getObservedTimeRange();
            obsQuery.withTimeObservedRange(new Date(times.getStartTime()), new Date(times.getStopTime()));
        }
        
        if (queryRequest.hasRange())
        {
            final Range range = queryRequest.getRange();
            obsQuery.withRange(range.getFromInclusive(), range.getToExclusive());
        }
        
        if (queryRequest.hasSortField() && queryRequest.hasSortOrder())
        {
            obsQuery.withOrder(EnumConverter.convertProtoSortFieldToJava(queryRequest.getSortField()),
                               EnumConverter.convertProtoSortOrderToJava(queryRequest.getSortOrder()));
        }
        
        return obsQuery;
    }
/**
     * Create a {@link ObservationQuery} from the given {@link Query} message.
     * @param queryRequest
     *  the message that contains the query parameters
     * @return
     *  the {@link ObservationQuery} object that was generated from the given {@link Query}
     * @throws IllegalArgumentException
     *  if the given observation sub type or sort order values given are not within the 
     *  range of acceptable values
     * @throws IllegalStateException
     *  if the asset uuid and asset type are both set
     */
Create a  ObservationQuery from the given  Query message.
@param queryRequest
the message that contains the query parameters
@return
the  ObservationQuery object that was generated from the given  Query
@throws IllegalArgumentException
if the given observation sub type or sort order values given are not within the
range of acceptable values
@throws IllegalStateException
if the asset uuid and asset type are both set
Create a ObservationQuery from the given Query message . @param queryRequest the message that contains the query parameters @return the ObservationQuery object that was generated from the given Query @throws IllegalArgumentException if the given observation sub type or sort order values given are not within the range of acceptable values @throws IllegalStateException if the asset uuid and asset type are both set
private ObservationQuery createObservationQuery(final Query queryRequest) throws IllegalArgumentException, 
            IllegalStateException
    {
        final ObservationQuery obsQuery = m_ObservationStore.newQuery();
        if (queryRequest.hasMaxNumberOfObs())
        {
            obsQuery.withMaxObservations(queryRequest.getMaxNumberOfObs());
        }
        if (queryRequest.hasAssetUuid())
        {
            obsQuery.withAssetUuid(SharedMessageUtils.convertProtoUUIDtoUUID(queryRequest.getAssetUuid()));
        }
        if (queryRequest.hasAssetType())
        {
            obsQuery.withAssetType(queryRequest.getAssetType());
        }
        for (ObservationSubType.Enum subTypeProto : queryRequest.getObservationSubTypeList())
        {
            final ObservationSubTypeEnum subType = ObservationSubTypeEnumConverter.convertProtoEnumToJava(subTypeProto);
            obsQuery.withSubType(subType);
        }
        if (queryRequest.hasCreatedTimeRange())
        {
            final TimeConstraintData times = queryRequest.getCreatedTimeRange();
            obsQuery.withTimeCreatedRange(new Date(times.getStartTime()), new Date(times.getStopTime()));
        }
        if (queryRequest.hasObservedTimeRange())
        {
            final TimeConstraintData times = queryRequest.getObservedTimeRange();
            obsQuery.withTimeObservedRange(new Date(times.getStartTime()), new Date(times.getStopTime()));
        }
        if (queryRequest.hasRange())
        {
            final Range range = queryRequest.getRange();
            obsQuery.withRange(range.getFromInclusive(), range.getToExclusive());
        }
        if (queryRequest.hasSortField() && queryRequest.hasSortOrder())
        {
            obsQuery.withOrder(EnumConverter.convertProtoSortFieldToJava(queryRequest.getSortField()),
                               EnumConverter.convertProtoSortOrderToJava(queryRequest.getSortOrder()));
        }
        return obsQuery;
    }
private ObservationQuery createObservationQuery ( final Query queryRequest ) throws IllegalArgumentException , IllegalStateException { final ObservationQuery obsQuery = m_ObservationStore . newQuery ( ) ; if ( queryRequest . hasMaxNumberOfObs ( ) ) { obsQuery . withMaxObservations ( queryRequest . getMaxNumberOfObs ( ) ) ; } if ( queryRequest . hasAssetUuid ( ) ) { obsQuery . withAssetUuid ( SharedMessageUtils . convertProtoUUIDtoUUID ( queryRequest . getAssetUuid ( ) ) ) ; } if ( queryRequest . hasAssetType ( ) ) { obsQuery . withAssetType ( queryRequest . getAssetType ( ) ) ; } for ( ObservationSubType . Enum subTypeProto : queryRequest . getObservationSubTypeList ( ) ) { final ObservationSubTypeEnum subType = ObservationSubTypeEnumConverter . convertProtoEnumToJava ( subTypeProto ) ; obsQuery . withSubType ( subType ) ; } if ( queryRequest . hasCreatedTimeRange ( ) ) { final TimeConstraintData times = queryRequest . getCreatedTimeRange ( ) ; obsQuery . withTimeCreatedRange ( new Date ( times . getStartTime ( ) ) , new Date ( times . getStopTime ( ) ) ) ; } if ( queryRequest . hasObservedTimeRange ( ) ) { final TimeConstraintData times = queryRequest . getObservedTimeRange ( ) ; obsQuery . withTimeObservedRange ( new Date ( times . getStartTime ( ) ) , new Date ( times . getStopTime ( ) ) ) ; } if ( queryRequest . hasRange ( ) ) { final Range range = queryRequest . getRange ( ) ; obsQuery . withRange ( range . getFromInclusive ( ) , range . getToExclusive ( ) ) ; } if ( queryRequest . hasSortField ( ) && queryRequest . hasSortOrder ( ) ) { obsQuery . withOrder ( EnumConverter . convertProtoSortFieldToJava ( queryRequest . getSortField ( ) ) , EnumConverter . convertProtoSortOrderToJava ( queryRequest . getSortOrder ( ) ) ) ; } return obsQuery ; }
Create a {@link ObservationQuery} from the given {@link Query} message.
Create a { @link ObservationQuery } from the given { @link Query } message .
// NOCHECKSTYLE: This logic is required until refactoring can be done