Skip to content

Commit bae546c

Browse files
committed
Merge branch 'release/2.0.0-alpha.4' into 2.0-master
2 parents 85ba388 + f2d072a commit bae546c

File tree

21 files changed

+128
-45
lines changed

21 files changed

+128
-45
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ plugins {
7171
...
7272
7373
// comment out this line. It pulls the version from the cloud
74-
// id 'com.marklogic.ml-data-hub' version '2.0.0-alpha.3'
74+
// id 'com.marklogic.ml-data-hub' version '2.0.0-alpha.4'
7575
}
7676
7777
// this tells gradle to apply the plugin you included above in the buildscript section

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Alternatively you can include the jar file as a build dependency in your Java pr
4848
**Gradle**
4949

5050
```groovy
51-
compile('com.marklogic:marklogic-data-hub:2.0.0-alpha.3')
51+
compile('com.marklogic:marklogic-data-hub:2.0.0-alpha.4')
5252
```
5353

5454
**Maven**
@@ -57,15 +57,15 @@ compile('com.marklogic:marklogic-data-hub:2.0.0-alpha.3')
5757
<dependency>
5858
<groupId>com.marklogic</groupId>
5959
<artifactId>marklogic-data-hub</artifactId>
60-
<version>2.0.0-alpha.3</version>
60+
<version>2.0.0-alpha.4</version>
6161
<type>pom</type>
6262
</dependency>
6363
```
6464

6565
**Ivy**
6666

6767
```xml
68-
<dependency org='com.marklogic' name='marklogic-data-hub' rev='2.0.0-alpha.3'>
68+
<dependency org='com.marklogic' name='marklogic-data-hub' rev='2.0.0-alpha.4'>
6969
<artifact name='$AID' ext='pom'></artifact>
7070
</dependency>
7171
```
@@ -76,7 +76,7 @@ If you prefer to use gradle for all of your hub interactions then you can includ
7676

7777
```groovy
7878
plugins {
79-
id 'com.marklogic.ml-data-hub' version '2.0.0-alpha.3'
79+
id 'com.marklogic.ml-data-hub' version '2.0.0-alpha.4'
8080
}
8181
```
8282

examples/spring-batch/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
id 'idea'
55
id 'application'
66
id 'net.saliman.properties' version '1.4.6'
7-
id 'com.marklogic.ml-data-hub' version '2.0.0-alpha.3'
7+
id 'com.marklogic.ml-data-hub' version '2.0.0-alpha.4'
88
}
99

1010
repositories {
@@ -13,7 +13,7 @@ repositories {
1313
}
1414

1515
dependencies {
16-
compile 'com.marklogic:marklogic-data-hub:2.0.0-alpha.3'
16+
compile 'com.marklogic:marklogic-data-hub:2.0.0-alpha.4'
1717
compile 'com.marklogic:marklogic-spring-batch-core:0.6.0'
1818
compile 'com.marklogic:ml-javaclient-util:4.0.alpha2'
1919
testCompile 'com.marklogic:marklogic-spring-batch-test:0.6.0'

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=2.0.0-alpha.3
1+
version=2.0.0-alpha.4

marklogic-data-hub/src/main/resources/ml-modules/root/com.marklogic.hub/lib/hub-entities.xqy

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ declare function hent:database-properties-generate(
207207
let $entity-type-names := map:keys($definitions)
208208
let $range-path-indexes := json:array()
209209
let $word-lexicons := json:array()
210+
let $range-element-indexes := json:array()
210211
let $_ :=
211212
for $entity-type-name in $entity-type-names
212213
let $entity-type := map:get($definitions, $entity-type-name)
@@ -236,6 +237,22 @@ declare function hent:database-properties-generate(
236237
let $_ := map:put($wl-map, "localname", $word-lexicon-property)
237238
let $_ := map:put($wl-map, "namespace-uri", "")
238239
return json:array-push($word-lexicons, $wl-map)
240+
,
241+
let $primary-key-property := map:get($entity-type, "primaryKey")
242+
where $primary-key-property
243+
return
244+
let $pk-map := json:object()
245+
let $property := map:get($properties, $primary-key-property)
246+
let $specified-datatype := esi:resolve-datatype($model, $entity-type-name, $primary-key-property)
247+
let $datatype := esi:indexable-datatype($specified-datatype)
248+
let $collation := head( (map:get($property, "collation"), "http://marklogic.com/collation/en") )
249+
let $_ := map:put($pk-map, "collation", $collation)
250+
let $_ := map:put($pk-map, "localname", $primary-key-property)
251+
let $_ := map:put($pk-map, "namespace-uri", "")
252+
let $_ := map:put($pk-map, "range-value-positions", fn:false())
253+
let $_ := map:put($pk-map, "scalar-type", $datatype)
254+
let $_ := map:put($pk-map, "invalid-values", "reject")
255+
return json:array-push($range-element-indexes, $pk-map)
239256
)
240257
let $path-namespaces := json:array()
241258
let $pn := json:object()
@@ -246,5 +263,6 @@ declare function hent:database-properties-generate(
246263
let $_ := map:put($database-properties, "path-namespace", $path-namespaces)
247264
let $_ := map:put($database-properties, "element-word-lexicon", $word-lexicons)
248265
let $_ := map:put($database-properties, "range-path-index", $range-path-indexes)
266+
let $_ := map:put($database-properties, "range-element-index", $range-element-indexes)
249267
return xdmp:to-json($database-properties)
250268
};

marklogic-data-hub/src/main/resources/scaffolding/build_gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99
id 'eclipse'
1010
id 'idea'
1111
id 'net.saliman.properties' version '1.4.6'
12-
id 'com.marklogic.ml-data-hub' version '2.0.0-alpha.3'
12+
id 'com.marklogic.ml-data-hub' version '2.0.0-alpha.4'
1313
}
1414

1515
repositories {
@@ -18,6 +18,6 @@ repositories {
1818
}
1919

2020
dependencies {
21-
compile 'com.marklogic:marklogic-data-hub:2.0.0-alpha.3'
21+
compile 'com.marklogic:marklogic-data-hub:2.0.0-alpha.4'
2222
compile 'com.marklogic:marklogic-xcc:9.0.1'
2323
}

marklogic-data-hub/src/trace-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "trace-ui",
3-
"version": "2.0.0-alpha.3",
3+
"version": "2.0.0-alpha.4",
44
"license": "APACHE",
55
"homepage": "https://github.com/marklogic/marklogic-data-hub",
66
"scripts": {

quick-start/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-hub-quickstart",
3-
"version": "2.0.0-alpha.3",
3+
"version": "2.0.0-alpha.4",
44
"license": "APACHE",
55
"homepage": "https://github.com/marklogic/marklogic-data-hub",
66
"scripts": {

quick-start/src/main/java/com/marklogic/quickstart/service/EntityManagerService.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ public void deleteEntity(String entity) throws IOException {
122122
}
123123
}
124124

125-
public List<JsonNode> getRawEntities() throws IOException {
125+
public List<JsonNode> getRawEntities(EnvironmentConfig environmentConfig) throws IOException {
126126
List<JsonNode> entities = new ArrayList<>();
127-
Path entitiesPath = Paths.get(envConfig().getProjectDir(), PLUGINS_DIR, ENTITIES_DIR);
127+
Path entitiesPath = Paths.get(environmentConfig.getProjectDir(), PLUGINS_DIR, ENTITIES_DIR);
128128
List<String> entityNames = FileUtil.listDirectFolders(entitiesPath.toFile());
129129
ObjectMapper objectMapper = new ObjectMapper();
130130
for (String entityName : entityNames) {
@@ -136,9 +136,9 @@ public List<JsonNode> getRawEntities() throws IOException {
136136
return entities;
137137
}
138138

139-
public void saveSearchOptions() {
139+
public void saveSearchOptions(EnvironmentConfig environmentConfig) {
140140

141-
HubConfig hubConfig = envConfig().getMlSettings();
141+
HubConfig hubConfig = environmentConfig.getMlSettings();
142142
AppConfig config = hubConfig.getAppConfig();
143143
XccAssetLoader xccAssetLoader = config.newXccAssetLoader();
144144

@@ -160,10 +160,10 @@ public void saveSearchOptions() {
160160
modulesLoader.setDatabaseClient(hubConfig.newFinalClient());
161161
modulesLoader.setShutdownTaskExecutorAfterLoadingModules(false);
162162

163-
SearchOptionsGenerator generator = new SearchOptionsGenerator(envConfig().getStagingClient());
163+
SearchOptionsGenerator generator = new SearchOptionsGenerator(environmentConfig.getStagingClient());
164164
try {
165-
String options = generator.generateOptions(getRawEntities());
166-
Path dir = Paths.get(envConfig().getProjectDir(), HubConfig.ENTITY_CONFIG_DIR);
165+
String options = generator.generateOptions(getRawEntities(environmentConfig));
166+
Path dir = Paths.get(environmentConfig.getProjectDir(), HubConfig.ENTITY_CONFIG_DIR);
167167
if (!dir.toFile().exists()) {
168168
dir.toFile().mkdirs();
169169
}
@@ -177,12 +177,12 @@ public void saveSearchOptions() {
177177
}
178178
}
179179

180-
public void saveDbIndexes() {
181-
DbIndexGenerator generator = new DbIndexGenerator(envConfig().getFinalClient());
180+
public void saveDbIndexes(EnvironmentConfig environmentConfig) {
181+
DbIndexGenerator generator = new DbIndexGenerator(environmentConfig.getFinalClient());
182182
try {
183-
String indexes = generator.getIndexes(getRawEntities());
183+
String indexes = generator.getIndexes(getRawEntities(environmentConfig));
184184

185-
Path dir = envConfig().getMlSettings().getEntityDatabaseDir();
185+
Path dir = environmentConfig.getMlSettings().getEntityDatabaseDir();
186186
if (!dir.toFile().exists()) {
187187
dir.toFile().mkdirs();
188188
}

quick-start/src/main/java/com/marklogic/quickstart/web/CurrentProjectController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public String getLastDeployed() throws IOException {
149149
public ResponseEntity<?> reinstallUserModules() throws IOException {
150150
// reinstall the user modules
151151
dataHubService.reinstallUserModules(envConfig().getMlSettings(), this, this);
152-
entityManagerService.saveSearchOptions();
152+
entityManagerService.saveSearchOptions(envConfig());
153153

154154
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
155155
}
@@ -217,7 +217,7 @@ private void startProjectWatcher() throws IOException {
217217

218218
private void installUserModules(HubConfig hubConfig, boolean force) {
219219
dataHubService.installUserModules(hubConfig, force, this, this);
220-
entityManagerService.saveSearchOptions();
220+
entityManagerService.saveSearchOptions(envConfig());
221221
}
222222

223223
@Override

0 commit comments

Comments
 (0)