use of org.obiba.mica.access.domain.DataAccessEntity in project mica2 by obiba.
the class DataAccessEntityResource method review.
protected Response review(String id) {
DataAccessEntity request = getService().findById(id);
boolean fromConditionallyApproved = request.getStatus() == DataAccessEntityStatus.CONDITIONALLY_APPROVED;
if (fromConditionallyApproved) {
restoreDaoActions(id);
}
return updateStatus(id, DataAccessEntityStatus.REVIEWED);
}
use of org.obiba.mica.access.domain.DataAccessEntity in project mica2 by obiba.
the class DataAccessEntityResource method createOrUpdateVariablesSet.
//
// Private methods
//
/**
* Create or update a variables set from user's cart.
*
* @param entity
* @return
*/
protected DocumentSet createOrUpdateVariablesSet(DataAccessEntity entity) {
DocumentSet set;
DocumentSet cart = variableSetService.getCartCurrentUser();
String setId = String.format("dar:%s", entity.getId());
Optional<DocumentSet> setOpt = variableSetService.getAllCurrentUser().stream().filter(docset -> setId.equals(docset.getName())).findFirst();
if (setOpt.isPresent()) {
// reuse and append an existing set with same name
set = variableSetService.addIdentifiers(setId, Lists.newArrayList(cart.getIdentifiers()));
} else {
// create a new one
set = variableSetService.create(setId, Lists.newArrayList(cart.getIdentifiers()));
}
// case an administrator is by-passing the flow
if (!DataAccessEntityStatus.OPENED.equals(entity.getStatus())) {
variableSetService.setLock(set, true);
}
return set;
}
use of org.obiba.mica.access.domain.DataAccessEntity in project mica2 by obiba.
the class DataAccessEntityResource method conditionallyApprove.
protected Response conditionallyApprove(String id) {
DataAccessEntity request = getService().findById(id);
restoreApplicantActions(id, request.getApplicant());
return updateStatus(id, DataAccessEntityStatus.CONDITIONALLY_APPROVED);
}
Aggregations