no message
This commit is contained in:
parent
0bb338e468
commit
37ae617dfa
|
@ -51,7 +51,7 @@ public class DMPs extends BaseController {
|
||||||
@RequestMapping(method = RequestMethod.POST, value = { "/dmps/getPaged" }, consumes = "application/json", produces="application/json")
|
@RequestMapping(method = RequestMethod.POST, value = { "/dmps/getPaged" }, consumes = "application/json", produces="application/json")
|
||||||
public @ResponseBody ResponseItem<DataTableData<DataManagementPlanListingModel>> getPaged(@Valid @RequestBody DataManagementPlanTableRequest dataManagementPlanTableRequest,Principal principal) {
|
public @ResponseBody ResponseItem<DataTableData<DataManagementPlanListingModel>> getPaged(@Valid @RequestBody DataManagementPlanTableRequest dataManagementPlanTableRequest,Principal principal) {
|
||||||
try {
|
try {
|
||||||
DataTableData<DataManagementPlanListingModel> dataTable = new DataManagementPlanManager().getPaged(this.getApiContext().getDatabaseRepository().getDmpDao(), dataManagementPlanTableRequest);
|
DataTableData<DataManagementPlanListingModel> dataTable = new DataManagementPlanManager().getPaged(this.getApiContext(), dataManagementPlanTableRequest,principal);
|
||||||
return new ResponseItem<DataTableData<DataManagementPlanListingModel>>().status(HttpStatus.OK).payload(dataTable);
|
return new ResponseItem<DataTableData<DataManagementPlanListingModel>>().status(HttpStatus.OK).payload(dataTable);
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.eudat.controllers;
|
package eu.eudat.controllers;
|
||||||
|
|
||||||
|
import eu.eudat.exceptions.UnauthorisedException;
|
||||||
import eu.eudat.managers.InvitationsManager;
|
import eu.eudat.managers.InvitationsManager;
|
||||||
import eu.eudat.models.helpers.responses.ResponseItem;
|
import eu.eudat.models.helpers.responses.ResponseItem;
|
||||||
import eu.eudat.models.invitation.Invitation;
|
import eu.eudat.models.invitation.Invitation;
|
||||||
|
@ -46,7 +47,11 @@ public class UserInvitationController extends BaseController{
|
||||||
try {
|
try {
|
||||||
UUID dmpId = InvitationsManager.assignUserAcceptedInvitation(this.getApiContext(),invitationID,principal);
|
UUID dmpId = InvitationsManager.assignUserAcceptedInvitation(this.getApiContext(),invitationID,principal);
|
||||||
return new ResponseItem<UUID>().status(HttpStatus.OK).payload(dmpId);
|
return new ResponseItem<UUID>().status(HttpStatus.OK).payload(dmpId);
|
||||||
} catch (Exception e) {
|
}catch (UnauthorisedException e){
|
||||||
|
e.printStackTrace();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return new ResponseItem<UUID>().message(e.getMessage());
|
return new ResponseItem<UUID>().message(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,5 +25,7 @@ public interface DMPDao {
|
||||||
DMP find(UUID id);
|
DMP find(UUID id);
|
||||||
|
|
||||||
Long count();
|
Long count();
|
||||||
|
QueryableList<DMP> getAuthenticated(QueryableList<DMP> query,UserInfo principal);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -16,6 +16,7 @@ import eu.eudat.entities.Project;
|
||||||
import eu.eudat.entities.UserInfo;
|
import eu.eudat.entities.UserInfo;
|
||||||
import eu.eudat.models.criteria.DataManagementPlanCriteria;
|
import eu.eudat.models.criteria.DataManagementPlanCriteria;
|
||||||
import eu.eudat.models.datasetwizard.DatasetWizardAutocompleteRequest;
|
import eu.eudat.models.datasetwizard.DatasetWizardAutocompleteRequest;
|
||||||
|
import eu.eudat.models.security.Principal;
|
||||||
import eu.eudat.queryable.QueryableList;
|
import eu.eudat.queryable.QueryableList;
|
||||||
import org.hibernate.query.Query;
|
import org.hibernate.query.Query;
|
||||||
|
|
||||||
|
@ -43,6 +44,11 @@ public class DMPDaoImpl implements DMPDao {
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public QueryableList<DMP> getAuthenticated(QueryableList<DMP> query,UserInfo principal) {
|
||||||
|
query.where((builder, root) -> builder.or(builder.equal(root.get("creator"),principal),builder.isMember(principal,root.get("users"))));
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DMP createOrUpdate(DMP item) {
|
public DMP createOrUpdate(DMP item) {
|
||||||
return this.databaseService.createOrUpdate(item,DMP.class);
|
return this.databaseService.createOrUpdate(item,DMP.class);
|
||||||
|
|
|
@ -25,9 +25,12 @@ import eu.eudat.utilities.builders.DomainModelConverter;
|
||||||
|
|
||||||
public class DataManagementPlanManager {
|
public class DataManagementPlanManager {
|
||||||
|
|
||||||
public DataTableData<DataManagementPlanListingModel> getPaged(DMPDao dmpsRepository, DataManagementPlanTableRequest dataManagementPlanTableRequest) throws IllegalAccessException, InstantiationException{
|
public DataTableData<DataManagementPlanListingModel> getPaged(ApiContext apiContext, DataManagementPlanTableRequest dataManagementPlanTableRequest,Principal principal) throws IllegalAccessException, InstantiationException{
|
||||||
QueryableList<DMP> items = dmpsRepository.getWithCriteria(dataManagementPlanTableRequest.getCriteria());
|
UserInfo userInfo = apiContext.getDatabaseRepository().getUserInfoDao().find(principal.getId());
|
||||||
QueryableList<DMP> pagedItems = PaginationManager.applyPaging(items,dataManagementPlanTableRequest);
|
QueryableList<DMP> items = apiContext.getDatabaseRepository().getDmpDao().getWithCriteria(dataManagementPlanTableRequest.getCriteria());
|
||||||
|
QueryableList<DMP> authItems = apiContext.getDatabaseRepository().getDmpDao().getAuthenticated(items,userInfo);
|
||||||
|
QueryableList<DMP> pagedItems = PaginationManager.applyPaging(authItems,dataManagementPlanTableRequest);
|
||||||
|
|
||||||
if(dataManagementPlanTableRequest.getWithHint())pagedItems.withHint("fullyDetailed");
|
if(dataManagementPlanTableRequest.getWithHint())pagedItems.withHint("fullyDetailed");
|
||||||
List<DataManagementPlanListingModel> datamanagementPlans = new DomainModelConverter<eu.eudat.entities.DMP, DataManagementPlanListingModel>().fromDataModel( pagedItems.toList(), DataManagementPlanListingModel.class);
|
List<DataManagementPlanListingModel> datamanagementPlans = new DomainModelConverter<eu.eudat.entities.DMP, DataManagementPlanListingModel>().fromDataModel( pagedItems.toList(), DataManagementPlanListingModel.class);
|
||||||
DataTableData<DataManagementPlanListingModel> dataTable = new DataTableData<DataManagementPlanListingModel>();
|
DataTableData<DataManagementPlanListingModel> dataTable = new DataTableData<DataManagementPlanListingModel>();
|
||||||
|
|
|
@ -2,6 +2,7 @@ package eu.eudat.managers;
|
||||||
|
|
||||||
import eu.eudat.entities.DMP;
|
import eu.eudat.entities.DMP;
|
||||||
import eu.eudat.entities.UserInfo;
|
import eu.eudat.entities.UserInfo;
|
||||||
|
import eu.eudat.exceptions.UnauthorisedException;
|
||||||
import eu.eudat.models.invitation.Invitation;
|
import eu.eudat.models.invitation.Invitation;
|
||||||
import eu.eudat.models.security.Principal;
|
import eu.eudat.models.security.Principal;
|
||||||
import eu.eudat.models.userinfo.UserInfoInvitationModel;
|
import eu.eudat.models.userinfo.UserInfoInvitationModel;
|
||||||
|
@ -36,10 +37,10 @@ public class InvitationsManager {
|
||||||
return userModels;
|
return userModels;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UUID assignUserAcceptedInvitation(ApiContext apiContext, UUID invitationID, Principal principal) throws Exception {
|
public static UUID assignUserAcceptedInvitation(ApiContext apiContext, UUID invitationID, Principal principal) throws UnauthorisedException {
|
||||||
eu.eudat.entities.Invitation invitation = apiContext.getDatabaseRepository().getInvitationDao().find(invitationID);
|
eu.eudat.entities.Invitation invitation = apiContext.getDatabaseRepository().getInvitationDao().find(invitationID);
|
||||||
if (invitation == null) throw new Exception("There is no Data Management Plan assigned to this Link");
|
if (invitation == null) throw new UnauthorisedException("There is no Data Management Plan assigned to this Link");
|
||||||
if (invitation.getAcceptedInvitation()) throw new Exception("This Url Has Expired");
|
if (invitation.getAcceptedInvitation()) throw new UnauthorisedException("This Url Has Expired");
|
||||||
UserInfo invitedUser = apiContext.getDatabaseRepository().getUserInfoDao().find(principal.getId());
|
UserInfo invitedUser = apiContext.getDatabaseRepository().getUserInfoDao().find(principal.getId());
|
||||||
DMP datamanagementPlan = invitation.getDmp();
|
DMP datamanagementPlan = invitation.getDmp();
|
||||||
apiContext.getInvitationService().assignToDmp(apiContext.getDatabaseRepository().getDmpDao(), invitedUser, datamanagementPlan);
|
apiContext.getInvitationService().assignToDmp(apiContext.getDatabaseRepository().getDmpDao(), invitedUser, datamanagementPlan);
|
||||||
|
|
|
@ -157,9 +157,9 @@ public class DatasetWizardModel implements DataModel<Dataset> {
|
||||||
this.description = entity.getDescription();
|
this.description = entity.getDescription();
|
||||||
this.profile = new DatasetProfileListingModel();
|
this.profile = new DatasetProfileListingModel();
|
||||||
this.profile.fromDataModel(entity.getProfile());
|
this.profile.fromDataModel(entity.getProfile());
|
||||||
this.registries = new DomainModelConverter<eu.eudat.entities.Registry,Registry>().fromDataModel(entity.getRegistries().stream().collect(Collectors.toList()), Registry.class);
|
this.registries = new DomainModelConverter<eu.eudat.entities.Registry, Registry>().fromDataModel(entity.getRegistries().stream().collect(Collectors.toList()), Registry.class);
|
||||||
this.dataRepositories = new DomainModelConverter<eu.eudat.entities.DataRepository,DataRepository>().fromDataModel(entity.getDataRepositories().stream().collect(Collectors.toList()), DataRepository.class);
|
this.dataRepositories = new DomainModelConverter<eu.eudat.entities.DataRepository, DataRepository>().fromDataModel(entity.getDataRepositories().stream().collect(Collectors.toList()), DataRepository.class);
|
||||||
this.services = new DomainModelConverter<eu.eudat.entities.Service,Service>().fromDataModel(entity.getServices().stream().collect(Collectors.toList()), Service.class);
|
this.services = new DomainModelConverter<eu.eudat.entities.Service, Service>().fromDataModel(entity.getServices().stream().collect(Collectors.toList()), Service.class);
|
||||||
this.created = entity.getCreated();
|
this.created = entity.getCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,26 +174,26 @@ public class DatasetWizardModel implements DataModel<Dataset> {
|
||||||
entity.setStatus(this.status);
|
entity.setStatus(this.status);
|
||||||
entity.setDmp(dmp.toDataModel());
|
entity.setDmp(dmp.toDataModel());
|
||||||
entity.setDescription(this.description);
|
entity.setDescription(this.description);
|
||||||
entity.setCreated(this.created!=null?this.created:new Date());
|
entity.setCreated(this.created != null ? this.created : new Date());
|
||||||
entity.setModified(new Date());
|
entity.setModified(new Date());
|
||||||
entity.setProfile(profile.toDataModel()); ///TODO
|
entity.setProfile(profile.toDataModel()); ///TODO
|
||||||
if(!this.registries.isEmpty()){
|
if (!this.registries.isEmpty()) {
|
||||||
entity.setRegistries(new HashSet<eu.eudat.entities.Registry>());
|
entity.setRegistries(new HashSet<eu.eudat.entities.Registry>());
|
||||||
for(Registry registry:this.registries){
|
for (Registry registry : this.registries) {
|
||||||
entity.getRegistries().add(registry.toDataModel());
|
entity.getRegistries().add(registry.toDataModel());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this.dataRepositories.isEmpty()){
|
if (!this.dataRepositories.isEmpty()) {
|
||||||
entity.setDataRepositories(new HashSet<eu.eudat.entities.DataRepository>());
|
entity.setDataRepositories(new HashSet<eu.eudat.entities.DataRepository>());
|
||||||
for(DataRepository dataRepository:this.dataRepositories){
|
for (DataRepository dataRepository : this.dataRepositories) {
|
||||||
entity.getDataRepositories().add(dataRepository.toDataModel());
|
entity.getDataRepositories().add(dataRepository.toDataModel());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this.services.isEmpty()){
|
if (!this.services.isEmpty()) {
|
||||||
entity.setServices(new HashSet<eu.eudat.entities.Service>());
|
entity.setServices(new HashSet<eu.eudat.entities.Service>());
|
||||||
for(Service service:this.services){
|
for (Service service : this.services) {
|
||||||
entity.getServices().add(service.toDataModel());
|
entity.getServices().add(service.toDataModel());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class InvitationServiceImpl implements InvitationService {
|
||||||
invitation.setInvitationEmail(userInfo.getEmail());
|
invitation.setInvitationEmail(userInfo.getEmail());
|
||||||
invitation.setUser(creator);
|
invitation.setUser(creator);
|
||||||
invitation.setToken(UUID.randomUUID());
|
invitation.setToken(UUID.randomUUID());
|
||||||
invitation.setAcceptedInvitation(userInfo.getId() != null);
|
invitation.setAcceptedInvitation(false);
|
||||||
invitationDao.createOrUpdate(invitation);
|
invitationDao.createOrUpdate(invitation);
|
||||||
sendInvitation(dmp, invitation, mailService);
|
sendInvitation(dmp, invitation, mailService);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ public class InvitationServiceImpl implements InvitationService {
|
||||||
|
|
||||||
private String createContent(UUID invitationID, DMP dmp, String templateContent) {
|
private String createContent(UUID invitationID, DMP dmp, String templateContent) {
|
||||||
String content = templateContent.replace("{dmpname}", dmp.getLabel());
|
String content = templateContent.replace("{dmpname}", dmp.getLabel());
|
||||||
content = templateContent.replace("{invitationID}", invitationID.toString());
|
content = content.replace("{invitationID}", invitationID.toString());
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { InvitationAcceptedComponent } from './invitation-accepted/invitation-accepted.component';
|
import { InvitationAcceptedComponent } from './invitation-accepted/invitation-accepted.component';
|
||||||
import { InvitationComponent } from './invitation/invitation.component';
|
|
||||||
import { UnauthorizedComponent } from './unauthorized/unauthorized.component';
|
import { UnauthorizedComponent } from './unauthorized/unauthorized.component';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
|
|
@ -119,6 +119,9 @@ import { AutocompleteComponent } from './shared/components/autocomplete/autocomp
|
||||||
DatasetService,
|
DatasetService,
|
||||||
BaseHttpService
|
BaseHttpService
|
||||||
],
|
],
|
||||||
|
entryComponents: [
|
||||||
|
InvitationComponent,
|
||||||
|
],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
})
|
})
|
||||||
export class AppModule {
|
export class AppModule {
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import { VisibilityRulesService } from '../../visibility-rules/visibility-rules.service';
|
import { VisibilityRulesService } from '../../visibility-rules/visibility-rules.service';
|
||||||
import { FormGroup, Form, FormArray } from '@angular/forms';
|
import { FormGroup, Form, FormArray } from '@angular/forms';
|
||||||
import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { CompositeField } from '@app/models/CompositeField';
|
import { CompositeField } from '../../models/CompositeField';
|
||||||
import { Section } from '@app/models/Section';
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -32,6 +31,7 @@ export class DynamicFormSectionComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
isVisible(fieldSet:CompositeField):boolean{
|
isVisible(fieldSet:CompositeField):boolean{
|
||||||
|
if(!this.visibilityRulesService.isElementVisible(null,fieldSet.id)) return false;
|
||||||
for(var i=0; i<fieldSet.fields.length; i++){
|
for(var i=0; i<fieldSet.fields.length; i++){
|
||||||
if (!this.visibilityRulesService.isElementVisible(null,fieldSet.fields[i].id))
|
if (!this.visibilityRulesService.isElementVisible(null,fieldSet.fields[i].id))
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue