Skip to content

Commit

Permalink
Merge pull request #1 from Open-MBEE/feature/MMS-1002
Browse files Browse the repository at this point in the history
Feature/mms 1002
  • Loading branch information
HuiJun authored Dec 6, 2018
2 parents 7e3722f + fa85af4 commit efc522b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
2 changes: 2 additions & 0 deletions crud/crud.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ dependencies {
compile project(':core')
compile project(':uml')
compile group: 'org.springframework', name: 'spring-jdbc', version: '5.0.8.RELEASE'
compile 'org.elasticsearch:elasticsearch:6.5.1'
compile 'org.elasticsearch.client:elasticsearch-rest-high-level-client:6.5.1'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.openmbee.sdvc.crud.config;

import org.apache.http.HttpHost;
import org.openmbee.sdvc.core.config.PersistenceJPAConfig;
import org.openmbee.sdvc.core.domains.Project;
import org.openmbee.sdvc.core.repositories.ProjectRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.beans.factory.annotation.Value;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.RestClient;


@Configuration
public class ElasticsearchConfig {

@Value("${elasticsearch.host}")
private String elasticsearchHost;

@Bean(destroyMethod = "close")
public RestHighLevelClient restClient() {
RestHighLevelClient client = new RestHighLevelClient(
RestClient.builder(new HttpHost(elasticsearchHost)));
// :TODO can pass other params to config here, like loading the schema..to be over thought later
return client;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class DefaultNodeService implements NodeService {

protected NodeDAO nodeRepository;
protected CommitDAO commitRepository;
protected CommitElasticDAO commitElacticRepository;
protected NodeElasticDAO nodeElasticRepository;

@Autowired
Expand Down Expand Up @@ -89,6 +90,7 @@ public ElementsResponse post(String projectId, String refId, ElementsRequest req
commit.setTimestamp(Instant.now());

this.commitRepository.save(commit);
this.commitElacticRepository.save();
return response;
}

Expand Down
5 changes: 4 additions & 1 deletion example/src/main/resources/application.properties.example
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL94Dialec
# Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
spring.jpa.open-in-view=false
spring.jpa.open-in-view=false

#Configuration for Elasticsearch
elasticsearch.host=localhost:9200

0 comments on commit efc522b

Please sign in to comment.