public void storeAs ( String queryName ) { QueryRecorder . queryCompleted ( this . query ) ; QueryMemento qm = this . createMemento ( ) ; IDBAccess dbAccess = ( ( IIntDomainAccess ) this . domainAccess ) . getInternalDomainAccess ( ) . getDBAccess ( ) ; String qLabel = ( ( IIntDomainAccess ) this . domainAccess ) . getInternalDomainAccess ( ) . getDomainLabel ( ) . concat ( Q_LABEL_POSTFIX ) ; JcNode n = new JcNode ( "n" ) ; IClause [ ] clauses = new IClause [ ] { MERGE . node ( n ) . label ( qLabel ) . property ( PROP_NAME ) . value ( queryName ) , DO . SET ( n . property ( PROP_Q_JAVA ) ) . to ( qm . getQueryJava ( ) ) , DO . SET ( n . property ( PROP_Q_JSON ) ) . to ( qm . getQueryJSON ( ) ) } ; JcQuery q = new JcQuery ( ) ; q . setClauses ( clauses ) ; JcQueryResult result = dbAccess . execute ( q ) ; if ( result . hasErrors ( ) ) { StringBuilder sb = new StringBuilder ( ) ; Util . appendErrorList ( Util . collectErrors ( result ) , sb ) ; throw new RuntimeException ( sb . toString ( ) ) ; } return ; }
Store the query with the domain model under the given name .