code clean up
This commit is contained in:
parent
64d92e864d
commit
e62d765796
|
@ -13,7 +13,7 @@ import java.util.UUID;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "\"DmpUser\"")
|
@Table(name = "\"DmpUser\"")
|
||||||
public class DmpUserEntity implements DataEntity {
|
public class DmpUserEntity {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||||
|
@ -108,19 +108,4 @@ public class DmpUserEntity implements DataEntity {
|
||||||
public void setIsActive(IsActive isActive) {
|
public void setIsActive(IsActive isActive) {
|
||||||
this.isActive = isActive;
|
this.isActive = isActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update(Object entity) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getKeys() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object buildFromTuple(List tuple, List fields, String base) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import java.util.UUID;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "\"UserDescriptionTemplate\"")
|
@Table(name = "\"UserDescriptionTemplate\"")
|
||||||
public class UserDescriptionTemplateEntity implements DataEntity<UserDescriptionTemplateEntity, UUID> {
|
public class UserDescriptionTemplateEntity {
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
@ -102,21 +102,4 @@ public class UserDescriptionTemplateEntity implements DataEntity<UserDescription
|
||||||
public void setRole(UserDescriptionTemplateRole role) {
|
public void setRole(UserDescriptionTemplateRole role) {
|
||||||
this.role = role;
|
this.role = role;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update(UserDescriptionTemplateEntity entity) {
|
|
||||||
this.role = entity.getRole();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UUID getKeys() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserDescriptionTemplateEntity buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
|
||||||
String currentBase = base.isEmpty() ? "" : base + ".";
|
|
||||||
if (fields.contains(currentBase + "id")) this.id = EntityBinder.fromTuple(tuple, currentBase + "id");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
package eu.eudat.data.dao.entities;
|
|
||||||
|
|
||||||
import eu.eudat.data.UserDescriptionTemplateEntity;
|
|
||||||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by ikalyvas on 2/8/2018.
|
|
||||||
*/
|
|
||||||
public interface UserDatasetProfileDao extends DatabaseAccessLayer<UserDescriptionTemplateEntity, UUID> {
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
package eu.eudat.data.dao.entities;
|
|
||||||
|
|
||||||
import eu.eudat.data.UserDescriptionTemplateEntity;
|
|
||||||
import eu.eudat.data.dao.DatabaseAccess;
|
|
||||||
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
|
||||||
import eu.eudat.queryable.QueryableList;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.scheduling.annotation.Async;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.management.InvalidApplicationException;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
|
|
||||||
@Component("userDatasetProfileDao")
|
|
||||||
public class UserDatasetProfileDaoImpl extends DatabaseAccess<UserDescriptionTemplateEntity> implements UserDatasetProfileDao {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public UserDatasetProfileDaoImpl(DatabaseService<UserDescriptionTemplateEntity> databaseService) {
|
|
||||||
super(databaseService);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserDescriptionTemplateEntity createOrUpdate(UserDescriptionTemplateEntity item) {
|
|
||||||
return this.getDatabaseService().createOrUpdate(item, UserDescriptionTemplateEntity.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserDescriptionTemplateEntity find(UUID id) throws InvalidApplicationException {
|
|
||||||
return this.getDatabaseService().getQueryable(UserDescriptionTemplateEntity.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingleOrDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void delete(UserDescriptionTemplateEntity item) {
|
|
||||||
this.getDatabaseService().delete(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public QueryableList<UserDescriptionTemplateEntity> asQueryable() {
|
|
||||||
return this.getDatabaseService().getQueryable(UserDescriptionTemplateEntity.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Async
|
|
||||||
@Override
|
|
||||||
public CompletableFuture<UserDescriptionTemplateEntity> createOrUpdateAsync(UserDescriptionTemplateEntity item) {
|
|
||||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserDescriptionTemplateEntity find(UUID id, String hint) {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
package eu.eudat.data.dao.entities;
|
|
||||||
|
|
||||||
import eu.eudat.data.DmpUserEntity;
|
|
||||||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by ikalyvas on 2/8/2018.
|
|
||||||
*/
|
|
||||||
public interface UserDmpDao extends DatabaseAccessLayer<DmpUserEntity, UUID> {
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
package eu.eudat.data.dao.entities;
|
|
||||||
|
|
||||||
import eu.eudat.data.DmpUserEntity;
|
|
||||||
import eu.eudat.data.dao.DatabaseAccess;
|
|
||||||
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
|
||||||
import eu.eudat.queryable.QueryableList;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.scheduling.annotation.Async;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.management.InvalidApplicationException;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by ikalyvas on 2/8/2018.
|
|
||||||
*/
|
|
||||||
@Component("userDmpDao")
|
|
||||||
public class UserDmpDaoImpl extends DatabaseAccess<DmpUserEntity> implements UserDmpDao {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public UserDmpDaoImpl(DatabaseService<DmpUserEntity> databaseService) {
|
|
||||||
super(databaseService);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DmpUserEntity createOrUpdate(DmpUserEntity item) {
|
|
||||||
return this.getDatabaseService().createOrUpdate(item, DmpUserEntity.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DmpUserEntity find(UUID id) throws InvalidApplicationException {
|
|
||||||
return this.getDatabaseService().getQueryable(DmpUserEntity.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingleOrDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void delete(DmpUserEntity item) {
|
|
||||||
this.getDatabaseService().delete(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public QueryableList<DmpUserEntity> asQueryable() {
|
|
||||||
return this.getDatabaseService().getQueryable(DmpUserEntity.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Async
|
|
||||||
@Override
|
|
||||||
public CompletableFuture<DmpUserEntity> createOrUpdateAsync(DmpUserEntity item) {
|
|
||||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DmpUserEntity find(UUID id, String hint) {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -17,6 +17,7 @@ import eu.eudat.logic.managers.DataManagementPlanManager;
|
||||||
import eu.eudat.logic.proxy.config.configloaders.ConfigLoader;
|
import eu.eudat.logic.proxy.config.configloaders.ConfigLoader;
|
||||||
import eu.eudat.logic.services.ApiContext;
|
import eu.eudat.logic.services.ApiContext;
|
||||||
import eu.eudat.logic.services.operations.DatabaseRepository;
|
import eu.eudat.logic.services.operations.DatabaseRepository;
|
||||||
|
import eu.eudat.model.DmpUser;
|
||||||
import eu.eudat.model.file.FileEnvelope;
|
import eu.eudat.model.file.FileEnvelope;
|
||||||
import eu.eudat.utilities.pdf.PDFUtils;
|
import eu.eudat.utilities.pdf.PDFUtils;
|
||||||
import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel;
|
import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel;
|
||||||
|
@ -27,7 +28,6 @@ import eu.eudat.models.data.helpers.common.DataTableData;
|
||||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||||
import eu.eudat.models.data.listingmodels.DataManagementPlanListingModel;
|
import eu.eudat.models.data.listingmodels.DataManagementPlanListingModel;
|
||||||
import eu.eudat.models.data.listingmodels.DataManagementPlanOverviewModel;
|
import eu.eudat.models.data.listingmodels.DataManagementPlanOverviewModel;
|
||||||
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
|
|
||||||
import eu.eudat.models.data.listingmodels.VersionListingModel;
|
import eu.eudat.models.data.listingmodels.VersionListingModel;
|
||||||
import eu.eudat.query.DMPQuery;
|
import eu.eudat.query.DMPQuery;
|
||||||
import eu.eudat.types.ApiMessageCode;
|
import eu.eudat.types.ApiMessageCode;
|
||||||
|
@ -353,7 +353,7 @@ public class DMPs extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = {"/updateusers/{id}"})
|
@RequestMapping(method = RequestMethod.POST, value = {"/updateusers/{id}"})
|
||||||
public ResponseEntity<ResponseItem<DmpEntity>> updateUsers(@PathVariable String id, @RequestBody List<UserInfoListingModel> users) {
|
public ResponseEntity<ResponseItem<DmpEntity>> updateUsers(@PathVariable String id, @RequestBody List<DmpUser> users) {
|
||||||
this.authorizationService.authorizeForce(Permission.AuthenticatedRole);
|
this.authorizationService.authorizeForce(Permission.AuthenticatedRole);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -27,6 +27,7 @@ import eu.eudat.exceptions.security.ForbiddenException;
|
||||||
import eu.eudat.exceptions.security.UnauthorisedException;
|
import eu.eudat.exceptions.security.UnauthorisedException;
|
||||||
import eu.eudat.logic.builders.entity.UserInfoBuilder;
|
import eu.eudat.logic.builders.entity.UserInfoBuilder;
|
||||||
import eu.eudat.logic.proxy.config.configloaders.ConfigLoader;
|
import eu.eudat.logic.proxy.config.configloaders.ConfigLoader;
|
||||||
|
import eu.eudat.model.DmpUser;
|
||||||
import eu.eudat.model.mapper.deposit.DMPToDepositMapper;
|
import eu.eudat.model.mapper.deposit.DMPToDepositMapper;
|
||||||
import eu.eudat.logic.services.ApiContext;
|
import eu.eudat.logic.services.ApiContext;
|
||||||
import eu.eudat.logic.services.forms.VisibilityRuleService;
|
import eu.eudat.logic.services.forms.VisibilityRuleService;
|
||||||
|
@ -34,8 +35,7 @@ import eu.eudat.logic.services.forms.VisibilityRuleServiceImpl;
|
||||||
import eu.eudat.logic.services.operations.DatabaseRepository;
|
import eu.eudat.logic.services.operations.DatabaseRepository;
|
||||||
import eu.eudat.commons.types.xml.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import eu.eudat.model.file.FileEnvelope;
|
import eu.eudat.model.file.FileEnvelope;
|
||||||
import eu.eudat.query.DmpDescriptionTemplateQuery;
|
import eu.eudat.query.*;
|
||||||
import eu.eudat.query.UserQuery;
|
|
||||||
import eu.eudat.utilities.pdf.PDFUtils;
|
import eu.eudat.utilities.pdf.PDFUtils;
|
||||||
import eu.eudat.logic.utilities.documents.types.ParagraphStyle;
|
import eu.eudat.logic.utilities.documents.types.ParagraphStyle;
|
||||||
import eu.eudat.logic.utilities.documents.word.WordBuilder;
|
import eu.eudat.logic.utilities.documents.word.WordBuilder;
|
||||||
|
@ -56,8 +56,6 @@ import eu.eudat.models.data.helpers.common.DataTableData;
|
||||||
import eu.eudat.models.data.listingmodels.*;
|
import eu.eudat.models.data.listingmodels.*;
|
||||||
import eu.eudat.models.data.project.ProjectDMPEditorModel;
|
import eu.eudat.models.data.project.ProjectDMPEditorModel;
|
||||||
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
||||||
import eu.eudat.query.DescriptionTemplateQuery;
|
|
||||||
import eu.eudat.query.DmpBlueprintQuery;
|
|
||||||
import eu.eudat.queryable.QueryableList;
|
import eu.eudat.queryable.QueryableList;
|
||||||
import eu.eudat.service.dmpblueprint.DmpBlueprintService;
|
import eu.eudat.service.dmpblueprint.DmpBlueprintService;
|
||||||
import eu.eudat.types.MetricNames;
|
import eu.eudat.types.MetricNames;
|
||||||
|
@ -535,15 +533,14 @@ public class DataManagementPlanManager {
|
||||||
|
|
||||||
newDmp.setCreatedAt(dmp.getCreatedAt() == null ? Instant.now() : dmp.getCreatedAt());
|
newDmp.setCreatedAt(dmp.getCreatedAt() == null ? Instant.now() : dmp.getCreatedAt());
|
||||||
DmpEntity finalNewDmp = newDmp;
|
DmpEntity finalNewDmp = newDmp;
|
||||||
this.databaseRepository.getUserDmpDao().asQueryable().where((builder, root) -> root.get("dmp").in(finalNewDmp.getId())).toList();
|
if (this.queryFactory.query(DmpUserQuery.class).dmpIds(finalNewDmp.getId()).collect() != null &&
|
||||||
if (this.databaseRepository.getUserDmpDao().asQueryable().where((builder, root) -> root.get("dmp").in(finalNewDmp.getId())).toList()!= null &&
|
this.queryFactory.query(DmpUserQuery.class).dmpIds(finalNewDmp.getId()).collect().stream().filter(userInfo -> this.userScope.getUserIdSafe().equals(userInfo.getUserId()))
|
||||||
this.databaseRepository.getUserDmpDao().asQueryable().where((builder, root) -> root.get("dmp").in(finalNewDmp.getId())).toList().stream().filter(userInfo -> this.userScope.getUserIdSafe().equals(userInfo.getUserId()))
|
|
||||||
.collect(Collectors.toList()).size() == 0) {
|
.collect(Collectors.toList()).size() == 0) {
|
||||||
List<DmpUserEntity> userDMPList = new ArrayList<>(this.databaseRepository.getUserDmpDao().asQueryable().where((builder, root) -> root.get("dmp").in(finalNewDmp.getId())).toList());
|
List<DmpUserEntity> userDMPList = new ArrayList<>(this.queryFactory.query(DmpUserQuery.class).dmpIds(finalNewDmp.getId()).collect());
|
||||||
for (UserInfoListingModel userInfoListingModel : dataManagementPlan.getUsers()) {
|
for (DmpUser userInfoListingModel : dataManagementPlan.getUsers()) {
|
||||||
for (DmpUserEntity userDMP : userDMPList) {
|
for (DmpUserEntity userDMP : userDMPList) {
|
||||||
if (!(userDMP.getUserId().equals(userInfoListingModel.getId()))) {
|
if (!(userDMP.getUserId().equals(userInfoListingModel.getId()))) {
|
||||||
apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().delete(userDMP);
|
// apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().delete(userDMP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -581,9 +578,9 @@ public class DataManagementPlanManager {
|
||||||
|
|
||||||
if (dataManagementPlan.getUsers() != null && !dataManagementPlan.getUsers().isEmpty()) {
|
if (dataManagementPlan.getUsers() != null && !dataManagementPlan.getUsers().isEmpty()) {
|
||||||
clearUsers(newDmp);
|
clearUsers(newDmp);
|
||||||
for (UserInfoListingModel userListing : dataManagementPlan.getUsers()) {
|
for (DmpUser userListing : dataManagementPlan.getUsers()) {
|
||||||
UserEntity tempUser = this.queryFactory.query(UserQuery.class).ids(userListing.getId()).first();
|
UserEntity tempUser = this.queryFactory.query(UserQuery.class).ids(userListing.getId()).first();
|
||||||
assignUser(dmp, tempUser, DmpUserRole.of((short)userListing.getRole()));
|
assignUser(dmp, tempUser, userListing.getRole());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -782,14 +779,13 @@ public class DataManagementPlanManager {
|
||||||
|
|
||||||
copyDatasets(newDmp, databaseRepository.getDatasetDao());
|
copyDatasets(newDmp, databaseRepository.getDatasetDao());
|
||||||
|
|
||||||
databaseRepository
|
this.queryFactory.query(DmpUserQuery.class).dmpIds(oldDmp.getId()).collect()
|
||||||
.getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), oldDmp.getId()))
|
.stream().forEach(userDMP -> {
|
||||||
.toList().stream().forEach(userDMP -> {
|
|
||||||
DmpUserEntity temp = new DmpUserEntity();
|
DmpUserEntity temp = new DmpUserEntity();
|
||||||
temp.setUserId(userDMP.getUserId());
|
temp.setUserId(userDMP.getUserId());
|
||||||
temp.setRole(userDMP.getRole());
|
temp.setRole(userDMP.getRole());
|
||||||
temp.setDmp(newDmp.getId());
|
temp.setDmp(newDmp.getId());
|
||||||
apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().createOrUpdate(temp);
|
// apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().createOrUpdate(temp);
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
|
@ -1344,14 +1340,14 @@ public class DataManagementPlanManager {
|
||||||
metricsManager.increaseValue(MetricNames.DMP, 1, MetricNames.DRAFT);
|
metricsManager.increaseValue(MetricNames.DMP, 1, MetricNames.DRAFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateUsers(UUID id, List<UserInfoListingModel> users) throws Exception {
|
public void updateUsers(UUID id, List<DmpUser> users) throws Exception {
|
||||||
DmpEntity dmp = this.apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(id);
|
DmpEntity dmp = this.apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(id);
|
||||||
if (!isUserOwnerOfDmp(dmp))
|
if (!isUserOwnerOfDmp(dmp))
|
||||||
throw new Exception("User does not have the privilege to do this action.");
|
throw new Exception("User does not have the privilege to do this action.");
|
||||||
clearUsers(dmp);
|
clearUsers(dmp);
|
||||||
for (UserInfoListingModel userListing : users) {
|
for (DmpUser userListing : users) {
|
||||||
UserEntity tempUser = this.queryFactory.query(UserQuery.class).ids(userListing.getId()).first();
|
UserEntity tempUser = this.queryFactory.query(UserQuery.class).ids(userListing.getId()).first();
|
||||||
assignUser(dmp, tempUser, DmpUserRole.of((short)userListing.getRole()));
|
assignUser(dmp, tempUser, userListing.getRole());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2410,12 +2406,12 @@ public class DataManagementPlanManager {
|
||||||
userDMP.setDmp(dmp.getId());
|
userDMP.setDmp(dmp.getId());
|
||||||
userDMP.setUserId(userInfo.getId());
|
userDMP.setUserId(userInfo.getId());
|
||||||
userDMP.setRole(role);
|
userDMP.setRole(role);
|
||||||
databaseRepository.getUserDmpDao().createOrUpdate(userDMP);
|
// databaseRepository.getUserDmpDao().createOrUpdate(userDMP);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearUsers(DmpEntity dmp) throws InvalidApplicationException {
|
private void clearUsers(DmpEntity dmp) throws InvalidApplicationException {
|
||||||
List<DmpUserEntity> userDMPs = apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where(((builder, root) -> builder.equal(root.get("dmp").get("id"), dmp.getId()))).toList();
|
List<DmpUserEntity> userDMPs = this.queryFactory.query(DmpUserQuery.class).dmpIds(dmp.getId()).collect();
|
||||||
userDMPs.forEach(userDMP -> apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().delete(userDMP));
|
// userDMPs.forEach(userDMP -> apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().delete(userDMP));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assignGrandUserIfInternal(DmpEntity dmp, UserEntity user) {
|
private void assignGrandUserIfInternal(DmpEntity dmp, UserEntity user) {
|
||||||
|
@ -2681,7 +2677,7 @@ public class DataManagementPlanManager {
|
||||||
* */
|
* */
|
||||||
|
|
||||||
private void sendNotification(DmpEntity dmp, UserEntity user, NotificationType notificationType) throws InvalidApplicationException {
|
private void sendNotification(DmpEntity dmp, UserEntity user, NotificationType notificationType) throws InvalidApplicationException {
|
||||||
List<DmpUserEntity> userDMPS = databaseRepository.getUserDmpDao().asQueryable().where(((builder, root) -> builder.equal(root.get("dmp").get("id"), dmp.getId()))).toList();
|
List<DmpUserEntity> userDMPS = this.queryFactory.query(DmpUserQuery.class).dmpIds(dmp.getId()).collect();
|
||||||
for (DmpUserEntity userDMP : userDMPS) {
|
for (DmpUserEntity userDMP : userDMPS) {
|
||||||
if (!userDMP.getUserId().equals(user.getId())) {
|
if (!userDMP.getUserId().equals(user.getId())) {
|
||||||
Notification notification = new Notification();
|
Notification notification = new Notification();
|
||||||
|
|
|
@ -51,6 +51,7 @@ import eu.eudat.models.data.listingmodels.DatasetListingModel;
|
||||||
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
||||||
import eu.eudat.query.DescriptionTemplateQuery;
|
import eu.eudat.query.DescriptionTemplateQuery;
|
||||||
import eu.eudat.query.DmpDescriptionTemplateQuery;
|
import eu.eudat.query.DmpDescriptionTemplateQuery;
|
||||||
|
import eu.eudat.query.DmpUserQuery;
|
||||||
import eu.eudat.query.UserContactInfoQuery;
|
import eu.eudat.query.UserContactInfoQuery;
|
||||||
import eu.eudat.queryable.QueryableList;
|
import eu.eudat.queryable.QueryableList;
|
||||||
import eu.eudat.types.MetricNames;
|
import eu.eudat.types.MetricNames;
|
||||||
|
@ -728,7 +729,7 @@ public class DatasetManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendNotification(DescriptionEntity descriptionEntity, DmpEntity dmp, UserEntity user, NotificationType notificationType) throws InvalidApplicationException {
|
private void sendNotification(DescriptionEntity descriptionEntity, DmpEntity dmp, UserEntity user, NotificationType notificationType) throws InvalidApplicationException {
|
||||||
List<DmpUserEntity> userDMPS = databaseRepository.getUserDmpDao().asQueryable().where(((builder, root) -> builder.equal(root.get("dmp").get("id"), dmp.getId()))).toList();
|
List<DmpUserEntity> userDMPS = this.queryFactory.query(DmpUserQuery.class).dmpIds(dmp.getId()).collect();
|
||||||
for (DmpUserEntity userDMP : userDMPS) {
|
for (DmpUserEntity userDMP : userDMPS) {
|
||||||
if (!userDMP.getUserId().equals(user.getId())) {
|
if (!userDMP.getUserId().equals(user.getId())) {
|
||||||
Notification notification = new Notification();
|
Notification notification = new Notification();
|
||||||
|
|
|
@ -89,11 +89,11 @@ public class MergeEmailConfirmationManager {
|
||||||
// UserCredentialEntity credential = databaseRepository.getCredentialDao().asQueryable().where((builder, root) -> builder.and(builder.equal(root.get("userId"), oldUser.getId()), builder.equal(root.get("provider"), provider))).getSingle();
|
// UserCredentialEntity credential = databaseRepository.getCredentialDao().asQueryable().where((builder, root) -> builder.and(builder.equal(root.get("userId"), oldUser.getId()), builder.equal(root.get("provider"), provider))).getSingle();
|
||||||
// credential.setUserId(newUser.getId());
|
// credential.setUserId(newUser.getId());
|
||||||
// databaseRepository.getCredentialDao().createOrUpdate(credential);
|
// databaseRepository.getCredentialDao().createOrUpdate(credential);
|
||||||
List<DmpUserEntity> userDmps = databaseRepository.getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("user"), oldUser)).toList();
|
// List<DmpUserEntity> userDmps = databaseRepository.getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("user"), oldUser)).toList();
|
||||||
userDmps.forEach(userDmp -> {
|
// userDmps.forEach(userDmp -> {
|
||||||
userDmp.setUserId(newUser.getId());
|
// userDmp.setUserId(newUser.getId());
|
||||||
databaseRepository.getUserDmpDao().createOrUpdate(userDmp);
|
// databaseRepository.getUserDmpDao().createOrUpdate(userDmp);
|
||||||
});
|
// });
|
||||||
//TODO
|
//TODO
|
||||||
// try {
|
// try {
|
||||||
//
|
//
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class QuickWizardManager {
|
||||||
userDMP.setDmp(dmp.getId());
|
userDMP.setDmp(dmp.getId());
|
||||||
userDMP.setUserId(userInfo.getId());
|
userDMP.setUserId(userInfo.getId());
|
||||||
userDMP.setRole(DmpUserRole.User);
|
userDMP.setRole(DmpUserRole.User);
|
||||||
apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().createOrUpdate(userDMP);
|
//apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().createOrUpdate(userDMP);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createGrantIfItDoesntExist(DmpEntity newDmp, UserEntity userInfo) throws InvalidApplicationException {
|
private void createGrantIfItDoesntExist(DmpEntity newDmp, UserEntity userInfo) throws InvalidApplicationException {
|
||||||
|
|
|
@ -28,10 +28,6 @@ public interface DatabaseRepository {
|
||||||
|
|
||||||
ExternalDatasetDao getExternalDatasetDao();
|
ExternalDatasetDao getExternalDatasetDao();
|
||||||
|
|
||||||
UserDatasetProfileDao getUserDatasetProfileDao();
|
|
||||||
|
|
||||||
UserDmpDao getUserDmpDao();
|
|
||||||
|
|
||||||
ContentDao getContentDao();
|
ContentDao getContentDao();
|
||||||
|
|
||||||
EmailConfirmationDao getLoginConfirmationEmailDao();
|
EmailConfirmationDao getLoginConfirmationEmailDao();
|
||||||
|
|
|
@ -32,10 +32,6 @@ public class DatabaseRepositoryImpl implements DatabaseRepository {
|
||||||
|
|
||||||
private ExternalDatasetDao externalDatasetDao;
|
private ExternalDatasetDao externalDatasetDao;
|
||||||
|
|
||||||
private UserDatasetProfileDao userDatasetProfileDao;
|
|
||||||
|
|
||||||
private UserDmpDao userDmpDao;
|
|
||||||
|
|
||||||
private ContentDao contentDao;
|
private ContentDao contentDao;
|
||||||
|
|
||||||
private EmailConfirmationDao loginConfirmationEmailDao;
|
private EmailConfirmationDao loginConfirmationEmailDao;
|
||||||
|
@ -178,16 +174,6 @@ public class DatabaseRepositoryImpl implements DatabaseRepository {
|
||||||
this.entityManager = entityManager;
|
this.entityManager = entityManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserDmpDao getUserDmpDao() {
|
|
||||||
return userDmpDao;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public void setUserDmpDao(UserDmpDao userDmpDao) {
|
|
||||||
this.userDmpDao = userDmpDao;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ContentDao getContentDao() {
|
public ContentDao getContentDao() {
|
||||||
return this.contentDao;
|
return this.contentDao;
|
||||||
|
@ -248,15 +234,6 @@ public class DatabaseRepositoryImpl implements DatabaseRepository {
|
||||||
this.notificationDao = notificationDao;
|
this.notificationDao = notificationDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserDatasetProfileDao getUserDatasetProfileDao() {
|
|
||||||
return userDatasetProfileDao;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public void setUserDatasetProfileDao(UserDatasetProfileDao userDatasetProfileDao) {
|
|
||||||
this.userDatasetProfileDao = userDatasetProfileDao;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FileUploadDao getFileUploadDao() {
|
public FileUploadDao getFileUploadDao() {
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
package eu.eudat.models.data.admin.composite;
|
package eu.eudat.models.data.admin.composite;
|
||||||
|
|
||||||
import eu.eudat.commons.types.descriptiontemplate.DefinitionEntity;
|
import eu.eudat.commons.types.descriptiontemplate.DefinitionEntity;
|
||||||
import eu.eudat.commons.types.descriptiontemplate.SectionEntity;
|
|
||||||
import eu.eudat.logic.utilities.builders.ModelBuilder;
|
import eu.eudat.logic.utilities.builders.ModelBuilder;
|
||||||
|
import eu.eudat.model.DmpUser;
|
||||||
import eu.eudat.models.data.admin.components.datasetprofile.Page;
|
import eu.eudat.models.data.admin.components.datasetprofile.Page;
|
||||||
import eu.eudat.models.data.admin.components.datasetprofile.Section;
|
import eu.eudat.models.data.admin.components.datasetprofile.Section;
|
||||||
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -21,7 +20,7 @@ public class DatasetProfile {
|
||||||
private Short status;
|
private Short status;
|
||||||
private Short version;
|
private Short version;
|
||||||
private String language;
|
private String language;
|
||||||
private List<UserInfoListingModel> users;
|
private List<DmpUser> users;
|
||||||
|
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
|
@ -74,10 +73,10 @@ public class DatasetProfile {
|
||||||
this.language = language;
|
this.language = language;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserInfoListingModel> getUsers() {
|
public List<DmpUser> getUsers() {
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
public void setUsers(List<UserInfoListingModel> users) {
|
public void setUsers(List<DmpUser> users) {
|
||||||
this.users = users;
|
this.users = users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package eu.eudat.models.data.dashboard.recent.model;
|
package eu.eudat.models.data.dashboard.recent.model;
|
||||||
|
|
||||||
|
import eu.eudat.model.DmpUser;
|
||||||
import eu.eudat.models.DataModel;
|
import eu.eudat.models.DataModel;
|
||||||
import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel;
|
import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel;
|
||||||
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
|
|
||||||
import eu.eudat.data.old.queryableentity.DataEntity;
|
import eu.eudat.data.old.queryableentity.DataEntity;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -20,7 +20,7 @@ public abstract class RecentActivityModel<T extends DataEntity, S extends DataMo
|
||||||
private Date publishedAt;
|
private Date publishedAt;
|
||||||
private DatasetProfileOverviewModel profile;
|
private DatasetProfileOverviewModel profile;
|
||||||
private int type;
|
private int type;
|
||||||
private List<UserInfoListingModel> users;
|
private List<DmpUser> users;
|
||||||
private Boolean isPublic;
|
private Boolean isPublic;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
@ -111,11 +111,11 @@ public abstract class RecentActivityModel<T extends DataEntity, S extends DataMo
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserInfoListingModel> getUsers() {
|
public List<DmpUser> getUsers() {
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUsers(List<UserInfoListingModel> users) {
|
public void setUsers(List<DmpUser> users) {
|
||||||
this.users = users;
|
this.users = users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
package eu.eudat.models.data.dashboard.recent.model;
|
package eu.eudat.models.data.dashboard.recent.model;
|
||||||
|
|
||||||
import eu.eudat.data.DescriptionEntity;
|
import eu.eudat.data.DescriptionEntity;
|
||||||
import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel;
|
|
||||||
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class RecentDatasetModel extends RecentActivityModel<DescriptionEntity, RecentDatasetModel> {
|
public class RecentDatasetModel extends RecentActivityModel<DescriptionEntity, RecentDatasetModel> {
|
||||||
private String dmp;
|
private String dmp;
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
package eu.eudat.models.data.dashboard.recent.model;
|
package eu.eudat.models.data.dashboard.recent.model;
|
||||||
|
|
||||||
import eu.eudat.data.DmpEntity;
|
import eu.eudat.data.DmpEntity;
|
||||||
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
|
|
||||||
import eu.eudat.models.data.urls.DatasetUrlListing;
|
import eu.eudat.models.data.urls.DatasetUrlListing;
|
||||||
|
|
||||||
import jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class RecentDmpModel extends RecentActivityModel<DmpEntity, RecentDmpModel> {
|
public class RecentDmpModel extends RecentActivityModel<DmpEntity, RecentDmpModel> {
|
||||||
private Map<String, Object> extraProperties;
|
private Map<String, Object> extraProperties;
|
||||||
|
|
|
@ -2,17 +2,15 @@ package eu.eudat.models.data.dataset;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.DescriptionStatus;
|
import eu.eudat.commons.enums.DescriptionStatus;
|
||||||
import eu.eudat.data.DescriptionEntity;
|
import eu.eudat.data.DescriptionEntity;
|
||||||
|
import eu.eudat.model.DmpUser;
|
||||||
import eu.eudat.models.DataModel;
|
import eu.eudat.models.DataModel;
|
||||||
import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel;
|
import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel;
|
||||||
import eu.eudat.models.data.grant.GrantOverviewModel;
|
import eu.eudat.models.data.grant.GrantOverviewModel;
|
||||||
import eu.eudat.models.data.listingmodels.DataManagementPlanOverviewModel;
|
import eu.eudat.models.data.listingmodels.DataManagementPlanOverviewModel;
|
||||||
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
|
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class DatasetOverviewModel implements DataModel<DescriptionEntity, DatasetOverviewModel> {
|
public class DatasetOverviewModel implements DataModel<DescriptionEntity, DatasetOverviewModel> {
|
||||||
|
|
||||||
|
@ -20,7 +18,7 @@ public class DatasetOverviewModel implements DataModel<DescriptionEntity, Datase
|
||||||
private String label;
|
private String label;
|
||||||
private DescriptionStatus status;
|
private DescriptionStatus status;
|
||||||
private DatasetProfileOverviewModel datasetTemplate;
|
private DatasetProfileOverviewModel datasetTemplate;
|
||||||
private List<UserInfoListingModel> users;
|
private List<DmpUser> users;
|
||||||
private DataManagementPlanOverviewModel dmp;
|
private DataManagementPlanOverviewModel dmp;
|
||||||
private GrantOverviewModel grant;
|
private GrantOverviewModel grant;
|
||||||
private String description;
|
private String description;
|
||||||
|
@ -56,11 +54,11 @@ public class DatasetOverviewModel implements DataModel<DescriptionEntity, Datase
|
||||||
this.datasetTemplate = datasetTemplate;
|
this.datasetTemplate = datasetTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserInfoListingModel> getUsers() {
|
public List<DmpUser> getUsers() {
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUsers(List<UserInfoListingModel> users) {
|
public void setUsers(List<DmpUser> users) {
|
||||||
this.users = users;
|
this.users = users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,17 @@
|
||||||
package eu.eudat.models.data.dmp;
|
package eu.eudat.models.data.dmp;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import eu.eudat.commons.enums.DescriptionStatus;
|
|
||||||
import eu.eudat.commons.enums.IsActive;
|
|
||||||
import eu.eudat.data.DmpBlueprintEntity;
|
|
||||||
import eu.eudat.data.DmpEntity;
|
import eu.eudat.data.DmpEntity;
|
||||||
import eu.eudat.data.old.*;
|
import eu.eudat.model.DmpUser;
|
||||||
import eu.eudat.model.doi.Doi;
|
import eu.eudat.model.doi.Doi;
|
||||||
import eu.eudat.models.DataModel;
|
import eu.eudat.models.DataModel;
|
||||||
import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
|
import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
|
||||||
import eu.eudat.models.data.dynamicfields.DynamicFieldWithValue;
|
import eu.eudat.models.data.dynamicfields.DynamicFieldWithValue;
|
||||||
import eu.eudat.models.data.funder.Funder;
|
import eu.eudat.models.data.funder.Funder;
|
||||||
import eu.eudat.models.data.helpermodels.Tuple;
|
import eu.eudat.models.data.helpermodels.Tuple;
|
||||||
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
|
|
||||||
import eu.eudat.models.data.grant.Grant;
|
import eu.eudat.models.data.grant.Grant;
|
||||||
import eu.eudat.models.data.project.Project;
|
import eu.eudat.models.data.project.Project;
|
||||||
import net.minidev.json.JSONObject;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class DataManagementPlan implements DataModel<DmpEntity, DataManagementPlan> {
|
public class DataManagementPlan implements DataModel<DmpEntity, DataManagementPlan> {
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
@ -40,7 +32,7 @@ public class DataManagementPlan implements DataModel<DmpEntity, DataManagementPl
|
||||||
private Date created;
|
private Date created;
|
||||||
private List<DynamicFieldWithValue> dynamicFields;
|
private List<DynamicFieldWithValue> dynamicFields;
|
||||||
private Map<String, Object> properties;
|
private Map<String, Object> properties;
|
||||||
private List<UserInfoListingModel> users;
|
private List<DmpUser> users;
|
||||||
private List<Doi> dois;
|
private List<Doi> dois;
|
||||||
private Project project;
|
private Project project;
|
||||||
private Funder funder;
|
private Funder funder;
|
||||||
|
@ -174,10 +166,10 @@ public class DataManagementPlan implements DataModel<DmpEntity, DataManagementPl
|
||||||
this.datasets = datasets;
|
this.datasets = datasets;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserInfoListingModel> getUsers() {
|
public List<DmpUser> getUsers() {
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
public void setUsers(List<UserInfoListingModel> users) {
|
public void setUsers(List<DmpUser> users) {
|
||||||
this.users = users;
|
this.users = users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package eu.eudat.models.data.dmp;
|
package eu.eudat.models.data.dmp;
|
||||||
|
|
||||||
import eu.eudat.data.DmpEntity;
|
import eu.eudat.data.DmpEntity;
|
||||||
|
import eu.eudat.model.DmpUser;
|
||||||
import eu.eudat.models.DataModel;
|
import eu.eudat.models.DataModel;
|
||||||
import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
|
import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
|
||||||
import eu.eudat.models.data.dynamicfields.DynamicFieldWithValue;
|
import eu.eudat.models.data.dynamicfields.DynamicFieldWithValue;
|
||||||
import eu.eudat.models.data.funder.FunderDMPEditorModel;
|
import eu.eudat.models.data.funder.FunderDMPEditorModel;
|
||||||
import eu.eudat.models.data.grant.GrantDMPEditorModel;
|
import eu.eudat.models.data.grant.GrantDMPEditorModel;
|
||||||
import eu.eudat.models.data.helpermodels.Tuple;
|
import eu.eudat.models.data.helpermodels.Tuple;
|
||||||
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
|
|
||||||
import eu.eudat.models.data.project.ProjectDMPEditorModel;
|
import eu.eudat.models.data.project.ProjectDMPEditorModel;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -34,7 +34,7 @@ public class DataManagementPlanEditorModel implements DataModel<DmpEntity, DataM
|
||||||
private Date created;
|
private Date created;
|
||||||
private List<DynamicFieldWithValue> dynamicFields;
|
private List<DynamicFieldWithValue> dynamicFields;
|
||||||
private Map<String, Object> properties;
|
private Map<String, Object> properties;
|
||||||
private List<UserInfoListingModel> users;
|
private List<DmpUser> users;
|
||||||
private List<UUID> datasetsToBeFinalized;
|
private List<UUID> datasetsToBeFinalized;
|
||||||
private ProjectDMPEditorModel project;
|
private ProjectDMPEditorModel project;
|
||||||
private FunderDMPEditorModel funder;
|
private FunderDMPEditorModel funder;
|
||||||
|
@ -164,10 +164,10 @@ public class DataManagementPlanEditorModel implements DataModel<DmpEntity, DataM
|
||||||
this.datasets = datasets;
|
this.datasets = datasets;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserInfoListingModel> getUsers() {
|
public List<DmpUser> getUsers() {
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
public void setUsers(List<UserInfoListingModel> users) {
|
public void setUsers(List<DmpUser> users) {
|
||||||
this.users = users;
|
this.users = users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package eu.eudat.models.data.listingmodels;
|
||||||
|
|
||||||
import eu.eudat.data.DmpEntity;
|
import eu.eudat.data.DmpEntity;
|
||||||
import eu.eudat.data.old.Grant;
|
import eu.eudat.data.old.Grant;
|
||||||
|
import eu.eudat.model.DmpUser;
|
||||||
import eu.eudat.models.DataModel;
|
import eu.eudat.models.DataModel;
|
||||||
import eu.eudat.models.data.urls.DatasetUrlListing;
|
import eu.eudat.models.data.urls.DatasetUrlListing;
|
||||||
|
|
||||||
|
@ -22,7 +23,7 @@ public class DataManagementPlanListingModel implements DataModel<DmpEntity, Data
|
||||||
private int status;
|
private int status;
|
||||||
private UUID groupId;
|
private UUID groupId;
|
||||||
private List<DatasetUrlListing> datasets;
|
private List<DatasetUrlListing> datasets;
|
||||||
private List<UserInfoListingModel> users;
|
private List<DmpUser> users;
|
||||||
private Date finalizedAt;
|
private Date finalizedAt;
|
||||||
private Boolean isPublic;
|
private Boolean isPublic;
|
||||||
private Date publishedAt;
|
private Date publishedAt;
|
||||||
|
@ -91,10 +92,10 @@ public class DataManagementPlanListingModel implements DataModel<DmpEntity, Data
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserInfoListingModel> getUsers() {
|
public List<DmpUser> getUsers() {
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
public void setUsers(List<UserInfoListingModel> users) {
|
public void setUsers(List<DmpUser> users) {
|
||||||
this.users = users;
|
this.users = users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import eu.eudat.commons.enums.DescriptionStatus;
|
import eu.eudat.commons.enums.DescriptionStatus;
|
||||||
import eu.eudat.commons.enums.IsActive;
|
import eu.eudat.commons.enums.IsActive;
|
||||||
import eu.eudat.data.DmpEntity;
|
import eu.eudat.data.DmpEntity;
|
||||||
|
import eu.eudat.model.DmpUser;
|
||||||
import eu.eudat.model.doi.Doi;
|
import eu.eudat.model.doi.Doi;
|
||||||
import eu.eudat.models.DataModel;
|
import eu.eudat.models.DataModel;
|
||||||
import eu.eudat.models.data.dataset.DatasetOverviewModel;
|
import eu.eudat.models.data.dataset.DatasetOverviewModel;
|
||||||
|
@ -32,7 +33,7 @@ public class DataManagementPlanOverviewModel implements DataModel<DmpEntity, Dat
|
||||||
private List<DatasetOverviewModel> datasets;
|
private List<DatasetOverviewModel> datasets;
|
||||||
private List<AssociatedProfile> associatedProfiles;
|
private List<AssociatedProfile> associatedProfiles;
|
||||||
private List<Researcher> researchers;
|
private List<Researcher> researchers;
|
||||||
private List<UserInfoListingModel> users;
|
private List<DmpUser> users;
|
||||||
private String description;
|
private String description;
|
||||||
private boolean isPublic;
|
private boolean isPublic;
|
||||||
private Date publishedAt;
|
private Date publishedAt;
|
||||||
|
@ -130,10 +131,10 @@ public class DataManagementPlanOverviewModel implements DataModel<DmpEntity, Dat
|
||||||
this.associatedProfiles = associatedProfiles;
|
this.associatedProfiles = associatedProfiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserInfoListingModel> getUsers() {
|
public List<DmpUser> getUsers() {
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
public void setUsers(List<UserInfoListingModel> users) {
|
public void setUsers(List<DmpUser> users) {
|
||||||
this.users = users;
|
this.users = users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package eu.eudat.models.data.listingmodels;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.DescriptionStatus;
|
import eu.eudat.commons.enums.DescriptionStatus;
|
||||||
import eu.eudat.data.DescriptionEntity;
|
import eu.eudat.data.DescriptionEntity;
|
||||||
|
import eu.eudat.model.DmpUser;
|
||||||
import eu.eudat.models.DataModel;
|
import eu.eudat.models.DataModel;
|
||||||
import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel;
|
import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel;
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ public class DatasetListingModel implements DataModel<DescriptionEntity, Dataset
|
||||||
private Instant finalizedAt;
|
private Instant finalizedAt;
|
||||||
private Instant dmpPublishedAt;
|
private Instant dmpPublishedAt;
|
||||||
private int version;
|
private int version;
|
||||||
private List<UserInfoListingModel> users;
|
private List<DmpUser> users;
|
||||||
private Boolean isPublic;
|
private Boolean isPublic;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
@ -118,11 +119,11 @@ public class DatasetListingModel implements DataModel<DescriptionEntity, Dataset
|
||||||
this.version = version;
|
this.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserInfoListingModel> getUsers() {
|
public List<DmpUser> getUsers() {
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUsers(List<UserInfoListingModel> users) {
|
public void setUsers(List<DmpUser> users) {
|
||||||
this.users = users;
|
this.users = users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
package eu.eudat.models.data.listingmodels;
|
|
||||||
|
|
||||||
import eu.eudat.commons.enums.DmpUserRole;
|
|
||||||
import eu.eudat.data.DmpUserEntity;
|
|
||||||
import eu.eudat.data.UserEntity;
|
|
||||||
import eu.eudat.models.DataModel;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class UserInfoListingModel implements DataModel<DmpUserEntity, UserInfoListingModel> {
|
|
||||||
|
|
||||||
private UUID id;
|
|
||||||
private String name;
|
|
||||||
private int role;
|
|
||||||
|
|
||||||
public UUID getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(UUID id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getRole() {
|
|
||||||
return role;
|
|
||||||
}
|
|
||||||
public void setRole(int role) {
|
|
||||||
this.role = role;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserInfoListingModel fromDataModel(DmpUserEntity entity) {
|
|
||||||
// this.id = entity.getUser().getId(); //TODO
|
|
||||||
// this.name = entity.getUser().getName();
|
|
||||||
// this.role = entity.getRole();
|
|
||||||
// this.email = entity.getUser().getEmail();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DmpUserEntity toDataModel() {
|
|
||||||
DmpUserEntity entity = new DmpUserEntity();
|
|
||||||
entity.setId(this.getId());
|
|
||||||
entity.setRole(DmpUserRole.of((short) this.getRole()));
|
|
||||||
UserEntity userInfo = new UserEntity();
|
|
||||||
userInfo.setName(this.getName());
|
|
||||||
// entity.setUser(userInfo);
|
|
||||||
return entity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getHint() {
|
|
||||||
return "UserInfoListingModel";
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,9 +2,9 @@ package eu.eudat.publicapi.models.listingmodels;
|
||||||
|
|
||||||
import eu.eudat.data.DmpEntity;
|
import eu.eudat.data.DmpEntity;
|
||||||
import eu.eudat.data.old.Grant;
|
import eu.eudat.data.old.Grant;
|
||||||
|
import eu.eudat.model.DmpUser;
|
||||||
import eu.eudat.models.DataModel;
|
import eu.eudat.models.DataModel;
|
||||||
import eu.eudat.publicapi.models.researcher.ResearcherPublicModel;
|
import eu.eudat.publicapi.models.researcher.ResearcherPublicModel;
|
||||||
import eu.eudat.publicapi.models.user.UserInfoPublicModel;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -17,7 +17,7 @@ public class DataManagementPlanPublicListingModel implements DataModel<DmpEntity
|
||||||
private Date modifiedAt;
|
private Date modifiedAt;
|
||||||
private int version;
|
private int version;
|
||||||
private UUID groupId;
|
private UUID groupId;
|
||||||
private List<UserInfoPublicModel> users;
|
private List<DmpUser> users;
|
||||||
private List<ResearcherPublicModel> researchers;
|
private List<ResearcherPublicModel> researchers;
|
||||||
private Date finalizedAt;
|
private Date finalizedAt;
|
||||||
private Date publishedAt;
|
private Date publishedAt;
|
||||||
|
@ -71,10 +71,10 @@ public class DataManagementPlanPublicListingModel implements DataModel<DmpEntity
|
||||||
this.groupId = groupId;
|
this.groupId = groupId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserInfoPublicModel> getUsers() {
|
public List<DmpUser> getUsers() {
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
public void setUsers(List<UserInfoPublicModel> users) {
|
public void setUsers(List<DmpUser> users) {
|
||||||
this.users = users;
|
this.users = users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package eu.eudat.publicapi.models.listingmodels;
|
package eu.eudat.publicapi.models.listingmodels;
|
||||||
|
|
||||||
import eu.eudat.data.DescriptionEntity;
|
import eu.eudat.data.DescriptionEntity;
|
||||||
|
import eu.eudat.model.DmpUser;
|
||||||
import eu.eudat.models.DataModel;
|
import eu.eudat.models.DataModel;
|
||||||
import eu.eudat.publicapi.models.datasetprofile.DatasetProfilePublicModel;
|
import eu.eudat.publicapi.models.datasetprofile.DatasetProfilePublicModel;
|
||||||
import eu.eudat.publicapi.models.user.UserInfoPublicModel;
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -21,7 +21,7 @@ public class DatasetPublicListingModel implements DataModel<DescriptionEntity, D
|
||||||
private Date finalizedAt;
|
private Date finalizedAt;
|
||||||
private Date dmpPublishedAt;
|
private Date dmpPublishedAt;
|
||||||
private int version;
|
private int version;
|
||||||
private List<UserInfoPublicModel> users;
|
private List<DmpUser> users;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -107,11 +107,11 @@ public class DatasetPublicListingModel implements DataModel<DescriptionEntity, D
|
||||||
this.version = version;
|
this.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserInfoPublicModel> getUsers() {
|
public List<DmpUser> getUsers() {
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUsers(List<UserInfoPublicModel> users) {
|
public void setUsers(List<DmpUser> users) {
|
||||||
this.users = users;
|
this.users = users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import eu.eudat.data.DescriptionEntity;
|
||||||
import eu.eudat.data.DescriptionTemplateEntity;
|
import eu.eudat.data.DescriptionTemplateEntity;
|
||||||
import eu.eudat.commons.types.xml.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import eu.eudat.data.DmpEntity;
|
import eu.eudat.data.DmpEntity;
|
||||||
|
import eu.eudat.model.DmpUser;
|
||||||
import eu.eudat.models.DataModel;
|
import eu.eudat.models.DataModel;
|
||||||
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
||||||
import eu.eudat.publicapi.models.associatedprofile.AssociatedProfilePublicModel;
|
import eu.eudat.publicapi.models.associatedprofile.AssociatedProfilePublicModel;
|
||||||
|
@ -16,7 +17,6 @@ import eu.eudat.publicapi.models.doi.DoiPublicModel;
|
||||||
import eu.eudat.publicapi.models.grant.GrantPublicOverviewModel;
|
import eu.eudat.publicapi.models.grant.GrantPublicOverviewModel;
|
||||||
import eu.eudat.publicapi.models.organisation.OrganizationPublicModel;
|
import eu.eudat.publicapi.models.organisation.OrganizationPublicModel;
|
||||||
import eu.eudat.publicapi.models.researcher.ResearcherPublicModel;
|
import eu.eudat.publicapi.models.researcher.ResearcherPublicModel;
|
||||||
import eu.eudat.publicapi.models.user.UserInfoPublicModel;
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public class DataManagementPlanPublicModel implements DataModel<DmpEntity, DataM
|
||||||
private List<DatasetPublicModel> datasets;
|
private List<DatasetPublicModel> datasets;
|
||||||
private List<AssociatedProfilePublicModel> associatedProfiles;
|
private List<AssociatedProfilePublicModel> associatedProfiles;
|
||||||
private List<ResearcherPublicModel> researchers;
|
private List<ResearcherPublicModel> researchers;
|
||||||
private List<UserInfoPublicModel> users;
|
private List<DmpUser> users;
|
||||||
private String description;
|
private String description;
|
||||||
private Date publishedAt;
|
private Date publishedAt;
|
||||||
private List<DoiPublicModel> dois;
|
private List<DoiPublicModel> dois;
|
||||||
|
@ -127,10 +127,10 @@ public class DataManagementPlanPublicModel implements DataModel<DmpEntity, DataM
|
||||||
this.associatedProfiles = associatedProfiles;
|
this.associatedProfiles = associatedProfiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserInfoPublicModel> getUsers() {
|
public List<DmpUser> getUsers() {
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
public void setUsers(List<UserInfoPublicModel> users) {
|
public void setUsers(List<DmpUser> users) {
|
||||||
this.users = users;
|
this.users = users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
package eu.eudat.publicapi.models.user;
|
|
||||||
|
|
||||||
import eu.eudat.commons.enums.DmpUserRole;
|
|
||||||
import eu.eudat.data.DmpUserEntity;
|
|
||||||
import eu.eudat.data.UserEntity;
|
|
||||||
import eu.eudat.models.DataModel;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class UserInfoPublicModel implements DataModel<DmpUserEntity, UserInfoPublicModel> {
|
|
||||||
private UUID id;
|
|
||||||
private String name;
|
|
||||||
private int role;
|
|
||||||
|
|
||||||
public UUID getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(UUID id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getRole() {
|
|
||||||
return role;
|
|
||||||
}
|
|
||||||
public void setRole(int role) {
|
|
||||||
this.role = role;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserInfoPublicModel fromDataModel(DmpUserEntity entity) {
|
|
||||||
// this.id = entity.getUser().getId(); //TODO
|
|
||||||
// this.name = entity.getUser().getName();
|
|
||||||
// this.role = entity.getRole().getValue();
|
|
||||||
// this.email = entity.getUser().getEmail();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DmpUserEntity toDataModel() {
|
|
||||||
DmpUserEntity entity = new DmpUserEntity();
|
|
||||||
entity.setId(this.getId());
|
|
||||||
entity.setRole(DmpUserRole.of((short)this.getRole()));
|
|
||||||
UserEntity userInfo = new UserEntity();
|
|
||||||
userInfo.setName(this.getName());
|
|
||||||
// entity.setUser(userInfo);
|
|
||||||
return entity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getHint() {
|
|
||||||
return "UserInfoListingModel";
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue