public boolean savePool ( ) { if ( newTopicPool . isEmpty ( ) && updatedTopicPool . isEmpty ( ) ) return true ; try { // Save the new topics if ( ! newTopicPool . isEmpty ( ) ) { final CollectionWrapper < TopicWrapper > response = topicProvider . createTopics ( newTopicPool ) ; // Check that the response isn't empty (ie failed) if ( response == null ) return false ; if ( response . getItems ( ) == null ) return false ; // The response is valid so set it as the pool newTopicPool = response ; } // Update the existing topics if ( ! updatedTopicPool . isEmpty ( ) ) { final CollectionWrapper < TopicWrapper > response = topicProvider . updateTopics ( updatedTopicPool ) ; // Check that the response isn't empty (ie failed) if ( response == null ) return false ; if ( response . getItems ( ) == null ) return false ; // The response is valid so set it as the pool updatedTopicPool = response ; } initialised = true ; return true ; } catch ( Exception e ) { log . error ( "" , e ) ; return false ; } }
Saves all the topics in the pool to the database using the REST API .