add action confirmation entity and dmp notifications
This commit is contained in:
parent
e4d2cde296
commit
e2c352bf00
|
@ -35,6 +35,8 @@ public class AuditableAction {
|
||||||
public static final EventId Dmp_PersistNewVersion = new EventId(5005, "Dmp_PersistNewVersion");
|
public static final EventId Dmp_PersistNewVersion = new EventId(5005, "Dmp_PersistNewVersion");
|
||||||
public static final EventId Dmp_Assign_Users = new EventId(5006, "Dmp_Assign_Users");
|
public static final EventId Dmp_Assign_Users = new EventId(5006, "Dmp_Assign_Users");
|
||||||
public static final EventId Dmp_RemoveUser = new EventId(5007, "Dmp_RemoveUser");
|
public static final EventId Dmp_RemoveUser = new EventId(5007, "Dmp_RemoveUser");
|
||||||
|
public static final EventId Dmp_Invite_Users = new EventId(5008, "Dmp_Invite_Users");
|
||||||
|
public static final EventId Dmp_Invite_Accept = new EventId(5009, "Dmp_Invite_Accept");
|
||||||
|
|
||||||
public static final EventId Description_Query = new EventId(6000, "Description_Query");
|
public static final EventId Description_Query = new EventId(6000, "Description_Query");
|
||||||
public static final EventId Description_Lookup = new EventId(6001, "Description_Lookup");
|
public static final EventId Description_Lookup = new EventId(6001, "Description_Lookup");
|
||||||
|
|
|
@ -78,6 +78,7 @@ public final class Permission {
|
||||||
public static String ExportDmp = "ExportDmp";
|
public static String ExportDmp = "ExportDmp";
|
||||||
public static String FinalizeDmp = "FinalizeDmp";
|
public static String FinalizeDmp = "FinalizeDmp";
|
||||||
public static String AssignDmpUsers = "AssignDmpUsers";
|
public static String AssignDmpUsers = "AssignDmpUsers";
|
||||||
|
public static String InviteDmpUsers = "InviteDmpUsers";
|
||||||
|
|
||||||
//DmpBlueprint
|
//DmpBlueprint
|
||||||
public static String BrowseDmpBlueprint = "BrowseDmpBlueprint";
|
public static String BrowseDmpBlueprint = "BrowseDmpBlueprint";
|
||||||
|
@ -169,5 +170,10 @@ public final class Permission {
|
||||||
public static String EditLock = "EditLock";
|
public static String EditLock = "EditLock";
|
||||||
public static String DeleteLock = "DeleteLock";
|
public static String DeleteLock = "DeleteLock";
|
||||||
|
|
||||||
|
//ActionConfirmation
|
||||||
|
public static String BrowseActionConfirmation = "BrowseActionConfirmation";
|
||||||
|
public static String EditActionConfirmation = "EditActionConfirmation";
|
||||||
|
public static String DeleteActionConfirmation = "DeleteActionConfirmation";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package eu.eudat.commons.enums;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public enum ActionConfirmationStatus implements DatabaseEnum<Short> {
|
||||||
|
|
||||||
|
Requested((short) 0),
|
||||||
|
Accepted((short) 1);
|
||||||
|
|
||||||
|
private final Short value;
|
||||||
|
|
||||||
|
ActionConfirmationStatus(Short value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@JsonValue
|
||||||
|
public Short getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Map<Short, ActionConfirmationStatus> map = EnumUtils.getEnumValueMap(ActionConfirmationStatus.class);
|
||||||
|
|
||||||
|
public static ActionConfirmationStatus of(Short i) {
|
||||||
|
return map.get(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package eu.eudat.commons.enums;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public enum ActionConfirmationType implements DatabaseEnum<Short> {
|
||||||
|
|
||||||
|
MergeAccount((short) 0),
|
||||||
|
RemoveCredential((short) 1),
|
||||||
|
DmpInvitation((short) 2);
|
||||||
|
|
||||||
|
private final Short value;
|
||||||
|
|
||||||
|
ActionConfirmationType(Short value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@JsonValue
|
||||||
|
public Short getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Map<Short, ActionConfirmationType> map = EnumUtils.getEnumValueMap(ActionConfirmationType.class);
|
||||||
|
|
||||||
|
public static ActionConfirmationType of(Short i) {
|
||||||
|
return map.get(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package eu.eudat.commons.types.actionconfirmation;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DmpUserRole;
|
||||||
|
import jakarta.xml.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "dmp-invitation")
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public class DmpInvitationEntity {
|
||||||
|
|
||||||
|
@XmlAttribute(name = "email")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@XmlAttribute(name = "dmp")
|
||||||
|
private UUID dmpId;
|
||||||
|
|
||||||
|
@XmlAttribute(name = "dmp-role")
|
||||||
|
private DmpUserRole role;
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getDmpId() {
|
||||||
|
return dmpId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDmpId(UUID dmpId) {
|
||||||
|
this.dmpId = dmpId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpUserRole getRole() {
|
||||||
|
return role;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRole(DmpUserRole role) {
|
||||||
|
this.role = role;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package eu.eudat.commons.types.actionconfirmation;
|
||||||
|
|
||||||
|
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "email-confirmation")
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public class EmailConfirmationEntity {
|
||||||
|
|
||||||
|
@XmlAttribute(name = "email")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,85 +5,94 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
@ConfigurationProperties(prefix = "notification")
|
@ConfigurationProperties(prefix = "notification")
|
||||||
public class NotificationProperties {
|
public class NotificationProperties {
|
||||||
|
|
||||||
private String confirmation;
|
private String dmpInvitation;
|
||||||
private String dataManagementPlan;
|
private String dmpModified;
|
||||||
private String finalised;
|
private String dmpFinalised;
|
||||||
private String mergeConfirmation;
|
private String descriptionModified;
|
||||||
private String modified;
|
private String descriptionFinalised;
|
||||||
private String modifiedFinalised;
|
private String mergeAccountConfirmation;
|
||||||
private String publish;
|
private String removeCredentialConfirmation;
|
||||||
private String template;
|
private String dmpDeposit;
|
||||||
private String unlinkConfirmation;
|
private String descriptionTemplateInvitation;
|
||||||
|
private String emailExpirationTimeSeconds;
|
||||||
|
|
||||||
public String getConfirmation() {
|
public String getDmpInvitation() {
|
||||||
return confirmation;
|
return dmpInvitation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConfirmation(String confirmation) {
|
public void setDmpInvitation(String dmpInvitation) {
|
||||||
this.confirmation = confirmation;
|
this.dmpInvitation = dmpInvitation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDataManagementPlan() {
|
public String getDmpModified() {
|
||||||
return dataManagementPlan;
|
return dmpModified;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDataManagementPlan(String dataManagementPlan) {
|
public void setDmpModified(String dmpModified) {
|
||||||
this.dataManagementPlan = dataManagementPlan;
|
this.dmpModified = dmpModified;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFinalised() {
|
public String getDmpFinalised() {
|
||||||
return finalised;
|
return dmpFinalised;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFinalised(String finalised) {
|
public void setDmpFinalised(String dmpFinalised) {
|
||||||
this.finalised = finalised;
|
this.dmpFinalised = dmpFinalised;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMergeConfirmation() {
|
public String getDescriptionModified() {
|
||||||
return mergeConfirmation;
|
return descriptionModified;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMergeConfirmation(String mergeConfirmation) {
|
public void setDescriptionModified(String descriptionModified) {
|
||||||
this.mergeConfirmation = mergeConfirmation;
|
this.descriptionModified = descriptionModified;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getModified() {
|
public String getDescriptionFinalised() {
|
||||||
return modified;
|
return descriptionFinalised;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setModified(String modified) {
|
public void setDescriptionFinalised(String descriptionFinalised) {
|
||||||
this.modified = modified;
|
this.descriptionFinalised = descriptionFinalised;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getModifiedFinalised() {
|
public String getMergeAccountConfirmation() {
|
||||||
return modifiedFinalised;
|
return mergeAccountConfirmation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setModifiedFinalised(String modifiedFinalised) {
|
public void setMergeAccountConfirmation(String mergeAccountConfirmation) {
|
||||||
this.modifiedFinalised = modifiedFinalised;
|
this.mergeAccountConfirmation = mergeAccountConfirmation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPublish() {
|
public String getRemoveCredentialConfirmation() {
|
||||||
return publish;
|
return removeCredentialConfirmation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPublish(String publish) {
|
public void setRemoveCredentialConfirmation(String removeCredentialConfirmation) {
|
||||||
this.publish = publish;
|
this.removeCredentialConfirmation = removeCredentialConfirmation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTemplate() {
|
public String getDmpDeposit() {
|
||||||
return template;
|
return dmpDeposit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTemplate(String template) {
|
public void setDmpDeposit(String dmpDeposit) {
|
||||||
this.template = template;
|
this.dmpDeposit = dmpDeposit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUnlinkConfirmation() {
|
public String getDescriptionTemplateInvitation() {
|
||||||
return unlinkConfirmation;
|
return descriptionTemplateInvitation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUnlinkConfirmation(String unlinkConfirmation) {
|
public void setDescriptionTemplateInvitation(String descriptionTemplateInvitation) {
|
||||||
this.unlinkConfirmation = unlinkConfirmation;
|
this.descriptionTemplateInvitation = descriptionTemplateInvitation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmailExpirationTimeSeconds() {
|
||||||
|
return emailExpirationTimeSeconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmailExpirationTimeSeconds(String emailExpirationTimeSeconds) {
|
||||||
|
this.emailExpirationTimeSeconds = emailExpirationTimeSeconds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,143 @@
|
||||||
|
package eu.eudat.data;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.ActionConfirmationStatus;
|
||||||
|
import eu.eudat.commons.enums.ActionConfirmationType;
|
||||||
|
import eu.eudat.commons.enums.IsActive;
|
||||||
|
import eu.eudat.data.converters.enums.ActionConfirmationStatusConverter;
|
||||||
|
import eu.eudat.data.converters.enums.ActionConfirmationTypeConverter;
|
||||||
|
import eu.eudat.data.converters.enums.IsActiveConverter;
|
||||||
|
import eu.eudat.data.tenant.TenantScopedBaseEntity;
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "\"ActionConfirmation\"")
|
||||||
|
public class ActionConfirmationEntity extends TenantScopedBaseEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
|
private UUID id;
|
||||||
|
public static final String _id = "id";
|
||||||
|
|
||||||
|
@Column(name = "type", nullable = false)
|
||||||
|
@Convert(converter = ActionConfirmationTypeConverter.class)
|
||||||
|
private ActionConfirmationType type;
|
||||||
|
public static final String _type = "type";
|
||||||
|
|
||||||
|
@Column(name = "status", nullable = false)
|
||||||
|
@Convert(converter = ActionConfirmationStatusConverter.class)
|
||||||
|
private ActionConfirmationStatus status;
|
||||||
|
public static final String _status = "status";
|
||||||
|
|
||||||
|
@Column(name = "\"token\"", updatable = false, nullable = false)
|
||||||
|
private String token;
|
||||||
|
public static final String _token = "token";
|
||||||
|
|
||||||
|
@Column(name = "\"data\"", nullable = false)
|
||||||
|
private String data;
|
||||||
|
public static final String _data = "data";
|
||||||
|
|
||||||
|
@Column(name = "\"expires_at\"", nullable = false)
|
||||||
|
private Instant expiresAt;
|
||||||
|
public static final String _expiresAt = "expiresAt";
|
||||||
|
|
||||||
|
@Column(name = "created_by", columnDefinition = "uuid", nullable = false)
|
||||||
|
private UUID createdById;
|
||||||
|
public static final String _createdById = "createdById";
|
||||||
|
|
||||||
|
@Column(name = "created_at", nullable = false)
|
||||||
|
private Instant createdAt;
|
||||||
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
|
@Column(name = "updated_at", nullable = false)
|
||||||
|
private Instant updatedAt;
|
||||||
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
|
@Column(name = "is_active", nullable = false)
|
||||||
|
@Convert(converter = IsActiveConverter.class)
|
||||||
|
private IsActive isActive;
|
||||||
|
|
||||||
|
public static final String _isActive = "isActive";
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(UUID id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(ActionConfirmationType type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationStatus getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(ActionConfirmationStatus status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getToken() {
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToken(String token) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(String data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getExpiresAt() {
|
||||||
|
return expiresAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpiresAt(Instant expiresAt) {
|
||||||
|
this.expiresAt = expiresAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getCreatedById() {
|
||||||
|
return createdById;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedById(UUID createdById) {
|
||||||
|
this.createdById = createdById;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedAt(Instant createdAt) {
|
||||||
|
this.createdAt = createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getUpdatedAt() {
|
||||||
|
return updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdatedAt(Instant updatedAt) {
|
||||||
|
this.updatedAt = updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IsActive getIsActive() {
|
||||||
|
return isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsActive(IsActive isActive) {
|
||||||
|
this.isActive = isActive;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package eu.eudat.data.converters.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.ActionConfirmationStatus;
|
||||||
|
import jakarta.persistence.Converter;
|
||||||
|
|
||||||
|
@Converter
|
||||||
|
public class ActionConfirmationStatusConverter extends DatabaseEnumConverter<ActionConfirmationStatus, Short> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ActionConfirmationStatus of(Short i) {
|
||||||
|
return ActionConfirmationStatus.of(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package eu.eudat.data.converters.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.ActionConfirmationType;
|
||||||
|
import jakarta.persistence.Converter;
|
||||||
|
|
||||||
|
@Converter
|
||||||
|
public class ActionConfirmationTypeConverter extends DatabaseEnumConverter<ActionConfirmationType, Short> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ActionConfirmationType of(Short i) {
|
||||||
|
return ActionConfirmationType.of(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,157 @@
|
||||||
|
package eu.eudat.model;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.ActionConfirmationStatus;
|
||||||
|
import eu.eudat.commons.enums.ActionConfirmationType;
|
||||||
|
import eu.eudat.commons.enums.IsActive;
|
||||||
|
import eu.eudat.model.actionconfirmation.DmpInvitation;
|
||||||
|
import eu.eudat.model.actionconfirmation.EmailConfirmation;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class ActionConfirmation {
|
||||||
|
|
||||||
|
private UUID id;
|
||||||
|
public static final String _id = "id";
|
||||||
|
|
||||||
|
private ActionConfirmationType type;
|
||||||
|
public static final String _type = "type";
|
||||||
|
|
||||||
|
private ActionConfirmationStatus status;
|
||||||
|
public static final String _status = "status";
|
||||||
|
|
||||||
|
private String token;
|
||||||
|
public static final String _token = "token";
|
||||||
|
|
||||||
|
private EmailConfirmation emailConfirmation;
|
||||||
|
public static final String _emailConfirmation = "emailConfirmation";
|
||||||
|
|
||||||
|
private DmpInvitation dmpInvitation;
|
||||||
|
public static final String _dmpInvitation = "dmpInvitation";
|
||||||
|
|
||||||
|
private Instant expiresAt;
|
||||||
|
public static final String _expiresAt = "expiresAt";
|
||||||
|
|
||||||
|
private User createdBy;
|
||||||
|
public static final String _createdBy = "createdBy";
|
||||||
|
|
||||||
|
private Instant createdAt;
|
||||||
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
|
private Instant updatedAt;
|
||||||
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
|
|
||||||
|
private IsActive isActive;
|
||||||
|
public static final String _isActive = "isActive";
|
||||||
|
|
||||||
|
private Tenant tenant;
|
||||||
|
public static final String _tenant = "tenant";
|
||||||
|
|
||||||
|
private String hash;
|
||||||
|
public static final String _hash = "hash";
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(UUID id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(ActionConfirmationType type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationStatus getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(ActionConfirmationStatus status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getToken() {
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToken(String token) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EmailConfirmation getEmailConfirmation() {
|
||||||
|
return emailConfirmation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmailConfirmation(EmailConfirmation emailConfirmation) {
|
||||||
|
this.emailConfirmation = emailConfirmation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpInvitation getDmpInvitation() {
|
||||||
|
return dmpInvitation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDmpInvitation(DmpInvitation dmpInvitation) {
|
||||||
|
this.dmpInvitation = dmpInvitation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getExpiresAt() {
|
||||||
|
return expiresAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpiresAt(Instant expiresAt) {
|
||||||
|
this.expiresAt = expiresAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getCreatedBy() {
|
||||||
|
return createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedBy(User createdBy) {
|
||||||
|
this.createdBy = createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Tenant getTenant() {
|
||||||
|
return tenant;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTenant(Tenant tenant) {
|
||||||
|
this.tenant = tenant;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedAt(Instant createdAt) {
|
||||||
|
this.createdAt = createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getUpdatedAt() {
|
||||||
|
return updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdatedAt(Instant updatedAt) {
|
||||||
|
this.updatedAt = updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IsActive getIsActive() {
|
||||||
|
return isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsActive(IsActive isActive) {
|
||||||
|
this.isActive = isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHash() {
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHash(String hash) {
|
||||||
|
this.hash = hash;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package eu.eudat.model.actionconfirmation;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DmpUserRole;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class DmpInvitation {
|
||||||
|
|
||||||
|
private String email;
|
||||||
|
public static final String _email = "email";
|
||||||
|
|
||||||
|
private UUID dmpId;
|
||||||
|
public static final String _dmpId = "dmpId";
|
||||||
|
|
||||||
|
private DmpUserRole role;
|
||||||
|
public static final String _role = "role";
|
||||||
|
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getDmpId() {
|
||||||
|
return dmpId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDmpId(UUID dmpId) {
|
||||||
|
this.dmpId = dmpId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpUserRole getRole() {
|
||||||
|
return role;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRole(DmpUserRole role) {
|
||||||
|
this.role = role;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package eu.eudat.model.actionconfirmation;
|
||||||
|
|
||||||
|
|
||||||
|
public class EmailConfirmation {
|
||||||
|
|
||||||
|
private String email;
|
||||||
|
public static final String _email = "email";
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,156 @@
|
||||||
|
package eu.eudat.model.builder;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.XmlHandlingService;
|
||||||
|
import eu.eudat.commons.enums.ActionConfirmationType;
|
||||||
|
import eu.eudat.commons.types.actionconfirmation.DmpInvitationEntity;
|
||||||
|
import eu.eudat.commons.types.actionconfirmation.EmailConfirmationEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.data.ActionConfirmationEntity;
|
||||||
|
import eu.eudat.model.ActionConfirmation;
|
||||||
|
import eu.eudat.model.Tenant;
|
||||||
|
import eu.eudat.model.User;
|
||||||
|
import eu.eudat.model.builder.actionconfirmation.DmpInvitationBuilder;
|
||||||
|
import eu.eudat.model.builder.actionconfirmation.EmailConfirmationBuilder;
|
||||||
|
import eu.eudat.query.TenantQuery;
|
||||||
|
import eu.eudat.query.UserQuery;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class ActionConfirmationBuilder extends BaseBuilder<ActionConfirmation, ActionConfirmationEntity> {
|
||||||
|
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
private final QueryFactory queryFactory;
|
||||||
|
private final XmlHandlingService xmlHandlingService;
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
@Autowired
|
||||||
|
public ActionConfirmationBuilder(ConventionService conventionService, BuilderFactory builderFactory, QueryFactory queryFactory, XmlHandlingService xmlHandlingService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(ActionConfirmationBuilder.class)));
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
|
this.queryFactory = queryFactory;
|
||||||
|
this.xmlHandlingService = xmlHandlingService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationBuilder authorize(EnumSet<AuthorizationFlags> values){
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<ActionConfirmation> build(FieldSet fields, List<ActionConfirmationEntity> data) throws MyApplicationException {
|
||||||
|
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0),Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size) .orElse(0));
|
||||||
|
this.logger.trace(new DataLogEntry("requested fields",fields));
|
||||||
|
if(fields == null || data == null || fields.isEmpty()) return new ArrayList<>();
|
||||||
|
|
||||||
|
FieldSet emailConfirmationFields = fields.extractPrefixed(this.asPrefix(ActionConfirmation._emailConfirmation));
|
||||||
|
FieldSet dmpInvitationFields = fields.extractPrefixed(this.asPrefix(ActionConfirmation._dmpInvitation));
|
||||||
|
|
||||||
|
FieldSet userFields = fields.extractPrefixed(this.asPrefix(ActionConfirmation._createdBy));
|
||||||
|
Map<UUID, User> userMap = this.collectUsers(userFields, data);
|
||||||
|
|
||||||
|
FieldSet tenantFields = fields.extractPrefixed(this.asPrefix(ActionConfirmation._tenant));
|
||||||
|
Map<UUID, Tenant> tenantMap = this.collectTenants(tenantFields, data);
|
||||||
|
|
||||||
|
List<ActionConfirmation> models = new ArrayList<>();
|
||||||
|
for(ActionConfirmationEntity d : data){
|
||||||
|
ActionConfirmation m = new ActionConfirmation();
|
||||||
|
if(fields.hasField(this.asIndexer(ActionConfirmation._id))) m.setId(d.getId());
|
||||||
|
if(fields.hasField(this.asIndexer(ActionConfirmation._type))) m.setType(d.getType());
|
||||||
|
if(fields.hasField(this.asIndexer(ActionConfirmation._status))) m.setStatus(d.getStatus());
|
||||||
|
if(fields.hasField(this.asIndexer(ActionConfirmation._token))) m.setToken(d.getToken());
|
||||||
|
if(fields.hasField(this.asIndexer(ActionConfirmation._isActive))) m.setIsActive(d.getIsActive());
|
||||||
|
if(fields.hasField(this.asIndexer(ActionConfirmation._expiresAt))) m.setExpiresAt(d.getExpiresAt());
|
||||||
|
if (!emailConfirmationFields.isEmpty() && d.getData() != null){
|
||||||
|
if (d.getType().equals(ActionConfirmationType.MergeAccount) || d.getType().equals(ActionConfirmationType.RemoveCredential)){
|
||||||
|
EmailConfirmationEntity emailConfirmation = this.xmlHandlingService.fromXmlSafe(EmailConfirmationEntity.class, d.getData());
|
||||||
|
m.setEmailConfirmation(this.builderFactory.builder(EmailConfirmationBuilder.class).authorize(this.authorize).build(emailConfirmationFields, emailConfirmation));
|
||||||
|
}else{
|
||||||
|
DmpInvitationEntity dmpInvitation = this.xmlHandlingService.fromXmlSafe(DmpInvitationEntity.class, d.getData());
|
||||||
|
m.setDmpInvitation(this.builderFactory.builder(DmpInvitationBuilder.class).authorize(this.authorize).build(dmpInvitationFields, dmpInvitation));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (!userFields.isEmpty() && userMap != null && userMap.containsKey(d.getCreatedById())) m.setCreatedBy(userMap.get(d.getCreatedById()));
|
||||||
|
if (!tenantFields.isEmpty() && tenantMap != null && tenantMap.containsKey(d.getTenantId())) m.setTenant(tenantMap.get(d.getTenantId()));
|
||||||
|
if(fields.hasField(this.asIndexer(ActionConfirmation._createdAt))) m.setCreatedAt(d.getCreatedAt());
|
||||||
|
if(fields.hasField(this.asIndexer(ActionConfirmation._updatedAt))) m.setUpdatedAt(d.getUpdatedAt());
|
||||||
|
if(fields.hasField(this.asIndexer(ActionConfirmation._hash))) m.setHash(this.hashValue(d.getUpdatedAt()));
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items",Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Map<UUID, User> collectUsers(FieldSet fields, List<ActionConfirmationEntity> datas) throws MyApplicationException {
|
||||||
|
if (fields.isEmpty() || datas.isEmpty()) return null;
|
||||||
|
this.logger.debug("checking related - {}", User.class.getSimpleName());
|
||||||
|
|
||||||
|
Map<UUID, User> itemMap = null;
|
||||||
|
if (!fields.hasOtherField(this.asIndexer(User._id))) {
|
||||||
|
itemMap = this.asEmpty(
|
||||||
|
datas.stream().map(x -> x.getCreatedById()).distinct().collect(Collectors.toList()),
|
||||||
|
x -> {
|
||||||
|
User item = new User();
|
||||||
|
item.setId(x);
|
||||||
|
return item;
|
||||||
|
},
|
||||||
|
x -> x.getId());
|
||||||
|
} else {
|
||||||
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(User._id);
|
||||||
|
UserQuery q = this.queryFactory.query(UserQuery.class).authorize(this.authorize).ids(datas.stream().map(x -> x.getCreatedById()).distinct().collect(Collectors.toList()));
|
||||||
|
itemMap = this.builderFactory.builder(UserBuilder.class).authorize(this.authorize).asForeignKey(q, clone, x -> x.getId());
|
||||||
|
}
|
||||||
|
if (!fields.hasField(User._id)) {
|
||||||
|
itemMap.values().stream().filter(x -> x != null).map(x -> {
|
||||||
|
x.setId(null);
|
||||||
|
return x;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
return itemMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<UUID, Tenant> collectTenants(FieldSet fields, List<ActionConfirmationEntity> datas) throws MyApplicationException {
|
||||||
|
if (fields.isEmpty() || datas.isEmpty()) return null;
|
||||||
|
this.logger.debug("checking related - {}", Tenant.class.getSimpleName());
|
||||||
|
|
||||||
|
Map<UUID, Tenant> itemMap = null;
|
||||||
|
if (!fields.hasOtherField(this.asIndexer(Tenant._id))) {
|
||||||
|
itemMap = this.asEmpty(
|
||||||
|
datas.stream().map(x -> x.getTenantId()).distinct().collect(Collectors.toList()),
|
||||||
|
x -> {
|
||||||
|
Tenant item = new Tenant();
|
||||||
|
item.setId(x);
|
||||||
|
return item;
|
||||||
|
},
|
||||||
|
x -> x.getId());
|
||||||
|
} else {
|
||||||
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Tenant._id);
|
||||||
|
TenantQuery q = this.queryFactory.query(TenantQuery.class).authorize(this.authorize).ids(datas.stream().map(x -> x.getTenantId()).distinct().collect(Collectors.toList()));
|
||||||
|
itemMap = this.builderFactory.builder(TenantBuilder.class).authorize(this.authorize).asForeignKey(q, clone, x -> x.getId());
|
||||||
|
}
|
||||||
|
if (!fields.hasField(Tenant._id)) {
|
||||||
|
itemMap.values().stream().filter(x -> x != null).map(x -> {
|
||||||
|
x.setId(null);
|
||||||
|
return x;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
return itemMap;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package eu.eudat.model.builder.actionconfirmation;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.types.actionconfirmation.DmpInvitationEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.actionconfirmation.DmpInvitation;
|
||||||
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class DmpInvitationBuilder extends BaseBuilder<DmpInvitation, DmpInvitationEntity> {
|
||||||
|
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public DmpInvitationBuilder(
|
||||||
|
ConventionService conventionService, BuilderFactory builderFactory) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpInvitationBuilder.class)));
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpInvitationBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DmpInvitation> build(FieldSet fields, List<DmpInvitationEntity> data) throws MyApplicationException {
|
||||||
|
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
||||||
|
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
List<DmpInvitation> models = new ArrayList<>();
|
||||||
|
for (DmpInvitationEntity d : data) {
|
||||||
|
DmpInvitation m = new DmpInvitation();
|
||||||
|
if (fields.hasField(this.asIndexer(DmpInvitation._email))) m.setEmail(d.getEmail());
|
||||||
|
if (fields.hasField(this.asIndexer(DmpInvitation._dmpId))) m.setDmpId(d.getDmpId());
|
||||||
|
if (fields.hasField(this.asIndexer(DmpInvitation._role))) m.setRole(d.getRole());
|
||||||
|
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
package eu.eudat.model.builder.actionconfirmation;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.types.actionconfirmation.EmailConfirmationEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.actionconfirmation.EmailConfirmation;
|
||||||
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class EmailConfirmationBuilder extends BaseBuilder<EmailConfirmation, EmailConfirmationEntity> {
|
||||||
|
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public EmailConfirmationBuilder(
|
||||||
|
ConventionService conventionService, BuilderFactory builderFactory) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(EmailConfirmationBuilder.class)));
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EmailConfirmationBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EmailConfirmation> build(FieldSet fields, List<EmailConfirmationEntity> data) throws MyApplicationException {
|
||||||
|
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
||||||
|
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
List<EmailConfirmation> models = new ArrayList<>();
|
||||||
|
for (EmailConfirmationEntity d : data) {
|
||||||
|
EmailConfirmation m = new EmailConfirmation();
|
||||||
|
if (fields.hasField(this.asIndexer(EmailConfirmation._email))) m.setEmail(d.getEmail());
|
||||||
|
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
package eu.eudat.model.deleter;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.IsActive;
|
||||||
|
import eu.eudat.data.ActionConfirmationEntity;
|
||||||
|
import eu.eudat.query.ActionConfirmationQuery;
|
||||||
|
import gr.cite.tools.data.deleter.Deleter;
|
||||||
|
import gr.cite.tools.data.deleter.DeleterFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
|
import jakarta.persistence.EntityManager;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.management.InvalidApplicationException;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class ActionConfirmationDeleter implements Deleter {
|
||||||
|
|
||||||
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(ActionConfirmationDeleter.class));
|
||||||
|
private final EntityManager entityManager;
|
||||||
|
|
||||||
|
protected final QueryFactory queryFactory;
|
||||||
|
|
||||||
|
protected final DeleterFactory deleterFactory;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ActionConfirmationDeleter(
|
||||||
|
EntityManager entityManager,
|
||||||
|
QueryFactory queryFactory,
|
||||||
|
DeleterFactory deleterFactory
|
||||||
|
) {
|
||||||
|
this.entityManager = entityManager;
|
||||||
|
this.queryFactory = queryFactory;
|
||||||
|
this.deleterFactory = deleterFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteAndSaveByIds(List<UUID> ids) throws InvalidApplicationException {
|
||||||
|
logger.debug(new MapLogEntry("collecting to delete").And("count", Optional.ofNullable(ids).map(List::size).orElse(0)).And("ids", ids));
|
||||||
|
List<ActionConfirmationEntity> data = this.queryFactory.query(ActionConfirmationQuery.class).ids(ids).collect();
|
||||||
|
logger.trace("retrieved {} items", Optional.ofNullable(data).map(List::size).orElse(0));
|
||||||
|
this.deleteAndSave(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteAndSave(List<ActionConfirmationEntity> data) throws InvalidApplicationException {
|
||||||
|
logger.debug("will delete {} items", Optional.ofNullable(data).map(List::size).orElse(0));
|
||||||
|
this.delete(data);
|
||||||
|
logger.trace("saving changes");
|
||||||
|
this.entityManager.flush();
|
||||||
|
logger.trace("changes saved");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete(List<ActionConfirmationEntity> data) throws InvalidApplicationException {
|
||||||
|
logger.debug("will delete {} items", Optional.ofNullable(data).map(List::size).orElse(0));
|
||||||
|
if (data == null || data.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Instant now = Instant.now();
|
||||||
|
|
||||||
|
for (ActionConfirmationEntity item : data) {
|
||||||
|
logger.trace("deleting item {}", item.getId());
|
||||||
|
item.setIsActive(IsActive.Inactive);
|
||||||
|
item.setUpdatedAt(now);
|
||||||
|
logger.trace("updating item");
|
||||||
|
this.entityManager.merge(item);
|
||||||
|
logger.trace("updated item");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,122 @@
|
||||||
|
package eu.eudat.model.persist;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.ActionConfirmationStatus;
|
||||||
|
import eu.eudat.commons.enums.ActionConfirmationType;
|
||||||
|
import eu.eudat.commons.validation.FieldNotNullIfOtherSet;
|
||||||
|
import eu.eudat.commons.validation.ValidEnum;
|
||||||
|
import eu.eudat.commons.validation.ValidId;
|
||||||
|
import eu.eudat.model.persist.actionconfirmation.DmpInvitationPersist;
|
||||||
|
import eu.eudat.model.persist.actionconfirmation.EmailConfirmationPersist;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@FieldNotNullIfOtherSet(message = "{validation.hashempty}")
|
||||||
|
public class ActionConfirmationPersist {
|
||||||
|
@ValidId(message = "{validation.invalidid}")
|
||||||
|
private UUID id;
|
||||||
|
|
||||||
|
@ValidEnum(message = "{validation.empty}")
|
||||||
|
private ActionConfirmationType type;
|
||||||
|
|
||||||
|
@ValidEnum(message = "{validation.empty}")
|
||||||
|
private ActionConfirmationStatus status;
|
||||||
|
|
||||||
|
@NotNull(message = "{validation.empty}")
|
||||||
|
@NotEmpty(message = "{validation.empty}")
|
||||||
|
private String token;
|
||||||
|
|
||||||
|
@Valid
|
||||||
|
private DmpInvitationPersist dmpInvitation;
|
||||||
|
|
||||||
|
@Valid
|
||||||
|
private EmailConfirmationPersist emailConfirmation;
|
||||||
|
|
||||||
|
@NotNull(message = "{validation.empty}")
|
||||||
|
@Valid
|
||||||
|
private Instant expiresAt;
|
||||||
|
|
||||||
|
@NotNull(message = "{validation.empty}")
|
||||||
|
@Valid
|
||||||
|
private UUID createdById;
|
||||||
|
|
||||||
|
private String hash;
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(UUID id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(ActionConfirmationType type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationStatus getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(ActionConfirmationStatus status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getToken() {
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToken(String token) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpInvitationPersist getDmpInvitation() {
|
||||||
|
return dmpInvitation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDmpInvitation(DmpInvitationPersist dmpInvitation) {
|
||||||
|
this.dmpInvitation = dmpInvitation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EmailConfirmationPersist getEmailConfirmation() {
|
||||||
|
return emailConfirmation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmailConfirmation(EmailConfirmationPersist emailConfirmation) {
|
||||||
|
this.emailConfirmation = emailConfirmation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getExpiresAt() {
|
||||||
|
return expiresAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpiresAt(Instant expiresAt) {
|
||||||
|
this.expiresAt = expiresAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getCreatedById() {
|
||||||
|
return createdById;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedById(UUID createdById) {
|
||||||
|
this.createdById = createdById;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHash() {
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHash(String hash) {
|
||||||
|
this.hash = hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package eu.eudat.model.persist;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DmpUserRole;
|
||||||
|
import eu.eudat.commons.validation.ValidEnum;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DmpUserInvitePersist {
|
||||||
|
|
||||||
|
@Valid
|
||||||
|
private List<DmpUserInviteTypePersist> users;
|
||||||
|
|
||||||
|
@ValidEnum(message = "{validation.empty}")
|
||||||
|
private DmpUserRole role;
|
||||||
|
|
||||||
|
public List<DmpUserInviteTypePersist> getUsers() {
|
||||||
|
return users;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsers(List<DmpUserInviteTypePersist> users) {
|
||||||
|
this.users = users;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpUserRole getRole() {
|
||||||
|
return role;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRole(DmpUserRole role) {
|
||||||
|
this.role = role;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package eu.eudat.model.persist;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class DmpUserInviteTypePersist {
|
||||||
|
|
||||||
|
private UUID userId;
|
||||||
|
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
public UUID getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(UUID userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
package eu.eudat.model.persist.actionconfirmation;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DmpUserRole;
|
||||||
|
import eu.eudat.commons.validation.ValidEnum;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class DmpInvitationPersist {
|
||||||
|
|
||||||
|
@NotNull(message = "{validation.empty}")
|
||||||
|
@NotEmpty(message = "{validation.empty}")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@NotNull(message = "{validation.empty}")
|
||||||
|
@Valid
|
||||||
|
private UUID dmpId;
|
||||||
|
|
||||||
|
@ValidEnum(message = "{validation.empty}")
|
||||||
|
private DmpUserRole role;
|
||||||
|
|
||||||
|
public DmpInvitationPersist(String email, UUID dmpId, DmpUserRole role) {
|
||||||
|
this.email = email;
|
||||||
|
this.dmpId = dmpId;
|
||||||
|
this.role = role;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getDmpId() {
|
||||||
|
return dmpId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDmpId(UUID dmpId) {
|
||||||
|
this.dmpId = dmpId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpUserRole getRole() {
|
||||||
|
return role;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRole(DmpUserRole role) {
|
||||||
|
this.role = role;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package eu.eudat.model.persist.actionconfirmation;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
public class EmailConfirmationPersist {
|
||||||
|
|
||||||
|
@NotNull(message = "{validation.empty}")
|
||||||
|
@NotEmpty(message = "{validation.empty}")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
public EmailConfirmationPersist() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public EmailConfirmationPersist(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,271 @@
|
||||||
|
package eu.eudat.query;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.enums.ActionConfirmationStatus;
|
||||||
|
import eu.eudat.commons.enums.ActionConfirmationType;
|
||||||
|
import eu.eudat.commons.enums.IsActive;
|
||||||
|
import eu.eudat.commons.enums.LockTargetType;
|
||||||
|
import eu.eudat.data.ActionConfirmationEntity;
|
||||||
|
import eu.eudat.data.LockEntity;
|
||||||
|
import eu.eudat.data.TagEntity;
|
||||||
|
import eu.eudat.model.ActionConfirmation;
|
||||||
|
import eu.eudat.model.Tag;
|
||||||
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
import gr.cite.tools.data.query.QueryContext;
|
||||||
|
import jakarta.persistence.Tuple;
|
||||||
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class ActionConfirmationQuery extends QueryBase<ActionConfirmationEntity> {
|
||||||
|
|
||||||
|
private String like;
|
||||||
|
|
||||||
|
private Collection<UUID> ids;
|
||||||
|
|
||||||
|
private Collection<UUID> excludedIds;
|
||||||
|
|
||||||
|
private Collection<IsActive> isActives;
|
||||||
|
|
||||||
|
private Collection<UUID> createdByIds;
|
||||||
|
|
||||||
|
private Collection<ActionConfirmationType> types;
|
||||||
|
|
||||||
|
private Collection<ActionConfirmationStatus> statuses;
|
||||||
|
|
||||||
|
private Collection<String> tokens;
|
||||||
|
|
||||||
|
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
public ActionConfirmationQuery() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery like(String value) {
|
||||||
|
this.like = value;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery ids(UUID value) {
|
||||||
|
this.ids = List.of(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery ids(UUID... value) {
|
||||||
|
this.ids = Arrays.asList(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery ids(Collection<UUID> values) {
|
||||||
|
this.ids = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery excludedIds(Collection<UUID> values) {
|
||||||
|
this.excludedIds = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery excludedIds(UUID value) {
|
||||||
|
this.excludedIds = List.of(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery excludedIds(UUID... value) {
|
||||||
|
this.excludedIds = Arrays.asList(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery isActive(IsActive value) {
|
||||||
|
this.isActives = List.of(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery isActive(IsActive... value) {
|
||||||
|
this.isActives = Arrays.asList(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery isActive(Collection<IsActive> values) {
|
||||||
|
this.isActives = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery createdByIds(UUID value) {
|
||||||
|
this.createdByIds = List.of(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery createdByIds(UUID... value) {
|
||||||
|
this.createdByIds = Arrays.asList(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery createdByIds(Collection<UUID> values) {
|
||||||
|
this.createdByIds = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery types(ActionConfirmationType value) {
|
||||||
|
this.types = List.of(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery types(ActionConfirmationType... value) {
|
||||||
|
this.types = Arrays.asList(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery types(Collection<ActionConfirmationType> values) {
|
||||||
|
this.types = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery statuses(ActionConfirmationStatus value) {
|
||||||
|
this.statuses = List.of(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery statuses(ActionConfirmationStatus... value) {
|
||||||
|
this.statuses = Arrays.asList(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery statuses(Collection<ActionConfirmationStatus> values) {
|
||||||
|
this.statuses = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery tokens(String value) {
|
||||||
|
this.tokens = List.of(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery tokens(String... value) {
|
||||||
|
this.tokens = Arrays.asList(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionConfirmationQuery tokens(Collection<String> values) {
|
||||||
|
this.tokens = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ActionConfirmationQuery authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Boolean isFalseQuery() {
|
||||||
|
return
|
||||||
|
this.isEmpty(this.ids) ||
|
||||||
|
this.isEmpty(this.isActives) ||
|
||||||
|
this.isEmpty(this.excludedIds) ||
|
||||||
|
this.isEmpty(this.statuses) ||
|
||||||
|
this.isEmpty(this.types) ||
|
||||||
|
this.isEmpty(this.tokens) ||
|
||||||
|
this.isEmpty(this.createdByIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<ActionConfirmationEntity> entityClass() {
|
||||||
|
return ActionConfirmationEntity.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||||
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
|
if (this.like != null && !this.like.isEmpty()) {
|
||||||
|
predicates.add(queryContext.CriteriaBuilder.like(queryContext.Root.get(ActionConfirmationEntity._token), this.like));
|
||||||
|
}
|
||||||
|
if (this.ids != null) {
|
||||||
|
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(ActionConfirmationEntity._id));
|
||||||
|
for (UUID item : this.ids)
|
||||||
|
inClause.value(item);
|
||||||
|
predicates.add(inClause);
|
||||||
|
}
|
||||||
|
if (this.types != null) {
|
||||||
|
CriteriaBuilder.In<ActionConfirmationType> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(ActionConfirmationEntity._type));
|
||||||
|
for (ActionConfirmationType item : this.types)
|
||||||
|
inClause.value(item);
|
||||||
|
predicates.add(inClause);
|
||||||
|
}
|
||||||
|
if (this.excludedIds != null) {
|
||||||
|
CriteriaBuilder.In<UUID> notInClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(ActionConfirmationEntity._id));
|
||||||
|
for (UUID item : this.excludedIds)
|
||||||
|
notInClause.value(item);
|
||||||
|
predicates.add(notInClause.not());
|
||||||
|
}
|
||||||
|
if (this.isActives != null) {
|
||||||
|
CriteriaBuilder.In<IsActive> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(ActionConfirmationEntity._isActive));
|
||||||
|
for (IsActive item : this.isActives)
|
||||||
|
inClause.value(item);
|
||||||
|
predicates.add(inClause);
|
||||||
|
}
|
||||||
|
if (this.createdByIds != null) {
|
||||||
|
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(ActionConfirmationEntity._createdById));
|
||||||
|
for (UUID item : this.createdByIds)
|
||||||
|
inClause.value(item);
|
||||||
|
predicates.add(inClause);
|
||||||
|
}
|
||||||
|
if (this.tokens != null) {
|
||||||
|
CriteriaBuilder.In<String> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(ActionConfirmationEntity._token));
|
||||||
|
for (String item : this.tokens)
|
||||||
|
inClause.value(item);
|
||||||
|
predicates.add(inClause);
|
||||||
|
}
|
||||||
|
if (!predicates.isEmpty()) {
|
||||||
|
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||||
|
return queryContext.CriteriaBuilder.and(predicatesArray);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String fieldNameOf(FieldResolver item) {
|
||||||
|
if (item.match(ActionConfirmation._id)) return ActionConfirmationEntity._id;
|
||||||
|
else if (item.match(ActionConfirmation._type)) return ActionConfirmationEntity._type;
|
||||||
|
else if (item.match(ActionConfirmation._status)) return ActionConfirmationEntity._status;
|
||||||
|
else if (item.match(ActionConfirmation._token)) return ActionConfirmationEntity._token;
|
||||||
|
else if (item.match(ActionConfirmation._expiresAt)) return ActionConfirmationEntity._expiresAt;
|
||||||
|
else if (item.prefix(ActionConfirmation._emailConfirmation)) return ActionConfirmationEntity._data;
|
||||||
|
else if (item.prefix(ActionConfirmation._dmpInvitation)) return ActionConfirmationEntity._data;
|
||||||
|
else if (item.prefix(ActionConfirmation._createdBy)) return ActionConfirmationEntity._createdById;
|
||||||
|
else if (item.match(ActionConfirmation._createdBy)) return ActionConfirmationEntity._createdById;
|
||||||
|
else if (item.prefix(ActionConfirmation._tenant)) return ActionConfirmationEntity._tenantId;
|
||||||
|
else if (item.match(ActionConfirmation._createdAt)) return ActionConfirmationEntity._createdAt;
|
||||||
|
else if (item.match(ActionConfirmation._updatedAt)) return ActionConfirmationEntity._updatedAt;
|
||||||
|
else if (item.match(ActionConfirmation._hash)) return ActionConfirmationEntity._updatedAt;
|
||||||
|
else if (item.match(ActionConfirmation._isActive)) return ActionConfirmationEntity._isActive;
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ActionConfirmationEntity convert(Tuple tuple, Set<String> columns) {
|
||||||
|
ActionConfirmationEntity item = new ActionConfirmationEntity();
|
||||||
|
item.setId(QueryBase.convertSafe(tuple, columns, ActionConfirmationEntity._id, UUID.class));
|
||||||
|
item.setType(QueryBase.convertSafe(tuple, columns, ActionConfirmationEntity._type, ActionConfirmationType.class));
|
||||||
|
item.setStatus(QueryBase.convertSafe(tuple, columns, ActionConfirmationEntity._status, ActionConfirmationStatus.class));
|
||||||
|
item.setToken(QueryBase.convertSafe(tuple, columns, ActionConfirmationEntity._token, String.class));
|
||||||
|
item.setData(QueryBase.convertSafe(tuple, columns, ActionConfirmationEntity._data, String.class));
|
||||||
|
item.setExpiresAt(QueryBase.convertSafe(tuple, columns, ActionConfirmationEntity._expiresAt, Instant.class));
|
||||||
|
item.setCreatedById(QueryBase.convertSafe(tuple, columns, ActionConfirmationEntity._createdById, UUID.class));
|
||||||
|
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, ActionConfirmationEntity._createdAt, Instant.class));
|
||||||
|
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, ActionConfirmationEntity._updatedAt, Instant.class));
|
||||||
|
item.setIsActive(QueryBase.convertSafe(tuple, columns, ActionConfirmationEntity._isActive, IsActive.class));
|
||||||
|
item.setTenantId(QueryBase.convertSafe(tuple, columns, ActionConfirmationEntity._tenantId, UUID.class));
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package eu.eudat.service.actionconfirmation;
|
||||||
|
|
||||||
|
import eu.eudat.model.persist.ActionConfirmationPersist;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.exception.MyForbiddenException;
|
||||||
|
import gr.cite.tools.exception.MyNotFoundException;
|
||||||
|
import gr.cite.tools.exception.MyValidationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import jakarta.xml.bind.JAXBException;
|
||||||
|
|
||||||
|
import javax.management.InvalidApplicationException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public interface ActionConfirmationService {
|
||||||
|
|
||||||
|
void persist(ActionConfirmationPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException;
|
||||||
|
|
||||||
|
void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException, IOException;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,139 @@
|
||||||
|
package eu.eudat.service.actionconfirmation;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.Permission;
|
||||||
|
import eu.eudat.commons.XmlHandlingService;
|
||||||
|
import eu.eudat.commons.enums.ActionConfirmationType;
|
||||||
|
import eu.eudat.commons.enums.IsActive;
|
||||||
|
import eu.eudat.commons.types.actionconfirmation.DmpInvitationEntity;
|
||||||
|
import eu.eudat.commons.types.actionconfirmation.EmailConfirmationEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.data.ActionConfirmationEntity;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
import eu.eudat.model.ReferenceType;
|
||||||
|
import eu.eudat.model.deleter.ActionConfirmationDeleter;
|
||||||
|
import eu.eudat.model.persist.ActionConfirmationPersist;
|
||||||
|
import eu.eudat.model.persist.actionconfirmation.DmpInvitationPersist;
|
||||||
|
import eu.eudat.model.persist.actionconfirmation.EmailConfirmationPersist;
|
||||||
|
import eu.eudat.service.dmpblueprint.DmpBlueprintServiceImpl;
|
||||||
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.deleter.DeleterFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.exception.MyForbiddenException;
|
||||||
|
import gr.cite.tools.exception.MyNotFoundException;
|
||||||
|
import gr.cite.tools.exception.MyValidationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
|
import jakarta.persistence.EntityManager;
|
||||||
|
import jakarta.xml.bind.JAXBException;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.management.InvalidApplicationException;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ActionConfirmationServiceImpl implements ActionConfirmationService {
|
||||||
|
|
||||||
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpBlueprintServiceImpl.class));
|
||||||
|
private final EntityManager entityManager;
|
||||||
|
private final AuthorizationService authorizationService;
|
||||||
|
private final DeleterFactory deleterFactory;
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
private final ConventionService conventionService;
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
private final XmlHandlingService xmlHandlingService;
|
||||||
|
private final ErrorThesaurusProperties errors;
|
||||||
|
|
||||||
|
|
||||||
|
public ActionConfirmationServiceImpl(
|
||||||
|
EntityManager entityManager, AuthorizationService authorizationService, DeleterFactory deleterFactory, BuilderFactory builderFactory,
|
||||||
|
ConventionService conventionService, MessageSource messageSource,
|
||||||
|
XmlHandlingService xmlHandlingService, ErrorThesaurusProperties errors) {
|
||||||
|
this.entityManager = entityManager;
|
||||||
|
this.authorizationService = authorizationService;
|
||||||
|
this.deleterFactory = deleterFactory;
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
|
this.conventionService = conventionService;
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
this.xmlHandlingService = xmlHandlingService;
|
||||||
|
this.errors = errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void persist(ActionConfirmationPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException{
|
||||||
|
logger.debug(new MapLogEntry("persisting data").And("model", model).And("fields", fields));
|
||||||
|
|
||||||
|
// this.authorizationService.authorizeForce(Permission.EditActionConfirmation); TODO
|
||||||
|
|
||||||
|
Boolean isUpdate = this.conventionService.isValidGuid(model.getId());
|
||||||
|
|
||||||
|
ActionConfirmationEntity data;
|
||||||
|
if (isUpdate) {
|
||||||
|
data = this.entityManager.find(ActionConfirmationEntity.class, model.getId());
|
||||||
|
if (data == null)
|
||||||
|
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), ReferenceType.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
|
if (!this.conventionService.hashValue(data.getUpdatedAt()).equals(model.getHash())) throw new MyValidationException(this.errors.getHashConflict().getCode(), this.errors.getHashConflict().getMessage());
|
||||||
|
} else {
|
||||||
|
|
||||||
|
data = new ActionConfirmationEntity();
|
||||||
|
data.setId(UUID.randomUUID());
|
||||||
|
data.setIsActive(IsActive.Active);
|
||||||
|
data.setCreatedAt(Instant.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
data.setToken(model.getToken());
|
||||||
|
data.setCreatedById(model.getCreatedById());
|
||||||
|
data.setType(model.getType());
|
||||||
|
data.setStatus(model.getStatus());
|
||||||
|
data.setExpiresAt(model.getExpiresAt());
|
||||||
|
if (model.getType().equals(ActionConfirmationType.MergeAccount) || model.getType().equals(ActionConfirmationType.RemoveCredential)){
|
||||||
|
data.setData(this.xmlHandlingService.toXmlSafe(this.buildEmailConfirmationEntity(model.getEmailConfirmation())));
|
||||||
|
}else{
|
||||||
|
data.setData(this.xmlHandlingService.toXmlSafe(this.buildDmpInvitationEntity(model.getDmpInvitation())));
|
||||||
|
}
|
||||||
|
data.setUpdatedAt(Instant.now());
|
||||||
|
|
||||||
|
if (isUpdate) this.entityManager.merge(data);
|
||||||
|
else this.entityManager.persist(data);
|
||||||
|
|
||||||
|
this.entityManager.flush();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private @NotNull DmpInvitationEntity buildDmpInvitationEntity(DmpInvitationPersist persist){
|
||||||
|
DmpInvitationEntity data = new DmpInvitationEntity();
|
||||||
|
if (persist == null) return data;
|
||||||
|
|
||||||
|
data.setEmail(persist.getEmail());
|
||||||
|
data.setRole(persist.getRole());
|
||||||
|
data.setDmpId(persist.getDmpId());
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
private @NotNull EmailConfirmationEntity buildEmailConfirmationEntity(EmailConfirmationPersist persist){
|
||||||
|
EmailConfirmationEntity data = new EmailConfirmationEntity();
|
||||||
|
if (persist == null) return data;
|
||||||
|
|
||||||
|
data.setEmail(persist.getEmail());
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException {
|
||||||
|
logger.debug("deleting : {}", id);
|
||||||
|
|
||||||
|
this.authorizationService.authorizeForce(Permission.DeleteActionConfirmation);
|
||||||
|
|
||||||
|
this.deleterFactory.deleter(ActionConfirmationDeleter.class).deleteAndSaveByIds(List.of(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package eu.eudat.service.dmp;
|
package eu.eudat.service.dmp;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import eu.eudat.data.DmpEntity;
|
||||||
import eu.eudat.data.DmpUserEntity;
|
import eu.eudat.data.DmpUserEntity;
|
||||||
import eu.eudat.model.Dmp;
|
import eu.eudat.model.Dmp;
|
||||||
import eu.eudat.model.DmpUser;
|
import eu.eudat.model.DmpUser;
|
||||||
|
@ -39,4 +40,8 @@ public interface DmpService {
|
||||||
|
|
||||||
ResponseEntity<byte[]> export(UUID id, DmpExportType exportType);
|
ResponseEntity<byte[]> export(UUID id, DmpExportType exportType);
|
||||||
|
|
||||||
|
void inviteUsers(UUID id, DmpUserInvitePersist model) throws InvalidApplicationException, JAXBException;
|
||||||
|
|
||||||
|
void dmpInvitationAccept(String token) throws InvalidApplicationException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,34 +6,44 @@ import eu.eudat.authorization.Permission;
|
||||||
import eu.eudat.commons.JsonHandlingService;
|
import eu.eudat.commons.JsonHandlingService;
|
||||||
import eu.eudat.commons.XmlHandlingService;
|
import eu.eudat.commons.XmlHandlingService;
|
||||||
import eu.eudat.commons.enums.*;
|
import eu.eudat.commons.enums.*;
|
||||||
|
import eu.eudat.commons.enums.notification.NotificationContactType;
|
||||||
import eu.eudat.commons.scope.user.UserScope;
|
import eu.eudat.commons.scope.user.UserScope;
|
||||||
|
import eu.eudat.commons.types.actionconfirmation.DmpInvitationEntity;
|
||||||
import eu.eudat.commons.types.dmp.DmpBlueprintValueEntity;
|
import eu.eudat.commons.types.dmp.DmpBlueprintValueEntity;
|
||||||
import eu.eudat.commons.types.dmp.DmpContactEntity;
|
import eu.eudat.commons.types.dmp.DmpContactEntity;
|
||||||
import eu.eudat.commons.types.dmp.DmpPropertiesEntity;
|
import eu.eudat.commons.types.dmp.DmpPropertiesEntity;
|
||||||
|
import eu.eudat.commons.types.notification.*;
|
||||||
import eu.eudat.commons.types.reference.DefinitionEntity;
|
import eu.eudat.commons.types.reference.DefinitionEntity;
|
||||||
import eu.eudat.commons.types.reference.FieldEntity;
|
import eu.eudat.commons.types.reference.FieldEntity;
|
||||||
|
import eu.eudat.configurations.notification.NotificationProperties;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
import eu.eudat.data.*;
|
import eu.eudat.data.*;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
import eu.eudat.event.DmpTouchedEvent;
|
import eu.eudat.event.DmpTouchedEvent;
|
||||||
import eu.eudat.event.EventBroker;
|
import eu.eudat.event.EventBroker;
|
||||||
|
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEvent;
|
||||||
|
import eu.eudat.integrationevent.outbox.notification.NotificationIntegrationEventHandler;
|
||||||
import eu.eudat.model.Dmp;
|
import eu.eudat.model.Dmp;
|
||||||
import eu.eudat.model.DmpUser;
|
import eu.eudat.model.DmpUser;
|
||||||
import eu.eudat.model.Reference;
|
import eu.eudat.model.Reference;
|
||||||
|
import eu.eudat.model.UserContactInfo;
|
||||||
import eu.eudat.model.builder.DmpBuilder;
|
import eu.eudat.model.builder.DmpBuilder;
|
||||||
import eu.eudat.model.builder.DmpUserBuilder;
|
import eu.eudat.model.builder.DmpUserBuilder;
|
||||||
import eu.eudat.model.deleter.*;
|
import eu.eudat.model.deleter.*;
|
||||||
import eu.eudat.model.persist.*;
|
import eu.eudat.model.persist.*;
|
||||||
|
import eu.eudat.model.persist.actionconfirmation.DmpInvitationPersist;
|
||||||
import eu.eudat.model.persist.dmpproperties.DmpBlueprintValuePersist;
|
import eu.eudat.model.persist.dmpproperties.DmpBlueprintValuePersist;
|
||||||
import eu.eudat.model.persist.dmpproperties.DmpContactPersist;
|
import eu.eudat.model.persist.dmpproperties.DmpContactPersist;
|
||||||
import eu.eudat.model.persist.dmpproperties.DmpPropertiesPersist;
|
import eu.eudat.model.persist.dmpproperties.DmpPropertiesPersist;
|
||||||
import eu.eudat.model.persist.referencedefinition.DefinitionPersist;
|
import eu.eudat.model.persist.referencedefinition.DefinitionPersist;
|
||||||
import eu.eudat.model.persist.referencedefinition.FieldPersist;
|
import eu.eudat.model.persist.referencedefinition.FieldPersist;
|
||||||
import eu.eudat.query.*;
|
import eu.eudat.query.*;
|
||||||
|
import eu.eudat.service.actionconfirmation.ActionConfirmationService;
|
||||||
import eu.eudat.service.description.DescriptionService;
|
import eu.eudat.service.description.DescriptionService;
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.deleter.DeleterFactory;
|
import gr.cite.tools.data.deleter.DeleterFactory;
|
||||||
|
import gr.cite.tools.data.query.Ordering;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
import gr.cite.tools.exception.MyForbiddenException;
|
import gr.cite.tools.exception.MyForbiddenException;
|
||||||
|
@ -94,6 +104,12 @@ public class DmpServiceImpl implements DmpService {
|
||||||
|
|
||||||
private final DescriptionService descriptionService;
|
private final DescriptionService descriptionService;
|
||||||
|
|
||||||
|
private final NotificationIntegrationEventHandler eventHandler;
|
||||||
|
|
||||||
|
private final NotificationProperties notificationProperties;
|
||||||
|
|
||||||
|
private final ActionConfirmationService actionConfirmationService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public DmpServiceImpl(
|
public DmpServiceImpl(
|
||||||
EntityManager entityManager,
|
EntityManager entityManager,
|
||||||
|
@ -106,7 +122,7 @@ public class DmpServiceImpl implements DmpService {
|
||||||
MessageSource messageSource,
|
MessageSource messageSource,
|
||||||
XmlHandlingService xmlHandlingService,
|
XmlHandlingService xmlHandlingService,
|
||||||
JsonHandlingService jsonHandlingService,
|
JsonHandlingService jsonHandlingService,
|
||||||
UserScope userScope, EventBroker eventBroker, DescriptionService descriptionService) {
|
UserScope userScope, EventBroker eventBroker, DescriptionService descriptionService, NotificationIntegrationEventHandler eventHandler, NotificationProperties notificationProperties, ActionConfirmationService actionConfirmationService) {
|
||||||
this.entityManager = entityManager;
|
this.entityManager = entityManager;
|
||||||
this.authorizationService = authorizationService;
|
this.authorizationService = authorizationService;
|
||||||
this.deleterFactory = deleterFactory;
|
this.deleterFactory = deleterFactory;
|
||||||
|
@ -120,6 +136,9 @@ public class DmpServiceImpl implements DmpService {
|
||||||
this.userScope = userScope;
|
this.userScope = userScope;
|
||||||
this.eventBroker = eventBroker;
|
this.eventBroker = eventBroker;
|
||||||
this.descriptionService = descriptionService;
|
this.descriptionService = descriptionService;
|
||||||
|
this.eventHandler = eventHandler;
|
||||||
|
this.notificationProperties = notificationProperties;
|
||||||
|
this.actionConfirmationService = actionConfirmationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dmp persist(DmpPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JsonProcessingException {
|
public Dmp persist(DmpPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JsonProcessingException {
|
||||||
|
@ -133,9 +152,65 @@ public class DmpServiceImpl implements DmpService {
|
||||||
|
|
||||||
this.eventBroker.emit(new DmpTouchedEvent(data.getId()));
|
this.eventBroker.emit(new DmpTouchedEvent(data.getId()));
|
||||||
|
|
||||||
|
this.sendNotification(data);
|
||||||
|
|
||||||
return this.builderFactory.builder(DmpBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, Dmp._id, Dmp._hash), data);
|
return this.builderFactory.builder(DmpBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, Dmp._id, Dmp._hash), data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendNotification(DmpEntity dmp) throws InvalidApplicationException {
|
||||||
|
List<DmpUserEntity> existingUsers = this.queryFactory.query(DmpUserQuery.class)
|
||||||
|
.dmpIds(dmp.getId())
|
||||||
|
.isActives(IsActive.Active)
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
if (existingUsers == null || existingUsers.size() <= 1){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (DmpUserEntity dmpUser : existingUsers) {
|
||||||
|
if (!dmpUser.getUserId().equals(this.userScope.getUserIdSafe())){
|
||||||
|
UserEntity user = this.queryFactory.query(UserQuery.class).ids(dmpUser.getUserId()).first();
|
||||||
|
if (user != null){
|
||||||
|
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
|
||||||
|
event.setUserId(this.userScope.getUserId());
|
||||||
|
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).userIds(user.getId());
|
||||||
|
query.setOrder(new Ordering().addAscending(UserContactInfo._ordinal));
|
||||||
|
|
||||||
|
List<ContactPair> contactPairs = new ArrayList<>();
|
||||||
|
contactPairs.add(new ContactPair(ContactInfoType.Email, query.first().getValue()));
|
||||||
|
NotificationContactData contactData = new NotificationContactData(contactPairs, null, null);
|
||||||
|
event.setContactHint(jsonHandlingService.toJsonSafe(contactData));
|
||||||
|
event.setContactTypeHint(NotificationContactType.EMAIL);
|
||||||
|
|
||||||
|
event = this.applyNotificationType(dmp.getStatus(), event);
|
||||||
|
NotificationFieldData data = new NotificationFieldData();
|
||||||
|
List<FieldInfo> fieldInfoList = new ArrayList<>();
|
||||||
|
fieldInfoList.add(new FieldInfo("{recipient}", DataType.String, user.getName()));
|
||||||
|
fieldInfoList.add(new FieldInfo("{reasonName}", DataType.String, this.queryFactory.query(UserQuery.class).ids(this.userScope.getUserId()).first().getName()));
|
||||||
|
fieldInfoList.add(new FieldInfo("{name}", DataType.String, dmp.getLabel()));
|
||||||
|
fieldInfoList.add(new FieldInfo("{id}", DataType.String, dmp.getId().toString()));
|
||||||
|
data.setFields(fieldInfoList);
|
||||||
|
event.setData(jsonHandlingService.toJsonSafe(data));
|
||||||
|
|
||||||
|
eventHandler.handle(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private NotificationIntegrationEvent applyNotificationType(DmpStatus status, NotificationIntegrationEvent event) throws InvalidApplicationException {
|
||||||
|
switch (status) {
|
||||||
|
case Draft:
|
||||||
|
event.setNotificationType(UUID.fromString(notificationProperties.getDmpModified()));
|
||||||
|
return event;
|
||||||
|
case Finalized:
|
||||||
|
event.setNotificationType(UUID.fromString(notificationProperties.getDmpFinalised()));
|
||||||
|
return event;
|
||||||
|
default:
|
||||||
|
throw new InvalidApplicationException("Unsupported Dmp Status.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException, IOException {
|
public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException, IOException {
|
||||||
logger.debug("deleting dmp: {}", id);
|
logger.debug("deleting dmp: {}", id);
|
||||||
|
|
||||||
|
@ -611,4 +686,80 @@ public class DmpServiceImpl implements DmpService {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// invites
|
||||||
|
public void inviteUsers(UUID id, DmpUserInvitePersist model) throws InvalidApplicationException, JAXBException {
|
||||||
|
|
||||||
|
this.authorizationService.authorizeForce(Permission.InviteDmpUsers);
|
||||||
|
|
||||||
|
DmpEntity dmp = this.queryFactory.query(DmpQuery.class).ids(id).first();
|
||||||
|
if (dmp == null){
|
||||||
|
throw new InvalidApplicationException("Dmp does not exist!");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (DmpUserInviteTypePersist type :model.getUsers()) {
|
||||||
|
if (type.getUserId() != null){
|
||||||
|
DmpUserPersist dmpUserPersist = new DmpUserPersist();
|
||||||
|
dmpUserPersist.setUser(type.getUserId());
|
||||||
|
dmpUserPersist.setRole(model.getRole());
|
||||||
|
this.assignUsers(id, List.of(dmpUserPersist), null);
|
||||||
|
} else if (type.getEmail() != null) {
|
||||||
|
this.sendDmpInvitation(type.getEmail(),dmp, model.getRole());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendDmpInvitation(String email, DmpEntity dmp, DmpUserRole role) throws JAXBException, InvalidApplicationException {
|
||||||
|
ActionConfirmationPersist persist = new ActionConfirmationPersist();
|
||||||
|
persist.setType(ActionConfirmationType.DmpInvitation);
|
||||||
|
persist.setStatus(ActionConfirmationStatus.Requested);
|
||||||
|
persist.setToken(UUID.randomUUID().toString());
|
||||||
|
persist.setDmpInvitation(new DmpInvitationPersist(email, dmp.getId(), role));
|
||||||
|
persist.setCreatedById(this.userScope.getUserIdSafe());
|
||||||
|
persist.setExpiresAt(Instant.now().plusSeconds(Long.parseLong(this.notificationProperties.getEmailExpirationTimeSeconds())));
|
||||||
|
this.actionConfirmationService.persist(persist, null);
|
||||||
|
|
||||||
|
NotificationIntegrationEvent event = new NotificationIntegrationEvent();
|
||||||
|
event.setUserId(this.userScope.getUserIdSafe());
|
||||||
|
|
||||||
|
List<ContactPair> contactPairs = new ArrayList<>();
|
||||||
|
contactPairs.add(new ContactPair(ContactInfoType.Email, email));
|
||||||
|
NotificationContactData contactData = new NotificationContactData(contactPairs, null, null);
|
||||||
|
event.setContactHint(jsonHandlingService.toJsonSafe(contactData));
|
||||||
|
event.setContactTypeHint(NotificationContactType.EMAIL);
|
||||||
|
event.setNotificationType(UUID.fromString(notificationProperties.getDmpInvitation()));
|
||||||
|
NotificationFieldData data = new NotificationFieldData();
|
||||||
|
List<FieldInfo> fieldInfoList = new ArrayList<>();
|
||||||
|
fieldInfoList.add(new FieldInfo("{recipient}", DataType.String, email));
|
||||||
|
fieldInfoList.add(new FieldInfo("{confirmationToken}", DataType.String, persist.getToken()));
|
||||||
|
fieldInfoList.add(new FieldInfo("{dmpname}", DataType.String, dmp.getLabel()));
|
||||||
|
fieldInfoList.add(new FieldInfo("{dmprole}", DataType.String, role.toString()));
|
||||||
|
data.setFields(fieldInfoList);
|
||||||
|
event.setData(jsonHandlingService.toJsonSafe(data));
|
||||||
|
eventHandler.handle(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void dmpInvitationAccept(String token) throws InvalidApplicationException {
|
||||||
|
ActionConfirmationEntity action = this.queryFactory.query(ActionConfirmationQuery.class).tokens(token).first();
|
||||||
|
|
||||||
|
if (action == null){
|
||||||
|
throw new InvalidApplicationException("Token does not exist!");
|
||||||
|
}
|
||||||
|
if (action.getStatus().equals(ActionConfirmationStatus.Accepted)){
|
||||||
|
throw new InvalidApplicationException("Invitation is already confirmed!");
|
||||||
|
}
|
||||||
|
if (action.getExpiresAt().compareTo(Instant.now()) < 0){
|
||||||
|
throw new InvalidApplicationException("Token has expired!");
|
||||||
|
}
|
||||||
|
|
||||||
|
DmpInvitationEntity dmpInvitation = this.xmlHandlingService.fromXmlSafe(DmpInvitationEntity.class, action.getData());
|
||||||
|
DmpUserPersist model = new DmpUserPersist();
|
||||||
|
model.setUser(this.userScope.getUserIdSafe());
|
||||||
|
model.setRole(dmpInvitation.getRole());
|
||||||
|
this.assignUsers(dmpInvitation.getDmpId(), List.of(model), null);
|
||||||
|
action.setStatus(ActionConfirmationStatus.Accepted);
|
||||||
|
this.entityManager.merge(action);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ notification:
|
||||||
optional: [ ]
|
optional: [ ]
|
||||||
body-path: classpath:notification_templates/dmpinvitation/email/body.{language}.html
|
body-path: classpath:notification_templates/dmpinvitation/email/body.{language}.html
|
||||||
body-field-options:
|
body-field-options:
|
||||||
mandatory: [ "{dmpname}", "{dmprole}", "{installation-url}", "{invitationID}" ]
|
mandatory: [ "{dmpname}", "{dmprole}", "{installation-url}", "{confirmationToken}" ]
|
||||||
optional:
|
optional:
|
||||||
- key: "{recipient}"
|
- key: "{recipient}"
|
||||||
value:
|
value:
|
||||||
|
|
|
@ -271,7 +271,7 @@
|
||||||
<table border="0" cellpadding="0" cellspacing="0">
|
<table border="0" cellpadding="0" cellspacing="0">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="{installation-url}/plans/invitation/{invitationID}" target="_blank">Join</a> </td>
|
<td> <a href="{installation-url}/plans/invitation/{confirmationToken}" target="_blank">Join</a> </td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
ARGOS - Data Management Plan Invite
|
ARGOS - Dmp Invite
|
|
@ -11,68 +11,47 @@ notification:
|
||||||
overrides: []
|
overrides: []
|
||||||
resolver:
|
resolver:
|
||||||
global-policies:
|
global-policies:
|
||||||
- #Confirmation
|
- #dmpInvitation
|
||||||
type: 4FDBFA80-7A71-4A69-B854-67CBB70648F1
|
|
||||||
contacts: [ email ]
|
|
||||||
- #DataManagementPlan
|
|
||||||
type: 065DEECD-21BB-44AF-9983-E660FDF24BC4
|
type: 065DEECD-21BB-44AF-9983-E660FDF24BC4
|
||||||
contacts: [ email ]
|
contacts: [ email ]
|
||||||
- #Finalised
|
- #dpmModified
|
||||||
type: 90DB0B46-42DE-BD89-AEBF-6F27EFEB256E
|
|
||||||
contacts: [ email ]
|
|
||||||
- #MergeConfirmation
|
|
||||||
type: BFE68845-CB05-4C5A-A03D-29161A7C9660
|
|
||||||
contacts: [ email ]
|
|
||||||
- #Modified
|
|
||||||
type: 4542262A-22F8-4BAA-9DB6-1C8E70AC1DBB
|
type: 4542262A-22F8-4BAA-9DB6-1C8E70AC1DBB
|
||||||
contacts: [ email ]
|
contacts: [ email ]
|
||||||
- #ModifiedFinalised
|
- #dmpFinalised
|
||||||
type: D3CD55FE-8DA2-42E7-A501-3795EE4F16D3
|
type: 90DB0B46-42DE-BD89-AEBF-6F27EFEB256E
|
||||||
contacts: [ email ]
|
contacts: [ email ]
|
||||||
- #Publish
|
- #descriptionModified
|
||||||
|
type: 4FDBFA80-7A71-4A69-B854-67CBB70648F1
|
||||||
|
contacts: [ email ]
|
||||||
|
- #descriptionFinalised
|
||||||
|
type: 33790bad-94d4-488a-8ee2-7f6295ca18ea
|
||||||
|
contacts: [ email ]
|
||||||
|
- #mergeAcountConfirmation
|
||||||
|
type: BFE68845-CB05-4C5A-A03D-29161A7C9660
|
||||||
|
contacts: [ email ]
|
||||||
|
- #removeCredentialConfirmation
|
||||||
|
type: C9BC3F16-057E-4BBA-8A5F-36BD835E5604
|
||||||
|
contacts: [ email ]
|
||||||
|
- #dmpDeposit
|
||||||
type: 55736F7A-83AB-4190-AF43-9D031A6F9612
|
type: 55736F7A-83AB-4190-AF43-9D031A6F9612
|
||||||
contacts: [ email ]
|
contacts: [ email ]
|
||||||
- #Template
|
- #descriptionTemplateInvitation
|
||||||
type: 223BB607-EFA1-4CE7-99EC-4BEABFEF9A8B
|
type: 223BB607-EFA1-4CE7-99EC-4BEABFEF9A8B
|
||||||
contacts: [ email ]
|
contacts: [ email ]
|
||||||
- #UnlinkConfirmation
|
|
||||||
type: C9BC3F16-057E-4BBA-8A5F-36BD835E5604
|
|
||||||
contacts: [ email ]
|
|
||||||
ad-hoc-config:
|
ad-hoc-config:
|
||||||
ad-hoc-notification-type: null
|
ad-hoc-notification-type: null
|
||||||
message:
|
message:
|
||||||
email:
|
email:
|
||||||
flows:
|
flows:
|
||||||
- #Confirmation
|
- #dmpInvitation
|
||||||
key: 4FDBFA80-7A71-4A69-B854-67CBB70648F1
|
|
||||||
subject-path: classpath:notification_templates/Confirmation/Email/subject.{language}.txt
|
|
||||||
subject-field-options:
|
|
||||||
mandatory: [ ]
|
|
||||||
optional: [ ]
|
|
||||||
|
|
||||||
body-path: classpath:notification_templates/Confirmation/Email/body.{language}.html
|
|
||||||
body-field-options:
|
|
||||||
mandatory: [ ]
|
|
||||||
optional:
|
|
||||||
- key: "{expiration_time}"
|
|
||||||
value: --
|
|
||||||
formatting:
|
|
||||||
'[{expiration_time}]': null
|
|
||||||
cc: [ ]
|
|
||||||
cc-mode: 0
|
|
||||||
bcc: [ ]
|
|
||||||
bcc-mode: 0
|
|
||||||
allow-attachments: false
|
|
||||||
cipher-fields: [ ]
|
|
||||||
- #DataManagementPlan
|
|
||||||
key: 065DEECD-21BB-44AF-9983-E660FDF24BC4
|
key: 065DEECD-21BB-44AF-9983-E660FDF24BC4
|
||||||
subject-path: classpath:notification_templates/DataManagementPlan/Email/subject.{language}.txt
|
subject-path: classpath:notification_templates/dmpinvitation/email/subject.{language}.txt
|
||||||
subject-field-options:
|
subject-field-options:
|
||||||
mandatory: [ ]
|
mandatory: [ ]
|
||||||
optional: [ ]
|
optional: [ ]
|
||||||
body-path: classpath:notification_templates/DataManagementPlan/Email/body.{language}.html
|
body-path: classpath:notification_templates/dmpinvitation/email/body.{language}.html
|
||||||
body-field-options:
|
body-field-options:
|
||||||
mandatory: [ "{dmpname}", "{dmprole}", "{host}", "{invitationID}" ]
|
mandatory: [ "{dmpname}", "{dmprole}", "{installation-url}", "{confirmationToken}" ]
|
||||||
optional:
|
optional:
|
||||||
- key: "{recipient}"
|
- key: "{recipient}"
|
||||||
value:
|
value:
|
||||||
|
@ -86,15 +65,15 @@ notification:
|
||||||
bcc-mode: 0
|
bcc-mode: 0
|
||||||
allow-attachments: false
|
allow-attachments: false
|
||||||
cipher-fields: [ ]
|
cipher-fields: [ ]
|
||||||
- #Finalised
|
- #dmpModified
|
||||||
key: 90DB0B46-42DE-BD89-AEBF-6F27EFEB256E
|
key: 4542262A-22F8-4BAA-9DB6-1C8E70AC1DBB
|
||||||
subject-path: classpath:notification_templates/Finalised/Email/subject.{language}.txt
|
subject-path: classpath:notification_templates/dmpmodified/email/subject.{language}.txt
|
||||||
subject-field-options:
|
subject-field-options:
|
||||||
mandatory: [ ]
|
mandatory: [ ]
|
||||||
optional: [ ]
|
optional: [ ]
|
||||||
body-path: classpath:notification_templates/Finalised/Email/body.{language}.html
|
body-path: classpath:notification_templates/dmpmodified/email/body.{language}.html
|
||||||
body-field-options:
|
body-field-options:
|
||||||
mandatory: [ "{reasonName}", "{name}" ]
|
mandatory: [ "{reasonName}", "{name}", "{installation-url}", "{id}" ]
|
||||||
optional:
|
optional:
|
||||||
- key: "{recipient}"
|
- key: "{recipient}"
|
||||||
value:
|
value:
|
||||||
|
@ -108,21 +87,87 @@ notification:
|
||||||
bcc-mode: 0
|
bcc-mode: 0
|
||||||
allow-attachments: false
|
allow-attachments: false
|
||||||
cipher-fields: [ ]
|
cipher-fields: [ ]
|
||||||
- #MergeConfirmation
|
- #dmpFinalised
|
||||||
key: BFE68845-CB05-4C5A-A03D-29161A7C9660
|
key: 90DB0B46-42DE-BD89-AEBF-6F27EFEB256E
|
||||||
subject-path: classpath:notification_templates/MergeConfirmation/Email/subject.{language}.txt
|
subject-path: classpath:notification_templates/dmpfinalised/email/subject.{language}.txt
|
||||||
subject-field-options:
|
subject-field-options:
|
||||||
mandatory: [ ]
|
mandatory: [ ]
|
||||||
optional: [ ]
|
optional: [ ]
|
||||||
body-path: classpath:notification_templates/MergeConfirmation/Email/body.{language}.html
|
body-path: classpath:notification_templates/dmpfinalised/email/body.{language}.html
|
||||||
body-field-options:
|
body-field-options:
|
||||||
mandatory: [ "{userName}", "{host}", "{confirmationToken}" ]
|
mandatory: [ "{reasonName}", "{name}", "{installation-url}", "{id}" ]
|
||||||
|
optional:
|
||||||
|
- key: "{recipient}"
|
||||||
|
value:
|
||||||
|
formatting:
|
||||||
|
'[{reasonName}]': null
|
||||||
|
'[{name}]': null
|
||||||
|
'[{recipient}]': null
|
||||||
|
cc: [ ]
|
||||||
|
cc-mode: 0
|
||||||
|
bcc: [ ]
|
||||||
|
bcc-mode: 0
|
||||||
|
allow-attachments: false
|
||||||
|
cipher-fields: [ ]
|
||||||
|
- #desriptionModified
|
||||||
|
key: 4FDBFA80-7A71-4A69-B854-67CBB70648F1
|
||||||
|
subject-path: classpath:notification_templates/descriptionmodified/email/subject.{language}.txt
|
||||||
|
subject-field-options:
|
||||||
|
mandatory: [ ]
|
||||||
|
optional: [ ]
|
||||||
|
body-path: classpath:notification_templates/descriptionmodified/email/body.{language}.html
|
||||||
|
body-field-options:
|
||||||
|
mandatory: [ "{reasonName}", "{name}", "{installation-url}", "{id}" ]
|
||||||
|
optional:
|
||||||
|
- key: "{recipient}"
|
||||||
|
value:
|
||||||
|
formatting:
|
||||||
|
'[{reasonName}]': null
|
||||||
|
'[{name}]': null
|
||||||
|
'[{recipient}]': null
|
||||||
|
cc: [ ]
|
||||||
|
cc-mode: 0
|
||||||
|
bcc: [ ]
|
||||||
|
bcc-mode: 0
|
||||||
|
allow-attachments: false
|
||||||
|
cipher-fields: [ ]
|
||||||
|
- #descriptionFinalised
|
||||||
|
key: 33790bad-94d4-488a-8ee2-7f6295ca18ea
|
||||||
|
subject-path: classpath:notification_templates/descriptionfinalised/email/subject.{language}.txt
|
||||||
|
subject-field-options:
|
||||||
|
mandatory: [ ]
|
||||||
|
optional: [ ]
|
||||||
|
body-path: classpath:notification_templates/descriptionfinalised/email/body.{language}.html
|
||||||
|
body-field-options:
|
||||||
|
mandatory: [ "{reasonName}", "{name}", "{installation-url}", "{id}" ]
|
||||||
|
optional:
|
||||||
|
- key: "{recipient}"
|
||||||
|
value:
|
||||||
|
formatting:
|
||||||
|
'[{reasonName}]': null
|
||||||
|
'[{name}]': null
|
||||||
|
'[{recipient}]': null
|
||||||
|
cc: [ ]
|
||||||
|
cc-mode: 0
|
||||||
|
bcc: [ ]
|
||||||
|
bcc-mode: 0
|
||||||
|
allow-attachments: false
|
||||||
|
cipher-fields: [ ]
|
||||||
|
- #mergeAccountConfirmation
|
||||||
|
key: BFE68845-CB05-4C5A-A03D-29161A7C9660
|
||||||
|
subject-path: classpath:notification_templates/mergeaccountconfirmation/email/subject.{language}.txt
|
||||||
|
subject-field-options:
|
||||||
|
mandatory: [ ]
|
||||||
|
optional: [ ]
|
||||||
|
body-path: classpath:notification_templates/mergeaccountconfirmation/email/body.{language}.html
|
||||||
|
body-field-options:
|
||||||
|
mandatory: [ "{userName}", "{installation-url}", "{confirmationToken}" ]
|
||||||
optional:
|
optional:
|
||||||
- key: "{expiration_time}"
|
- key: "{expiration_time}"
|
||||||
value: ---
|
value: ---
|
||||||
formatting:
|
formatting:
|
||||||
'[{userName}]': null
|
'[{userName}]': null
|
||||||
'[{host}]': null
|
'[{installation-url}]': null
|
||||||
'[{expiration_time}]': null
|
'[{expiration_time}]': null
|
||||||
cc: [ ]
|
cc: [ ]
|
||||||
cc-mode: 0
|
cc-mode: 0
|
||||||
|
@ -130,100 +175,13 @@ notification:
|
||||||
bcc-mode: 0
|
bcc-mode: 0
|
||||||
allow-attachments: false
|
allow-attachments: false
|
||||||
cipher-fields: [ ]
|
cipher-fields: [ ]
|
||||||
- #Modified
|
- #removeCredentialConfirmation
|
||||||
key: 4542262A-22F8-4BAA-9DB6-1C8E70AC1DBB
|
|
||||||
subject-path: classpath:notification_templates/Modified/Email/subject.{language}.txt
|
|
||||||
subject-field-options:
|
|
||||||
mandatory: [ ]
|
|
||||||
optional: [ ]
|
|
||||||
body-path: classpath:notification_templates/Modified/Email/body.{language}.html
|
|
||||||
body-field-options:
|
|
||||||
mandatory: [ "{reasonName}", "{name}" ]
|
|
||||||
optional:
|
|
||||||
- key: "{recipient}"
|
|
||||||
value:
|
|
||||||
formatting:
|
|
||||||
'[{reasonName}]': null
|
|
||||||
'[{name}]': null
|
|
||||||
'[{recipient}]': null
|
|
||||||
cc: [ ]
|
|
||||||
cc-mode: 0
|
|
||||||
bcc: [ ]
|
|
||||||
bcc-mode: 0
|
|
||||||
allow-attachments: false
|
|
||||||
cipher-fields: [ ]
|
|
||||||
- #ModifiedFinalised
|
|
||||||
key: D3CD55FE-8DA2-42E7-A501-3795EE4F16D3
|
|
||||||
subject-path: classpath:notification_templates/ModifiedFinalised/Email/subject.{language}.txt
|
|
||||||
subject-field-options:
|
|
||||||
mandatory: [ ]
|
|
||||||
optional: [ ]
|
|
||||||
body-path: classpath:notification_templates/ModifiedFinalised/Email/body.{language}.html
|
|
||||||
body-field-options:
|
|
||||||
mandatory: [ "{reasonName}", "{name}" ]
|
|
||||||
optional:
|
|
||||||
- key: "{recipient}"
|
|
||||||
value:
|
|
||||||
formatting:
|
|
||||||
'[{reasonName}]': null
|
|
||||||
'[{name}]': null
|
|
||||||
'[{recipient}]': null
|
|
||||||
cc: [ ]
|
|
||||||
cc-mode: 0
|
|
||||||
bcc: [ ]
|
|
||||||
bcc-mode: 0
|
|
||||||
allow-attachments: false
|
|
||||||
cipher-fields: [ ]
|
|
||||||
- #Publish
|
|
||||||
key: 55736F7A-83AB-4190-AF43-9D031A6F9612
|
|
||||||
subject-path: classpath:notification_templates/Publish/Email/subject.{language}.txt
|
|
||||||
subject-field-options:
|
|
||||||
mandatory: [ ]
|
|
||||||
optional: [ ]
|
|
||||||
body-path: classpath:notification_templates/Publish/Email/body.{language}.html
|
|
||||||
body-field-options:
|
|
||||||
mandatory: [ "{reasonName}", "{name}" ]
|
|
||||||
optional:
|
|
||||||
- key: "{recipient}"
|
|
||||||
value:
|
|
||||||
formatting:
|
|
||||||
'[{reasonName}]': null
|
|
||||||
'[{name}]': null
|
|
||||||
'[{recipient}]': null
|
|
||||||
cc: [ ]
|
|
||||||
cc-mode: 0
|
|
||||||
bcc: [ ]
|
|
||||||
bcc-mode: 0
|
|
||||||
allow-attachments: false
|
|
||||||
cipher-fields: [ ]
|
|
||||||
- #Template
|
|
||||||
key: 223BB607-EFA1-4CE7-99EC-4BEABFEF9A8B
|
|
||||||
subject-path: classpath:notification_templates/Template/Email/subject.{language}.txt
|
|
||||||
subject-field-options:
|
|
||||||
mandatory: [ ]
|
|
||||||
optional: [ ]
|
|
||||||
body-path: classpath:notification_templates/Template/Email/body.{language}.html
|
|
||||||
body-field-options:
|
|
||||||
mandatory: [ "{templateName}", "{host}", "{templateID}" ]
|
|
||||||
optional:
|
|
||||||
- key: "{recipient}"
|
|
||||||
value:
|
|
||||||
formatting:
|
|
||||||
'[{templateName}]': null
|
|
||||||
'[{recipient}]': null
|
|
||||||
cc: [ ]
|
|
||||||
cc-mode: 0
|
|
||||||
bcc: [ ]
|
|
||||||
bcc-mode: 0
|
|
||||||
allow-attachments: false
|
|
||||||
cipher-fields: [ ]
|
|
||||||
- #UnlinkConfirmation
|
|
||||||
key: C9BC3F16-057E-4BBA-8A5F-36BD835E5604
|
key: C9BC3F16-057E-4BBA-8A5F-36BD835E5604
|
||||||
subject-path: classpath:notification_templates/UnlinkConfirmation/Email/subject.{language}.txt
|
subject-path: classpath:notification_templates/removecredentialconfirmation/email/subject.{language}.txt
|
||||||
subject-field-options:
|
subject-field-options:
|
||||||
mandatory: ["{host}", "{confirmationToken}"]
|
mandatory: [ "{installation-url}", "{confirmationToken}" ]
|
||||||
optional: [ ]
|
optional: [ ]
|
||||||
body-path: classpath:notification_templates/UnlinkConfirmation/Email/body.{language}.html
|
body-path: classpath:notification_templates/removecredentialconfirmation/email/body.{language}.html
|
||||||
body-field-options:
|
body-field-options:
|
||||||
mandatory: [ ]
|
mandatory: [ ]
|
||||||
optional:
|
optional:
|
||||||
|
@ -239,6 +197,49 @@ notification:
|
||||||
bcc-mode: 0
|
bcc-mode: 0
|
||||||
allow-attachments: false
|
allow-attachments: false
|
||||||
cipher-fields: [ ]
|
cipher-fields: [ ]
|
||||||
|
- #dmpDeposit
|
||||||
|
key: 55736F7A-83AB-4190-AF43-9D031A6F9612
|
||||||
|
subject-path: classpath:notification_templates/dmpdeposit/email/subject.{language}.txt
|
||||||
|
subject-field-options:
|
||||||
|
mandatory: [ ]
|
||||||
|
optional: [ ]
|
||||||
|
body-path: classpath:notification_templates/dmpdeposit/email/body.{language}.html
|
||||||
|
body-field-options:
|
||||||
|
mandatory: [ "{reasonName}", "{name}", "{installation-url}", "{id}" ]
|
||||||
|
optional:
|
||||||
|
- key: "{recipient}"
|
||||||
|
value:
|
||||||
|
formatting:
|
||||||
|
'[{reasonName}]': null
|
||||||
|
'[{name}]': null
|
||||||
|
'[{recipient}]': null
|
||||||
|
cc: [ ]
|
||||||
|
cc-mode: 0
|
||||||
|
bcc: [ ]
|
||||||
|
bcc-mode: 0
|
||||||
|
allow-attachments: false
|
||||||
|
cipher-fields: [ ]
|
||||||
|
- #descriptionTemplateInvitation
|
||||||
|
key: 223BB607-EFA1-4CE7-99EC-4BEABFEF9A8B
|
||||||
|
subject-path: classpath:notification_templates/descriptiontemplateinvitation/email/subject.{language}.txt
|
||||||
|
subject-field-options:
|
||||||
|
mandatory: [ ]
|
||||||
|
optional: [ ]
|
||||||
|
body-path: classpath:notification_templates/descriptiontemplateinvitation/email/body.{language}.html
|
||||||
|
body-field-options:
|
||||||
|
mandatory: [ "{templateName}", "{installation-url}", "{templateID}" ]
|
||||||
|
optional:
|
||||||
|
- key: "{recipient}"
|
||||||
|
value:
|
||||||
|
formatting:
|
||||||
|
'[{templateName}]': null
|
||||||
|
'[{recipient}]': null
|
||||||
|
cc: [ ]
|
||||||
|
cc-mode: 0
|
||||||
|
bcc: [ ]
|
||||||
|
bcc-mode: 0
|
||||||
|
allow-attachments: false
|
||||||
|
cipher-fields: [ ]
|
||||||
template-cache:
|
template-cache:
|
||||||
prefix: ${CACHE_DISAMBIGUATION:}
|
prefix: ${CACHE_DISAMBIGUATION:}
|
||||||
key-pattern: "{prefix}:Notification_Message_Email_Template:{key}:v0"
|
key-pattern: "{prefix}:Notification_Message_Email_Template:{key}:v0"
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
||||||
ARGOS - Email Confirmation
|
|
|
@ -1 +0,0 @@
|
||||||
ARGOS - Data Management Plan Invite
|
|
|
@ -1 +0,0 @@
|
||||||
ARGOS - Finalised
|
|
|
@ -1 +0,0 @@
|
||||||
ARGOS - Merge Confirmation
|
|
|
@ -1 +0,0 @@
|
||||||
ARGOS - Modified
|
|
|
@ -1 +0,0 @@
|
||||||
ARGOS - Modified Finalised
|
|
|
@ -1 +0,0 @@
|
||||||
ARGOS - Publish
|
|
|
@ -1 +0,0 @@
|
||||||
ARGOS - Template Invite
|
|
|
@ -261,7 +261,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p>Dear {recipient},</p>
|
<p>Dear {recipient},</p>
|
||||||
<p>{reasonName} just made changes to the {name}.</p>
|
<p>{reasonName} just made changes to the Description {name}.</p>
|
||||||
|
|
||||||
<table border="0" cellpadding="0" cellspacing="0" class="btn btn-primary">
|
<table border="0" cellpadding="0" cellspacing="0" class="btn btn-primary">
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -270,7 +270,7 @@
|
||||||
<table border="0" cellpadding="0" cellspacing="0">
|
<table border="0" cellpadding="0" cellspacing="0">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="{host}{path}/{id}" target="_blank">Click here to view it.</a> </td>
|
<td> <a href="{installation-url}/descriptions/edit/{id}" target="_blank">Click here to view it.</a> </td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
|
@ -0,0 +1 @@
|
||||||
|
ARGOS - Description Modified
|
|
@ -271,7 +271,7 @@
|
||||||
<table border="0" cellpadding="0" cellspacing="0">
|
<table border="0" cellpadding="0" cellspacing="0">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="{host}/dataset-profiles/{templateID}" target="_blank">{templateName}</a> </td>
|
<td> <a href="{installation-url}/description-templates/{templateID}" target="_blank">{templateName}</a> </td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
|
@ -0,0 +1 @@
|
||||||
|
ARGOS - Description Template Invite
|
|
@ -0,0 +1,304 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta name="viewport" content="width=device-width" />
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
|
<title>Simple Transactional Email</title>
|
||||||
|
<style>
|
||||||
|
/* -------------------------------------
|
||||||
|
GLOBAL RESETS
|
||||||
|
------------------------------------- */
|
||||||
|
img {
|
||||||
|
border: none;
|
||||||
|
-ms-interpolation-mode: bicubic;
|
||||||
|
max-width: 100%; }
|
||||||
|
body {
|
||||||
|
background-color: #f6f6f6;
|
||||||
|
font-family: sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.4;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
-ms-text-size-adjust: 100%;
|
||||||
|
-webkit-text-size-adjust: 100%; }
|
||||||
|
table {
|
||||||
|
border-collapse: separate;
|
||||||
|
mso-table-lspace: 0pt;
|
||||||
|
mso-table-rspace: 0pt;
|
||||||
|
width: 100%; }
|
||||||
|
table td {
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
vertical-align: top; }
|
||||||
|
/* -------------------------------------
|
||||||
|
BODY & CONTAINER
|
||||||
|
------------------------------------- */
|
||||||
|
.body {
|
||||||
|
background-color: #f6f6f6;
|
||||||
|
width: 100%; }
|
||||||
|
/* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something */
|
||||||
|
.container {
|
||||||
|
display: block;
|
||||||
|
Margin: 0 auto !important;
|
||||||
|
/* makes it centered */
|
||||||
|
max-width: 580px;
|
||||||
|
padding: 10px;
|
||||||
|
width: 580px; }
|
||||||
|
/* This should also be a block element, so that it will fill 100% of the .container */
|
||||||
|
.content {
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: block;
|
||||||
|
Margin: 0 auto;
|
||||||
|
max-width: 580px;
|
||||||
|
padding: 10px; }
|
||||||
|
/* -------------------------------------
|
||||||
|
HEADER, FOOTER, MAIN
|
||||||
|
------------------------------------- */
|
||||||
|
.main {
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 3px;
|
||||||
|
width: 100%; }
|
||||||
|
.wrapper {
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 20px; }
|
||||||
|
.content-block {
|
||||||
|
padding-bottom: 10px;
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
.footer {
|
||||||
|
clear: both;
|
||||||
|
Margin-top: 10px;
|
||||||
|
text-align: center;
|
||||||
|
width: 100%; }
|
||||||
|
.footer td,
|
||||||
|
.footer p,
|
||||||
|
.footer span,
|
||||||
|
.footer a {
|
||||||
|
color: #999999;
|
||||||
|
font-size: 12px;
|
||||||
|
text-align: center; }
|
||||||
|
/* -------------------------------------
|
||||||
|
TYPOGRAPHY
|
||||||
|
------------------------------------- */
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
h4 {
|
||||||
|
color: #000000;
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1.4;
|
||||||
|
margin: 0;
|
||||||
|
Margin-bottom: 30px; }
|
||||||
|
h1 {
|
||||||
|
font-size: 35px;
|
||||||
|
font-weight: 300;
|
||||||
|
text-align: center;
|
||||||
|
text-transform: capitalize; }
|
||||||
|
p,
|
||||||
|
ul,
|
||||||
|
ol {
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: normal;
|
||||||
|
margin: 0;
|
||||||
|
Margin-bottom: 15px; }
|
||||||
|
p li,
|
||||||
|
ul li,
|
||||||
|
ol li {
|
||||||
|
list-style-position: inside;
|
||||||
|
margin-left: 5px; }
|
||||||
|
a {
|
||||||
|
color: #3498db;
|
||||||
|
text-decoration: underline; }
|
||||||
|
/* -------------------------------------
|
||||||
|
BUTTONS
|
||||||
|
------------------------------------- */
|
||||||
|
.btn {
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 100%; }
|
||||||
|
.btn > tbody > tr > td {
|
||||||
|
padding-bottom: 15px; }
|
||||||
|
.btn table {
|
||||||
|
width: auto; }
|
||||||
|
.btn table td {
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 5px;
|
||||||
|
text-align: center; }
|
||||||
|
.btn a {
|
||||||
|
background-color: #ffffff;
|
||||||
|
border: solid 1px #3498db;
|
||||||
|
border-radius: 5px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
color: #3498db;
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin: 0;
|
||||||
|
padding: 12px 25px;
|
||||||
|
text-decoration: none;
|
||||||
|
text-transform: capitalize; }
|
||||||
|
.btn-primary table td {
|
||||||
|
background-color: #3498db; }
|
||||||
|
.btn-primary a {
|
||||||
|
background-color: #3498db;
|
||||||
|
border-color: #3498db;
|
||||||
|
color: #ffffff; }
|
||||||
|
/* -------------------------------------
|
||||||
|
OTHER STYLES THAT MIGHT BE USEFUL
|
||||||
|
------------------------------------- */
|
||||||
|
.last {
|
||||||
|
margin-bottom: 0; }
|
||||||
|
.first {
|
||||||
|
margin-top: 0; }
|
||||||
|
.align-center {
|
||||||
|
text-align: center; }
|
||||||
|
.align-right {
|
||||||
|
text-align: right; }
|
||||||
|
.align-left {
|
||||||
|
text-align: left; }
|
||||||
|
.clear {
|
||||||
|
clear: both; }
|
||||||
|
.mt0 {
|
||||||
|
margin-top: 0; }
|
||||||
|
.mb0 {
|
||||||
|
margin-bottom: 0; }
|
||||||
|
.preheader {
|
||||||
|
color: transparent;
|
||||||
|
display: none;
|
||||||
|
height: 0;
|
||||||
|
max-height: 0;
|
||||||
|
max-width: 0;
|
||||||
|
opacity: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
mso-hide: all;
|
||||||
|
visibility: hidden;
|
||||||
|
width: 0; }
|
||||||
|
.powered-by a {
|
||||||
|
text-decoration: none; }
|
||||||
|
hr {
|
||||||
|
border: 0;
|
||||||
|
border-bottom: 1px solid #f6f6f6;
|
||||||
|
Margin: 20px 0; }
|
||||||
|
/* -------------------------------------
|
||||||
|
RESPONSIVE AND MOBILE FRIENDLY STYLES
|
||||||
|
------------------------------------- */
|
||||||
|
@media only screen and (max-width: 620px) {
|
||||||
|
table[class=body] h1 {
|
||||||
|
font-size: 28px !important;
|
||||||
|
margin-bottom: 10px !important; }
|
||||||
|
table[class=body] p,
|
||||||
|
table[class=body] ul,
|
||||||
|
table[class=body] ol,
|
||||||
|
table[class=body] td,
|
||||||
|
table[class=body] span,
|
||||||
|
table[class=body] a {
|
||||||
|
font-size: 16px !important; }
|
||||||
|
table[class=body] .wrapper,
|
||||||
|
table[class=body] .article {
|
||||||
|
padding: 10px !important; }
|
||||||
|
table[class=body] .content {
|
||||||
|
padding: 0 !important; }
|
||||||
|
table[class=body] .container {
|
||||||
|
padding: 0 !important;
|
||||||
|
width: 100% !important; }
|
||||||
|
table[class=body] .main {
|
||||||
|
border-left-width: 0 !important;
|
||||||
|
border-radius: 0 !important;
|
||||||
|
border-right-width: 0 !important; }
|
||||||
|
table[class=body] .btn table {
|
||||||
|
width: 100% !important; }
|
||||||
|
table[class=body] .btn a {
|
||||||
|
width: 100% !important; }
|
||||||
|
table[class=body] .img-responsive {
|
||||||
|
height: auto !important;
|
||||||
|
max-width: 100% !important;
|
||||||
|
width: auto !important; }}
|
||||||
|
/* -------------------------------------
|
||||||
|
PRESERVE THESE STYLES IN THE HEAD
|
||||||
|
------------------------------------- */
|
||||||
|
@media all {
|
||||||
|
.ExternalClass {
|
||||||
|
width: 100%; }
|
||||||
|
.ExternalClass,
|
||||||
|
.ExternalClass p,
|
||||||
|
.ExternalClass span,
|
||||||
|
.ExternalClass font,
|
||||||
|
.ExternalClass td,
|
||||||
|
.ExternalClass div {
|
||||||
|
line-height: 100%; }
|
||||||
|
.apple-link a {
|
||||||
|
color: inherit !important;
|
||||||
|
font-family: inherit !important;
|
||||||
|
font-size: inherit !important;
|
||||||
|
font-weight: inherit !important;
|
||||||
|
line-height: inherit !important;
|
||||||
|
text-decoration: none !important; }
|
||||||
|
.btn-primary table td:hover {
|
||||||
|
background-color: #34495e !important; }
|
||||||
|
.btn-primary a:hover {
|
||||||
|
background-color: #34495e !important;
|
||||||
|
border-color: #34495e !important; } }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body class="">
|
||||||
|
<table border="0" cellpadding="0" cellspacing="0" class="body">
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
<td class="container">
|
||||||
|
<div class="content">
|
||||||
|
|
||||||
|
<!-- START CENTERED WHITE CONTAINER -->
|
||||||
|
<span class="preheader">This is preheader text. Some clients will show this text as a preview.</span>
|
||||||
|
<table class="main">
|
||||||
|
|
||||||
|
<!-- START MAIN CONTENT AREA -->
|
||||||
|
<tr>
|
||||||
|
<td class="wrapper">
|
||||||
|
<table border="0" cellpadding="0" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<p>Dear {recipient},</p>
|
||||||
|
<p>{reasonName} just finalised the Description {name}.</p>
|
||||||
|
|
||||||
|
<table border="0" cellpadding="0" cellspacing="0" class="btn btn-primary">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td align="left">
|
||||||
|
<table border="0" cellpadding="0" cellspacing="0">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td> <a href="{installation-url}/descriptions/edit/{id}" target="_blank">Click here to view it.</a> </td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<!-- END MAIN CONTENT AREA -->
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<!-- START FOOTER -->
|
||||||
|
<div class="footer">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- END FOOTER -->
|
||||||
|
|
||||||
|
<!-- END CENTERED WHITE CONTAINER -->
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1 @@
|
||||||
|
ARGOS - Description Finalised
|
|
@ -270,7 +270,7 @@
|
||||||
<table border="0" cellpadding="0" cellspacing="0">
|
<table border="0" cellpadding="0" cellspacing="0">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="{host}{path}/{id}" target="_blank">Click here to view it.</a> </td>
|
<td> <a href="{installation-url}/{path}/{id}" target="_blank">Click here to view it.</a> </td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
|
@ -0,0 +1 @@
|
||||||
|
ARGOS - Dmp Deposit
|
|
@ -261,7 +261,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p>Dear {recipient},</p>
|
<p>Dear {recipient},</p>
|
||||||
<p>{reasonName} just finalised the {name}.</p>
|
<p>{reasonName} just finalised the Dmp {name}.</p>
|
||||||
|
|
||||||
<table border="0" cellpadding="0" cellspacing="0" class="btn btn-primary">
|
<table border="0" cellpadding="0" cellspacing="0" class="btn btn-primary">
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -270,7 +270,7 @@
|
||||||
<table border="0" cellpadding="0" cellspacing="0">
|
<table border="0" cellpadding="0" cellspacing="0">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="{host}{path}/{id}" target="_blank">Click here to view it.</a> </td>
|
<td> <a href="{installation-url}/plans/edit/{id}" target="_blank">Click here to view it.</a> </td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
|
@ -0,0 +1 @@
|
||||||
|
ARGOS - Dmp Finalised
|
|
@ -271,7 +271,7 @@
|
||||||
<table border="0" cellpadding="0" cellspacing="0">
|
<table border="0" cellpadding="0" cellspacing="0">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="{host}/plans/invitation/{invitationID}" target="_blank">Join</a> </td>
|
<td> <a href="{installation-url}/plans/invitation/{confirmationToken}" target="_blank">Join</a> </td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
|
@ -0,0 +1 @@
|
||||||
|
ARGOS - Dmp Invite
|
|
@ -261,7 +261,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p>Dear {recipient},</p>
|
<p>Dear {recipient},</p>
|
||||||
<p>{reasonName} just made changes and finalised the {name}.</p>
|
<p>{reasonName} just made changes to the Dmp {name}.</p>
|
||||||
|
|
||||||
<table border="0" cellpadding="0" cellspacing="0" class="btn btn-primary">
|
<table border="0" cellpadding="0" cellspacing="0" class="btn btn-primary">
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -270,7 +270,7 @@
|
||||||
<table border="0" cellpadding="0" cellspacing="0">
|
<table border="0" cellpadding="0" cellspacing="0">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="{host}{path}/{id}" target="_blank">Click here to view it.</a> </td>
|
<td> <a href="{installation-url}/plans/edit/{id}" target="_blank">Click here to view it.</a> </td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
|
@ -0,0 +1 @@
|
||||||
|
ARGOS - Dmp Modified
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
||||||
|
ARGOS - Merge Account Confirmation
|
|
@ -271,7 +271,7 @@
|
||||||
<table border="0" cellpadding="0" cellspacing="0">
|
<table border="0" cellpadding="0" cellspacing="0">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td> <a href="{host}/unlink/confirmation/{confirmationToken}" target="_blank">Confirm Unlink Request</a> </td>
|
<td> <a href="{installation-url}/unlink/confirmation/{confirmationToken}" target="_blank">Confirm Unlink Request</a> </td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
|
@ -12,9 +12,12 @@ import eu.eudat.model.builder.DmpUserBuilder;
|
||||||
import eu.eudat.model.censorship.DmpCensor;
|
import eu.eudat.model.censorship.DmpCensor;
|
||||||
import eu.eudat.model.persist.*;
|
import eu.eudat.model.persist.*;
|
||||||
import eu.eudat.model.result.QueryResult;
|
import eu.eudat.model.result.QueryResult;
|
||||||
|
import eu.eudat.models.data.dmp.DataManagementPlan;
|
||||||
|
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||||
import eu.eudat.query.DmpQuery;
|
import eu.eudat.query.DmpQuery;
|
||||||
import eu.eudat.query.lookup.DmpLookup;
|
import eu.eudat.query.lookup.DmpLookup;
|
||||||
import eu.eudat.service.dmp.DmpService;
|
import eu.eudat.service.dmp.DmpService;
|
||||||
|
import eu.eudat.types.ApiMessageCode;
|
||||||
import gr.cite.tools.auditing.AuditService;
|
import gr.cite.tools.auditing.AuditService;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.censor.CensorFactory;
|
import gr.cite.tools.data.censor.CensorFactory;
|
||||||
|
@ -30,6 +33,7 @@ import jakarta.xml.bind.JAXBException;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -202,4 +206,32 @@ public class DmpController {
|
||||||
return this.dmpService.export(id, DmpService.DmpExportType.valueOf(exportType));
|
return this.dmpService.export(id, DmpService.DmpExportType.valueOf(exportType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("{id}/invite-users")
|
||||||
|
@Transactional
|
||||||
|
public ResponseEntity inviteUsers(@PathVariable("id") UUID id, @MyValidate @RequestBody DmpUserInvitePersist model) throws InvalidApplicationException, JAXBException {
|
||||||
|
logger.debug(new MapLogEntry("inviting users to dmp").And("model", model));
|
||||||
|
|
||||||
|
this.dmpService.inviteUsers(id, model);
|
||||||
|
|
||||||
|
this.auditService.track(AuditableAction.Dmp_Invite_Users, Map.ofEntries(
|
||||||
|
new AbstractMap.SimpleEntry<String, Object>("model", model)
|
||||||
|
));
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<String>().status(ApiMessageCode.SUCCESS_MESSAGE).payload("Invite Users Success"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("{id}/token/{token}/invite-accept")
|
||||||
|
@Transactional
|
||||||
|
public ResponseEntity inviteUsers(@PathVariable("id") UUID id, @PathVariable("token") String token) throws InvalidApplicationException, JAXBException {
|
||||||
|
logger.debug(new MapLogEntry("inviting users to dmp").And("id", id));
|
||||||
|
|
||||||
|
this.dmpService.dmpInvitationAccept(token);
|
||||||
|
|
||||||
|
this.auditService.track(AuditableAction.Dmp_Invite_Accept, Map.ofEntries(
|
||||||
|
new AbstractMap.SimpleEntry<String, Object>("token", token)
|
||||||
|
));
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<String>().status(ApiMessageCode.SUCCESS_MESSAGE).payload("Invite Accept Success"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
notification:
|
notification:
|
||||||
confirmation: 4FDBFA80-7A71-4A69-B854-67CBB70648F1
|
dmpInvitation: 065DEECD-21BB-44AF-9983-E660FDF24BC4
|
||||||
dataManagementPlan: 065DEECD-21BB-44AF-9983-E660FDF24BC4
|
dmpModified: 4542262A-22F8-4BAA-9DB6-1C8E70AC1DBB
|
||||||
finalised: 90DB0B46-42DE-BD89-AEBF-6F27EFEB256E
|
dmpFinalised: 90DB0B46-42DE-BD89-AEBF-6F27EFEB256E
|
||||||
mergeConfirmation: BFE68845-CB05-4C5A-A03D-29161A7C9660
|
descriptionModified: 4FDBFA80-7A71-4A69-B854-67CBB70648F1
|
||||||
modified: 4542262A-22F8-4BAA-9DB6-1C8E70AC1DBB
|
descriptionFinalised: 33790bad-94d4-488a-8ee2-7f6295ca18ea
|
||||||
modifiedFinalised: D3CD55FE-8DA2-42E7-A501-3795EE4F16D3
|
mergeAccountConfirmation: BFE68845-CB05-4C5A-A03D-29161A7C9660
|
||||||
publish: 55736F7A-83AB-4190-AF43-9D031A6F9612
|
removeCredentialConfirmation: C9BC3F16-057E-4BBA-8A5F-36BD835E5604
|
||||||
template: 223BB607-EFA1-4CE7-99EC-4BEABFEF9A8B
|
dmpDeposit: 55736F7A-83AB-4190-AF43-9D031A6F9612
|
||||||
unlinkConfirmation: C9BC3F16-057E-4BBA-8A5F-36BD835E5604
|
descriptionTemplateInvitation: 223BB607-EFA1-4CE7-99EC-4BEABFEF9A8B
|
||||||
|
emailExpirationTimeSeconds: 14400
|
|
@ -364,6 +364,13 @@ permissions:
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
allowAuthenticated: false
|
allowAuthenticated: false
|
||||||
|
InviteDmpUsers:
|
||||||
|
roles:
|
||||||
|
- User
|
||||||
|
claims: [ ]
|
||||||
|
clients: [ ]
|
||||||
|
allowAnonymous: false
|
||||||
|
allowAuthenticated: false
|
||||||
# DmpBlueprint
|
# DmpBlueprint
|
||||||
BrowseDmpBlueprint:
|
BrowseDmpBlueprint:
|
||||||
roles:
|
roles:
|
||||||
|
@ -652,19 +659,40 @@ permissions:
|
||||||
# Lock Permissions
|
# Lock Permissions
|
||||||
BrowseLock:
|
BrowseLock:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- User
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
allowAuthenticated: false
|
allowAuthenticated: false
|
||||||
EditLock:
|
EditLock:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- User
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
allowAuthenticated: false
|
allowAuthenticated: false
|
||||||
DeleteLock:
|
DeleteLock:
|
||||||
roles:
|
roles:
|
||||||
- Admin
|
- User
|
||||||
|
claims: [ ]
|
||||||
|
clients: [ ]
|
||||||
|
allowAnonymous: false
|
||||||
|
allowAuthenticated: false
|
||||||
|
|
||||||
|
# ActionConfirmation Permissions
|
||||||
|
BrowseActionConfirmation:
|
||||||
|
roles:
|
||||||
|
- User
|
||||||
|
clients: [ ]
|
||||||
|
allowAnonymous: false
|
||||||
|
allowAuthenticated: false
|
||||||
|
EditActionConfirmation:
|
||||||
|
roles:
|
||||||
|
- User
|
||||||
|
clients: [ ]
|
||||||
|
allowAnonymous: false
|
||||||
|
allowAuthenticated: false
|
||||||
|
DeleteActionConfirmation:
|
||||||
|
roles:
|
||||||
|
- User
|
||||||
claims: [ ]
|
claims: [ ]
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
|
|
Loading…
Reference in New Issue