private AdhocQuery getStoredQuery( String id, MetadataStore<RegistryObject> queryStore ) throws MetadataStoreException { MetadataResultSet<RegistryObject> recordById; recordById = queryStore.getRecordById( Collections.singletonList( id ), new QName[] { new QName( RIM_NS, "AdhocQuery", "rim" ) } ); recordById.next(); Object storedQuery = recordById.getRecord(); if ( storedQuery == null || !( storedQuery instanceof AdhocQuery ) ) { String msg = "Could not find an stored AdhocQuery with id " + id; LOG.debug( msg ); throw new IllegalArgumentException( msg ); } return (AdhocQuery) storedQuery; }
public static ServiceProfile createProfile( MetadataStore<?> store ) { LOG.info( "Create profile for store with type " + store.getType() ); if ( "iso".equals( store.getType() ) ) { return new CommonCSWProfile(); } if ( "ebrimeo".equals( store.getType() ) ) { return new EbrimProfile(); } throw new IllegalArgumentException( "Unknown store type '" + store.getType() + "'" ); }
MetadataStoreTransaction ta = store.acquireTransaction(); writer.writeAttribute( "handleRef", handle ); MetadataResultSet<?> rs = store.getRecordById( ids, null ); try { while ( rs.next() ) {
@Override boolean insertRecord( OMElement record ) throws Exception { MetadataStoreTransaction trans = metadataStore.acquireTransaction(); try { List<String> performInsert = trans.performInsert( new InsertOperation( Collections.singletonList( MetadataRecordFactory.create( record ) ), null, null ) ); trans.commit(); if ( performInsert.isEmpty() ) return false; return true; } catch ( Exception e ) { trans.rollback(); throw e; } }
countRows = store.getRecordCount( query ); returnedRecords = 0; nextRecord = 1; if ( !isResultTypeHits ) { rs = store.getRecords( query ); returnedRecords = computeReturned( countRows, getRec.getMaxRecords(), getRec.getStartPosition() ); nextRecord = computeNext( countRows, getRec.getMaxRecords(), getRec.getStartPosition() ); rs = store.getRecords( query ); List<MetadataRecord> records = new ArrayList<MetadataRecord>( maxMatches ); int maxRecords = getRec.getMaxRecords();
protected MetadataResultSet<?> getRecordById( GetRecordById getRecBI, MetadataStore<?> store, List<String> requestedIdList ) throws OWSException { if ( store != null ) { try { return store.getRecordById( requestedIdList, getRecBI.getTypeNames() ); } catch ( MetadataStoreException e ) { throw new OWSException( e.getMessage(), OWSException.NO_APPLICABLE_CODE ); } } return null; }