ir.addPreparedArgument( new SQLIdentifier( "key" ), "REGISTRYPACKAGE_ID" ); ir.addPreparedArgument( new SQLIdentifier( "value" ), insertedId ); ir.performInsert( conn ); ir.performInsert( conn );
private void insertInKeywordTable( Connection conn, int operatesOnId, QueryableProperties qp ) throws MetadataStoreException { List<Keyword> keywords = qp.getKeywords(); if ( keywords != null && keywords.size() > 0 ) { for ( Keyword keyword : keywords ) { InsertRow ir = new InsertRow( new TableName( keywordTable ), null ); try { int localId = getNewIdentifier( conn, keywordTable ); ir.addPreparedArgument( idColumn, localId ); ir.addPreparedArgument( fk_main, operatesOnId ); ir.addPreparedArgument( "keywordtype", keyword.getKeywordType() ); ir.addPreparedArgument( "keywords", concatenate( keyword.getKeywords() ) ); LOG.debug( ir.getSql() ); ir.performInsert( conn ); } catch ( SQLException e ) { String msg = Messages.getMessage( "ERROR_SQL", ir.getSql(), e.getMessage() ); LOG.debug( msg ); throw new MetadataStoreException( msg ); } } } }
private void insertInCRSTable( Connection conn, int operatesOnId, QueryableProperties qp ) throws MetadataStoreException { List<CRS> crss = qp.getCrs(); if ( crss != null && crss.size() > 0 ) { for ( CRS crs : crss ) { InsertRow ir = new InsertRow( new TableName( crsTable ), null ); try { int localId = getNewIdentifier( conn, crsTable ); ir.addPreparedArgument( idColumn, localId ); ir.addPreparedArgument( fk_main, operatesOnId ); ir.addPreparedArgument( "authority", ( crs.getAuthority() != null && crs.getAuthority().length() > 0 ) ? crs.getAuthority() : null ); ir.addPreparedArgument( "crsid", ( crs.getCrsId() != null && crs.getCrsId().length() > 0 ) ? crs.getCrsId() : null ); ir.addPreparedArgument( "version", ( crs.getVersion() != null && crs.getVersion().length() > 0 ) ? crs.getVersion() : null ); LOG.debug( ir.getSql() ); ir.performInsert( conn ); } catch ( SQLException e ) { String msg = Messages.getMessage( "ERROR_SQL", ir.getSql(), e.getMessage() ); LOG.debug( msg ); throw new MetadataStoreException( msg ); } } } }
private void insertInOperatesOnTable( Connection conn, int operatesOnId, QueryableProperties qp ) throws MetadataStoreException { List<OperatesOnData> opOns = qp.getOperatesOnData(); if ( opOns != null && opOns.size() > 0 ) { for ( OperatesOnData opOn : opOns ) { InsertRow ir = new InsertRow( new TableName( opOnTable ), null ); try { int localId = getNewIdentifier( conn, opOnTable ); ir.addPreparedArgument( idColumn, localId ); ir.addPreparedArgument( fk_main, operatesOnId ); ir.addPreparedArgument( "operateson", opOn.getOperatesOnId() ); ir.addPreparedArgument( "operatesonid", opOn.getOperatesOnIdentifier() ); ir.addPreparedArgument( "operatesonname", opOn.getOperatesOnName() ); LOG.debug( ir.getSql() ); ir.performInsert( conn ); } catch ( SQLException e ) { String msg = Messages.getMessage( "ERROR_SQL", ir.getSql(), e.getMessage() ); LOG.debug( msg ); throw new MetadataStoreException( msg ); } } } }
@Override public synchronized int executeInsert( Connection conn, ISORecord rec ) throws MetadataStoreException, XMLStreamException { int internalId = 0; InsertRow ir = new InsertRow( new TableName( mainTable ), null ); try { internalId = getLastDatasetId( conn, mainTable ); internalId++; ir.addPreparedArgument( idColumn, internalId ); ir.addPreparedArgument( recordColumn, rec.getAsByteArray() ); ir.addPreparedArgument( "fileidentifier", rec.getIdentifier() ); ir.addPreparedArgument( "version", null ); ir.addPreparedArgument( "status", null ); appendValues( rec, ir ); LOG.debug( ir.getSql() ); ir.performInsert( conn ); QueryableProperties qp = rec.getParsedElement().getQueryableProperties(); insertNewValues( conn, internalId, qp ); } catch ( SQLException e ) { String msg = Messages.getMessage( "ERROR_SQL", ir.getSql(), e.getMessage() ); LOG.debug( msg ); throw new MetadataStoreException( msg ); } return internalId; }
private void insertAssociation( Association association, int regPackId, Connection conn ) throws SQLException { InsertRow ir = new InsertRow( new TableName( Table.idxtb_association.name() ), null ); addRegistryObject( ir, association ); ir.addPreparedArgument( new SQLIdentifier( "sourceObject" ), association.getSourceObject() ); ir.addPreparedArgument( new SQLIdentifier( "targetObject" ), association.getTargetObject() ); ir.addPreparedArgument( new SQLIdentifier( "associationType" ), association.getAssociationType() ); ir.addPreparedArgument( new SQLIdentifier( "data" ), getAsByteArray( association.getElement() ) ); ir.addPreparedArgument( new SQLIdentifier( "fk_registrypackage" ), regPackId ); ir.performInsert( conn ); }
private void insertClassification( Classification classification, int regPackId, Connection conn ) throws SQLException { InsertRow ir = new InsertRow( new TableName( Table.idxtb_classification.name() ), null ); addRegistryObject( ir, classification ); ir.addPreparedArgument( new SQLIdentifier( "classificationNode" ), classification.getClassificationNode() ); ir.addPreparedArgument( new SQLIdentifier( "classifiedObject" ), classification.getClassifiedObject() ); ir.addPreparedArgument( new SQLIdentifier( "classificationScheme" ), classification.getClassificationScheme() ); ir.addPreparedArgument( new SQLIdentifier( "data" ), getAsByteArray( classification.getElement() ) ); ir.addPreparedArgument( new SQLIdentifier( "fk_registrypackage" ), regPackId ); ir.performInsert( conn ); }
private void insertClassificationNode( ClassificationNode classificationNode, int regPackId, Connection conn ) throws SQLException { InsertRow ir = new InsertRow( new TableName( Table.idxtb_classificationNode.name() ), null ); addRegistryObject( ir, classificationNode ); ir.addPreparedArgument( new SQLIdentifier( "parent" ), classificationNode.getParent() ); ir.addPreparedArgument( new SQLIdentifier( "code" ), classificationNode.getCode() ); ir.addPreparedArgument( new SQLIdentifier( "path" ), classificationNode.getPath() ); ir.addPreparedArgument( new SQLIdentifier( "data" ), getAsByteArray( classificationNode.getElement() ) ); ir.addPreparedArgument( new SQLIdentifier( "fk_registrypackage" ), regPackId ); ir.performInsert( conn ); }
ir.performInsert( conn );
ir.performInsert( conn );