private List<String> doInsert( MetadataStoreTransaction ta, InsertOperation insert ) throws MetadataStoreException, OWSException, MetadataInspectorException { // TODO the first element determines the metadataStore // String uri = insert.getElements().get( 0 ).getNamespace().getNamespaceURI(); // String localName = insert.getElements().get( 0 ).getLocalName(); // String prefix = insert.getElements().get( 0 ).getNamespace().getPrefix(); List<String> ids = ta.performInsert( insert ); LOG.debug( "inserted metadata: " + ids ); LOG.info( "Insert done!" ); return ids; }
@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; } }
trans.performDelete( new DeleteOperation( null, null, constraint ) ); List<String> performInsert = trans.performInsert( new InsertOperation( Collections.singletonList( profile ), null, null ) );