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; }
private int doDelete( MetadataStoreTransaction ta, DeleteOperation delete ) throws MetadataStoreException { int i = ta.performDelete( delete ); LOG.info( "Delete done!" ); return i; }
private int doUpdate( MetadataStoreTransaction ta, UpdateOperation update ) throws MetadataStoreException, MetadataInspectorException { int i = ta.performUpdate( update ); LOG.info( "Update done!" ); return i; }
null ); Filter constraint = new OperatorFilter( new PropertyIsEqualTo( propertyName, lit, true, null ) ); trans.performDelete( new DeleteOperation( null, null, constraint ) ); List<String> performInsert = trans.performInsert( new InsertOperation( Collections.singletonList( profile ), null, null ) ); trans.commit(); if ( !performInsert.isEmpty() ) { LOG.info( "Inserted profile with id " + performInsert.get( 0 ) ); LOG.debug( msg ); try { trans.rollback(); } catch ( MetadataStoreException e1 ) { LOG.error( "Rollback failed: ", e1 ); LOG.debug( msg ); try { trans.rollback(); } catch ( MetadataStoreException e1 ) { LOG.error( "Rollback failed: ", e1 );
@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; } }