Skip to content

Commit 8094715

Browse files
committed
Merge from master
1 parent e25e063 commit 8094715

File tree

7 files changed

+35
-14
lines changed

7 files changed

+35
-14
lines changed

mica-core/src/main/java/org/obiba/mica/study/service/StudyService.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.obiba.mica.study.service;
22

3-
import java.io.IOException;
43
import java.util.Arrays;
54
import java.util.HashMap;
65
import java.util.List;
@@ -259,7 +258,14 @@ private String getNextId(LocalizedString suggested) {
259258
}
260259

261260
@Nullable
262-
private Study unpublish(StudyState studyState) {
261+
public Study unpublish(String id) {
262+
StudyState studyState = studyStateRepository.findOne(id);
263+
return studyState == null ? null : unpublish(studyState);
264+
}
265+
266+
@CacheEvict(value = { "studies-draft", "studies-published" }, key = "#id")
267+
@Nullable
268+
public Study unpublish(StudyState studyState) {
263269
log.info("Unpublish state since there are no Git repo for study: {}", studyState.getId());
264270
studyState.resetRevisionsAhead();
265271
studyState.setPublishedTag(null);

mica-rest/src/main/java/org/obiba/mica/study/rest/DraftStudyResource.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package org.obiba.mica.study.rest;
22

3-
import java.io.IOException;
4-
53
import javax.inject.Inject;
64
import javax.ws.rs.DELETE;
75
import javax.ws.rs.GET;
@@ -12,10 +10,10 @@
1210

1311
import org.apache.shiro.authz.annotation.RequiresAuthentication;
1412
import org.apache.shiro.authz.annotation.RequiresRoles;
15-
import org.obiba.mica.file.rest.FileResource;
1613
import org.obiba.mica.core.security.Roles;
17-
import org.obiba.mica.study.service.StudyService;
14+
import org.obiba.mica.file.rest.FileResource;
1815
import org.obiba.mica.study.domain.Study;
16+
import org.obiba.mica.study.service.StudyService;
1917
import org.obiba.mica.web.model.Dtos;
2018
import org.obiba.mica.web.model.Mica;
2119
import org.springframework.context.ApplicationContext;
@@ -67,16 +65,26 @@ public Response update(@SuppressWarnings("TypeMayBeWeakened") Mica.StudyDto stud
6765

6866
@PUT
6967
@Path("/_publish")
68+
@RequiresRoles(Roles.MICA_ADMIN)
7069
@Timed
7170
public Response publish() {
7271
studyService.publish(id);
7372
return Response.noContent().build();
7473
}
7574

75+
@DELETE
76+
@Path("/_publish")
77+
@RequiresRoles(Roles.MICA_ADMIN)
78+
public Response unPublish() {
79+
studyService.unpublish(id);
80+
return Response.noContent().build();
81+
}
82+
7683
/**
7784
* DELETE /ws/studies/:id -> delete the "id" study.
7885
*/
7986
@DELETE
87+
@RequiresRoles(Roles.MICA_ADMIN)
8088
@Timed
8189
public Response delete() {
8290
studyService.delete(id);

mica-search/src/main/resources/study-facets.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222

2323
id:
2424
start:
25+
properties:
26+
type: "stats"
2527
end:
28+
properties:
29+
type: "stats"
2630
access:
2731

2832
methods:
@@ -46,6 +50,9 @@ populations:
4650
ageMin:
4751
properties:
4852
type: "stats"
53+
ageMax:
54+
properties:
55+
type: "stats"
4956
gender:
5057

5158
recruitment:

mica-webapp/src/main/conf/mica-aggregations.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ network:
44
study:
55
- id: methods-designs
66
title: {en: Study design}
7-
- id: populations-recruitment-dataSources
8-
title: {en: Recruitment datasource}
97
- id: populations-selectionCriteria-countriesIso
108
title: {en: Country of residence}
119
- id: populations-selectionCriteria-ageMin
@@ -22,12 +20,14 @@ study:
2220
title: {en: Target number of participants with samples}
2321
- id: methods-recruitments
2422
title: {en: Recruitment target}
23+
- id: populations-recruitment-dataSources
24+
title: {en: Sources of recruitment}
2525
- id: populations-recruitment-generalPopulationSources
2626
title: {en: General population sources}
2727
- id: populations-dataCollectionEvents-dataSources
2828
title: {en: Data sources}
2929
- id: access
30-
title: {en: Access}
30+
title: {en: Access permitted}
3131
- id: populations-dataCollectionEvents-bioSamples
3232
title: {en: Biosamples}
3333
- id: start

mica-webapp/src/main/conf/mica-studies.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ vocabularies:
2626
title: {en: Members of specific association}
2727
- name: other
2828
title: {en: Other specific population}
29-
- name: selectionCriteriaGender
29+
- name: populations-selectionCriteria-gender
3030
terms:
3131
- name: men
32-
title: {en: Men}
32+
title: {en: Men only}
3333
- name: women
34-
title: {en: Women}
34+
title: {en: Women only}
3535
- name: selectionCriteriaCriteria
3636
terms:
3737
- name: gravidity

mica-webapp/src/main/webapp/app/study/study-controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ mica.study
293293
return opts ? opts[0] : [];
294294
}
295295

296-
$scope.selectionCriteriaGenders = extractVocabulary('selectionCriteriaGender').map(function (obj) {
296+
$scope.selectionCriteriaGenders = extractVocabulary('populations-selectionCriteria-gender').map(function (obj) {
297297
return {id: obj.name, label: obj.label};
298298
});
299299
$scope.availableSelectionCriteria = extractVocabulary('selectionCriteriaCriteria');

mica-webapp/src/main/webapp/app/study/views/population/population-view.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ <h5 translate>study.selection-criteria.label</h5>
1919

2020
<dl class="dl-horizontal">
2121
<dt translate ng-show="population.selectionCriteria.gender">study.selection-criteria.gender.label</dt>
22-
<dd ng-show="population.selectionCriteria.gender" ng-bind="getLabel('selectionCriteriaGender', population.selectionCriteria.gender)">
22+
<dd ng-show="population.selectionCriteria.gender" ng-bind="getLabel('populations-selectionCriteria-gender', population.selectionCriteria.gender)">
2323
</dd>
2424

2525
<dt translate ng-show="population.selectionCriteria.ageMin || population.selectionCriteria.ageMax">

0 commit comments

Comments
 (0)