Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring
This commit is contained in:
commit
e665cbdfc6
|
@ -56,9 +56,6 @@ permissions:
|
||||||
BrowseAnnotation:
|
BrowseAnnotation:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
entityAffiliated: true
|
entityAffiliated: true
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -67,9 +64,6 @@ permissions:
|
||||||
NewAnnotation:
|
NewAnnotation:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
entityAffiliated: true
|
entityAffiliated: true
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -78,9 +72,6 @@ permissions:
|
||||||
EditAnnotation:
|
EditAnnotation:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: true
|
allowAnonymous: true
|
||||||
|
@ -88,9 +79,6 @@ permissions:
|
||||||
DeleteAnnotation:
|
DeleteAnnotation:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
entityAffiliated: false
|
entityAffiliated: false
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
|
|
@ -9,6 +9,7 @@ import java.util.List;
|
||||||
public class AuthorizationProperties {
|
public class AuthorizationProperties {
|
||||||
|
|
||||||
private List<String> globalAdminRoles;
|
private List<String> globalAdminRoles;
|
||||||
|
private String adminRole;
|
||||||
private String tenantAdminRole;
|
private String tenantAdminRole;
|
||||||
private String globalUserRole;
|
private String globalUserRole;
|
||||||
private String tenantUserRole;
|
private String tenantUserRole;
|
||||||
|
@ -24,6 +25,14 @@ public class AuthorizationProperties {
|
||||||
this.globalAdminRoles = globalAdminRoles;
|
this.globalAdminRoles = globalAdminRoles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAdminRole() {
|
||||||
|
return adminRole;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdminRole(String adminRole) {
|
||||||
|
this.adminRole = adminRole;
|
||||||
|
}
|
||||||
|
|
||||||
public String getTenantAdminRole() {
|
public String getTenantAdminRole() {
|
||||||
return this.tenantAdminRole;
|
return this.tenantAdminRole;
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,11 @@ public class TenantServiceImpl implements TenantService {
|
||||||
item.setId(UUID.randomUUID());
|
item.setId(UUID.randomUUID());
|
||||||
item.setUserId(userId);
|
item.setUserId(userId);
|
||||||
item.setTenantId(tenant.getId());
|
item.setTenantId(tenant.getId());
|
||||||
item.setRole(this.authorizationProperties.getTenantAdminRole());
|
if (existingItems.stream().filter(x -> x.getUserId().equals(userId) && x.getRole().equals(this.authorizationProperties.getAdminRole())).findFirst().orElse(null) != null){
|
||||||
|
item.setRole(this.authorizationProperties.getTenantAdminRole()); // admin
|
||||||
|
} else {
|
||||||
|
item.setRole(this.authorizationProperties.getTenantUserRole()); // installation admin
|
||||||
|
}
|
||||||
item.setCreatedAt(Instant.now());
|
item.setCreatedAt(Instant.now());
|
||||||
this.entityManager.persist(item);
|
this.entityManager.persist(item);
|
||||||
keycloakIdsToAddToTenantGroup.add(userCredential.getExternalId());
|
keycloakIdsToAddToTenantGroup.add(userCredential.getExternalId());
|
||||||
|
|
|
@ -2,6 +2,7 @@ authorization:
|
||||||
globalAdminRoles:
|
globalAdminRoles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
- InstallationAdmin
|
||||||
|
adminRole: Admin
|
||||||
tenantAdminRole: TenantAdmin
|
tenantAdminRole: TenantAdmin
|
||||||
globalUserRole: User
|
globalUserRole: User
|
||||||
tenantUserRole: TenantUser
|
tenantUserRole: TenantUser
|
||||||
|
|
|
@ -6,8 +6,8 @@ permissions:
|
||||||
roles:
|
roles:
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
- TenantUser
|
- TenantUser
|
||||||
- TenantManager
|
- TenantPlanManager
|
||||||
- TenantDescriptionTemplateEditor
|
- TenantConfigManager
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
allowAuthenticated: false
|
allowAuthenticated: false
|
||||||
|
@ -94,9 +94,6 @@ permissions:
|
||||||
BrowseDeposit:
|
BrowseDeposit:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -104,9 +101,6 @@ permissions:
|
||||||
EditDeposit:
|
EditDeposit:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -120,6 +114,7 @@ permissions:
|
||||||
EditNotificationTemplate:
|
EditNotificationTemplate:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantConfigManager
|
- TenantConfigManager
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -127,6 +122,7 @@ permissions:
|
||||||
DeleteNotificationTemplate:
|
DeleteNotificationTemplate:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantConfigManager
|
- TenantConfigManager
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -164,6 +160,7 @@ permissions:
|
||||||
EditLanguage:
|
EditLanguage:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantConfigManager
|
- TenantConfigManager
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -171,6 +168,7 @@ permissions:
|
||||||
DeleteLanguage:
|
DeleteLanguage:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantConfigManager
|
- TenantConfigManager
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -186,9 +184,6 @@ permissions:
|
||||||
BrowseDescription:
|
BrowseDescription:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
dmp:
|
dmp:
|
||||||
roles:
|
roles:
|
||||||
|
@ -202,9 +197,6 @@ permissions:
|
||||||
ReviewDescription:
|
ReviewDescription:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
dmp:
|
dmp:
|
||||||
roles:
|
roles:
|
||||||
|
@ -217,9 +209,6 @@ permissions:
|
||||||
EditDescription:
|
EditDescription:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
dmp:
|
dmp:
|
||||||
roles:
|
roles:
|
||||||
|
@ -231,9 +220,6 @@ permissions:
|
||||||
FinalizeDescription:
|
FinalizeDescription:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
dmp:
|
dmp:
|
||||||
roles:
|
roles:
|
||||||
|
@ -245,9 +231,6 @@ permissions:
|
||||||
DeleteDescription:
|
DeleteDescription:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
dmp:
|
dmp:
|
||||||
roles:
|
roles:
|
||||||
|
@ -260,9 +243,6 @@ permissions:
|
||||||
CloneDescription:
|
CloneDescription:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
dmp:
|
dmp:
|
||||||
roles:
|
roles:
|
||||||
|
@ -281,9 +261,6 @@ permissions:
|
||||||
BrowseTag:
|
BrowseTag:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -291,9 +268,6 @@ permissions:
|
||||||
EditTag:
|
EditTag:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -301,9 +275,6 @@ permissions:
|
||||||
DeleteTag:
|
DeleteTag:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -314,9 +285,8 @@ permissions:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
- InstallationAdmin
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
|
- TenantPlanManager
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
allowAuthenticated: false
|
allowAuthenticated: false
|
||||||
|
@ -346,9 +316,6 @@ permissions:
|
||||||
BrowseDmpAssociatedUser:
|
BrowseDmpAssociatedUser:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
dmp:
|
dmp:
|
||||||
roles:
|
roles:
|
||||||
|
@ -364,9 +331,7 @@ permissions:
|
||||||
BrowseDescriptionTemplateType:
|
BrowseDescriptionTemplateType:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
- TenantPlanManager
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
- TenantUser
|
- TenantUser
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -375,6 +340,7 @@ permissions:
|
||||||
EditDescriptionTemplateType:
|
EditDescriptionTemplateType:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantPlanManager
|
- TenantPlanManager
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -382,6 +348,7 @@ permissions:
|
||||||
DeleteDescriptionTemplateType:
|
DeleteDescriptionTemplateType:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantPlanManager
|
- TenantPlanManager
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -431,6 +398,7 @@ permissions:
|
||||||
EditDescriptionTemplate:
|
EditDescriptionTemplate:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantPlanManager
|
- TenantPlanManager
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -438,6 +406,7 @@ permissions:
|
||||||
DeleteDescriptionTemplate:
|
DeleteDescriptionTemplate:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantPlanManager
|
- TenantPlanManager
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -446,6 +415,7 @@ permissions:
|
||||||
CloneDescriptionTemplate:
|
CloneDescriptionTemplate:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantPlanManager
|
- TenantPlanManager
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -454,6 +424,7 @@ permissions:
|
||||||
CreateNewVersionDescriptionTemplate:
|
CreateNewVersionDescriptionTemplate:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantPlanManager
|
- TenantPlanManager
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -462,6 +433,7 @@ permissions:
|
||||||
ImportDescriptionTemplate:
|
ImportDescriptionTemplate:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantPlanManager
|
- TenantPlanManager
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -470,6 +442,7 @@ permissions:
|
||||||
ExportDescriptionTemplate:
|
ExportDescriptionTemplate:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantPlanManager
|
- TenantPlanManager
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -479,9 +452,6 @@ permissions:
|
||||||
BrowseDmp:
|
BrowseDmp:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
dmp:
|
dmp:
|
||||||
roles:
|
roles:
|
||||||
|
@ -495,9 +465,6 @@ permissions:
|
||||||
EditDmp:
|
EditDmp:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
dmp:
|
dmp:
|
||||||
roles:
|
roles:
|
||||||
|
@ -519,9 +486,6 @@ permissions:
|
||||||
DeleteDmp:
|
DeleteDmp:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
dmp:
|
dmp:
|
||||||
roles:
|
roles:
|
||||||
|
@ -533,9 +497,6 @@ permissions:
|
||||||
DepositDmp:
|
DepositDmp:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
dmp:
|
dmp:
|
||||||
roles:
|
roles:
|
||||||
|
@ -547,9 +508,6 @@ permissions:
|
||||||
CloneDmp:
|
CloneDmp:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
dmp:
|
dmp:
|
||||||
roles:
|
roles:
|
||||||
|
@ -567,9 +525,6 @@ permissions:
|
||||||
CreateNewVersionDmp:
|
CreateNewVersionDmp:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
dmp:
|
dmp:
|
||||||
roles:
|
roles:
|
||||||
|
@ -581,9 +536,6 @@ permissions:
|
||||||
FinalizeDmp:
|
FinalizeDmp:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
dmp:
|
dmp:
|
||||||
roles:
|
roles:
|
||||||
|
@ -595,9 +547,6 @@ permissions:
|
||||||
UndoFinalizeDmp:
|
UndoFinalizeDmp:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
dmp:
|
dmp:
|
||||||
roles:
|
roles:
|
||||||
|
@ -609,9 +558,6 @@ permissions:
|
||||||
AssignDmpUsers:
|
AssignDmpUsers:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
dmp:
|
dmp:
|
||||||
roles:
|
roles:
|
||||||
|
@ -623,9 +569,6 @@ permissions:
|
||||||
InviteDmpUsers:
|
InviteDmpUsers:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
dmp:
|
dmp:
|
||||||
roles:
|
roles:
|
||||||
|
@ -649,6 +592,7 @@ permissions:
|
||||||
EditDmpBlueprint:
|
EditDmpBlueprint:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantPlanManager
|
- TenantPlanManager
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -656,6 +600,7 @@ permissions:
|
||||||
CloneDmpBlueprint:
|
CloneDmpBlueprint:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantPlanManager
|
- TenantPlanManager
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -663,12 +608,14 @@ permissions:
|
||||||
CreateNewVersionDmpBlueprint:
|
CreateNewVersionDmpBlueprint:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantPlanManager
|
- TenantPlanManager
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
allowAuthenticated: false
|
allowAuthenticated: false
|
||||||
ExportDmpBlueprint:
|
ExportDmpBlueprint:
|
||||||
roles:
|
roles:
|
||||||
|
- TenantAdmin
|
||||||
- TenantPlanManager
|
- TenantPlanManager
|
||||||
- Admin
|
- Admin
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -677,6 +624,7 @@ permissions:
|
||||||
ImportDmpBlueprint:
|
ImportDmpBlueprint:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantPlanManager
|
- TenantPlanManager
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -685,6 +633,7 @@ permissions:
|
||||||
DeleteDmpBlueprint:
|
DeleteDmpBlueprint:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantPlanManager
|
- TenantPlanManager
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -694,9 +643,6 @@ permissions:
|
||||||
BrowseEntityDoi:
|
BrowseEntityDoi:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -704,9 +650,6 @@ permissions:
|
||||||
EditEntityDoi:
|
EditEntityDoi:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -714,9 +657,6 @@ permissions:
|
||||||
DeleteEntityDoi:
|
DeleteEntityDoi:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -728,9 +668,6 @@ permissions:
|
||||||
BrowseReference:
|
BrowseReference:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -753,9 +690,6 @@ permissions:
|
||||||
BrowseDmpReference:
|
BrowseDmpReference:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -763,9 +697,6 @@ permissions:
|
||||||
EditDmpReference:
|
EditDmpReference:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -773,9 +704,6 @@ permissions:
|
||||||
DeleteDmpReference:
|
DeleteDmpReference:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -786,9 +714,6 @@ permissions:
|
||||||
BrowseDmpUser:
|
BrowseDmpUser:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -796,9 +721,6 @@ permissions:
|
||||||
EditDmpUser:
|
EditDmpUser:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -806,9 +728,6 @@ permissions:
|
||||||
DeleteDmpUser:
|
DeleteDmpUser:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -824,12 +743,14 @@ permissions:
|
||||||
- TenantConfigManager
|
- TenantConfigManager
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
- TenantUser
|
- TenantUser
|
||||||
|
- User
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: yes
|
allowAnonymous: yes
|
||||||
allowAuthenticated: yes
|
allowAuthenticated: yes
|
||||||
EditSupportiveMaterial:
|
EditSupportiveMaterial:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantConfigManager
|
- TenantConfigManager
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -837,6 +758,7 @@ permissions:
|
||||||
DeleteSupportiveMaterial:
|
DeleteSupportiveMaterial:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantConfigManager
|
- TenantConfigManager
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -858,14 +780,14 @@ permissions:
|
||||||
EditReferenceType:
|
EditReferenceType:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- TenantPlanManager
|
- TenantAdmin
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
allowAuthenticated: false
|
allowAuthenticated: false
|
||||||
DeleteReferenceType:
|
DeleteReferenceType:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- TenantPlanManager
|
- TenantAdmin
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -923,9 +845,6 @@ permissions:
|
||||||
BrowseDmpDescriptionTemplate:
|
BrowseDmpDescriptionTemplate:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -933,9 +852,6 @@ permissions:
|
||||||
EditDmpDescriptionTemplate:
|
EditDmpDescriptionTemplate:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -943,9 +859,6 @@ permissions:
|
||||||
DeleteDmpDescriptionTemplate:
|
DeleteDmpDescriptionTemplate:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -956,9 +869,6 @@ permissions:
|
||||||
BrowseDescriptionReference:
|
BrowseDescriptionReference:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -966,9 +876,6 @@ permissions:
|
||||||
EditDescriptionReference:
|
EditDescriptionReference:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -976,9 +883,6 @@ permissions:
|
||||||
DeleteDescriptionReference:
|
DeleteDescriptionReference:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -989,9 +893,6 @@ permissions:
|
||||||
BrowseDescriptionTag:
|
BrowseDescriptionTag:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -999,9 +900,6 @@ permissions:
|
||||||
EditDescriptionTag:
|
EditDescriptionTag:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -1009,9 +907,6 @@ permissions:
|
||||||
DeleteDescriptionTag:
|
DeleteDescriptionTag:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -1046,11 +941,6 @@ permissions:
|
||||||
EditLock:
|
EditLock:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
|
||||||
- TenantUser
|
|
||||||
dmp:
|
dmp:
|
||||||
roles:
|
roles:
|
||||||
- Owner
|
- Owner
|
||||||
|
@ -1063,11 +953,6 @@ permissions:
|
||||||
DeleteLock:
|
DeleteLock:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
|
||||||
- TenantUser
|
|
||||||
dmp:
|
dmp:
|
||||||
roles:
|
roles:
|
||||||
- Owner
|
- Owner
|
||||||
|
@ -1089,33 +974,21 @@ permissions:
|
||||||
BrowseActionConfirmation:
|
BrowseActionConfirmation:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
- TenantUser
|
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
allowAuthenticated: false
|
allowAuthenticated: false
|
||||||
EditActionConfirmation:
|
EditActionConfirmation:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
- TenantUser
|
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
allowAuthenticated: false
|
allowAuthenticated: false
|
||||||
DeleteActionConfirmation:
|
DeleteActionConfirmation:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
- TenantUser
|
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -1153,6 +1026,7 @@ permissions:
|
||||||
ViewDescriptionTemplateTypePage:
|
ViewDescriptionTemplateTypePage:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantPlanManager
|
- TenantPlanManager
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -1172,6 +1046,7 @@ permissions:
|
||||||
ViewNotificationTemplatePage:
|
ViewNotificationTemplatePage:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantConfigManager
|
- TenantConfigManager
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -1179,6 +1054,7 @@ permissions:
|
||||||
ViewSupportiveMaterialPage:
|
ViewSupportiveMaterialPage:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantConfigManager
|
- TenantConfigManager
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -1186,6 +1062,7 @@ permissions:
|
||||||
ViewLanguagePage:
|
ViewLanguagePage:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantConfigManager
|
- TenantConfigManager
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -1233,6 +1110,7 @@ permissions:
|
||||||
ViewDescriptionTemplatePage:
|
ViewDescriptionTemplatePage:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantPlanManager
|
- TenantPlanManager
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -1240,6 +1118,7 @@ permissions:
|
||||||
ViewDmpBlueprintPage:
|
ViewDmpBlueprintPage:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantPlanManager
|
- TenantPlanManager
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -1257,9 +1136,6 @@ permissions:
|
||||||
ViewMyDescriptionPage:
|
ViewMyDescriptionPage:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
- TenantUser
|
- TenantUser
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
@ -1268,9 +1144,6 @@ permissions:
|
||||||
ViewMyDmpPage:
|
ViewMyDmpPage:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
- InstallationAdmin
|
|
||||||
- TenantPlanManager
|
|
||||||
- TenantConfigManager
|
|
||||||
- TenantAdmin
|
- TenantAdmin
|
||||||
- TenantUser
|
- TenantUser
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
|
|
|
@ -41,6 +41,7 @@ import java.util.*;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class DatasetMigrationService {
|
public class DatasetMigrationService {
|
||||||
|
@ -97,16 +98,41 @@ public class DatasetMigrationService {
|
||||||
DefinitionEntity definitionEntity = this.xmlHandlingService.fromXml(DefinitionEntity.class, dmpBlueprint.getDefinition());
|
DefinitionEntity definitionEntity = this.xmlHandlingService.fromXml(DefinitionEntity.class, dmpBlueprint.getDefinition());
|
||||||
dmpBlueprintsMap.put(dmpBlueprint.getId(), definitionEntity);
|
dmpBlueprintsMap.put(dmpBlueprint.getId(), definitionEntity);
|
||||||
}
|
}
|
||||||
|
List<UUID> changeTemplateToH2020 = Stream.of("0c82f2ce-5ff7-4ca9-a500-9f3062adf550",
|
||||||
|
"7acd3b36-e598-459c-8170-87c51ac80efb",
|
||||||
|
"64e7969a-6d0e-4895-ad4a-a382b6efb279",
|
||||||
|
"b4f3e186-98e7-424e-983e-c6f5c911e3be",
|
||||||
|
"8266cb3e-ef0e-4c19-b9fc-c33e44cebd03",
|
||||||
|
"dc7a7fbb-2a94-4e62-88b7-461a7b7411e1",
|
||||||
|
"7c16ef72-8728-41aa-9154-8f0f2105c75c",
|
||||||
|
"6382ffd2-0e13-45b7-9e4f-3bd2a695d394",
|
||||||
|
"4648c912-d514-460a-b6bf-fa9d3150438b",
|
||||||
|
"b6208df9-baef-4fa4-b483-9332e77ba3e5",
|
||||||
|
"28520240-c8bd-4272-a822-150cf23ca2e3",
|
||||||
|
"d243e090-aa83-4349-b64c-166cb132f4c8").map(UUID::fromString).toList();
|
||||||
|
|
||||||
|
UUID horizon2020UUID = UUID.fromString("6ddde24b-e7a0-477f-a2cd-0a8fad915dc8");
|
||||||
|
UUID horizonGroupId = UUID.fromString("3689bcce-405a-4d55-9854-669597b79c0a");
|
||||||
|
|
||||||
List<DmpDescriptionTemplateEntity> dmpDescriptionTemplateEntities = this.queryFactory.query(DmpDescriptionTemplateQuery.class).dmpIds(items.stream().map(x-> x.getDmp().getId()).distinct().toList()).collect();
|
List<DmpDescriptionTemplateEntity> dmpDescriptionTemplateEntities = this.queryFactory.query(DmpDescriptionTemplateQuery.class).dmpIds(items.stream().map(x-> x.getDmp().getId()).distinct().toList()).collect();
|
||||||
List<DescriptionTemplateEntity> descriptionTemplates = this.queryFactory.query(DescriptionTemplateQuery.class).ids(items.stream().map(x-> x.getProfile().getId()).distinct().toList()).collect();
|
|
||||||
Map<UUID, UUID> creatorsByDmp = this.queryFactory.query(DmpQuery.class).ids(items.stream().map(x-> x.getDmp().getId()).distinct().toList()).collectAs(new BaseFieldSet().ensure(Dmp._id).ensure(Dmp._creator)).stream().collect(Collectors.toMap(DmpEntity::getId, DmpEntity::getCreatorId));
|
Map<UUID, UUID> creatorsByDmp = this.queryFactory.query(DmpQuery.class).ids(items.stream().map(x-> x.getDmp().getId()).distinct().toList()).collectAs(new BaseFieldSet().ensure(Dmp._id).ensure(Dmp._creator)).stream().collect(Collectors.toMap(DmpEntity::getId, DmpEntity::getCreatorId));
|
||||||
|
|
||||||
|
List<UUID> profileIds = new ArrayList<>(items.stream().map(x -> x.getProfile().getId()).distinct().toList());
|
||||||
|
profileIds.add(horizon2020UUID);
|
||||||
|
List<DescriptionTemplateEntity> descriptionTemplates = this.queryFactory.query(DescriptionTemplateQuery.class).ids(profileIds).collect();
|
||||||
Map<UUID, org.opencdmp.commons.types.descriptiontemplate.DefinitionEntity> descriptionTemplateDefinitionMap = new HashMap<>();
|
Map<UUID, org.opencdmp.commons.types.descriptiontemplate.DefinitionEntity> descriptionTemplateDefinitionMap = new HashMap<>();
|
||||||
for (DescriptionTemplateEntity descriptionTemplateEntity : descriptionTemplates){
|
for (DescriptionTemplateEntity descriptionTemplateEntity : descriptionTemplates){
|
||||||
descriptionTemplateDefinitionMap.put(descriptionTemplateEntity.getId(), this.xmlHandlingService.fromXml(org.opencdmp.commons.types.descriptiontemplate.DefinitionEntity.class, descriptionTemplateEntity.getDefinition()));
|
descriptionTemplateDefinitionMap.put(descriptionTemplateEntity.getId(), this.xmlHandlingService.fromXml(org.opencdmp.commons.types.descriptiontemplate.DefinitionEntity.class, descriptionTemplateEntity.getDefinition()));
|
||||||
}
|
}
|
||||||
for (Dataset item : items) {
|
for (Dataset item : items) {
|
||||||
|
UUID profileId = item.getProfile().getId();
|
||||||
|
UUID profileGroupId = item.getProfile().getGroupId();
|
||||||
|
|
||||||
|
if (changeTemplateToH2020.contains(item.getId())) {
|
||||||
|
profileId = horizon2020UUID;
|
||||||
|
profileGroupId = horizonGroupId;
|
||||||
|
}
|
||||||
|
|
||||||
DefinitionEntity definition = dmpBlueprintsMap.getOrDefault(item.getDmp().getProfile().getId(), null);
|
DefinitionEntity definition = dmpBlueprintsMap.getOrDefault(item.getDmp().getProfile().getId(), null);
|
||||||
|
|
||||||
if (definition == null || definition.getSections() == null || definition.getSections().size() <= item.getDmpSectionIndex()) {
|
if (definition == null || definition.getSections() == null || definition.getSections().size() <= item.getDmpSectionIndex()) {
|
||||||
|
@ -117,7 +143,7 @@ public class DatasetMigrationService {
|
||||||
throw new MyApplicationException("Migrate Dataset " + item.getId() + " cannot found section id for section " + item.getDmpSectionIndex());
|
throw new MyApplicationException("Migrate Dataset " + item.getId() + " cannot found section id for section " + item.getDmpSectionIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<DmpDescriptionTemplateEntity> itemDescriptionTemplates = this.getOrCreateDmpDescriptionTemplateEntity(item, sectionId, dmpDescriptionTemplateEntities);
|
List<DmpDescriptionTemplateEntity> itemDescriptionTemplates = this.getOrCreateDmpDescriptionTemplateEntity(item, sectionId, profileGroupId, dmpDescriptionTemplateEntities);
|
||||||
|
|
||||||
if (itemDescriptionTemplates.size() > 1) {
|
if (itemDescriptionTemplates.size() > 1) {
|
||||||
throw new MyApplicationException("Migrate Dataset " + item.getId() + " multiple DmpDescriptionTemplateEntity for section " + item.getDmpSectionIndex());
|
throw new MyApplicationException("Migrate Dataset " + item.getId() + " multiple DmpDescriptionTemplateEntity for section " + item.getDmpSectionIndex());
|
||||||
|
@ -134,7 +160,7 @@ public class DatasetMigrationService {
|
||||||
data.setDmpId(item.getDmp().getId());
|
data.setDmpId(item.getDmp().getId());
|
||||||
data.setLabel(item.getLabel());
|
data.setLabel(item.getLabel());
|
||||||
data.setDmpDescriptionTemplateId(itemDescriptionTemplates.getFirst().getId());
|
data.setDmpDescriptionTemplateId(itemDescriptionTemplates.getFirst().getId());
|
||||||
data.setDescriptionTemplateId(item.getProfile().getId());
|
data.setDescriptionTemplateId(profileId);
|
||||||
data.setCreatedAt(item.getCreated() != null ? item.getCreated().toInstant() : Instant.now());
|
data.setCreatedAt(item.getCreated() != null ? item.getCreated().toInstant() : Instant.now());
|
||||||
data.setUpdatedAt(item.getModified() != null ? item.getModified().toInstant() : Instant.now());
|
data.setUpdatedAt(item.getModified() != null ? item.getModified().toInstant() : Instant.now());
|
||||||
if (item.getFinalizedAt() != null)
|
if (item.getFinalizedAt() != null)
|
||||||
|
@ -149,7 +175,8 @@ public class DatasetMigrationService {
|
||||||
if (data.getCreatedById() == null){
|
if (data.getCreatedById() == null){
|
||||||
throw new MyApplicationException("Migration skipped creator not found " + item.getId());
|
throw new MyApplicationException("Migration skipped creator not found " + item.getId());
|
||||||
}
|
}
|
||||||
org.opencdmp.commons.types.descriptiontemplate.DefinitionEntity descriptionTemplateDefinitionEntity = descriptionTemplateDefinitionMap.getOrDefault(item.getProfile().getId(), null);
|
|
||||||
|
org.opencdmp.commons.types.descriptiontemplate.DefinitionEntity descriptionTemplateDefinitionEntity = descriptionTemplateDefinitionMap.getOrDefault(profileId, null);
|
||||||
this.entityManager.persist(data);
|
this.entityManager.persist(data);
|
||||||
this.entityManager.flush();
|
this.entityManager.flush();
|
||||||
|
|
||||||
|
@ -164,20 +191,21 @@ public class DatasetMigrationService {
|
||||||
} while (items != null && !items.isEmpty() && !TestMode);
|
} while (items != null && !items.isEmpty() && !TestMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<DmpDescriptionTemplateEntity> getOrCreateDmpDescriptionTemplateEntity(Dataset item, UUID sectionId, List<DmpDescriptionTemplateEntity> dmpDescriptionTemplateEntities){
|
private List<DmpDescriptionTemplateEntity> getOrCreateDmpDescriptionTemplateEntity(Dataset item, UUID sectionId, UUID groupId, List<DmpDescriptionTemplateEntity> dmpDescriptionTemplateEntities){
|
||||||
List<DmpDescriptionTemplateEntity> itemDescriptionTemplates = dmpDescriptionTemplateEntities.stream().filter(x-> x.getDescriptionTemplateGroupId().equals(item.getProfile().getGroupId()) && x.getDmpId().equals(item.getDmp().getId()) && x.getSectionId().equals(sectionId)).toList();
|
List<DmpDescriptionTemplateEntity> itemDescriptionTemplates = dmpDescriptionTemplateEntities.stream().filter(x-> x.getDescriptionTemplateGroupId().equals(groupId) && x.getDmpId().equals(item.getDmp().getId()) && x.getSectionId().equals(sectionId)).toList();
|
||||||
if (itemDescriptionTemplates.isEmpty()) {
|
if (itemDescriptionTemplates.isEmpty()) {
|
||||||
if (!item.getStatus().equals(Dataset.Status.DELETED.getValue())) logger.warn("Migrate Dataset " + item.getId() + " cannot found DmpDescriptionTemplateEntity for section " + item.getDmpSectionIndex());
|
if (!item.getStatus().equals(Dataset.Status.DELETED.getValue())) logger.warn("Migrate Dataset " + item.getId() + " cannot found DmpDescriptionTemplateEntity for section " + item.getDmpSectionIndex());
|
||||||
if (dmpDescriptionTemplateEntities.stream().anyMatch(x -> x.getDmpId().equals(item.getDmp().getId()) && x.getSectionId().equals(sectionId))) {
|
if (dmpDescriptionTemplateEntities.stream().anyMatch(x -> x.getDmpId().equals(item.getDmp().getId()) && x.getSectionId().equals(sectionId))) {
|
||||||
DmpDescriptionTemplateEntity dmpDescriptionTemplateEntity = new DmpDescriptionTemplateEntity();
|
DmpDescriptionTemplateEntity dmpDescriptionTemplateEntity = new DmpDescriptionTemplateEntity();
|
||||||
dmpDescriptionTemplateEntity.setId(UUID.randomUUID());
|
dmpDescriptionTemplateEntity.setId(UUID.randomUUID());
|
||||||
dmpDescriptionTemplateEntity.setDescriptionTemplateGroupId(item.getProfile().getGroupId());
|
dmpDescriptionTemplateEntity.setDescriptionTemplateGroupId(groupId);
|
||||||
dmpDescriptionTemplateEntity.setDmpId(item.getDmp().getId());
|
dmpDescriptionTemplateEntity.setDmpId(item.getDmp().getId());
|
||||||
dmpDescriptionTemplateEntity.setCreatedAt(item.getCreated() != null ? item.getCreated().toInstant() : Instant.now());
|
dmpDescriptionTemplateEntity.setCreatedAt(item.getCreated() != null ? item.getCreated().toInstant() : Instant.now());
|
||||||
dmpDescriptionTemplateEntity.setUpdatedAt(item.getModified() != null ? item.getModified().toInstant() : Instant.now());
|
dmpDescriptionTemplateEntity.setUpdatedAt(item.getModified() != null ? item.getModified().toInstant() : Instant.now());
|
||||||
dmpDescriptionTemplateEntity.setSectionId(sectionId);
|
dmpDescriptionTemplateEntity.setSectionId(sectionId);
|
||||||
dmpDescriptionTemplateEntity.setIsActive(!item.getStatus().equals(Dataset.Status.DELETED.getValue()) ? IsActive.Active : IsActive.Inactive);
|
dmpDescriptionTemplateEntity.setIsActive(!item.getStatus().equals(Dataset.Status.DELETED.getValue()) ? IsActive.Active : IsActive.Inactive);
|
||||||
this.entityManager.persist(dmpDescriptionTemplateEntity);
|
this.entityManager.persist(dmpDescriptionTemplateEntity);
|
||||||
|
this.entityManager.flush();
|
||||||
itemDescriptionTemplates = List.of(dmpDescriptionTemplateEntity);
|
itemDescriptionTemplates = List.of(dmpDescriptionTemplateEntity);
|
||||||
} else {
|
} else {
|
||||||
throw new MyApplicationException("Migrate Dataset " + item.getId() + " " + item.getLabel() + " cannot found DmpDescriptionTemplateEntity for section " + item.getDmpSectionIndex());
|
throw new MyApplicationException("Migrate Dataset " + item.getId() + " " + item.getLabel() + " cannot found DmpDescriptionTemplateEntity for section " + item.getDmpSectionIndex());
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package eu.old.eudat.migration;
|
package eu.old.eudat.migration;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import eu.old.eudat.data.entities.DMP;
|
||||||
import org.opencdmp.commons.JsonHandlingService;
|
import org.opencdmp.commons.JsonHandlingService;
|
||||||
import org.opencdmp.commons.XmlHandlingService;
|
import org.opencdmp.commons.XmlHandlingService;
|
||||||
import org.opencdmp.commons.enums.IsActive;
|
import org.opencdmp.commons.enums.IsActive;
|
||||||
|
@ -103,9 +104,9 @@ public class DmpDatasetProfileMigrationService {
|
||||||
DmpDescriptionTemplateEntity data = new DmpDescriptionTemplateEntity();
|
DmpDescriptionTemplateEntity data = new DmpDescriptionTemplateEntity();
|
||||||
data.setId(UUID.randomUUID());
|
data.setId(UUID.randomUUID());
|
||||||
data.setDescriptionTemplateGroupId(item.getDatasetprofile().getGroupId());
|
data.setDescriptionTemplateGroupId(item.getDatasetprofile().getGroupId());
|
||||||
data.setDmpId(item.getDmp().getId());
|
data.setDmpId(getDmp(item).getId());
|
||||||
data.setCreatedAt(Instant.now());
|
data.setCreatedAt(item.getDmp().getCreated() != null ? item.getDmp().getCreated().toInstant() : Instant.now());
|
||||||
data.setUpdatedAt(Instant.now());
|
data.setUpdatedAt(item.getDmp().getModified() != null ? item.getDmp().getModified().toInstant() : Instant.now());
|
||||||
data.setSectionId(sectionId);
|
data.setSectionId(sectionId);
|
||||||
data.setIsActive(IsActive.Active);
|
data.setIsActive(IsActive.Active);
|
||||||
this.entityManager.persist(data);
|
this.entityManager.persist(data);
|
||||||
|
@ -120,6 +121,10 @@ public class DmpDatasetProfileMigrationService {
|
||||||
removeDuplicates();
|
removeDuplicates();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DMP getDmp(DMPDatasetProfile item) {
|
||||||
|
return item.getDmp();
|
||||||
|
}
|
||||||
|
|
||||||
private void removeDuplicates() {
|
private void removeDuplicates() {
|
||||||
logger.debug("Checking for duplicates on DmpDescriptionTemplate table after migration");
|
logger.debug("Checking for duplicates on DmpDescriptionTemplate table after migration");
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,7 @@ permissions:
|
||||||
ViewNotificationTemplatePage:
|
ViewNotificationTemplatePage:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantConfigManager
|
- TenantConfigManager
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -155,6 +156,7 @@ permissions:
|
||||||
BrowseNotificationTemplate:
|
BrowseNotificationTemplate:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantConfigManager
|
- TenantConfigManager
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -162,6 +164,7 @@ permissions:
|
||||||
EditNotificationTemplate:
|
EditNotificationTemplate:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantConfigManager
|
- TenantConfigManager
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
@ -169,6 +172,7 @@ permissions:
|
||||||
DeleteNotificationTemplate:
|
DeleteNotificationTemplate:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- Admin
|
||||||
|
- TenantAdmin
|
||||||
- TenantConfigManager
|
- TenantConfigManager
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
|
Loading…
Reference in New Issue